Loading [MathJax]/extensions/tex2jax.js
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 57 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 62 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 177 of file PropertyVector.h.

181 {
182 }
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 191 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 115 of file PropertyVector.h.

115{ 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 110 of file PropertyVector.h.

110{ 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 111 of file PropertyVector.h.

112 {
113 return data_.data() + data_.size();
114 }

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

168{ 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 87 of file PropertyVector.h.

89 {
93 return cloned_pv;
94 }
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:42

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

105{ 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 116 of file PropertyVector.h.

116{ 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 79 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 118 of file PropertyVector.h.

119 {
121 {
123 "PropertyVector<bool>::operator[] cannot be "
124 "instantiated for booleans.");
125 }
126 else
127 {
128 return data_[pos];
129 }
130 }

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

132 {
133 return data_[pos];
134 }

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

138 {
139 data_.resize(size, value);
140 }

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

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

References data_.

◆ Properties

template<typename PROP_VAL_TYPE>
friend class Properties
friend

Definition at line 59 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: