Skip to content
Snippets Groups Projects
Commit 88888382 authored by Norihiro Watanabe's avatar Norihiro Watanabe Committed by GitHub
Browse files

Merge pull request #1453 from norihiro-w/bc-builder

BoundaryConditionBuilder
parents 241195ac efc47edf
No related branches found
No related tags found
No related merge requests found
...@@ -33,13 +33,12 @@ static std::vector<MeshLib::Element*> getClonedElements( ...@@ -33,13 +33,12 @@ static std::vector<MeshLib::Element*> getClonedElements(
namespace ProcessLib namespace ProcessLib
{ {
std::unique_ptr<BoundaryCondition> createBoundaryCondition(
std::unique_ptr<BoundaryCondition> BoundaryConditionBuilder::createBoundaryCondition(
const BoundaryConditionConfig& config, const BoundaryConditionConfig& config,
const NumLib::LocalToGlobalIndexMap& dof_table, const NumLib::LocalToGlobalIndexMap& dof_table, const MeshLib::Mesh& mesh,
const MeshLib::Mesh& mesh, const int variable_id, const unsigned integration_order,
const int variable_id, const std::vector<std::unique_ptr<ProcessLib::ParameterBase>>& parameters)
const unsigned integration_order,
std::vector<std::unique_ptr<ParameterBase>> const& parameters)
{ {
MeshGeoToolsLib::MeshNodeSearcher& mesh_node_searcher = MeshGeoToolsLib::MeshNodeSearcher& mesh_node_searcher =
MeshGeoToolsLib::MeshNodeSearcher::getMeshNodeSearcher(mesh); MeshGeoToolsLib::MeshNodeSearcher::getMeshNodeSearcher(mesh);
...@@ -102,4 +101,5 @@ std::unique_ptr<BoundaryCondition> createBoundaryCondition( ...@@ -102,4 +101,5 @@ std::unique_ptr<BoundaryCondition> createBoundaryCondition(
} }
} }
} // ProcessLib } // ProcessLib
...@@ -55,11 +55,17 @@ public: ...@@ -55,11 +55,17 @@ public:
virtual ~BoundaryCondition() = default; virtual ~BoundaryCondition() = default;
}; };
std::unique_ptr<BoundaryCondition> createBoundaryCondition( class BoundaryConditionBuilder
const BoundaryConditionConfig& config, {
const NumLib::LocalToGlobalIndexMap& dof_table, const MeshLib::Mesh& mesh, public:
const int variable_id, const unsigned integration_order, virtual ~BoundaryConditionBuilder() {}
const std::vector<std::unique_ptr<ProcessLib::ParameterBase>>& parameters);
virtual std::unique_ptr<BoundaryCondition> createBoundaryCondition(
const BoundaryConditionConfig& config,
const NumLib::LocalToGlobalIndexMap& dof_table, const MeshLib::Mesh& mesh,
const int variable_id, const unsigned integration_order,
const std::vector<std::unique_ptr<ProcessLib::ParameterBase>>& parameters);
};
} // ProcessLib } // ProcessLib
......
...@@ -30,7 +30,8 @@ ProcessVariable::ProcessVariable( ...@@ -30,7 +30,8 @@ ProcessVariable::ProcessVariable(
_initial_condition(findParameter<double>( _initial_condition(findParameter<double>(
//! \ogs_file_param{prj__process_variables__process_variable__initial_condition} //! \ogs_file_param{prj__process_variables__process_variable__initial_condition}
config.getConfigParameter<std::string>("initial_condition"), config.getConfigParameter<std::string>("initial_condition"),
parameters, _n_components)) parameters, _n_components)),
_bc_builder(new BoundaryConditionBuilder())
{ {
DBUG("Constructing process variable %s", _name.c_str()); DBUG("Constructing process variable %s", _name.c_str());
...@@ -95,7 +96,8 @@ ProcessVariable::ProcessVariable(ProcessVariable&& other) ...@@ -95,7 +96,8 @@ ProcessVariable::ProcessVariable(ProcessVariable&& other)
_mesh(other._mesh), _mesh(other._mesh),
_n_components(other._n_components), _n_components(other._n_components),
_initial_condition(std::move(other._initial_condition)), _initial_condition(std::move(other._initial_condition)),
_bc_configs(std::move(other._bc_configs)) _bc_configs(std::move(other._bc_configs)),
_bc_builder(std::move(other._bc_builder))
{ {
} }
...@@ -139,7 +141,7 @@ ProcessVariable::createBoundaryConditions( ...@@ -139,7 +141,7 @@ ProcessVariable::createBoundaryConditions(
std::vector<std::unique_ptr<BoundaryCondition>> bcs; std::vector<std::unique_ptr<BoundaryCondition>> bcs;
for (auto& config : _bc_configs) for (auto& config : _bc_configs)
bcs.emplace_back(createBoundaryCondition( bcs.emplace_back(_bc_builder->createBoundaryCondition(
config, dof_table, _mesh, variable_id, integration_order, parameters)); config, dof_table, _mesh, variable_id, integration_order, parameters));
return bcs; return bcs;
......
...@@ -22,6 +22,8 @@ template <typename T> class PropertyVector; ...@@ -22,6 +22,8 @@ template <typename T> class PropertyVector;
namespace ProcessLib namespace ProcessLib
{ {
class BoundaryConditionBuilder;
/// A named process variable. Its properties includes the mesh, and the initial /// A named process variable. Its properties includes the mesh, and the initial
/// and boundary conditions. /// and boundary conditions.
class ProcessVariable class ProcessVariable
...@@ -42,6 +44,11 @@ public: ...@@ -42,6 +44,11 @@ public:
/// Returns the number of components of the process variable. /// Returns the number of components of the process variable.
int getNumberOfComponents() const { return _n_components; } int getNumberOfComponents() const { return _n_components; }
void setBoundaryConditionBuilder(std::unique_ptr<BoundaryConditionBuilder> bc_builder)
{
_bc_builder = std::move(bc_builder);
}
std::vector<std::unique_ptr<BoundaryCondition>> createBoundaryConditions( std::vector<std::unique_ptr<BoundaryCondition>> createBoundaryConditions(
const NumLib::LocalToGlobalIndexMap& dof_table, const int variable_id, const NumLib::LocalToGlobalIndexMap& dof_table, const int variable_id,
unsigned const integration_order, unsigned const integration_order,
...@@ -64,6 +71,7 @@ private: ...@@ -64,6 +71,7 @@ private:
Parameter<double> const& _initial_condition; Parameter<double> const& _initial_condition;
std::vector<BoundaryConditionConfig> _bc_configs; std::vector<BoundaryConditionConfig> _bc_configs;
std::unique_ptr<BoundaryConditionBuilder> _bc_builder;
}; };
} // namespace ProcessLib } // namespace ProcessLib
......
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