v0.16.3
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
MoFEM::GetFTensor2SymmetricFromMatImpl< Tensor_Dim, S, DataLayoutTraits< DataLayout::GaussByCoeffs >, M > Struct Template Reference

#include "include/Templates.hpp"

Static Public Member Functions

static auto get (M &data, int rr=0, int cc=0)
 

Detailed Description

template<int Tensor_Dim, int S, class M>
struct MoFEM::GetFTensor2SymmetricFromMatImpl< Tensor_Dim, S, DataLayoutTraits< DataLayout::GaussByCoeffs >, M >

Definition at line 746 of file Templates.hpp.

Member Function Documentation

◆ get()

template<int Tensor_Dim, int S, class M >
static auto MoFEM::GetFTensor2SymmetricFromMatImpl< Tensor_Dim, S, DataLayoutTraits< DataLayout::GaussByCoeffs >, M >::get ( M &  data,
int  rr = 0,
int  cc = 0 
)
inlinestatic

Definition at line 748 of file Templates.hpp.

748 {
749 // Preserve const matrix elements in the non-owning tensor view.
750 using T = std::remove_reference_t<decltype(data(0, 0))>;
751 constexpr int symm_size = (Tensor_Dim * (Tensor_Dim + 1)) / 2;
752 constexpr int stride = S == -1 ? symm_size : S;
753 static_assert(stride % symm_size == 0,
754 "getFTensor2SymmetricFromMat: stride should be a multiple of "
755 "symm_size");
756
757#ifndef NDEBUG
758 if (data.size2() != symm_size)
760 "getFTensor2SymmetricFromMat<" +
761 boost::lexical_cast<std::string>(Tensor_Dim) +
762 ">: wrong size of data matrix, number of columns should be " +
763 boost::lexical_cast<std::string>(symm_size) + " but is " +
764 boost::lexical_cast<std::string>(data.size2()));
765 auto *first = &data(rr + 0, cc + 0);
766 auto *last = &data(rr + 0, cc + 0 + symm_size - 1);
767 if (last - first != symm_size - 1)
768 THROW_MESSAGE("getFTensor2SymmetricFromMat<" +
769 boost::lexical_cast<std::string>(Tensor_Dim) +
770 ">: row slice is not contiguous");
771#endif
773 Tensor_Dim>(&data(rr + 0, cc + 0));
774 }
#define THROW_MESSAGE(msg)
Throw MoFEM exception.

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