OGS
CreateOutputConfig.cpp File Reference

Detailed Description

Definition in file CreateOutputConfig.cpp.

Include dependency graph for CreateOutputConfig.cpp:

Go to the source code of this file.

Namespaces

namespace  ProcessLib
 

Functions

std::string createMeshOutputName (std::vector< int > const &material_ids, std::string const &mesh_name)
 
std::string parseOutputMeshConfig (BaseLib::ConfigTree const &output_mesh_config, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)
 
OutputConfig ProcessLib::createOutputConfig (const BaseLib::ConfigTree &config, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)
 

Function Documentation

◆ createMeshOutputName()

std::string createMeshOutputName ( std::vector< int > const & material_ids,
std::string const & mesh_name )

Definition at line 26 of file CreateOutputConfig.cpp.

28{
29 if (material_ids.empty())
30 {
31 return mesh_name;
32 }
33 return mesh_name + "_" + fmt::format("{}", fmt::join(material_ids, "_"));
34}

Referenced by parseOutputMeshConfig().

◆ parseOutputMeshConfig()

std::string parseOutputMeshConfig ( BaseLib::ConfigTree const & output_mesh_config,
std::vector< std::unique_ptr< MeshLib::Mesh > > & meshes )
Input File Parameter
prj__time_loop__output__meshes__mesh__material_ids

Definition at line 36 of file CreateOutputConfig.cpp.

39{
40 auto const mesh_name = output_mesh_config.getValue<std::string>();
41 auto const& mesh = MeshLib::findMeshByName(meshes, mesh_name);
42
43 auto material_id_string =
45 output_mesh_config.getConfigAttributeOptional<std::string>(
46 "material_ids");
47
48 if (!material_id_string)
49 {
50 return mesh_name;
51 }
52
53 auto const material_ids_for_output =
54 MaterialLib::splitMaterialIdString(*material_id_string);
55#ifdef USE_PETSC
56 // this mesh isn't yet a NodePartitionedMesh
57 auto subdomain_mesh = MeshLib::createMaterialIDsBasedSubMesh(
58 mesh, material_ids_for_output,
59 createMeshOutputName(material_ids_for_output, mesh_name));
60 auto const* bulk_mesh =
61 dynamic_cast<MeshLib::NodePartitionedMesh const*>(&mesh);
63 bulk_mesh, subdomain_mesh.get()));
64#else
66 mesh, material_ids_for_output,
67 createMeshOutputName(material_ids_for_output, mesh_name)));
68#endif
69
70 return meshes.back()->getName();
71}
std::string createMeshOutputName(std::vector< int > const &material_ids, std::string const &mesh_name)
std::vector< int > splitMaterialIdString(std::string const &material_id_string)
Mesh & findMeshByName(std::vector< std::unique_ptr< Mesh > > const &meshes, std::string_view const name)
Definition Mesh.cpp:364
std::unique_ptr< MeshLib::Mesh > createMaterialIDsBasedSubMesh(MeshLib::Mesh const &mesh, std::vector< int > const &material_ids, std::string const &name_for_created_mesh)
std::unique_ptr< NodePartitionedMesh > transformMeshToNodePartitionedMesh(NodePartitionedMesh const *const bulk_mesh, Mesh const *const subdomain_mesh)

References MeshLib::createMaterialIDsBasedSubMesh(), createMeshOutputName(), MeshLib::findMeshByName(), BaseLib::ConfigTree::getConfigAttributeOptional(), MeshLib::Mesh::getName(), BaseLib::ConfigTree::getValue(), MaterialLib::splitMaterialIdString(), and MeshLib::transformMeshToNodePartitionedMesh().

Referenced by ProcessLib::createOutputConfig().