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 54 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 103 of file PropertyVector.h.

106  : std::vector<PROP_VAL_TYPE>(),
107  PropertyVectorBase(property_name, mesh_item_type, n_components)
108  {
109  }
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 118 of file PropertyVector.h.

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

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 84 of file PropertyVector.h.

86  {
87  auto* t(new PropertyVector<PROP_VAL_TYPE>(
89  BaseLib::excludeObjectCopy(*this, exclude_positions, *t);
90  return t;
91  }
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
static const double t

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

◆ 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 75 of file PropertyVector.h.

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

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 57 of file PropertyVector.h.


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