16 std::size_t n_components)
18 auto it(_properties.find(std::string(name)));
19 if (it != _properties.end()) {
20 ERR(
"A property of the name '{:s}' is already assigned to the mesh.",
24 auto entry_info(_properties.insert(
25 std::make_pair(std::string(name),
33 std::string
const& name,
34 std::size_t n_prop_groups,
35 std::vector<std::size_t>
const& item2group_mapping,
37 std::size_t n_components)
40 auto it(_properties.find(name));
41 if (it != _properties.end()) {
42 ERR(
"A property of the name '{:s}' already assigned to the mesh.",
48 for (std::size_t k(0); k<item2group_mapping.size(); k++) {
49 std::size_t
const group_id (item2group_mapping[k]);
50 if (group_id >= n_prop_groups) {
51 ERR(
"The mapping to property {:d} for item {:d} is not in the "
52 "correct range [0,{:d}).",
53 group_id, k, n_prop_groups);
60 std::pair<std::string, PropertyVectorBase*>(
63 item2group_mapping, name, mesh_item_type, n_components)
84bool Properties::existsPropertyVector(std::string_view name,
86 int const number_of_components)
const
88 auto const it = _properties.find(std::string(name));
89 if (it == _properties.end())
95 if (property ==
nullptr)
99 if (property->getMeshItemType() != mesh_item_type)
103 if (property->getNumberOfGlobalComponents() != 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}' to "
185 "requested data type.",
188 if (property->getMeshItemType() != item_type)
191 "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
193 name, toString(property->getMeshItemType()), toString(item_type));
195 if (property->getNumberOfGlobalComponents() != n_components)
198 "PropertyVector '{:s}' has {:d} components, {:d} components are "
200 name, property->getNumberOfGlobalComponents(), n_components);
208 int const n_components)
210 auto const it = _properties.find(std::string(name));
211 if (it == _properties.end())
214 "A PropertyVector with name '{:s}' does not exist in the mesh.",
219 if (property ==
nullptr)
222 "Could not cast the data type of the PropertyVector '{:s}' to "
223 "requested data type.",
226 if (property->getMeshItemType() != item_type)
229 "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
231 name, toString(property->getMeshItemType()), toString(item_type));
233 if (property->getNumberOfGlobalComponents() != n_components)
236 "PropertyVector '{:s}' has {:d} components, {:d} components are "
238 name, property->getNumberOfGlobalComponents(), n_components);
246 for (
auto [name, property] : properties)
253 bool success = f(
double{}, property) || f(
float{}, property) ||
254 f(
int{}, property) || f(
unsigned{}, property) ||
255 f(
long{}, property) ||
256 f(
static_cast<unsigned long>(0), property) ||
257 f(std::size_t{}, property) || f(
char{}, property) ||
258 f(
static_cast<unsigned char>(0), property);
261 OGS_FATAL(
"Could not apply function to PropertyVector '{:s}'.",
262 property->getPropertyName());