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 const &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 const &name) const
 
template<typename T >
bool existsPropertyVector (std::string const &name, MeshItemType const mesh_item_type, int const number_of_components) const
 
template<typename T >
PropertyVector< T > const * getPropertyVector (std::string const &name) const
 
template<typename T >
PropertyVector< T > * getPropertyVector (std::string const &name)
 
template<typename T >
PropertyVector< T > const * getPropertyVector (std::string const &name, MeshItemType const item_type, int const n_components) const
 
template<typename T >
PropertyVector< T > * getPropertyVector (std::string const &name, MeshItemType const item_type, int const n_components)
 
void removePropertyVector (std::string const &name)
 
bool hasPropertyVector (std::string const &name) 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 const &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 const &name) const
 
template<typename T >
bool existsPropertyVector (std::string const &name, MeshItemType const mesh_item_type, int const number_of_components) const
 
template<typename T >
PropertyVector< T > const * getPropertyVector (std::string const &name) const
 
template<typename T >
PropertyVector< T > * getPropertyVector (std::string const &name)
 
template<typename T >
PropertyVector< T > const * getPropertyVector (std::string const &name, MeshItemType const item_type, int const n_components) const
 
template<typename T >
PropertyVector< T > * getPropertyVector (std::string const &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 104 of file Properties.cpp.

105  : _properties(properties._properties)
106 {
107  std::vector<std::size_t> exclude_positions;
108  for (auto& name_vector_pair : _properties)
109  {
110  PropertyVectorBase* t(
111  name_vector_pair.second->clone(exclude_positions));
112  name_vector_pair.second = t;
113  }
114 }
std::map< std::string, PropertyVectorBase * > _properties
Definition: Properties.h:165
static const double t

References _properties, and MathLib::t.

◆ Properties() [3/3]

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

◆ ~Properties()

MeshLib::Properties::~Properties ( )

Definition at line 135 of file Properties.cpp.

136 {
137  for (auto name_vector_pair : _properties)
138  {
139  delete name_vector_pair.second;
140  }
141 }

References _properties.

Member Function Documentation

◆ begin() [1/2]

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

Definition at line 155 of file Properties.cpp.

156 {
157  return _properties.begin();
158 }

References _properties.

◆ begin() [2/2]

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

Definition at line 143 of file Properties.cpp.

145 {
146  return _properties.cbegin();
147 }

References _properties.

Referenced by size().

◆ createNewPropertyVector() [1/4]

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

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

18 {
19  std::map<std::string, PropertyVectorBase*>::const_iterator it(
20  _properties.find(name)
21  );
22  if (it != _properties.end()) {
23  ERR("A property of the name '{:s}' is already assigned to the mesh.",
24  name);
25  return nullptr;
26  }
27  auto entry_info(
28  _properties.insert(
29  std::make_pair(
30  name, new PropertyVector<T>(name, mesh_item_type, n_components)
31  )
32  )
33  );
34  return static_cast<PropertyVector<T>*>((entry_info.first)->second);
35 }
void ERR(char const *fmt, Args const &... args)
Definition: Logging.h:42

References ERR(), and MaterialPropertyLib::name.

◆ createNewPropertyVector() [2/4]

template<typename T >
PropertyVector<T>* MeshLib::Properties::createNewPropertyVector ( std::string const &  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(), MeshLib::RasterToMesh::convert(), MeshLib::VtkMeshConverter::convertTypedArray(), MeshLib::MeshRevision::copyProperties(), ApplicationUtils::copyPropertyVector(), MeshLib::MeshLayerMapper::createStaticLayers(), LayeredMeshGenerator::getMesh(), MeshLib::IO::Legacy::MeshIO::loadMeshFromFile(), main(), mapArray(), FileIO::Gocad::GocadAsciiReader::parseProperties(), FileIO::Gocad::GocadAsciiReader::readData(), FileIO::GMSInterface::readGMS3DMMesh(), FileIO::GMSH::readGMSHMesh(), FileIO::SwmmInterface::readSwmmInputToLineMesh(), FileIO::TetGenInterface::readTetGenMesh(), MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh(), and writeDataToMesh().

◆ createNewPropertyVector() [3/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 38 of file Properties-impl.h.

44 {
45  // check if there is already a PropertyVector with the same name
46  std::map<std::string, PropertyVectorBase*>::const_iterator it(
47  _properties.find(name)
48  );
49  if (it != _properties.end()) {
50  ERR("A property of the name '{:s}' already assigned to the mesh.",
51  name);
52  return nullptr;
53  }
54 
55  // check entries of item2group_mapping for consistence
56  for (std::size_t k(0); k<item2group_mapping.size(); k++) {
57  std::size_t const group_id (item2group_mapping[k]);
58  if (group_id >= n_prop_groups) {
59  ERR("The mapping to property {:d} for item {:d} is not in the "
60  "correct range [0,{:d}).",
61  group_id, k, n_prop_groups);
62  return nullptr;
63  }
64  }
65 
66  auto entry_info(
67  _properties.insert(
68  std::pair<std::string, PropertyVectorBase*>(
69  name,
70  new PropertyVector<T>(n_prop_groups,
71  item2group_mapping, name, mesh_item_type, n_components)
72  )
73  )
74  );
75  return static_cast<PropertyVector<T>*>((entry_info.first)->second);
76 }

References ERR(), and MaterialPropertyLib::name.

◆ createNewPropertyVector() [4/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.

◆ end() [1/2]

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

Definition at line 160 of file Properties.cpp.

161 {
162  return _properties.end();
163 }

References _properties.

◆ end() [2/2]

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

Definition at line 149 of file Properties.cpp.

151 {
152  return _properties.cend();
153 }

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 82 of file Properties.cpp.

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

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 58 of file Properties.cpp.

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

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

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

◆ existsPropertyVector() [1/4]

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

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

80 {
81  auto it(_properties.find(name));
82  // Check that a PropertyVector with the appropriate name exists.
83  if (it == _properties.end())
84  {
85  return false;
86  }
87  // Check that the PropertyVector has the correct data type.
88  return dynamic_cast<PropertyVector<T> const*>(it->second) != nullptr;
89 }

References MaterialPropertyLib::name.

◆ existsPropertyVector() [2/4]

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

Checks if a property vector with given name and the given type exists.

Parameters
namename of the requested property vector

Referenced by MeshLib::ElementStatus::ElementStatus(), ProcessLib::SolutionDependentDirichletBoundaryCondition::SolutionDependentDirichletBoundaryCondition(), MeshElementRemovalDialog::accept(), MeshLib::addLayerToMesh(), ProcessLib::checkParametersOfDirichletBoundaryCondition(), MeshLib::MeshRevision::copyProperties(), ProcessLib::getIntegrationPointMetaData(), MeshLib::getOrCreateMeshProperty(), getSurfaceIntegratedValuesForNodes(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::TH2M::TH2MProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowProcess::initializeConcreteProcess(), ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), MeshLib::Mesh2MeshPropertyInterpolation::interpolateElementPropertiesToNodeProperties(), MeshLib::materialIDs(), MeshElementRemovalDialog::on_scalarArrayComboBox_currentIndexChanged(), MeshLib::scaleMeshPropertyVector(), MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh(), MeshLib::IO::Legacy::MeshIO::write(), and FileIO::TetGenInterface::write2dElements().

◆ existsPropertyVector() [3/4]

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

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

95 {
96  auto const it = _properties.find(name);
97  if (it == _properties.end())
98  {
99  return false;
100  }
101 
102  auto property = dynamic_cast<PropertyVector<T>*>(it->second);
103  if (property == nullptr)
104  {
105  return false;
106  }
107  if (property->getMeshItemType() != mesh_item_type)
108  {
109  return false;
110  }
111  if (property->getNumberOfGlobalComponents() != number_of_components)
112  {
113  return false;
114  }
115  return true;
116 }

References MaterialPropertyLib::name.

◆ existsPropertyVector() [4/4]

template<typename T >
bool MeshLib::Properties::existsPropertyVector ( std::string const &  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 const &  name)

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

140 {
141  auto it(_properties.find(name));
142  if (it == _properties.end())
143  {
144  OGS_FATAL(
145  "A PropertyVector with the specified name '{:s}' is not available.",
146  name);
147  }
148  if (!dynamic_cast<PropertyVector<T>*>(it->second))
149  {
150  OGS_FATAL(
151  "The PropertyVector '{:s}' has a different type than the requested "
152  "PropertyVector.",
153  name);
154  }
155  return dynamic_cast<PropertyVector<T>*>(it->second);
156 }
#define OGS_FATAL(...)
Definition: Error.h:26

References MaterialPropertyLib::name, and OGS_FATAL.

◆ getPropertyVector() [2/8]

template<typename T >
PropertyVector<T>* MeshLib::Properties::getPropertyVector ( std::string const &  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 const &  name) const

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

121 {
122  auto it(_properties.find(name));
123  if (it == _properties.end())
124  {
125  OGS_FATAL("The PropertyVector '{:s}' is not available in the mesh.",
126  name);
127  }
128  if (!dynamic_cast<PropertyVector<T> const*>(it->second))
129  {
130  OGS_FATAL(
131  "The PropertyVector '{:s}' has a different type than the requested "
132  "PropertyVector.",
133  name);
134  }
135  return dynamic_cast<PropertyVector<T> const*>(it->second);
136 }

References MaterialPropertyLib::name, and OGS_FATAL.

◆ getPropertyVector() [4/8]

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

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

Referenced by ProcessLib::ConstraintDirichletBoundaryCondition::ConstraintDirichletBoundaryCondition(), MeshLib::ElementStatus::ElementStatus(), ProcessLib::LIE::PostProcessTool::PostProcessTool(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::SmallDeformationProcess(), MeshLib::addLayerToMesh(), castPropertyVectorToPropertyVector(), MeshLib::ElementValueModification::condense(), MeshLib::MeshRevision::copyProperties(), ParameterLib::createGroupBasedParameter(), ParameterLib::createMeshElementParameter(), ParameterLib::createMeshNodeParameter(), ParameterLib::createRandomFieldMeshElementParameter(), extractMatGroup(), ProcessLib::PythonBoundaryCondition::getEssentialBCValues(), getSurfaceIntegratedValuesForNodes(), anonymous_namespace{IdentifySubdomainMesh.cpp}::identifySubdomainMeshElements(), MeshLib::Mesh2MeshPropertyInterpolation::interpolateElementPropertiesToNodeProperties(), mapArray(), markFaults(), MeshElementRemovalDialog::on_scalarArrayComboBox_currentIndexChanged(), FileIO::Gocad::GocadAsciiReader::parseElements(), FileIO::Gocad::GocadAsciiReader::parseLineSegments(), ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh(), MeshLib::ElementValueModification::replace(), MeshGeoToolsLib::resetMeshElementProperty(), MeshLib::scaleMeshPropertyVector(), MeshLib::ElementSearch::searchByPropertyValueRange(), MeshLib::ElementValueModification::setByElementType(), setMaterialIDs(), MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh(), MeshLib::IO::Legacy::MeshIO::write(), FileIO::TetGenInterface::write2dElements(), and FileIO::TetGenInterface::write3dElements().

◆ getPropertyVector() [5/8]

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

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

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

References MaterialPropertyLib::name, OGS_FATAL, and MaterialLib::Solids::MFront::toString().

◆ getPropertyVector() [6/8]

template<typename T >
PropertyVector<T>* MeshLib::Properties::getPropertyVector ( std::string const &  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 const &  name,
MeshItemType const  item_type,
int const  n_components 
) const

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

162 {
163  auto const it = _properties.find(name);
164  if (it == _properties.end())
165  {
166  OGS_FATAL(
167  "A PropertyVector with name '{:s}' does not exist in the mesh.",
168  name);
169  }
170 
171  auto property = dynamic_cast<PropertyVector<T>*>(it->second);
172  if (property == nullptr)
173  {
174  OGS_FATAL(
175  "Could not cast the data type of the PropertyVector '{:s}' to "
176  "requested data type.",
177  name);
178  }
179  if (property->getMeshItemType() != item_type)
180  {
181  OGS_FATAL(
182  "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
183  "requested.",
184  name, toString(property->getMeshItemType()), toString(item_type));
185  }
186  if (property->getNumberOfGlobalComponents() != n_components)
187  {
188  OGS_FATAL(
189  "PropertyVector '{:s}' has {:d} components, {:d} components are "
190  "needed.",
191  name, property->getNumberOfGlobalComponents(), n_components);
192  }
193  return property;
194 }

References MaterialPropertyLib::name, OGS_FATAL, and MaterialLib::Solids::MFront::toString().

◆ getPropertyVector() [8/8]

template<typename T >
PropertyVector<T> const* MeshLib::Properties::getPropertyVector ( std::string const &  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 35 of file Properties.cpp.

36 {
37  std::vector<std::string> names;
38  std::transform(_properties.begin(), _properties.end(),
39  std::back_inserter(names),
40  [](auto const& pair) { return pair.first; });
41  return names;
42 }

References _properties.

Referenced by MeshLib::MeshRevision::copyProperties().

◆ getPropertyVectorNames() [2/2]

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

Definition at line 44 of file Properties.cpp.

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

References _properties, and MathLib::t.

◆ hasPropertyVector()

bool MeshLib::Properties::hasPropertyVector ( std::string const &  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 30 of file Properties.cpp.

31 {
32  return _properties.find(name) != _properties.end();
33 }

References _properties, and MaterialPropertyLib::name.

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

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Definition at line 116 of file Properties.cpp.

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

References _properties, and MathLib::t.

◆ removePropertyVector()

void MeshLib::Properties::removePropertyVector ( std::string const &  name)

Definition at line 17 of file Properties.cpp.

18 {
19  std::map<std::string, PropertyVectorBase*>::const_iterator it(
20  _properties.find(name));
21  if (it == _properties.end())
22  {
23  WARN("A property of the name '{:s}' does not exist.", name);
24  return;
25  }
26  delete it->second;
27  _properties.erase(it);
28 }
void WARN(char const *fmt, Args const &... args)
Definition: Logging.h:37

References _properties, MaterialPropertyLib::name, and WARN().

◆ size() [1/2]

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

Definition at line 165 of file Properties.cpp.

166 {
167  return _properties.size();
168 }

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 170 of file Properties.cpp.

172 {
173  return count_if(begin(), end(),
174  [&](auto const p)
175  { return p.second->getMeshItemType() == mesh_item_type; });
176 }
std::map< std::string, PropertyVectorBase * >::const_iterator begin() const
Definition: Properties.cpp:143
std::map< std::string, PropertyVectorBase * >::const_iterator end() const
Definition: Properties.cpp:149

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

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


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