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),
35 std::string
const& name,
36 std::size_t n_prop_groups,
37 std::vector<std::size_t>
const& item2group_mapping,
39 std::size_t n_components)
42 auto it(_properties.find(name));
43 if (it != _properties.end()) {
44 ERR(
"A property of the name '{:s}' already assigned to the mesh.",
50 for (std::size_t k(0); k<item2group_mapping.size(); k++) {
51 std::size_t
const group_id (item2group_mapping[k]);
52 if (group_id >= n_prop_groups) {
53 ERR(
"The mapping to property {:d} for item {:d} is not in the "
54 "correct range [0,{:d}).",
55 group_id, k, n_prop_groups);
62 std::pair<std::string, PropertyVectorBase*>(
65 item2group_mapping, name, mesh_item_type, n_components)
86bool Properties::existsPropertyVector(std::string_view name,
88 int const number_of_components)
const
90 auto const it = _properties.find(std::string(name));
91 if (it == _properties.end())
97 if (property ==
nullptr)
99 WARN(
"Property {} exists but does not have the requested type {}.",
100 name,
typeid(T).name());
103 if (property->getMeshItemType() != mesh_item_type)
106 "Property {} exists but does not have the requested mesh item type "
108 name, toString(mesh_item_type));
111 if (property->getNumberOfGlobalComponents() != number_of_components)
114 "Property {} exists but does not have the requested number of "
116 name, number_of_components);
170 int const n_components)
const
172 auto const it = _properties.find(std::string(name));
173 if (it == _properties.end())
176 "A PropertyVector with name '{:s}' does not exist in the mesh.",
181 if (property ==
nullptr)
184 "Could not cast the data type of the PropertyVector '{:s}' (type: "
185 "'{:s}') to the requested data type '{:s}'.",
186 name,
typeid(
decltype(*it->second)).name(),
189 if (property->getMeshItemType() != item_type)
192 "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
194 name, toString(property->getMeshItemType()), toString(item_type));
196 if (property->getNumberOfGlobalComponents() != n_components)
199 "PropertyVector '{:s}' has {:d} components, {:d} components are "
201 name, property->getNumberOfGlobalComponents(), n_components);
209 int const n_components)
211 auto const it = _properties.find(std::string(name));
212 if (it == _properties.end())
215 "A PropertyVector with name '{:s}' does not exist in the mesh.",
220 if (property ==
nullptr)
223 "Could not cast the data type of the PropertyVector '{:s}' to "
224 "requested data type.",
227 if (property->getMeshItemType() != item_type)
230 "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
232 name, toString(property->getMeshItemType()), toString(item_type));
234 if (property->getNumberOfGlobalComponents() != n_components)
237 "PropertyVector '{:s}' has {:d} components, {:d} components are "
239 name, property->getNumberOfGlobalComponents(), n_components);
247 for (
auto [name, property] : properties)
254 bool success = f(
double{}, property) || f(
float{}, property) ||
255 f(
int{}, property) || f(
unsigned{}, property) ||
256 f(
long{}, property) ||
257 f(
static_cast<unsigned long>(0), property) ||
258 f(std::size_t{}, property) || f(
char{}, property) ||
259 f(
static_cast<unsigned char>(0), property);
262 OGS_FATAL(
"Could not apply function to PropertyVector '{:s}'.",
263 property->getPropertyName());