OGS
MeshLib::PropertyVector< PROP_VAL_TYPE > Class Template Reference

Detailed Description

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

Contiguous storage for the values of one named mesh property. Values are laid out tuple-contiguous: the component of a tuple is at tuple_index * n_components + component, so the components of one tuple are adjacent in memory. Instances are created and owned by Properties.

Template Parameters
PROP_VAL_TYPEtypically a scalar, a vector or a matrix

Definition at line 65 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 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

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

193 {
194 }
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 203 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 123 of file PropertyVector.h.

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

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

120 {
121 return data_.data() + data_.size();
122 }

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

180{ 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 95 of file PropertyVector.h.

97 {
101 return cloned_pv;
102 }
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:36

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

113{ 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

Definition at line 181 of file PropertyVector.h.

181{ return data_.empty(); }

References data_.

Referenced by MeshToolsLib::MeshInformation::getValueBounds(), and MeshLib::nextUnusedMaterialId().

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

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

127 {
129 {
130 static_assert(false,
131 "PropertyVector<bool>::operator[] cannot be "
132 "instantiated for booleans.");
133 }
134 else
135 {
136 return data_[pos];
137 }
138 }

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

140 {
142 {
143 static_assert(false,
144 "PropertyVector<bool>::operator[] cannot be "
145 "instantiated for booleans.");
146 }
147 else
148 {
149 return data_[pos];
150 }
151 }

References data_.

◆ resize() [1/2]

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

155 {
156 data_.resize(size, value);
157 }

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

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

References data_.

◆ Properties

template<typename PROP_VAL_TYPE>
friend class Properties
friend

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