v0.16.3
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
MoFEM::GetFTensor1FromMatImpl< 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, int cc)
 

Detailed Description

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

Definition at line 235 of file Templates.hpp.

Member Function Documentation

◆ get()

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

Definition at line 237 of file Templates.hpp.

237 {
238 // Preserve const matrix elements in the non-owning tensor view.
239 using T = std::remove_reference_t<decltype(data(0, 0))>;
240 constexpr int stride = S == -1 ? Tensor_Dim : S;
241 static_assert(
242 stride % Tensor_Dim == 0,
243 "getFTensor1FromMat: stride should be a multiple of Tensor_Dim");
244
245#ifndef NDEBUG
246 if (data.size2() != Tensor_Dim)
248 "getFTensor1FromMat<" + boost::lexical_cast<std::string>(Tensor_Dim) +
249 ">: wrong size of data matrix, number of columns should be " +
250 boost::lexical_cast<std::string>(Tensor_Dim) + " but is " +
251 boost::lexical_cast<std::string>(data.size2()));
252 auto *first = &data(rr + 0, cc + 0);
253 auto *last = &data(rr + 0, cc + 0 + Tensor_Dim - 1);
254 if (last - first != Tensor_Dim - 1)
255 THROW_MESSAGE("getFTensor1FromMat<" +
256 boost::lexical_cast<std::string>(Tensor_Dim) +
257 ">: row slice is not contiguous");
258
259#endif
261 &data(rr + 0, cc + 0));
262 }
#define THROW_MESSAGE(msg)
Throw MoFEM exception.

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