27 std::string
const& mesh_name)
29 if (material_ids.empty())
33 return mesh_name +
"_" + fmt::format(
"{}", fmt::join(material_ids,
"_"));
38 std::vector<std::unique_ptr<MeshLib::Mesh>>& meshes)
40 auto const mesh_name = output_mesh_config.
getValue<std::string>();
43 auto material_id_string =
48 if (!material_id_string)
53 auto const material_ids_for_output =
58 mesh, material_ids_for_output,
60 auto const* bulk_mesh =
63 bulk_mesh, subdomain_mesh.get()));
66 mesh, material_ids_for_output,
70 return meshes.back()->
getName();
77 std::vector<std::unique_ptr<MeshLib::Mesh>>& meshes)
85 const std::map<std::string, OutputType> outputType_to_enum = {
87 auto type = outputType_to_enum.at(output_type);
91 catch (std::out_of_range&)
94 "No supported file type provided. Read `{:s}' from <output><type> \
95 in prj File. Supported: VTK, XDMF.",
108 "_ts_{:timestep}_t_{:time}");
123 return hdf->getConfigParameter<
unsigned int>(
"number_of_files");
132 return hdf->getConfigParameter<
unsigned int>(
"chunk_size_bytes");
154 "fixed_output_times_from_file",
"no_file");
156 if (filename !=
"no_file")
171 for (
auto pair : timesteps->getConfigSubtreeList(
"pair"))
174 auto repeat = pair.getConfigParameter<
unsigned>(
"repeat");
176 auto each_steps = pair.getConfigParameter<
unsigned>(
"each_steps");
178 assert(repeat != 0 && each_steps != 0);
179 repeats_each_steps.emplace_back(repeat, each_steps);
182 if (repeats_each_steps.empty())
185 "You have not given any pair (<repeat/>, <each_steps/>) that "
186 "defines at which timesteps output shall be written. "
195 repeats_each_steps.emplace_back(1, 1);
204 out_vars.getConfigParameterList<std::string>(
"variable"))
206 if (output_variables.find(out_var) != output_variables.cend())
208 OGS_FATAL(
"output variable `{:s}' specified more than once.",
212 DBUG(
"adding output variable `{:s}'", out_var);
213 output_variables.insert(out_var);
225 if (output_config.
prefix.find(
"{:meshname}") == std::string::npos)
228 "There are multiple meshes defined in the output section of "
229 "the project file, but the prefix doesn't contain "
230 "'{{:meshname}}'. Thus the names for the files, the simulation "
231 "results should be written to, would not be distinguishable "
232 "for different meshes.");
235 for (
auto mesh_config : meshes_config->getConfigParameterList(
"mesh"))
237 mesh_names_for_output.push_back(
239 INFO(
"Configure mesh '{:s}' for output.",
240 mesh_names_for_output.back());
244 if (
auto const geometrical_sets_config =
249 auto geometrical_set_config :
251 geometrical_sets_config->getConfigSubtreeList(
"geometrical_set"))
253 auto const geometrical_set_name =
255 geometrical_set_config.getConfigParameter<std::string>(
"name",
257 auto const geometry_name =
259 geometrical_set_config.getConfigParameter<std::string>(
261 mesh_names_for_output.push_back(geometrical_set_name +
"_" +
270 return output_config;
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)
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the Mesh class.
Definition of mesh class for partitioned mesh (by node) for parallel computing within the framework o...
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
T getConfigParameter(std::string const ¶m) const
ConfigTree getConfigSubtree(std::string const &root) const
std::optional< T > getConfigAttributeOptional(std::string const &attr) const
const std::string getName() const
Get name of the mesh.
std::vector< double > readDoublesFromBinaryFile(const std::string &filename)
void makeVectorUnique(std::vector< T > &v)
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)
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)
OutputConfig createOutputConfig(const BaseLib::ConfigTree &config, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)
std::vector< PairRepeatEachSteps > repeats_each_steps
bool output_extrapolation_residuals
std::vector< double > fixed_output_times
unsigned int number_of_files
bool output_iteration_results
unsigned int chunk_size_bytes
std::set< std::string > output_variables
std::vector< std::string > mesh_names_for_output