OGS
anonymous_namespace{ProcessVariable.cpp} Namespace Reference

Functions

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

Function Documentation

◆ findMeshInConfig()

MeshLib::Mesh const & 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
prj__process_variables__process_variable__source_terms__source_term__geometry
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__geometrical_set
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__geometry

Definition at line 35 of file ProcessVariable.cpp.

38{
39 //
40 // Get the mesh name from the config.
41 //
42 std::string mesh_name; // Either given directly in <mesh> or constructed
43 // from <geometrical_set>_<geometry>.
44
45#ifdef DOXYGEN_DOCU_ONLY
47 config.getConfigParameterOptional<std::string>("mesh");
48#endif // DOXYGEN_DOCU_ONLY
49
50 auto optional_mesh_name =
52 config.getConfigParameterOptional<std::string>("mesh");
53 if (optional_mesh_name)
54 {
55 mesh_name = *optional_mesh_name;
56 }
57 else
58 {
59#ifdef DOXYGEN_DOCU_ONLY
61 config.getConfigParameterOptional<std::string>("geometrical_set");
63 config.getConfigParameter<std::string>("geometry");
64#endif // DOXYGEN_DOCU_ONLY
65
66 // Looking for the mesh created before for the given geometry.
67 auto const geometrical_set_name =
69 config.getConfigParameter<std::string>("geometrical_set");
70 auto const geometry_name =
72 config.getConfigParameter<std::string>("geometry");
73
74 mesh_name = MeshGeoToolsLib::meshNameFromGeometry(geometrical_set_name,
75 geometry_name);
76 }
77
78 //
79 // Find and extract mesh from the list of meshes.
80 //
81 auto const& mesh = MeshLib::findMeshByName(meshes, mesh_name);
82 DBUG("Found mesh '{:s}' with id {:d}.", mesh.getName(), mesh.getID());
83
84 return mesh;
85}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
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:363

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