OGS
MeshLib::Properties Class Reference

Detailed Description

Property manager on mesh items. Class Properties manages scalar, vector or matrix properties. For instance in groundwater flow porosity is a scalar property and permeabilty can be stored as a tensor property. Properties are assigned to mesh items, i.e. Node or Element objects. The createNewPropertyVector() method first creates a PropertyVector of template type T (scalar, vector or matrix). This class stores the PropertyVector, accessible by a combination of the name and the type of the mesh item (Node or Element).

Definition at line 35 of file Properties.h.

#include <Properties.h>

Public Member Functions

template<typename T >
PropertyVector< T > * createNewPropertyVector (std::string_view name, MeshItemType mesh_item_type, std::size_t n_components=1)
 
template<typename T >
PropertyVector< T > * createNewPropertyVector (std::string const &name, std::size_t n_prop_groups, std::vector< std::size_t > const &item2group_mapping, MeshItemType mesh_item_type, std::size_t n_components=1)
 
template<typename T >
bool existsPropertyVector (std::string_view name) const
 
template<typename T >
bool existsPropertyVector (std::string_view name, MeshItemType const mesh_item_type, int const number_of_components) const
 
template<typename T >
PropertyVector< T > const * getPropertyVector (std::string_view name) const
 
template<typename T >
PropertyVector< T > * getPropertyVector (std::string_view name)
 
template<typename T >
PropertyVector< T > const * getPropertyVector (std::string_view name, MeshItemType const item_type, int const n_components) const
 
template<typename T >
PropertyVector< T > * getPropertyVector (std::string_view name, MeshItemType const item_type, int const n_components)
 
void removePropertyVector (std::string_view name)
 
bool hasPropertyVector (std::string_view name) const
 
template<typename T >
bool hasPropertyVector (std::string const &name, MeshItemType const item_type) const
 
std::vector< std::string > getPropertyVectorNames () const
 
std::vector< std::string > getPropertyVectorNames (MeshLib::MeshItemType t) const
 
Properties excludeCopyProperties (std::vector< std::size_t > const &exclude_elem_ids, std::vector< std::size_t > const &exclude_node_ids) const
 
Properties excludeCopyProperties (std::vector< MeshItemType > const &exclude_mesh_item_types) const
 
 Properties ()=default
 
 Properties (Properties const &properties)
 
 Properties (Properties &&properties)=default
 
Propertiesoperator= (Properties const &properties)
 
Propertiesoperator= (Properties &&properties)=default
 
 ~Properties ()
 
std::map< std::string, PropertyVectorBase * >::const_iterator begin () const
 
std::map< std::string, PropertyVectorBase * >::const_iterator end () const
 
std::map< std::string, PropertyVectorBase * >::iterator begin ()
 
std::map< std::string, PropertyVectorBase * >::iterator end ()
 
std::map< std::string, PropertyVectorBase * >::size_type size () const
 
std::map< std::string, PropertyVectorBase * >::size_type size (MeshItemType const mesh_item_type) const
 
template<typename T >
PropertyVector< T > * createNewPropertyVector (std::string_view name, MeshItemType mesh_item_type, std::size_t n_components)
 
template<typename T >
PropertyVector< T > * createNewPropertyVector (std::string const &name, std::size_t n_prop_groups, std::vector< std::size_t > const &item2group_mapping, MeshItemType mesh_item_type, std::size_t n_components)
 
template<typename T >
bool existsPropertyVector (std::string_view name) const
 
template<typename T >
bool existsPropertyVector (std::string_view name, MeshItemType const mesh_item_type, int const number_of_components) const
 
template<typename T >
PropertyVector< T > const * getPropertyVector (std::string_view name) const
 
template<typename T >
PropertyVector< T > * getPropertyVector (std::string_view name)
 
template<typename T >
bool hasPropertyVector (std::string const &name, MeshItemType const item_type) const
 
template<typename T >
PropertyVector< T > const * getPropertyVector (std::string_view name, MeshItemType const item_type, int const n_components) const
 
template<typename T >
PropertyVector< T > * getPropertyVector (std::string_view name, MeshItemType const item_type, int const n_components)
 

Private Attributes

std::map< std::string, PropertyVectorBase * > _properties
 

Constructor & Destructor Documentation

◆ Properties() [1/3]

MeshLib::Properties::Properties ( )
default

◆ Properties() [2/3]

MeshLib::Properties::Properties ( Properties const & properties)

Definition at line 103 of file Properties.cpp.

104 : _properties(properties._properties)
105{
106 for (auto& name_vector_pair : _properties)
107 {
108 PropertyVectorBase* t(name_vector_pair.second->clone({}));
109 name_vector_pair.second = t;
110 }
111}
std::map< std::string, PropertyVectorBase * > _properties
Definition Properties.h:173

References _properties.

◆ Properties() [3/3]

MeshLib::Properties::Properties ( Properties && properties)
default

◆ ~Properties()

MeshLib::Properties::~Properties ( )

Definition at line 132 of file Properties.cpp.

133{
134 for (auto name_vector_pair : _properties)
135 {
136 delete name_vector_pair.second;
137 }
138}

References _properties.

Member Function Documentation

◆ begin() [1/2]

std::map< std::string, PropertyVectorBase * >::iterator MeshLib::Properties::begin ( )

Definition at line 152 of file Properties.cpp.

153{
154 return _properties.begin();
155}

References _properties.

◆ begin() [2/2]

std::map< std::string, PropertyVectorBase * >::const_iterator MeshLib::Properties::begin ( ) const

Definition at line 140 of file Properties.cpp.

142{
143 return _properties.cbegin();
144}

References _properties.

Referenced by size().

◆ createNewPropertyVector() [1/4]

template<typename T >
PropertyVector< T > * MeshLib::Properties::createNewPropertyVector ( std::string const & name,
std::size_t n_prop_groups,
std::vector< std::size_t > const & item2group_mapping,
MeshItemType mesh_item_type,
std::size_t n_components )

Definition at line 34 of file Properties-impl.h.

40{
41 // check if there is already a PropertyVector with the same name
42 auto it(_properties.find(name));
43 if (it != _properties.end()) {
44 ERR("A property of the name '{:s}' already assigned to the mesh.",
45 name);
46 return nullptr;
47 }
48
49 // check entries of item2group_mapping for consistence
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);
56 return nullptr;
57 }
58 }
59
60 auto entry_info(
61 _properties.insert(
62 std::pair<std::string, PropertyVectorBase*>(
63 name,
64 new PropertyVector<T>(n_prop_groups,
65 item2group_mapping, name, mesh_item_type, n_components)
66 )
67 )
68 );
69 return static_cast<PropertyVector<T>*>((entry_info.first)->second);
70}
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:45

References ERR().

◆ createNewPropertyVector() [2/4]

template<typename T >
PropertyVector< T > * MeshLib::Properties::createNewPropertyVector ( std::string const & name,
std::size_t n_prop_groups,
std::vector< std::size_t > const & item2group_mapping,
MeshItemType mesh_item_type,
std::size_t n_components = 1 )

Method creates a PropertyVector if a PropertyVector with the same name and the same type T was not already created before. In case there exists already such a PropertyVector a nullptr is returned. This method is used if only a small number of distinct property values in a property exist (e.g. mapping property groups to elements). In this case a mapping between mesh items and properties (stored on the heap), see the parameter item2group_mapping, is required.

Template Parameters
Ttype of the property value
Parameters
namethe name of the property
n_prop_groupsnumber of distinct property groups
item2group_mappingthe mapping between mesh item and the property group
mesh_item_typefor instance node or element assigned properties
n_componentsnumber of components for each tuple
Returns
A pointer to a PropertyVector on success and a nullptr otherwise.

◆ createNewPropertyVector() [3/4]

template<typename T >
PropertyVector< T > * MeshLib::Properties::createNewPropertyVector ( std::string_view name,
MeshItemType mesh_item_type,
std::size_t n_components )

Definition at line 16 of file Properties-impl.h.

19{
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.",
23 name);
24 return nullptr;
25 }
26 auto entry_info(_properties.insert(
27 std::make_pair(std::string(name),
28 new PropertyVector<T>(std::string(name), mesh_item_type,
29 n_components))));
30 return static_cast<PropertyVector<T>*>((entry_info.first)->second);
31}

References ERR().

◆ createNewPropertyVector() [4/4]

template<typename T >
PropertyVector< T > * MeshLib::Properties::createNewPropertyVector ( std::string_view name,
MeshItemType mesh_item_type,
std::size_t n_components = 1 )

Method creates a PropertyVector if a PropertyVector with the same name and the same type T was not already created before. In case there exists already such a PropertyVector a nullptr is returned. There are two versions of this method. This method is used when every mesh item at hand has its own property value, i.e. \(n\) mesh item and \(n\) different property values. The user has to ensure the correct usage of the vector later on.

Template Parameters
Ttype of the property value
Parameters
namethe name of the property
mesh_item_typefor instance node or element assigned properties
n_componentsnumber of components for each tuple
Returns
A pointer to a PropertyVector on success and a nullptr otherwise.

Referenced by CreateStructuredGridDialog::accept(), MeshLib::addPropertyToMesh(), ApplicationUtils::addVtkGhostTypeProperty(), castPropertyVectorToPropertyVector(), MeshToolsLib::RasterToMesh::convert(), MeshLib::VtkMeshConverter::convertTypedArray(), copyDoubleValuedFieldDataToPointCloud(), anonymous_namespace{MeshRevision.cpp}::copyProperties(), ApplicationUtils::copyPropertyVector(), MeshToolsLib::MeshLayerMapper::createStaticLayers(), LayeredMeshGenerator::getMesh(), MeshLib::IO::Legacy::MeshIO::loadMeshFromFile(), main(), MeshToolsLib::MeshGenerator::VoxelGridFromMesh::mapArray(), FileIO::Gocad::GocadAsciiReader::parseProperties(), FileIO::Gocad::GocadAsciiReader::readData(), FileIO::GMSH::readGMSHMesh(), FileIO::GMSInterface::readMesh(), FileIO::SwmmInterface::readSwmmInputToLineMesh(), FileIO::TetGenInterface::readTetGenMesh(), MeshToolsLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh(), and writeDataToMesh().

◆ end() [1/2]

std::map< std::string, PropertyVectorBase * >::iterator MeshLib::Properties::end ( )

Definition at line 157 of file Properties.cpp.

158{
159 return _properties.end();
160}

References _properties.

◆ end() [2/2]

std::map< std::string, PropertyVectorBase * >::const_iterator MeshLib::Properties::end ( ) const

Definition at line 146 of file Properties.cpp.

148{
149 return _properties.cend();
150}

References _properties.

Referenced by size().

◆ excludeCopyProperties() [1/2]

Properties MeshLib::Properties::excludeCopyProperties ( std::vector< MeshItemType > const & exclude_mesh_item_types) const

copy all PropertyVector objects stored in the (internal) map but PropertyVector objects with the given MeshItemType are excluded.

Definition at line 81 of file Properties.cpp.

83{
84 Properties new_properties;
85 for (auto name_vector_pair : _properties)
86 {
87 if (std::find(exclude_mesh_item_types.begin(),
88 exclude_mesh_item_types.end(),
89 name_vector_pair.second->getMeshItemType()) !=
90 exclude_mesh_item_types.end())
91 {
92 continue;
93 }
94
95 std::vector<std::size_t> const exclude_positions{};
96 new_properties._properties.insert(
97 std::make_pair(name_vector_pair.first,
98 name_vector_pair.second->clone(exclude_positions)));
99 }
100 return new_properties;
101}

References _properties.

◆ excludeCopyProperties() [2/2]

Properties MeshLib::Properties::excludeCopyProperties ( std::vector< std::size_t > const & exclude_elem_ids,
std::vector< std::size_t > const & exclude_node_ids ) const

copy all PropertyVector objects stored in the (internal) map but only those nodes/elements of a PropertyVector whose ids are not in the vectors exclude_*_ids.

Definition at line 57 of file Properties.cpp.

60{
61 Properties exclude_copy;
62 for (auto name_vector_pair : _properties)
63 {
64 if (name_vector_pair.second->getMeshItemType() == MeshItemType::Cell)
65 {
66 exclude_copy._properties.insert(std::make_pair(
67 name_vector_pair.first,
68 name_vector_pair.second->clone(exclude_elem_ids)));
69 }
70 else if (name_vector_pair.second->getMeshItemType() ==
72 {
73 exclude_copy._properties.insert(std::make_pair(
74 name_vector_pair.first,
75 name_vector_pair.second->clone(exclude_node_ids)));
76 }
77 }
78 return exclude_copy;
79}

References _properties, MeshLib::Cell, and MeshLib::Node.

Referenced by MeshToolsLib::convertToLinearMesh(), MeshToolsLib::createQuadraticOrderMesh(), MeshToolsLib::removeElements(), and MeshToolsLib::removeNodes().

◆ existsPropertyVector() [1/4]

template<typename T >
bool MeshLib::Properties::existsPropertyVector ( std::string_view name) const

Definition at line 73 of file Properties-impl.h.

74{
75 auto it(_properties.find(std::string(name)));
76 // Check that a PropertyVector with the appropriate name exists.
77 if (it == _properties.end())
78 {
79 return false;
80 }
81 // Check that the PropertyVector has the correct data type.
82 return dynamic_cast<PropertyVector<T> const*>(it->second) != nullptr;
83}

◆ existsPropertyVector() [2/4]

◆ existsPropertyVector() [3/4]

template<typename T >
bool MeshLib::Properties::existsPropertyVector ( std::string_view name,
MeshItemType const mesh_item_type,
int const number_of_components ) const

Definition at line 86 of file Properties-impl.h.

89{
90 auto const it = _properties.find(std::string(name));
91 if (it == _properties.end())
92 {
93 return false;
94 }
95
96 auto property = dynamic_cast<PropertyVector<T>*>(it->second);
97 if (property == nullptr)
98 {
99 WARN("Property {} exists but does not have the requested type {}.",
100 name, typeid(T).name());
101 return false;
102 }
103 if (property->getMeshItemType() != mesh_item_type)
104 {
105 WARN(
106 "Property {} exists but does not have the requested mesh item type "
107 "{}.",
108 name, toString(mesh_item_type));
109 return false;
110 }
111 if (property->getNumberOfGlobalComponents() != number_of_components)
112 {
113 WARN(
114 "Property {} exists but does not have the requested number of "
115 "components {}",
116 name, number_of_components);
117 return false;
118 }
119 return true;
120}
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
static constexpr char const * toString(const MeshItemType t)
Returns a char array for a specific MeshItemType.
Definition Location.h:28

References WARN().

◆ existsPropertyVector() [4/4]

template<typename T >
bool MeshLib::Properties::existsPropertyVector ( std::string_view name,
MeshItemType const mesh_item_type,
int const number_of_components ) const

Checks if a property vector with given type T, name, mesh_item_type, and number_of_components exists.

◆ getPropertyVector() [1/8]

template<typename T >
PropertyVector< T > * MeshLib::Properties::getPropertyVector ( std::string_view name)

Definition at line 131 of file Properties-impl.h.

132{
133 auto it(_properties.find(std::string(name)));
134 if (it == _properties.end())
135 {
136 OGS_FATAL(
137 "A PropertyVector with the specified name '{:s}' is not available.",
138 name);
139 }
140 if (!dynamic_cast<PropertyVector<T>*>(it->second))
141 {
142 OGS_FATAL(
143 "The PropertyVector '{:s}' has a different type than the requested "
144 "PropertyVector.",
145 name);
146 }
147 return dynamic_cast<PropertyVector<T>*>(it->second);
148}
#define OGS_FATAL(...)
Definition Error.h:26

References OGS_FATAL.

◆ getPropertyVector() [2/8]

template<typename T >
PropertyVector< T > * MeshLib::Properties::getPropertyVector ( std::string_view name)

Returns a property vector with given name or aborts calling OGS_FATAL if no such property vector exists.

◆ getPropertyVector() [3/8]

template<typename T >
PropertyVector< T > const * MeshLib::Properties::getPropertyVector ( std::string_view name) const

Definition at line 123 of file Properties-impl.h.

125{
126 return const_cast<PropertyVector<T> const*>(
127 const_cast<Properties*>(this)->getPropertyVector<T>(name));
128}
PropertyVector< T > const * getPropertyVector(std::string_view name) const

◆ getPropertyVector() [4/8]

template<typename T >
PropertyVector< T > const * MeshLib::Properties::getPropertyVector ( std::string_view name) const

Returns a property vector with given name or aborts calling OGS_FATAL if no such property vector exists.

Referenced by MeshLib::ElementStatus::ElementStatus(), ProcessLib::LIE::PostProcessTool::PostProcessTool(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::SmallDeformationProcess(), ProcessLib::addBulkMeshPropertyToSubMesh(), MeshToolsLib::addLayerToMesh(), MeshLib::bulkElementIDs(), MeshLib::bulkNodeIDs(), castPropertyVectorToPropertyVector(), MeshToolsLib::ElementValueModification::condense(), anonymous_namespace{MeshRevision.cpp}::copyProperties(), copyPropertyVector(), ParameterLib::createGroupBasedParameter(), ParameterLib::createMeshElementParameter(), ParameterLib::createMeshNodeParameter(), ParameterLib::createRandomFieldMeshElementParameter(), extractMatGroup(), getRegularElements(), getSurfaceIntegratedValuesForNodes(), MeshToolsLib::Mesh2MeshPropertyInterpolation::interpolateElementPropertiesToNodeProperties(), MeshToolsLib::MeshGenerator::VoxelGridFromMesh::mapArray(), MeshLib::materialIDs(), MeshElementRemovalDialog::on_scalarArrayComboBox_currentIndexChanged(), FileIO::Gocad::GocadAsciiReader::parseElements(), FileIO::Gocad::GocadAsciiReader::parseLineSegments(), ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh(), ApplicationUtils::NodeWiseMeshPartitioner::renumberBulkIdsProperty(), reorderProperty(), MeshToolsLib::ElementValueModification::replace(), MeshGeoToolsLib::resetMeshElementProperty(), MeshLib::scaleMeshPropertyVector(), MeshLib::ElementSearch::searchByPropertyValueRange(), MeshToolsLib::ElementValueModification::setByElementType(), setMaterialIDs(), MeshToolsLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh(), MeshLib::IO::Legacy::MeshIO::write(), FileIO::TetGenInterface::write2dElements(), FileIO::TetGenInterface::write3dElements(), and MeshLib::IO::VtuInterface::writeVTU().

◆ getPropertyVector() [5/8]

template<typename T >
PropertyVector< T > * MeshLib::Properties::getPropertyVector ( std::string_view name,
MeshItemType const item_type,
int const n_components )

Definition at line 207 of file Properties-impl.h.

210{
211 auto const it = _properties.find(std::string(name));
212 if (it == _properties.end())
213 {
214 OGS_FATAL(
215 "A PropertyVector with name '{:s}' does not exist in the mesh.",
216 name);
217 }
218
219 auto property = dynamic_cast<PropertyVector<T>*>(it->second);
220 if (property == nullptr)
221 {
222 OGS_FATAL(
223 "Could not cast the data type of the PropertyVector '{:s}' to "
224 "requested data type.",
225 name);
226 }
227 if (property->getMeshItemType() != item_type)
228 {
229 OGS_FATAL(
230 "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
231 "requested.",
232 name, toString(property->getMeshItemType()), toString(item_type));
233 }
234 if (property->getNumberOfGlobalComponents() != n_components)
235 {
236 OGS_FATAL(
237 "PropertyVector '{:s}' has {:d} components, {:d} components are "
238 "needed.",
239 name, property->getNumberOfGlobalComponents(), n_components);
240 }
241 return property;
242}

References OGS_FATAL.

◆ getPropertyVector() [6/8]

template<typename T >
PropertyVector< T > * MeshLib::Properties::getPropertyVector ( std::string_view name,
MeshItemType const item_type,
int const n_components )

Non-const version of getPropertyVector returns a property vector with given name, item_type and number_of_components or calls OGS_FATAL if no such property vector exists.

◆ getPropertyVector() [7/8]

template<typename T >
PropertyVector< T > const * MeshLib::Properties::getPropertyVector ( std::string_view name,
MeshItemType const item_type,
int const n_components ) const

Definition at line 168 of file Properties-impl.h.

171{
172 auto const it = _properties.find(std::string(name));
173 if (it == _properties.end())
174 {
175 OGS_FATAL(
176 "A PropertyVector with name '{:s}' does not exist in the mesh.",
177 name);
178 }
179
180 auto property = dynamic_cast<PropertyVector<T>*>(it->second);
181 if (property == nullptr)
182 {
183 OGS_FATAL(
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(),
187 typeid(PropertyVector<T>).name());
188 }
189 if (property->getMeshItemType() != item_type)
190 {
191 OGS_FATAL(
192 "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
193 "requested.",
194 name, toString(property->getMeshItemType()), toString(item_type));
195 }
196 if (property->getNumberOfGlobalComponents() != n_components)
197 {
198 OGS_FATAL(
199 "PropertyVector '{:s}' has {:d} components, {:d} components are "
200 "needed.",
201 name, property->getNumberOfGlobalComponents(), n_components);
202 }
203 return property;
204}

References OGS_FATAL.

◆ getPropertyVector() [8/8]

template<typename T >
PropertyVector< T > const * MeshLib::Properties::getPropertyVector ( std::string_view name,
MeshItemType const item_type,
int const n_components ) const

Returns a property vector with given name, item_type and number_of_components or aborts calling OGS_FATAL if no such property vector exists.

◆ getPropertyVectorNames() [1/2]

std::vector< std::string > MeshLib::Properties::getPropertyVectorNames ( ) const

Definition at line 34 of file Properties.cpp.

35{
36 std::vector<std::string> names;
37 std::transform(_properties.begin(), _properties.end(),
38 std::back_inserter(names),
39 [](auto const& pair) { return std::string(pair.first); });
40 return names;
41}
constexpr ranges::views::view_closure names
For an element of a range view return its name.
Definition Mesh.h:229

References _properties.

Referenced by anonymous_namespace{MeshRevision.cpp}::copyProperties(), and ProcessLib::Output::prepareSubmesh().

◆ getPropertyVectorNames() [2/2]

std::vector< std::string > MeshLib::Properties::getPropertyVectorNames ( MeshLib::MeshItemType t) const

Definition at line 43 of file Properties.cpp.

45{
46 std::vector<std::string> names;
47 for (auto p : _properties)
48 {
49 if (p.second->getMeshItemType() == t)
50 {
51 names.push_back(std::string(p.first));
52 }
53 }
54 return names;
55}

References _properties.

◆ hasPropertyVector() [1/3]

template<typename T >
bool MeshLib::Properties::hasPropertyVector ( std::string const & name,
MeshItemType const item_type ) const

Definition at line 151 of file Properties-impl.h.

153{
154 auto const it = _properties.find(name);
155
156 if (it == _properties.end())
157 {
158 return false;
159 }
160
161 auto property = dynamic_cast<PropertyVector<T>*>(it->second);
162
163 return (property == nullptr) ? false
164 : property->getMeshItemType() == item_type;
165}

References MeshLib::PropertyVectorBase::getMeshItemType().

◆ hasPropertyVector() [2/3]

template<typename T >
bool MeshLib::Properties::hasPropertyVector ( std::string const & name,
MeshItemType const item_type ) const

Check if a PropertyVector accessible by the name and by the item type is already stored within the Properties object.

Parameters
namethe name of the property, e.g. porosity.
item_typethe type of mesh entity, e.g. CELL.

◆ hasPropertyVector() [3/3]

bool MeshLib::Properties::hasPropertyVector ( std::string_view name) const

Check if a PropertyVector accessible by the name is already stored within the Properties object.

Parameters
namethe name of the property (for instance porosity)

Definition at line 29 of file Properties.cpp.

30{
31 return _properties.find(std::string(name)) != _properties.end();
32}

References _properties.

Referenced by ProcessLib::LIE::PostProcessTool::PostProcessTool(), ProcessLib::checkParametersOfDirichletBoundaryCondition(), and ApplicationUtils::NodeWiseMeshPartitioner::renumberBulkIdsProperty().

◆ operator=() [1/2]

Properties & MeshLib::Properties::operator= ( Properties && properties)
default

◆ operator=() [2/2]

Properties & MeshLib::Properties::operator= ( Properties const & properties)

Definition at line 113 of file Properties.cpp.

114{
115 if (&properties == this)
116 {
117 return *this;
118 }
119
120 _properties = properties._properties;
121 std::vector<std::size_t> exclude_positions;
122 for (auto& name_vector_pair : _properties)
123 {
124 PropertyVectorBase* t(
125 name_vector_pair.second->clone(exclude_positions));
126 name_vector_pair.second = t;
127 }
128
129 return *this;
130}

References _properties.

◆ removePropertyVector()

void MeshLib::Properties::removePropertyVector ( std::string_view name)

Definition at line 17 of file Properties.cpp.

18{
19 auto it(_properties.find(std::string(name)));
20 if (it == _properties.end())
21 {
22 WARN("A property of the name '{:s}' does not exist.", name);
23 return;
24 }
25 delete it->second;
26 _properties.erase(it);
27}

References _properties, and WARN().

◆ size() [1/2]

std::map< std::string, PropertyVectorBase * >::size_type MeshLib::Properties::size ( ) const

Definition at line 162 of file Properties.cpp.

163{
164 return _properties.size();
165}

References _properties.

Referenced by ApplicationUtils::writeProperties().

◆ size() [2/2]

std::map< std::string, PropertyVectorBase * >::size_type MeshLib::Properties::size ( MeshItemType const mesh_item_type) const

Definition at line 167 of file Properties.cpp.

169{
170 return count_if(begin(), end(),
171 [&](auto const p)
172 { return p.second->getMeshItemType() == mesh_item_type; });
173}
std::map< std::string, PropertyVectorBase * >::const_iterator begin() const
std::map< std::string, PropertyVectorBase * >::const_iterator end() const

References begin(), and end().

Member Data Documentation

◆ _properties

std::map<std::string, PropertyVectorBase*> MeshLib::Properties::_properties
private

A mapping from property's name to the stored object of any type. See addProperty() and getProperty() documentation.

Definition at line 173 of file Properties.h.

Referenced by Properties(), ~Properties(), begin(), begin(), end(), end(), excludeCopyProperties(), excludeCopyProperties(), getPropertyVectorNames(), getPropertyVectorNames(), hasPropertyVector(), operator=(), removePropertyVector(), and size().


The documentation for this class was generated from the following files: