15 std::string
const&
name,
17 std::size_t n_components)
19 std::map<std::string, PropertyVectorBase*>::const_iterator it(
20 _properties.find(name)
22 if (it != _properties.end()) {
23 ERR(
"A property of the name '%s' is already assigned to the mesh.",
39 std::string
const&
name,
40 std::size_t n_prop_groups,
41 std::vector<std::size_t>
const& item2group_mapping,
43 std::size_t n_components)
47 std::map<std::string, PropertyVectorBase*>::const_iterator it(
48 _properties.find(name)
50 if (it != _properties.end()) {
51 ERR(
"A property of the name '%s' already assigned to the mesh.",
57 for (std::size_t k(0); k<item2group_mapping.size(); k++) {
58 std::size_t
const group_id (item2group_mapping[k]);
59 if (group_id >= n_prop_groups) {
60 ERR(
"The mapping to property %d for item %d is not in the correct range [0,%d).", group_id, k, n_prop_groups);
67 std::pair<std::string, PropertyVectorBase*>(
70 item2group_mapping, name, mesh_item_type, n_components)
78 bool Properties::existsPropertyVector(std::string
const&
name)
const 80 auto it(_properties.find(name));
82 if (it == _properties.end())
91 bool Properties::existsPropertyVector(std::string
const&
name,
93 int const number_of_components)
const 95 auto const it = _properties.find(name);
96 if (it == _properties.end())
102 if (property ==
nullptr)
106 if (property->getMeshItemType() != mesh_item_type)
110 if (property->getNumberOfComponents() != number_of_components)
117 template <
typename T>
119 std::string
const&
name)
const 121 auto it(_properties.find(name));
122 if (it == _properties.end())
125 "The PropertyVector '%s' is not available in the mesh.",
131 "The PropertyVector '%s' has a different type than the requested " 138 template <
typename T>
141 auto it(_properties.find(name));
142 if (it == _properties.end())
145 "A PropertyVector with the specified name '%s' is not available.",
151 "The PropertyVector '%s' has a different type than the requested " 158 template <
typename T>
161 int const n_components)
const 163 auto const it = _properties.find(name);
164 if (it == _properties.end())
166 OGS_FATAL(
"A PropertyVector with name '%s' does not exist in the mesh.",
171 if (property ==
nullptr)
174 "Could not cast the data type of the PropertyVector '%s' to " 175 "requested data type.",
178 if (property->getMeshItemType() != item_type)
181 "The PropertyVector '%s' has type '%s'. A '%s' field is requested.",
182 name.c_str(),
toString(property->getMeshItemType()),
185 if (property->getNumberOfComponents() != n_components)
188 "PropertyVector '%s' has %d components, %d components are needed.",
189 name.c_str(),
property->getNumberOfComponents(), n_components);
194 template <
typename T>
197 int const n_components)
199 auto const it = _properties.find(name);
200 if (it == _properties.end())
202 OGS_FATAL(
"A PropertyVector with name '%s' does not exist in the mesh.",
207 if (property ==
nullptr)
210 "Could not cast the data type of the PropertyVector '%s' to " 211 "requested data type.",
214 if (property->getMeshItemType() != item_type)
217 "The PropertyVector '%s' has type '%s'. A '%s' field is requested.",
218 name.c_str(),
toString(property->getMeshItemType()),
221 if (property->getNumberOfComponents() != n_components)
224 "PropertyVector '%s' has %d components, %d components are needed.",
225 name.c_str(),
property->getNumberOfComponents(), n_components);
#define OGS_FATAL(fmt,...)
const char * toString(mgis::behaviour::Behaviour::Kinematic kin)
Converts MGIS kinematic to a string representation.