OGS
anonymous_namespace{ProcessVariable.cpp} Namespace Reference

Functions

std::vector< std::reference_wrapper< const MeshLib::Mesh > > findMeshInConfig (BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes)

Function Documentation

◆ findMeshInConfig()

std::vector< std::reference_wrapper< const MeshLib::Mesh > > anonymous_namespace{ProcessVariable.cpp}::findMeshInConfig ( BaseLib::ConfigTree const & config,
std::vector< std::unique_ptr< MeshLib::Mesh > > const & meshes )
Input File Parameter
prj__process_variables__process_variable__source_terms__source_term__mesh
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__mesh
Input File Parameter
prj__process_variables__process_variable__source_terms__source_term__geometrical_set
Input File Parameter
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__geometrical_set
Input File Parameter
prj__process_variables__process_variable__source_terms__source_term__geometrical_set
Input File Parameter
prj__process_variables__process_variable__source_terms__source_term__geometry
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__geometry
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__meshes
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__meshes__mesh

Definition at line 28 of file ProcessVariable.cpp.

31{
32 //
33 // Get the mesh name from the config.
34 //
35 std::vector<std::string>
36 mesh_names; // Either given directly in <mesh> or <meshes> or
37 // constructed from <geometrical_set>_<geometry>.
38
39#ifdef DOXYGEN_DOCU_ONLY
41 config.getConfigParameterOptional<std::string>("mesh");
42#endif // DOXYGEN_DOCU_ONLY
43
44 auto optional_mesh_name =
46 config.getConfigParameterOptional<std::string>("mesh");
47
48 if (optional_mesh_name)
49 {
50 mesh_names.emplace_back(*optional_mesh_name);
51 INFO("Configure mesh '{}' for boundary condition or source term.",
52 mesh_names.back());
53 }
54 else if (
55 auto const geometrical_set_name =
58 config.getConfigParameterOptional<std::string>("geometrical_set"))
59 {
60#ifdef DOXYGEN_DOCU_ONLY
62 config.getConfigParameterOptional<std::string>("geometrical_set");
64 config.getConfigParameter<std::string>("geometry");
65#endif // DOXYGEN_DOCU_ONLY
66
67 auto const geometry_name =
69 config.getConfigParameter<std::string>("geometry");
70
71 mesh_names.emplace_back(MeshGeoToolsLib::meshNameFromGeometry(
72 *geometrical_set_name, geometry_name));
73 }
74 else if (
75 auto const meshes_config =
77 config.getConfigSubtreeOptional("meshes"))
78 {
80 for (auto mesh_config : meshes_config->getConfigParameterList("mesh"))
81 {
82 mesh_names.push_back(mesh_config.getValue<std::string>());
83 INFO("Configure mesh '{:s}' for boundary condition.",
84 mesh_names.back());
85 }
86 }
87
88 //
89 // Find and extract mesh from the list of meshes.
90 //
91 std::vector<std::reference_wrapper<const MeshLib::Mesh>> bc_meshes;
92 for (auto const& mesh_name : mesh_names)
93 {
94 bc_meshes.push_back(MeshLib::findMeshByName(meshes, mesh_name));
95 DBUG("Found mesh '{:s}' with id {:d}.", mesh_name,
96 bc_meshes.back().get().getID());
97 }
98
99 return bc_meshes;
100}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:28
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
std::string meshNameFromGeometry(std::string const &geometrical_set_name, std::string const &geometry_name)
Mesh & findMeshByName(std::vector< std::unique_ptr< Mesh > > const &meshes, std::string_view const name)
Definition Mesh.cpp:354

References DBUG(), MeshLib::findMeshByName(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtreeOptional(), INFO(), and MeshGeoToolsLib::meshNameFromGeometry().