Skip to content
Snippets Groups Projects
Commit 029f20e2 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[PL/BC] Extract DeactivatedSubdomainDirichlet.

parent ea58c6b7
No related branches found
No related tags found
No related merge requests found
/**
* \file
* \copyright
* Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#include "DeactivatedSubdomainDirichlet.h"
#include "BaseLib/TimeInterval.h"
#include "DirichletBoundaryCondition.h"
#include "DirichletBoundaryConditionAuxiliaryFunctions.h"
#include "NumLib/DOF/LocalToGlobalIndexMap.h"
#include "NumLib/IndexValueVector.h"
#include "ParameterLib/Parameter.h"
namespace ProcessLib
{
DeactivatedSubdomainDirichlet::DeactivatedSubdomainDirichlet(
std::unique_ptr<BaseLib::TimeInterval> time_interval,
ParameterLib::Parameter<double> const& parameter,
MeshLib::Mesh const& bc_mesh,
std::vector<MeshLib::Node*> const& nodes_in_bc_mesh,
NumLib::LocalToGlobalIndexMap const& dof_table_bulk, int const variable_id,
int const component_id)
: _parameter(parameter),
_bc_mesh(bc_mesh),
_nodes_in_bc_mesh(nodes_in_bc_mesh),
_variable_id(variable_id),
_component_id(component_id),
_time_interval(std::move(time_interval))
{
config(dof_table_bulk);
}
void DeactivatedSubdomainDirichlet::config(
NumLib::LocalToGlobalIndexMap const& dof_table_bulk)
{
checkParametersOfDirichletBoundaryCondition(_bc_mesh, dof_table_bulk,
_variable_id, _component_id);
std::vector<MeshLib::Node*> const& bc_nodes = _bc_mesh.getNodes();
MeshLib::MeshSubset bc_mesh_subset(_bc_mesh, bc_nodes);
// Create local DOF table from the BC mesh subset for the given variable
// and component id.
_dof_table_boundary.reset(dof_table_bulk.deriveBoundaryConstrainedMap(
_variable_id, {_component_id}, std::move(bc_mesh_subset)));
}
void DeactivatedSubdomainDirichlet::getEssentialBCValues(
const double t, GlobalVector const& x,
NumLib::IndexValueVector<GlobalIndexType>& bc_values) const
{
if (_time_interval->contains(t))
{
getEssentialBCValuesLocal(_parameter, _bc_mesh, _nodes_in_bc_mesh,
*_dof_table_boundary, _variable_id,
_component_id, t, x, bc_values);
return;
}
bc_values.ids.clear();
bc_values.values.clear();
}
} // namespace ProcessLib
/**
* \file
* \copyright
* Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#pragma once
#include <memory>
#include <vector>
#include "BoundaryCondition.h"
namespace BaseLib
{
class ConfigTree;
class TimeInterval;
} // namespace BaseLib
namespace MeshLib
{
class Node;
}
namespace ParameterLib
{
template <typename T>
struct Parameter;
}
namespace ProcessLib
{
class DeactivatedSubdomainDirichlet final : public BoundaryCondition
{
public:
DeactivatedSubdomainDirichlet(
std::unique_ptr<BaseLib::TimeInterval> time_interval,
ParameterLib::Parameter<double> const& parameter,
MeshLib::Mesh const& bc_mesh,
std::vector<MeshLib::Node*> const& nodes_in_bc_mesh,
NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
int const variable_id, int const component_id);
void getEssentialBCValues(
const double t, GlobalVector const& x,
NumLib::IndexValueVector<GlobalIndexType>& bc_values) const override;
private:
void config(NumLib::LocalToGlobalIndexMap const& dof_table_bulk);
private:
ParameterLib::Parameter<double> const& _parameter;
MeshLib::Mesh const& _bc_mesh;
/// Some nodes in _bc_mesh
std::vector<MeshLib::Node*> const& _nodes_in_bc_mesh;
std::unique_ptr<NumLib::LocalToGlobalIndexMap const> _dof_table_boundary;
int const _variable_id;
int const _component_id;
std::unique_ptr<BaseLib::TimeInterval const> _time_interval;
};
} // namespace ProcessLib
...@@ -38,24 +38,6 @@ DirichletBoundaryConditionWithinTimeInterval:: ...@@ -38,24 +38,6 @@ DirichletBoundaryConditionWithinTimeInterval::
config(dof_table_bulk); config(dof_table_bulk);
} }
DirichletBoundaryConditionWithinTimeInterval::
DirichletBoundaryConditionWithinTimeInterval(
std::unique_ptr<BaseLib::TimeInterval> time_interval,
ParameterLib::Parameter<double> const& parameter,
MeshLib::Mesh const& bc_mesh,
std::vector<MeshLib::Node*> const& nodes_in_bc_mesh,
NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
int const variable_id, int const component_id)
: _parameter(parameter),
_bc_mesh(bc_mesh),
_nodes_in_bc_mesh(nodes_in_bc_mesh),
_variable_id(variable_id),
_component_id(component_id),
_time_interval(std::move(time_interval))
{
config(dof_table_bulk);
}
void DirichletBoundaryConditionWithinTimeInterval::config( void DirichletBoundaryConditionWithinTimeInterval::config(
NumLib::LocalToGlobalIndexMap const& dof_table_bulk) NumLib::LocalToGlobalIndexMap const& dof_table_bulk)
{ {
......
...@@ -47,14 +47,6 @@ public: ...@@ -47,14 +47,6 @@ public:
NumLib::LocalToGlobalIndexMap const& dof_table_bulk, NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
int const variable_id, int const component_id); int const variable_id, int const component_id);
DirichletBoundaryConditionWithinTimeInterval(
std::unique_ptr<BaseLib::TimeInterval> time_interval,
ParameterLib::Parameter<double> const& parameter,
MeshLib::Mesh const& bc_mesh,
std::vector<MeshLib::Node*> const& nodes_in_bc_mesh,
NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
int const variable_id, int const component_id);
void getEssentialBCValues( void getEssentialBCValues(
const double t, GlobalVector const& x, const double t, GlobalVector const& x,
NumLib::IndexValueVector<GlobalIndexType>& bc_values) const override; NumLib::IndexValueVector<GlobalIndexType>& bc_values) const override;
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
#include "BaseLib/Logging.h"
#include "BaseLib/Algorithm.h" #include "BaseLib/Algorithm.h"
#include "BaseLib/Logging.h"
#include "BaseLib/TimeInterval.h" #include "BaseLib/TimeInterval.h"
#include "MeshGeoToolsLib/ConstructMeshesFromGeometries.h" #include "MeshGeoToolsLib/ConstructMeshesFromGeometries.h"
#include "MeshLib/Mesh.h" #include "MeshLib/Mesh.h"
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "ParameterLib/Utils.h" #include "ParameterLib/Utils.h"
#include "ProcessLib/BoundaryCondition/BoundaryCondition.h" #include "ProcessLib/BoundaryCondition/BoundaryCondition.h"
#include "ProcessLib/BoundaryCondition/CreateBoundaryCondition.h" #include "ProcessLib/BoundaryCondition/CreateBoundaryCondition.h"
#include "ProcessLib/BoundaryCondition/DirichletBoundaryConditionWithinTimeInterval.h" #include "ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.h"
#include "ProcessLib/SourceTerms/CreateSourceTerm.h" #include "ProcessLib/SourceTerms/CreateSourceTerm.h"
#include "ProcessLib/SourceTerms/SourceTerm.h" #include "ProcessLib/SourceTerms/SourceTerm.h"
...@@ -257,8 +257,7 @@ void ProcessVariable::createBoundaryConditionsForDeactivatedSubDomains( ...@@ -257,8 +257,7 @@ void ProcessVariable::createBoundaryConditionsForDeactivatedSubDomains(
std::make_unique<BaseLib::TimeInterval>( std::make_unique<BaseLib::TimeInterval>(
*deactivated_subdomain->time_interval); *deactivated_subdomain->time_interval);
auto bc = std::make_unique< auto bc = std::make_unique<DeactivatedSubdomainDirichlet>(
DirichletBoundaryConditionWithinTimeInterval>(
std::move(time_interval), parameter, std::move(time_interval), parameter,
*(deactivated_subdomain_mesh->mesh), *(deactivated_subdomain_mesh->mesh),
deactivated_subdomain_mesh->inner_nodes, dof_table, deactivated_subdomain_mesh->inner_nodes, dof_table,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment