OGS
MeshLib::PropertyVector< PROP_VAL_TYPE > Class Template Reference

Detailed Description

template<typename PROP_VAL_TYPE>
class MeshLib::PropertyVector< PROP_VAL_TYPE >

Class template PropertyVector is a std::vector with template parameter PROP_VAL_TYPE. The reason for the derivation of std::vector is the template specialisation for pointer types below.

Template Parameters
PROP_VAL_TYPEtypical this is a scalar, a vector or a matrix

Definition at line 55 of file PropertyVector.h.

#include <PropertyVector.h>

Inheritance diagram for MeshLib::PropertyVector< PROP_VAL_TYPE >:
[legend]
Collaboration diagram for MeshLib::PropertyVector< PROP_VAL_TYPE >:
[legend]

Public Member Functions

std::size_t getNumberOfTuples () const
 
PROP_VAL_TYPE & getComponent (std::size_t tuple_index, int component)
 Returns the value for the given component stored in the given tuple. More...
 
PROP_VAL_TYPE const & getComponent (std::size_t tuple_index, int component) const
 Returns the value for the given component stored in the given tuple. More...
 
PropertyVectorBaseclone (std::vector< std::size_t > const &exclude_positions) const override
 
std::size_t size () const
 
- Public Member Functions inherited from MeshLib::PropertyVectorBase
virtual ~PropertyVectorBase ()=default
 
MeshItemType getMeshItemType () const
 
std::string const & getPropertyName () const
 
int getNumberOfGlobalComponents () const
 

Protected Member Functions

 PropertyVector (std::string const &property_name, MeshItemType mesh_item_type, std::size_t n_components)
 The constructor taking meta information for the data. More...
 
 PropertyVector (std::size_t n_property_values, std::string const &property_name, MeshItemType mesh_item_type, std::size_t n_components)
 The constructor taking meta information for the data. More...
 
- Protected Member Functions inherited from MeshLib::PropertyVectorBase
 PropertyVectorBase (std::string property_name, MeshItemType mesh_item_type, std::size_t n_components)
 

Friends

class Properties
 

Additional Inherited Members

- Protected Attributes inherited from MeshLib::PropertyVectorBase
int const _n_components
 
MeshItemType const _mesh_item_type
 
std::string const _property_name
 

Constructor & Destructor Documentation

◆ PropertyVector() [1/2]

template<typename PROP_VAL_TYPE >
MeshLib::PropertyVector< PROP_VAL_TYPE >::PropertyVector ( std::string const &  property_name,
MeshItemType  mesh_item_type,
std::size_t  n_components 
)
inlineexplicitprotected

The constructor taking meta information for the data.

Parameters
property_namea string describing the property
mesh_item_typethe values of the property are either assigned to nodes or cells (see enumeration MeshItemType)
n_componentsthe number of components of a property

Definition at line 104 of file PropertyVector.h.

107  : std::vector<PROP_VAL_TYPE>(),
108  PropertyVectorBase(property_name, mesh_item_type, n_components)
109  {
110  }
PropertyVectorBase(std::string property_name, MeshItemType mesh_item_type, std::size_t n_components)

◆ PropertyVector() [2/2]

template<typename PROP_VAL_TYPE >
MeshLib::PropertyVector< PROP_VAL_TYPE >::PropertyVector ( std::size_t  n_property_values,
std::string const &  property_name,
MeshItemType  mesh_item_type,
std::size_t  n_components 
)
inlineprotected

The constructor taking meta information for the data.

Parameters
n_property_valuesnumber of property values (value can be a tuple with several entries)
property_namea string describing the property
mesh_item_typethe values of the property are either assigned to nodes or cells (see enumeration MeshItemType)
n_componentsthe number of components of a property

Definition at line 119 of file PropertyVector.h.

123  : std::vector<PROP_VAL_TYPE>(n_property_values * n_components),
124  PropertyVectorBase(property_name, mesh_item_type, n_components)
125  {
126  }

Member Function Documentation

◆ clone()

template<typename PROP_VAL_TYPE >
PropertyVectorBase* MeshLib::PropertyVector< PROP_VAL_TYPE >::clone ( std::vector< std::size_t > const &  exclude_positions) const
inlineoverridevirtual

Implements MeshLib::PropertyVectorBase.

Definition at line 85 of file PropertyVector.h.

87  {
88  auto* t(new PropertyVector<PROP_VAL_TYPE>(
90  BaseLib::excludeObjectCopy(*this, exclude_positions, *t);
91  return t;
92  }
MeshItemType const _mesh_item_type
std::string const _property_name
std::vector< T > excludeObjectCopy(std::vector< T > const &src_vec, std::vector< std::size_t > const &exclude_positions)
Definition: Algorithm.h:33

References MeshLib::PropertyVectorBase::_mesh_item_type, MeshLib::PropertyVectorBase::_n_components, MeshLib::PropertyVectorBase::_property_name, and BaseLib::excludeObjectCopy().

◆ getComponent() [1/2]

template<typename PROP_VAL_TYPE >
PROP_VAL_TYPE& MeshLib::PropertyVector< PROP_VAL_TYPE >::getComponent ( std::size_t  tuple_index,
int  component 
)
inline

◆ getComponent() [2/2]

template<typename PROP_VAL_TYPE >
PROP_VAL_TYPE const& MeshLib::PropertyVector< PROP_VAL_TYPE >::getComponent ( std::size_t  tuple_index,
int  component 
) const
inline

Returns the value for the given component stored in the given tuple.

Definition at line 76 of file PropertyVector.h.

78  {
79  assert(component < _n_components);
80  assert(tuple_index < getNumberOfTuples());
81  return this->operator[](tuple_index* getNumberOfGlobalComponents() +
82  component);
83  }

References MeshLib::PropertyVectorBase::_n_components, MeshLib::PropertyVectorBase::getNumberOfGlobalComponents(), and MeshLib::PropertyVector< PROP_VAL_TYPE >::getNumberOfTuples().

◆ getNumberOfTuples()

template<typename PROP_VAL_TYPE >
std::size_t MeshLib::PropertyVector< PROP_VAL_TYPE >::getNumberOfTuples ( ) const
inline

◆ size()

Friends And Related Function Documentation

◆ Properties

template<typename PROP_VAL_TYPE >
friend class Properties
friend

Definition at line 58 of file PropertyVector.h.


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