OGS 6.3.0-179-g962fdcd4e.dirty.20200403132553
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 26 of file CreateEquilibriumReactants.h.

#include <CreateEquilibriumReactants.h>

Inheritance diagram for MeshLib::PropertyVector< PROP_VAL_TYPE >:
Collaboration diagram for MeshLib::PropertyVector< PROP_VAL_TYPE >:

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 getNumberOfComponents () 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  }
PropertyVectorBase(std::string property_name, MeshItemType mesh_item_type, std::size_t n_components)

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  }
std::vector< T > excludeObjectCopy(std::vector< T > const &src_vec, std::vector< std::size_t > const &exclude_positions)
Definition: Algorithm.h:32
std::string const _property_name
MeshItemType const _mesh_item_type

◆ 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

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

Definition at line 67 of file PropertyVector.h.

Referenced by ProcessLib::SurfaceFluxLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::integrate(), and NumLib::transformVariableFromGlobalVector().

68  {
69  assert(component < _n_components);
70  assert(tuple_index < getNumberOfTuples());
71  return this->operator[](tuple_index* getNumberOfComponents() +
72  component);
73  }
std::size_t getNumberOfTuples() const

◆ 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* getNumberOfComponents() +
82  component);
83  }
std::size_t getNumberOfTuples() const

◆ getNumberOfTuples()

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

Definition at line 61 of file PropertyVector.h.

Referenced by MeshLib::ElementValueModification::replace(), and MeshLib::ElementSearch::searchByPropertyValueRange().

62  {
63  return std::vector<PROP_VAL_TYPE>::size() / _n_components;
64  }

◆ 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: