diff --git a/ProcessLib/ProcessVariable.cpp b/ProcessLib/ProcessVariable.cpp index e157087036879b4c2ea08996a6006ea7397dea3f..1fe4cff889ffcecda403dbdb22c0387c5e0fa442 100644 --- a/ProcessLib/ProcessVariable.cpp +++ b/ProcessLib/ProcessVariable.cpp @@ -15,6 +15,8 @@ #include "MeshLib/Mesh.h" #include "ProcessLib/BoundaryCondition/BoundaryCondition.h" #include "ProcessLib/BoundaryCondition/CreateBoundaryCondition.h" +#include "ProcessLib/SourceTerms/CreateSourceTerm.h" +#include "ProcessLib/SourceTerms/NodalSourceTerm.h" #include "ProcessLib/Utils/ProcessUtils.h" namespace ProcessLib @@ -34,8 +36,7 @@ ProcessVariable::ProcessVariable( _initial_condition(findParameter<double>( //! \ogs_file_param{prj__process_variables__process_variable__initial_condition} config.getConfigParameter<std::string>("initial_condition"), - parameters, _n_components)), - _source_term_builder(std::make_unique<SourceTermBuilder>()) + parameters, _n_components)) { DBUG("Constructing process variable %s", _name.c_str()); @@ -147,8 +148,7 @@ ProcessVariable::ProcessVariable(ProcessVariable&& other) _shapefunction_order(other._shapefunction_order), _initial_condition(std::move(other._initial_condition)), _bc_configs(std::move(other._bc_configs)), - _source_term_configs(std::move(other._source_term_configs)), - _source_term_builder(std::move(other._source_term_builder)) + _source_term_configs(std::move(other._source_term_configs)) { } @@ -201,7 +201,7 @@ ProcessVariable::createSourceTerms( std::vector<std::unique_ptr<NodalSourceTerm>> source_terms; for (auto& config : _source_term_configs) - source_terms.emplace_back(_source_term_builder->createSourceTerm( + source_terms.emplace_back(createSourceTerm( config, dof_table, _mesh, variable_id, integration_order, _shapefunction_order, parameters)); diff --git a/ProcessLib/ProcessVariable.h b/ProcessLib/ProcessVariable.h index 6f0fe06414c5832d9f5ce55d77006624fa250b54..6af79513640cc8e21fcda48606a64f2eee457cc1 100644 --- a/ProcessLib/ProcessVariable.h +++ b/ProcessLib/ProcessVariable.h @@ -12,7 +12,6 @@ #include "ProcessLib/BoundaryCondition/BoundaryConditionConfig.h" #include "ProcessLib/Parameter/Parameter.h" #include "ProcessLib/SourceTerms/SourceTermConfig.h" -#include "ProcessLib/SourceTerms/SourceTermBuilder.h" namespace MeshLib { @@ -98,7 +97,6 @@ private: std::vector<BoundaryConditionConfig> _bc_configs; std::vector<SourceTermConfig> _source_term_configs; - std::unique_ptr<SourceTermBuilder> _source_term_builder; }; } // namespace ProcessLib diff --git a/ProcessLib/SourceTerms/CreateNodalSourceTerm.cpp b/ProcessLib/SourceTerms/CreateNodalSourceTerm.cpp index e97e90f71c6413de1a299f4345e65c87cbb59e8a..74d792253db3068dc20b20dfeb67719af4d07fee 100644 --- a/ProcessLib/SourceTerms/CreateNodalSourceTerm.cpp +++ b/ProcessLib/SourceTerms/CreateNodalSourceTerm.cpp @@ -9,8 +9,11 @@ #include "CreateNodalSourceTerm.h" -#include "BaseLib/FileTools.h" +#include <logog/include/logog.hpp> + +#include "BaseLib/ConfigTree.h" #include "ProcessLib/Utils/ProcessUtils.h" + #include "NodalSourceTerm.h" namespace ProcessLib diff --git a/ProcessLib/SourceTerms/CreateNodalSourceTerm.h b/ProcessLib/SourceTerms/CreateNodalSourceTerm.h index bdd7bcb37e8437e91063b10b1ca53edd910c33ef..9144d92f10906d3a3f203202e20a0910edcd6972 100644 --- a/ProcessLib/SourceTerms/CreateNodalSourceTerm.h +++ b/ProcessLib/SourceTerms/CreateNodalSourceTerm.h @@ -10,7 +10,25 @@ #pragma once #include <memory> -#include "ProcessLib/Process.h" +#include <vector> + +namespace BaseLib +{ +class ConfigTree; +} +namespace MeshLib +{ +class Mesh; +} +namespace NumLib +{ +class LocalToGlobalIndexMap; +} +namespace ProcessLib +{ +class NodalSourceTerm; +struct ParameterBase; +} // namespace ProcessLib namespace ProcessLib { diff --git a/ProcessLib/SourceTerms/SourceTermBuilder.cpp b/ProcessLib/SourceTerms/CreateSourceTerm.cpp similarity index 53% rename from ProcessLib/SourceTerms/SourceTermBuilder.cpp rename to ProcessLib/SourceTerms/CreateSourceTerm.cpp index 45d67c87c97c1ea2f382232cf53cb2ea38c1674a..32a4a778c52e5c819cee545bb0276905f5b4dd08 100644 --- a/ProcessLib/SourceTerms/SourceTermBuilder.cpp +++ b/ProcessLib/SourceTerms/CreateSourceTerm.cpp @@ -7,18 +7,19 @@ * */ -#include "SourceTermBuilder.h" -#include "SourceTermConfig.h" +#include "CreateSourceTerm.h" + #include "CreateNodalSourceTerm.h" #include "NodalSourceTerm.h" +#include "SourceTermConfig.h" namespace ProcessLib { -std::unique_ptr<NodalSourceTerm> SourceTermBuilder::createSourceTerm( +std::unique_ptr<NodalSourceTerm> createSourceTerm( const SourceTermConfig& config, const NumLib::LocalToGlobalIndexMap& dof_table, const MeshLib::Mesh& mesh, - const int variable_id, const unsigned integration_order, - const unsigned shapefunction_order, + const int variable_id, const unsigned /*integration_order*/, + const unsigned /*shapefunction_order*/, std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters) { //! \ogs_file_param{prj__process_variables__process_variable__source_terms__source_term__type} @@ -26,24 +27,11 @@ std::unique_ptr<NodalSourceTerm> SourceTermBuilder::createSourceTerm( if (type == "Nodal") { - return createNodalSourceTerm(config, dof_table, mesh, variable_id, - integration_order, shapefunction_order, - parameters); + return ProcessLib::createNodalSourceTerm( + config.config, config.mesh, dof_table, mesh.getID(), variable_id, + *config.component_id, parameters); } OGS_FATAL("Unknown source term type: `%s'.", type.c_str()); } - -std::unique_ptr<NodalSourceTerm> SourceTermBuilder::createNodalSourceTerm( - const SourceTermConfig& config, - const NumLib::LocalToGlobalIndexMap& dof_table, const MeshLib::Mesh& mesh, - const int variable_id, const unsigned /*integration_order*/, - const unsigned /*shapefunction_order*/, - std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters) -{ - return ProcessLib::createNodalSourceTerm( - config.config, config.mesh, dof_table, mesh.getID(), variable_id, - *config.component_id, parameters); -} - -} // ProcessLib +} // namespace ProcessLib diff --git a/ProcessLib/SourceTerms/CreateSourceTerm.h b/ProcessLib/SourceTerms/CreateSourceTerm.h new file mode 100644 index 0000000000000000000000000000000000000000..41c058997448b0cbe4f50fd3fb3c18ffb77e2303 --- /dev/null +++ b/ProcessLib/SourceTerms/CreateSourceTerm.h @@ -0,0 +1,42 @@ +/** + * \copyright + * Copyright (c) 2012-2018, 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 <vector> +#include <memory> + +#include "ProcessLib/Parameter/Parameter.h" + +namespace MeshLib +{ +class Mesh; +} + +namespace NumLib +{ +class LocalToGlobalIndexMap; +} // namespace NumLib + +namespace ProcessLib +{ +class NodalSourceTerm; +struct SourceTermConfig; +} // namespace ProcessLib + +namespace ProcessLib +{ +std::unique_ptr<NodalSourceTerm> createSourceTerm( + const SourceTermConfig& config, + const NumLib::LocalToGlobalIndexMap& dof_table, const MeshLib::Mesh& mesh, + const int variable_id, const unsigned integration_order, + const unsigned shapefunction_order, + std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters); + +} // namespace ProcessLib diff --git a/ProcessLib/SourceTerms/SourceTermBuilder.h b/ProcessLib/SourceTerms/SourceTermBuilder.h deleted file mode 100644 index 76b8373f9188447ce278189beffeef914e9a2972..0000000000000000000000000000000000000000 --- a/ProcessLib/SourceTerms/SourceTermBuilder.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * \copyright - * Copyright (c) 2012-2018, 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 "NodalSourceTerm.h" -#include "ProcessLib/Parameter/Parameter.h" - -namespace MeshLib -{ -class Mesh; -} - -namespace NumLib -{ -class LocalToGlobalIndexMap; -template <typename> -struct IndexValueVector; -} - -namespace ProcessLib -{ -struct SourceTermConfig; - -class SourceTermBuilder -{ -public: - virtual ~SourceTermBuilder() = default; - - virtual std::unique_ptr<NodalSourceTerm> createSourceTerm( - const SourceTermConfig& config, - const NumLib::LocalToGlobalIndexMap& dof_table, - const MeshLib::Mesh& mesh, const int variable_id, - const unsigned integration_order, const unsigned shapefunction_order, - std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& - parameters); - -protected: - virtual std::unique_ptr<NodalSourceTerm> createNodalSourceTerm( - const SourceTermConfig& config, - const NumLib::LocalToGlobalIndexMap& dof_table, - const MeshLib::Mesh& mesh, const int variable_id, - const unsigned integration_order, const unsigned shapefunction_order, - std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& - parameters); -}; - -} // ProcessLib