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 32 of file Properties-impl.h.

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

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

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 71 of file Properties-impl.h.

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

◆ 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 84 of file Properties-impl.h.

87{
88 auto const it = _properties.find(std::string(name));
89 if (it == _properties.end())
90 {
91 return false;
92 }
93
94 auto property = dynamic_cast<PropertyVector<T>*>(it->second);
95 if (property == nullptr)
96 {
97 return false;
98 }
99 if (property->getMeshItemType() != mesh_item_type)
100 {
101 return false;
102 }
103 if (property->getNumberOfGlobalComponents() != number_of_components)
104 {
105 return false;
106 }
107 return true;
108}

◆ 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 111 of file Properties-impl.h.

113{
114 auto it(_properties.find(std::string(name)));
115 if (it == _properties.end())
116 {
117 OGS_FATAL("The PropertyVector '{:s}' is not available in the mesh.",
118 name);
119 }
120 if (!dynamic_cast<PropertyVector<T> const*>(it->second))
121 {
122 OGS_FATAL(
123 "The PropertyVector '{:s}' has a different type than the requested "
124 "PropertyVector.",
125 name);
126 }
127 return dynamic_cast<PropertyVector<T> const*>(it->second);
128}

References OGS_FATAL.

◆ 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 206 of file Properties-impl.h.

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

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}' to "
185 "requested data type.",
186 name);
187 }
188 if (property->getMeshItemType() != item_type)
189 {
190 OGS_FATAL(
191 "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
192 "requested.",
193 name, toString(property->getMeshItemType()), toString(item_type));
194 }
195 if (property->getNumberOfGlobalComponents() != n_components)
196 {
197 OGS_FATAL(
198 "PropertyVector '{:s}' has {:d} components, {:d} components are "
199 "needed.",
200 name, property->getNumberOfGlobalComponents(), n_components);
201 }
202 return property;
203}

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}
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40

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: