OGS
MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces > Class Template Reference

Detailed Description

template<int DisplacementDim, typename TDynForces>
class MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces >

Provides convenient access to the individual blocks of MFront's thermodynamic forces data.

Template Parameters
DisplacementDimthe displacement dimension
TDynForcesa list (of types) of thermodynamic forces

"Thermodynamic forces" is MFront nomenclature for the data an MFront behaviour computes.

TDynForces is a list of types. Each is expected to behave like Strain and the other classes in Variable.h.

MFront's thermodynamic forces are stored in a single vector of double values. The data of forces that come earlier in TDynForces are stored earlier in MFront's data.

Definition at line 35 of file ThermodynamicForcesView.h.

#include <ThermodynamicForcesView.h>

Classes

struct  SizeOf
 A template metafunction accessing the size of the given Variable. More...

Public Member Functions

template<typename Force>
auto block (Force force, OGSMFrontThermodynamicForcesData const &data) const
 Read-only access to the data for the given thermodynamic force Force.
template<typename Force>
auto block (Force, std::vector< double > const &data) const
 Overload taking a std::vector.
template<typename Force, std::enable_if_t< SizeOf< Force >::value==1, bool > = true>
double & block (Force force, OGSMFrontThermodynamicForcesData &data) const
template<typename Force, std::enable_if_t< SizeOf< Force >::value==1, bool > = true>
double & block (Force, std::vector< double > &data) const
 Overload taking a std::vector.
template<typename Force, std::enable_if_t< SizeOf< Force >::value !=1, bool > = true>
auto block (Force force, OGSMFrontThermodynamicForcesData &data) const
template<typename Force, std::enable_if_t< SizeOf< Force >::value !=1, bool > = true>
auto block (Force, std::vector< double > &data) const
 Overload taking a std::vector.

Static Public Attributes

static constexpr std::size_t data_size_all_forces
 The passed data to the block() methods must have this size.

Static Private Member Functions

template<typename Force>
static constexpr std::size_t dataOffset ()
template<typename Force, typename DataVector>
static constexpr auto asEigenMap (DataVector &data)
 Access a block of the given data as an Eigen::Map.
template<typename Force, typename DataVector>
static constexpr auto & asDouble (DataVector &data)
 Access a block of the given data as a double value.

Member Function Documentation

◆ asDouble()

template<int DisplacementDim, typename TDynForces>
template<typename Force, typename DataVector>
constexpr auto & MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces >::asDouble ( DataVector & data)
inlinestaticconstexprprivate

Access a block of the given data as a double value.

Definition at line 90 of file ThermodynamicForcesView.h.

91 {
92 static_assert(Force::template size<DisplacementDim>() == 1,
93 "Use asEigenMap for the multi component case.");
94
96
98
99 return data[data_offset];
100 }
static constexpr std::size_t data_size_all_forces
The passed data to the block() methods must have this size.

References data_size_all_forces, and dataOffset().

Referenced by block(), and block().

◆ asEigenMap()

template<int DisplacementDim, typename TDynForces>
template<typename Force, typename DataVector>
constexpr auto MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces >::asEigenMap ( DataVector & data)
inlinestaticconstexprprivate

Access a block of the given data as an Eigen::Map.

Definition at line 67 of file ThermodynamicForcesView.h.

References data_size_all_forces, and dataOffset().

Referenced by block(), and block().

◆ block() [1/6]

template<int DisplacementDim, typename TDynForces>
template<typename Force, std::enable_if_t< SizeOf< Force >::value==1, bool > = true>
double & MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces >::block ( Force force,
OGSMFrontThermodynamicForcesData & data ) const
inline

Read-write access to the data for the given thermodynamic force Force.

This overload is chosen if Force has one component.

Definition at line 133 of file ThermodynamicForcesView.h.

134 {
135 return block(force, data.data);
136 }
auto block(Force force, OGSMFrontThermodynamicForcesData const &data) const
Read-only access to the data for the given thermodynamic force Force.

References block(), and MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesData::data.

◆ block() [2/6]

template<int DisplacementDim, typename TDynForces>
template<typename Force, std::enable_if_t< SizeOf< Force >::value !=1, bool > = true>
auto MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces >::block ( Force force,
OGSMFrontThermodynamicForcesData & data ) const
inline

Read-write access to the data for the given thermodynamic force Force.

This overload is chosen if Force has more than one component.

Definition at line 152 of file ThermodynamicForcesView.h.

153 {
154 return block(force, data.data);
155 }

References block(), and MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesData::data.

◆ block() [3/6]

template<int DisplacementDim, typename TDynForces>
template<typename Force>
auto MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces >::block ( Force force,
OGSMFrontThermodynamicForcesData const & data ) const
inline

Read-only access to the data for the given thermodynamic force Force.

Definition at line 105 of file ThermodynamicForcesView.h.

106 {
107 return block(force, data.data);
108 }

References block(), and MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesData::data.

Referenced by block(), and block().

◆ block() [4/6]

template<int DisplacementDim, typename TDynForces>
template<typename Force, std::enable_if_t< SizeOf< Force >::value==1, bool > = true>
double & MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces >::block ( Force ,
std::vector< double > & data ) const
inline

Overload taking a std::vector.

Definition at line 141 of file ThermodynamicForcesView.h.

142 {
143 return asDouble<Force>(data);
144 }
static constexpr auto & asDouble(DataVector &data)
Access a block of the given data as a double value.

References asDouble().

◆ block() [5/6]

template<int DisplacementDim, typename TDynForces>
template<typename Force, std::enable_if_t< SizeOf< Force >::value !=1, bool > = true>
auto MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces >::block ( Force ,
std::vector< double > & data ) const
inline

Overload taking a std::vector.

Definition at line 160 of file ThermodynamicForcesView.h.

161 {
162 return asEigenMap<Force>(data);
163 }
static constexpr auto asEigenMap(DataVector &data)
Access a block of the given data as an Eigen::Map.

References asEigenMap().

◆ block() [6/6]

template<int DisplacementDim, typename TDynForces>
template<typename Force>
auto MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces >::block ( Force ,
std::vector< double > const & data ) const
inline

Overload taking a std::vector.

Definition at line 112 of file ThermodynamicForcesView.h.

113 {
114 constexpr std::size_t data_size =
116
117 if constexpr (data_size == 1)
118 {
119 return asDouble<Force>(data);
120 }
121 else
122 {
123 return asEigenMap<Force>(data);
124 }
125 }

References asDouble(), and asEigenMap().

◆ dataOffset()

template<int DisplacementDim, typename TDynForces>
template<typename Force>
constexpr std::size_t MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces >::dataOffset ( )
inlinestaticconstexprprivate

Computes the offset of the given Force's data in MFront's thermodynamic forces data.

Definition at line 50 of file ThermodynamicForcesView.h.

51 {
52 using namespace boost::mp11;
54 "The type Force is not in the list TDynForces.");
55
57
59
61
63 }

Referenced by asDouble(), and asEigenMap().

Member Data Documentation

◆ data_size_all_forces

template<int DisplacementDim, typename TDynForces>
std::size_t MaterialLib::Solids::MFront::OGSMFrontThermodynamicForcesView< DisplacementDim, TDynForces >::data_size_all_forces
staticconstexpr
Initial value:
= boost::mp11::mp_apply<
boost::mp11::mp_plus,
boost::mp11::mp_transform<SizeOf, TDynForces>>::value

The passed data to the block() methods must have this size.

Definition at line 166 of file ThermodynamicForcesView.h.

Referenced by asDouble(), and asEigenMap().


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