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 51 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 Types

using value_type = PROP_VAL_TYPE

Public Member Functions

constexpr 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.
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.
PropertyVectorBaseclone (std::vector< std::size_t > const &exclude_positions) const override
constexpr std::size_t size () const
constexpr std::ptrdiff_t ssize () const
constexpr const PROP_VAL_TYPE * data () const
constexpr PROP_VAL_TYPE * data ()
constexpr PROP_VAL_TYPE * begin ()
constexpr PROP_VAL_TYPE * end ()
constexpr const PROP_VAL_TYPE * cbegin () const
constexpr const PROP_VAL_TYPE * cend () const
constexpr const PROP_VAL_TYPE * begin () const
constexpr const PROP_VAL_TYPE * end () const
constexpr PROP_VAL_TYPE & operator[] (std::size_t const pos)
constexpr PROP_VAL_TYPE const & operator[] (std::size_t const pos) const
constexpr void resize (std::size_t const size)
constexpr void resize (std::size_t const size, const PROP_VAL_TYPE &value)
template<typename R>
requires std::ranges::input_range<R> && std::convertible_to<std::ranges::range_value_t<R>, PROP_VAL_TYPE>
constexpr void assign (R &&r)
constexpr void push_back (const PROP_VAL_TYPE &value)
constexpr void clear ()
constexpr bool empty () 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.
 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.
Protected Member Functions inherited from MeshLib::PropertyVectorBase
 PropertyVectorBase (std::string property_name, MeshItemType mesh_item_type, std::size_t n_components)

Private Attributes

std::vector< PROP_VAL_TYPE > data_

Friends

class Properties

Additional Inherited Members

Public Attributes inherited from MeshLib::PropertyVectorBase
bool is_for_output = true
Protected Attributes inherited from MeshLib::PropertyVectorBase
int const _n_components
MeshItemType const _mesh_item_type
std::string const _property_name

Member Typedef Documentation

◆ value_type

template<typename PROP_VAL_TYPE>
using MeshLib::PropertyVector< PROP_VAL_TYPE >::value_type = PROP_VAL_TYPE

Definition at line 56 of file PropertyVector.h.

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

175 {
176 }
PropertyVectorBase(std::string property_name, MeshItemType mesh_item_type, std::size_t n_components)

References MeshLib::PropertyVectorBase::PropertyVectorBase().

Referenced by clone().

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

References MeshLib::PropertyVectorBase::PropertyVectorBase(), and data_.

Member Function Documentation

◆ assign()

template<typename PROP_VAL_TYPE>
template<typename R>
requires std::ranges::input_range<R> && std::convertible_to<std::ranges::range_value_t<R>, PROP_VAL_TYPE>
void MeshLib::PropertyVector< PROP_VAL_TYPE >::assign ( R && r)
inlineconstexpr

◆ begin() [1/2]

◆ begin() [2/2]

template<typename PROP_VAL_TYPE>
const PROP_VAL_TYPE * MeshLib::PropertyVector< PROP_VAL_TYPE >::begin ( ) const
inlineconstexpr

Definition at line 109 of file PropertyVector.h.

109{ return cbegin(); }
constexpr const PROP_VAL_TYPE * cbegin() const

References cbegin().

◆ cbegin()

template<typename PROP_VAL_TYPE>
const PROP_VAL_TYPE * MeshLib::PropertyVector< PROP_VAL_TYPE >::cbegin ( ) const
inlineconstexpr

Definition at line 104 of file PropertyVector.h.

104{ return data_.data(); }

References data_.

Referenced by begin(), main(), and MeshElementRemovalDialog::setRangeValues().

◆ cend()

template<typename PROP_VAL_TYPE>
const PROP_VAL_TYPE * MeshLib::PropertyVector< PROP_VAL_TYPE >::cend ( ) const
inlineconstexpr

Definition at line 105 of file PropertyVector.h.

106 {
107 return data_.data() + data_.size();
108 }

References data_.

Referenced by end(), main(), and MeshElementRemovalDialog::setRangeValues().

◆ clear()

template<typename PROP_VAL_TYPE>
void MeshLib::PropertyVector< PROP_VAL_TYPE >::clear ( )
inlineconstexpr

Definition at line 162 of file PropertyVector.h.

162{ data_.clear(); }

References data_.

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

83 {
87 return cloned_pv;
88 }
MeshItemType const _mesh_item_type
std::string const _property_name
PropertyVector(std::string const &property_name, MeshItemType mesh_item_type, std::size_t n_components)
The constructor taking meta information for the data.
std::vector< T > excludeObjectCopy(std::vector< T > const &src_vec, std::vector< std::size_t > const &exclude_positions)
Definition Algorithm.h:35

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

◆ data() [1/2]

template<typename PROP_VAL_TYPE>
PROP_VAL_TYPE * MeshLib::PropertyVector< PROP_VAL_TYPE >::data ( )
inlineconstexpr

Definition at line 99 of file PropertyVector.h.

99{ return data_.data(); }

References data_.

◆ data() [2/2]

template<typename PROP_VAL_TYPE>
const PROP_VAL_TYPE * MeshLib::PropertyVector< PROP_VAL_TYPE >::data ( ) const
inlineconstexpr

◆ empty()

template<typename PROP_VAL_TYPE>
bool MeshLib::PropertyVector< PROP_VAL_TYPE >::empty ( ) const
inlineconstexpr

◆ end() [1/2]

◆ end() [2/2]

template<typename PROP_VAL_TYPE>
const PROP_VAL_TYPE * MeshLib::PropertyVector< PROP_VAL_TYPE >::end ( ) const
inlineconstexpr

Definition at line 110 of file PropertyVector.h.

110{ return cend(); }
constexpr const PROP_VAL_TYPE * cend() const

References cend().

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

References MeshLib::PropertyVectorBase::_n_components, data_, MeshLib::PropertyVectorBase::getNumberOfGlobalComponents(), and getNumberOfTuples().

◆ getNumberOfTuples()

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

◆ operator[]() [1/2]

template<typename PROP_VAL_TYPE>
PROP_VAL_TYPE & MeshLib::PropertyVector< PROP_VAL_TYPE >::operator[] ( std::size_t const pos)
inlineconstexpr

Definition at line 112 of file PropertyVector.h.

113 {
115 {
117 "PropertyVector<bool>::operator[] cannot be "
118 "instantiated for booleans.");
119 }
120 else
121 {
122 return data_[pos];
123 }
124 }

References data_.

◆ operator[]() [2/2]

template<typename PROP_VAL_TYPE>
PROP_VAL_TYPE const & MeshLib::PropertyVector< PROP_VAL_TYPE >::operator[] ( std::size_t const pos) const
inlineconstexpr

Definition at line 125 of file PropertyVector.h.

126 {
127 return data_[pos];
128 }

References data_.

◆ push_back()

template<typename PROP_VAL_TYPE>
void MeshLib::PropertyVector< PROP_VAL_TYPE >::push_back ( const PROP_VAL_TYPE & value)
inlineconstexpr

◆ resize() [1/2]

template<typename PROP_VAL_TYPE>
void MeshLib::PropertyVector< PROP_VAL_TYPE >::resize ( std::size_t const size)
inlineconstexpr

◆ resize() [2/2]

template<typename PROP_VAL_TYPE>
void MeshLib::PropertyVector< PROP_VAL_TYPE >::resize ( std::size_t const size,
const PROP_VAL_TYPE & value )
inlineconstexpr

Definition at line 131 of file PropertyVector.h.

132 {
133 data_.resize(size, value);
134 }

References data_, and size().

◆ size()

◆ ssize()

template<typename PROP_VAL_TYPE>
std::ptrdiff_t MeshLib::PropertyVector< PROP_VAL_TYPE >::ssize ( ) const
inlineconstexpr

Definition at line 94 of file PropertyVector.h.

94{ return std::ssize(data_); }

References data_.

◆ Properties

template<typename PROP_VAL_TYPE>
friend class Properties
friend

Definition at line 53 of file PropertyVector.h.

References Properties.

Referenced by Properties.

Member Data Documentation

◆ data_

template<typename PROP_VAL_TYPE>
std::vector<PROP_VAL_TYPE> MeshLib::PropertyVector< PROP_VAL_TYPE >::data_
private

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