18 std::size_t n_components)
20 auto it(_properties.find(std::string(name)));
21 if (it != _properties.end()) {
22 ERR(
"A property of the name '{:s}' is already assigned to the mesh.",
26 auto entry_info(_properties.insert(
27 std::make_pair(std::string(name),
36 std::size_t n_property_values, std::size_t n_components)
38 auto it(_properties.find(std::string(name)));
39 if (it != _properties.end())
41 ERR(
"A property of the name '{:s}' is already assigned to the mesh.",
45 auto entry_info(_properties.insert(std::make_pair(
48 mesh_item_type, n_components))));
54 std::string
const& name,
55 std::size_t n_prop_groups,
56 std::vector<std::size_t>
const& item2group_mapping,
58 std::size_t n_components)
61 auto it(_properties.find(name));
62 if (it != _properties.end()) {
63 ERR(
"A property of the name '{:s}' already assigned to the mesh.",
69 for (std::size_t k(0); k<item2group_mapping.size(); k++) {
70 std::size_t
const group_id (item2group_mapping[k]);
71 if (group_id >= n_prop_groups) {
72 ERR(
"The mapping to property {:d} for item {:d} is not in the "
73 "correct range [0,{:d}).",
74 group_id, k, n_prop_groups);
81 std::pair<std::string, PropertyVectorBase*>(
84 item2group_mapping, name, mesh_item_type, n_components)
105bool Properties::existsPropertyVector(std::string_view name,
107 int const number_of_components)
const
109 auto const it = _properties.find(std::string(name));
110 if (it == _properties.end())
116 if (property ==
nullptr)
118 WARN(
"Property {} exists but does not have the requested type {}.",
119 name,
typeid(T).name());
122 if (property->getMeshItemType() != mesh_item_type)
125 "Property {} exists but does not have the requested mesh item type "
127 name, toString(mesh_item_type));
130 if (property->getNumberOfGlobalComponents() != number_of_components)
133 "Property {} exists but does not have the requested number of "
135 name, number_of_components);
189 int const n_components)
const
191 auto const it = _properties.find(std::string(name));
192 if (it == _properties.end())
195 "A PropertyVector with name '{:s}' does not exist in the mesh.",
200 if (property ==
nullptr)
203 "Could not cast the data type of the PropertyVector '{:s}' (type: "
204 "'{:s}') to the requested data type '{:s}'.",
205 name,
typeid(
decltype(*it->second)).name(),
208 if (property->getMeshItemType() != item_type)
211 "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
213 name, toString(property->getMeshItemType()), toString(item_type));
215 if (property->getNumberOfGlobalComponents() != n_components)
218 "PropertyVector '{:s}' has {:d} components, {:d} components are "
220 name, property->getNumberOfGlobalComponents(), n_components);
228 int const n_components)
230 auto const it = _properties.find(std::string(name));
231 if (it == _properties.end())
234 "A PropertyVector with name '{:s}' does not exist in the mesh.",
239 if (property ==
nullptr)
242 "Could not cast the data type of the PropertyVector '{:s}' to "
243 "requested data type.",
246 if (property->getMeshItemType() != item_type)
249 "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
251 name, toString(property->getMeshItemType()), toString(item_type));
253 if (property->getNumberOfGlobalComponents() != n_components)
256 "PropertyVector '{:s}' has {:d} components, {:d} components are "
258 name, property->getNumberOfGlobalComponents(), n_components);
266 for (
auto [name, property] : properties)
273 bool success = f(
double{}, property) || f(
float{}, property) ||
274 f(
int{}, property) || f(
unsigned{}, property) ||
275 f(
long{}, property) ||
276 f(
static_cast<unsigned long>(0), property) ||
277 f(std::size_t{}, property) || f(
char{}, property) ||
278 f(
static_cast<unsigned char>(0), property);
281 OGS_FATAL(
"Could not apply function to PropertyVector '{:s}'.",
282 property->getPropertyName());