OGS
CreateVolumetricSourceTerm.cpp
Go to the documentation of this file.
1
12
13#include "BaseLib/ConfigTree.h"
14#include "BaseLib/FileTools.h"
15#include "MeshLib/Mesh.h"
17#include "ParameterLib/Utils.h"
19
20namespace ProcessLib
21{
22std::unique_ptr<SourceTerm> createVolumetricSourceTerm(
23 BaseLib::ConfigTree const& config, unsigned const bulk_mesh_dimension,
24 MeshLib::Mesh const& source_term_mesh,
25 std::unique_ptr<NumLib::LocalToGlobalIndexMap> source_term_dof_table,
26 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
27 unsigned const integration_order, unsigned const shapefunction_order)
28{
30 auto const type = config.peekConfigParameter<std::string>("type");
31 if (type == "Line")
32 {
34 config.checkConfigParameter("type", "Line");
35 DBUG("Constructing LineSourceTerm from config.");
36 }
37 else
38 {
40 config.checkConfigParameter("type", "Volumetric");
41 DBUG("Constructing VolumetricSourceTerm from config.");
42 }
43
44 // source term field name
45 auto const& volumetric_source_term_parameter_name =
47 config.getConfigParameter<std::string>("parameter");
48 auto& volumetric_source_term = ParameterLib::findParameter<double>(
49 volumetric_source_term_parameter_name, parameters, 1,
50 &source_term_mesh);
51
52 // instruction to create documentation for the parameter
54
55 DBUG("Using '{:s}' as volumetric source term parameter.",
56 volumetric_source_term.name);
57
58 return std::make_unique<VolumetricSourceTerm>(
59 bulk_mesh_dimension, source_term_mesh, std::move(source_term_dof_table),
60 integration_order, shapefunction_order, volumetric_source_term);
61}
62
63} // namespace ProcessLib
Filename manipulation routines.
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
Definition of the Mesh class.
T peekConfigParameter(std::string const &param) const
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::unique_ptr< SourceTerm > createVolumetricSourceTerm(BaseLib::ConfigTree const &config, unsigned const bulk_mesh_dimension, MeshLib::Mesh const &source_term_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, unsigned const integration_order, unsigned const shapefunction_order)