OGS
MaterialLib::Solids::MFront::detail::SetGradient< DisplacementDim > Struct Template Reference

Detailed Description

template<int DisplacementDim>
struct MaterialLib::Solids::MFront::detail::SetGradient< DisplacementDim >

A helper struct filling MFront's gradient data (or thermodynamic forces) with values taken from a MaterialPropertyLib::VariableArray.

Definition at line 181 of file MFrontGeneric.h.

#include <MFrontGeneric.h>

Collaboration diagram for MaterialLib::Solids::MFront::detail::SetGradient< DisplacementDim >:
[legend]

Public Member Functions

template<typename Grad >
void operator() (Grad)
 

Public Attributes

MaterialPropertyLib::VariableArray const & variable_array
 
std::optional< MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > > const & Q
 
double * target
 

Member Function Documentation

◆ operator()()

template<int DisplacementDim>
template<typename Grad >
void MaterialLib::Solids::MFront::detail::SetGradient< DisplacementDim >::operator() ( Grad )
inline

Definition at line 189 of file MFrontGeneric.h.

190 {
191 auto constexpr num_comp = Grad::template size<DisplacementDim>();
192
193 if constexpr (Grad::type == mgis::behaviour::Variable::Type::SCALAR)
194 {
195 *target = variable_array.*Grad::mpl_var;
196 }
197 else if constexpr (Grad::type ==
198 mgis::behaviour::Variable::Type::STENSOR)
199 {
201 auto const& grad_ogs =
202 std::get<MPLType>(variable_array.*Grad::mpl_var);
203
204 auto const grad_mfront =
205 Q ? eigenSwap45View(Q->transpose() * grad_ogs).eval()
206 : eigenSwap45View(grad_ogs).eval();
207 std::copy_n(grad_mfront.data(), num_comp, target);
208 }
209 else if constexpr (Grad::type ==
210 mgis::behaviour::Variable::Type::TENSOR)
211 {
213 auto const& grad_ogs =
214 std::get<MPLType>(variable_array.*Grad::mpl_var);
215
216 if (Q.has_value())
217 {
218 OGS_FATAL("Rotations of tensors are not implemented.");
219 }
220
221 Eigen::Map<Eigen::Vector<double, num_comp>>{target} =
223 }
224 else
225 {
226 OGS_FATAL("Unsupported gradient type {}.",
227 varTypeToString(Grad::type));
228 }
229
230 target += num_comp;
231 }
#define OGS_FATAL(...)
Definition Error.h:26
typename MapToMPLType< DisplacementDim, MFrontType >::type MapToMPLType_t
constexpr auto ogsTensorToMFrontTensor(Eigen::MatrixBase< Derived > const &matrix)
constexpr auto eigenSwap45View(Eigen::MatrixBase< Derived > const &matrix)
const char * varTypeToString(int v)
std::optional< MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > > const & Q
MaterialPropertyLib::VariableArray const & variable_array

References MaterialLib::Solids::MFront::eigenSwap45View(), OGS_FATAL, and MaterialLib::Solids::MFront::varTypeToString().

Member Data Documentation

◆ Q

template<int DisplacementDim>
std::optional< MathLib::KelvinVector::KelvinMatrixType<DisplacementDim> > const& MaterialLib::Solids::MFront::detail::SetGradient< DisplacementDim >::Q

Definition at line 185 of file MFrontGeneric.h.

◆ target

template<int DisplacementDim>
double* MaterialLib::Solids::MFront::detail::SetGradient< DisplacementDim >::target

Definition at line 186 of file MFrontGeneric.h.

◆ variable_array

template<int DisplacementDim>
MaterialPropertyLib::VariableArray const& MaterialLib::Solids::MFront::detail::SetGradient< DisplacementDim >::variable_array

Definition at line 183 of file MFrontGeneric.h.


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