OGS
CreateNodalSourceTerm.cpp
Go to the documentation of this file.
1
12
13#include "BaseLib/ConfigTree.h"
14#include "BaseLib/Logging.h"
15#include "NodalSourceTerm.h"
16#include "ParameterLib/Utils.h"
17
18namespace ProcessLib
19{
20std::unique_ptr<SourceTerm> createNodalSourceTerm(
21 BaseLib::ConfigTree const& config, MeshLib::Mesh const& st_mesh,
22 std::unique_ptr<NumLib::LocalToGlobalIndexMap> dof_table,
23 std::size_t const source_term_mesh_id, const int variable_id,
24 const int component_id,
25 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
26{
27 DBUG("Constructing NodalSourceTerm from config.");
29 config.checkConfigParameter("type", "Nodal");
30
32 auto const param_name = config.getConfigParameter<std::string>("parameter");
33 DBUG("Using parameter {:s} as nodal source term.", param_name);
34
35 auto& param = ParameterLib::findParameter<double>(param_name, parameters, 1,
36 &st_mesh);
37
38 return std::make_unique<NodalSourceTerm>(std::move(dof_table),
39 source_term_mesh_id, st_mesh,
40 variable_id, component_id, param);
41}
42
43} // namespace ProcessLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
OGS_NO_DANGLING Parameter< ParameterDataType > & findParameter(std::string const &parameter_name, std::vector< std::unique_ptr< ParameterBase > > const &parameters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)
Definition Utils.h:102
std::unique_ptr< SourceTerm > createNodalSourceTerm(BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > dof_table, std::size_t const source_term_mesh_id, const int variable_id, const int component_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)