33 std::vector<std::unique_ptr<MeshLib::Mesh>>& meshes)
35 auto const mesh_name = output_mesh_config.
getValue<std::string>();
38 auto material_id_string =
43 if (!material_id_string)
48 auto const material_ids_for_output =
53 mesh, material_ids_for_output,
55 auto const* bulk_mesh =
58 bulk_mesh, subdomain_mesh.get()));
61 mesh, material_ids_for_output,
65 return meshes.back()->
getName();
72 std::vector<std::unique_ptr<MeshLib::Mesh>>& meshes)
80 const std::map<std::string, OutputType> outputType_to_enum = {
85 auto type = outputType_to_enum.at(output_type);
89 catch (std::out_of_range&)
92 "No supported file type provided. Read `{:s}' from <output><type> \
93 in prj File. Supported: VTK, XDMF.",
106 "_ts_{:timestep}_t_{:time}");
121 return hdf->getConfigParameter<
unsigned int>(
"number_of_files");
130 return hdf->getConfigParameter<
unsigned int>(
"chunk_size_bytes");
141 ->getConfigParameterOptional<
bool>(
142 "store_static_data_separately")
164 "fixed_output_times_from_file",
"no_file");
166 if (filename !=
"no_file")
182 for (
auto pair : timesteps->getConfigSubtreeList(
"pair"))
185 auto repeat = pair.getConfigParameter<
unsigned>(
"repeat");
187 auto each_steps = pair.getConfigParameter<
unsigned>(
"each_steps");
189 assert(repeat != 0 && each_steps != 0);
190 repeats_each_steps.emplace_back(repeat, each_steps);
193 if (repeats_each_steps.empty())
196 "You have not given any pair (<repeat/>, <each_steps/>) that "
197 "defines at which timesteps output shall be written. "
206 repeats_each_steps.emplace_back(1, 1);
215 out_vars.getConfigParameterList<std::string>(
"variable"))
217 if (output_variables.find(out_var) != output_variables.cend())
219 OGS_FATAL(
"output variable `{:s}' specified more than once.",
223 DBUG(
"adding output variable `{:s}'", out_var);
224 output_variables.insert(out_var);
228 auto const xdmf_config =
234 if (
auto const static_vars =
237 xdmf_config->getConfigSubtreeOptional(
"static_variables")
238 : std::optional<BaseLib::ConfigTree>{})
244 static_vars->getConfigParameterList<std::string>(
"variable"))
247 if (!output_variables.empty() &&
248 output_variables.find(var) == output_variables.cend())
251 "static output `{:s}' is not in output variables list.",
254 if (!static_output_variables.insert(var).second)
257 "static output variable `{:s}' specified more than once.",
260 DBUG(
"adding static output variable `{:s}'", var);
273 if (output_config.
prefix.find(
"{:meshname}") == std::string::npos)
276 "There are multiple meshes defined in the output section of "
277 "the project file, but the prefix doesn't contain "
278 "'{{:meshname}}'. Thus the names for the files, the simulation "
279 "results should be written to, would not be distinguishable "
280 "for different meshes.");
283 for (
auto mesh_config : meshes_config->getConfigParameterList(
"mesh"))
285 mesh_names_for_output.push_back(
287 INFO(
"Configure mesh '{:s}' for output.",
288 mesh_names_for_output.back());
292 if (
auto const geometrical_sets_config =
297 auto geometrical_set_config :
299 geometrical_sets_config->getConfigSubtreeList(
"geometrical_set"))
301 auto const geometrical_set_name =
303 geometrical_set_config.getConfigParameter<std::string>(
"name",
305 auto const geometry_name =
307 geometrical_set_config.getConfigParameter<std::string>(
309 mesh_names_for_output.push_back(geometrical_set_name +
"_" +
318 return output_config;