Loading [MathJax]/extensions/tex2jax.js
OGS
CreateMaterialSpatialDistributionMap.cpp
Go to the documentation of this file.
1
12
14#include "MeshLib/Mesh.h"
15
16namespace MaterialPropertyLib
17{
19 std::map<int, std::shared_ptr<Medium>> const& media,
20 MeshLib::Mesh const& mesh)
21{
22 auto const material_ids = materialIDs(mesh);
23
24 int const max_material_id = !material_ids ? 0 : ranges::max(*material_ids);
25
26 if (!material_ids && media.size() > 1)
27 {
29 "More than one porous medium definition (namely {}) is present in "
30 "the project file, but no MaterialIDs are present in the bulk "
31 "mesh.",
32 media.size());
33 }
34
35 if (max_material_id > static_cast<int>(media.size() - 1))
36 {
37 WARN(
38 "The maximum value of MaterialIDs in mesh is {:d}. As the given "
39 "number of porous media definitions in the project file is {:d}, "
40 "the maximum value of MaterialIDs in mesh must be {:d} (index "
41 "starts with zero).",
42 max_material_id, media.size(), max_material_id - 1);
43 }
44
45 if (max_material_id < static_cast<int>(media.size() - 1))
46 {
47 WARN(
48 "There are {:d} porous medium definitions in the project file but "
49 "only {:d} different values in the MaterialIDs vector/data_array "
50 "in the mesh.",
51 media.size(), max_material_id - 1);
52 }
53 return {media, material_ids};
54}
55} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
Definition of the Mesh class.
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)