v0.8.16
Classes | Functions
User data operator

Users data structures and operator. More...

Collaboration diagram for User data operator:

Classes

struct  MoFEM::DataForcesAndSourcesCore::EntData
 Data on single entity (This is passed as argument to DataOperator::doWork) More...
 
struct  MoFEM::DataForcesAndSourcesCore
 data structure for finite element entityIt keeps that about indices of degrees of freedom, dofs data, base functions functions, entity side number, type of entities, approximation order, etc. More...
 
struct  MoFEM::DerivedDataForcesAndSourcesCore::DerivedEntData
 Derived ata on single entity (This is passed as argument to DataOperator::doWork) More...
 
struct  MoFEM::DerivedDataForcesAndSourcesCore
 this class derive data form other data structure More...
 
struct  MoFEM::OpCalculateScalarFieldValues_General< T, A >
 Calculate field values for tenor field rank 0, i.e. scalar field. More...
 
struct  MoFEM::OpCalculateScalarFieldValues
 Get value at integration points for scalar field. More...
 
struct  MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, T, L, A >
 Calculate field values for tenor field rank 1, i.e. vector field. More...
 
struct  MoFEM::OpCalculateVectorFieldValues< Tensor_Dim >
 Get values at integration pts for tensor filed rank 1, i.e. vector field. More...
 
struct  MoFEM::OpCalculateTensor2FieldValues_General< Tensor_Dim0, Tensor_Dim1, T, L, A >
 Calculate field values for tenor field rank 2. More...
 
struct  MoFEM::OpCalculateTensor2FieldValues< Tensor_Dim0, Tensor_Dim1 >
 Get values at integration pts for tensor filed rank 2, i.e. matrix field. More...
 
struct  MoFEM::OpCalculateScalarFieldGradient_General< Tensor_Dim, T, L, A >
 Evaluate field gradient values for scalar field, i.e. gradient is tensor rank 1 (vector) More...
 
struct  MoFEM::OpCalculateScalarFieldGradient< Tensor_Dim >
 Get field gradients at integration pts for scalar filed rank 0, i.e. vector field. More...
 
struct  MoFEM::OpCalculateVectorFieldGradient_General< Tensor_Dim0, Tensor_Dim1, T, L, A >
 Evaluate field gradient values for vector field, i.e. gradient is tensor rank 2. More...
 
struct  MoFEM::OpCalculateVectorFieldGradient< Tensor_Dim0, Tensor_Dim1 >
 Get field gradients at integration pts for scalar filed rank 0, i.e. vector field. More...
 
struct  MoFEM::OpCalculateHdivVectorField_General< Tensor_Dim0, T, L, A >
 Get vector field for H-div approximation. More...
 
struct  MoFEM::OpCalculateHdivVectorField_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >
 Get vector field for H-div approximation. More...
 
struct  MoFEM::OpCalculateHdivVectorField< Tensor_Dim >
 Get vector field for H-div approximation. More...
 
struct  MoFEM::OpCalculateHVecTensorField< Tensor_Dim0, Tensor_Dim1 >
 Calculate tenor field using vectorial base, i.e. Hdiv/Hcurl. More...
 
struct  MoFEM::OpCalculateHTensorTensorField< Tensor_Dim0, Tensor_Dim1 >
 Calculate tenor field using vectorial base, i.e. Hdiv/Hcurl. More...
 
struct  MoFEM::OpCalculateHVecTensorDivergence< Tensor_Dim0, Tensor_Dim1 >
 Calculate divergence of tonsorial field using vectorial base. More...
 

Functions

template<class T , class A >
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > MoFEM::getFTensor0FromVec (ublas::vector< T, A > &data)
 Get tensor rank 0 (scalar) form data vectorExample how to use it. More...
 
template<int Tensor_Dim, class T , class L , class A >
FTensor::Tensor1< FTensor::PackPtr< T *, 1 >, Tensor_Dim > MoFEM::getFTensor1FromMat (ublas::matrix< T, L, A > &data)
 Get tensor rank 1 (vector) form data matrix. More...
 
template<int Tensor_Dim>
FTensor::Tensor1< FTensor::PackPtr< double *, 1 >, Tensor_Dim > MoFEM::getFTensor1FromMat (MatrixDouble &data)
 Get tensor rank 1 (vector) form data matrix (specialization) More...
 
template<int Tensor_Dim0, int Tensor_Dim1, class T , class L , class A >
FTensor::Tensor2< FTensor::PackPtr< T *, 1 >, Tensor_Dim0, Tensor_Dim1 > MoFEM::getFTensor2FromMat (ublas::matrix< T, L, A > &data)
 Get tensor rank 2 (matrix) form data matrix. More...
 
template<>
FTensor::Tensor2< FTensor::PackPtr< double *, 1 >, 3, 3 > MoFEM::getFTensor2FromMat (MatrixDouble &data)
 Get tensor rank 2 (matrix) form data matrix (specialization) More...
 
template<int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< FTensor::PackPtr< double *, 1 >, Tensor_Dim0, Tensor_Dim1 > MoFEM::getFTensor2FromMat (MatrixDouble &data)
 Get tensor rank 2 (matrix) form data matrix (specialization) More...
 
template<int Tensor_Dim, class T , class L , class A >
FTensor::Tensor2_symmetric< FTensor::PackPtr< T *, 1 >, Tensor_Dim > MoFEM::getFTensor2SymmetricFromMat (ublas::matrix< T, L, A > &data)
 Get symmetric tensor rank 2 (matrix) form data matrix. More...
 
MoFEMErrorCode MoFEM::OpCalculateScalarFieldValues_General< T, A >::doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 calculate values of scalar field at integration points More...
 
MoFEMErrorCode MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >::doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 Member function specialization calculating values for tenor field rank 1. More...
 
MoFEMErrorCode MoFEM::OpCalculateScalarFieldGradient_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >::doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 calculate gradient values of scalar field at integration points More...
 
MoFEMErrorCode MoFEM::OpCalculateVectorFieldGradient_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >::doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 calculate values of vector field at integration points More...
 

Detailed Description

Users data structures and operator.

Classes and functions used to evaluate fields at integration pts, jacobians, etc..

data structures

Data structures passed by argument to MoFEM::DataOperator::doWork and generic user operators operating on those structures.

Function Documentation

◆ doWork() [1/4]

template<class T , class A >
MoFEMErrorCode MoFEM::OpCalculateScalarFieldValues_General< T, A >::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)
virtual

calculate values of scalar field at integration points

Specialization of member function.

Parameters
sideside entity number
typeside entity type
dataentity data
Returns
error code

Reimplemented from MoFEM::DataOperator.

Definition at line 66 of file UserDataOperators.hpp.

67  {
69  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "Not implemented for T = %s",
70  typeid(T).name() // boost::core::demangle(typeid(T).name()).c_str()
71  );
73 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ doWork() [2/4]

template<int Tensor_Dim>
MoFEMErrorCode MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)
virtual

Member function specialization calculating values for tenor field rank 1.

Reimplemented from MoFEM::DataOperator.

Reimplemented in MoFEM::OpCalculateScalarFieldGradient_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >.

Definition at line 213 of file UserDataOperators.hpp.

214  {
216  const int nb_dofs = data.getFieldData().size();
217  if (!nb_dofs && type == this->zeroType) {
218  dataPtr->resize(Tensor_Dim, 0, false);
220  }
221  if (!nb_dofs) {
223  }
224  const int nb_gauss_pts = data.getN().size1();
225  const int nb_base_functions = data.getN().size2();
226  MatrixDouble &mat = *dataPtr;
227  if (type == zeroType) {
228  mat.resize(Tensor_Dim, nb_gauss_pts, false);
229  mat.clear();
230  }
231  auto base_function = data.getFTensor0N();
232  auto values_at_gauss_pts = getFTensor1FromMat<Tensor_Dim>(mat);
234  const int size = nb_dofs / Tensor_Dim;
235  if (nb_dofs % Tensor_Dim) {
236  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Data inconsistency");
237  }
238  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
239  auto field_data = data.getFTensor1FieldData<Tensor_Dim>();
240  int bb = 0;
241  for (; bb != size; ++bb) {
242  values_at_gauss_pts(I) += field_data(I) * base_function;
243  ++field_data;
244  ++base_function;
245  }
246  // Number of dofs can be smaller than number of Tensor_Dim x base functions
247  for (; bb != nb_base_functions; ++bb)
248  ++base_function;
249  ++values_at_gauss_pts;
250  }
252 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Common.hpp:212
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ doWork() [3/4]

template<int Tensor_Dim>
MoFEMErrorCode MoFEM::OpCalculateScalarFieldGradient_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)
virtual

calculate gradient values of scalar field at integration points

Member function specialization calculating scalar field gradients for tenor field rank 1.

Parameters
sideside entity number
typeside entity type
dataentity data
Returns
error code

Reimplemented from MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >.

Definition at line 500 of file UserDataOperators.hpp.

501  {
503  const int nb_dofs = data.getFieldData().size();
504  if (!this->dataPtr) {
505  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
506  "Data pointer not allocated");
507  }
508  if (!nb_dofs && type == this->zeroType) {
509  this->dataPtr->resize(Tensor_Dim, 0, false);
511  }
512  if (!nb_dofs) {
514  }
515  const int nb_gauss_pts = data.getN().size1();
516  const int nb_base_functions = data.getN().size2();
517  ublas::matrix<double, ublas::row_major, DoubleAllocator> &mat =
518  *this->dataPtr;
519  if (type == this->zeroType) {
520  mat.resize(Tensor_Dim, nb_gauss_pts, false);
521  mat.clear();
522  }
523  auto diff_base_function = data.getFTensor1DiffN<Tensor_Dim>();
524  auto gradients_at_gauss_pts = getFTensor1FromMat<Tensor_Dim>(mat);
526  for (int gg = 0; gg < nb_gauss_pts; ++gg) {
527  auto field_data = data.getFTensor0FieldData();
528  int bb = 0;
529  for (; bb < nb_dofs; ++bb) {
530  gradients_at_gauss_pts(I) += field_data * diff_base_function(I);
531  ++field_data;
532  ++diff_base_function;
533  }
534  // Number of dofs can be smaller than number of base functions
535  for (; bb != nb_base_functions; ++bb)
536  ++diff_base_function;
537  ++gradients_at_gauss_pts;
538  }
540 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ doWork() [4/4]

template<int Tensor_Dim0, int Tensor_Dim1>
MoFEMErrorCode MoFEM::OpCalculateVectorFieldGradient_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)
virtual

calculate values of vector field at integration points

Member function specialization calculating vector field gradients for tenor field rank 2.

Parameters
sideside entity number
typeside entity type
dataentity data
Returns
error code

Reimplemented from MoFEM::OpCalculateTensor2FieldValues_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >.

Definition at line 608 of file UserDataOperators.hpp.

609  {
611  const int nb_dofs = data.getFieldData().size();
612  if (!nb_dofs && type == this->zeroType) {
613  this->dataPtr->resize(Tensor_Dim0 * Tensor_Dim1, 0, false);
615  }
616  if (!nb_dofs) {
618  }
619  const int nb_gauss_pts = data.getN().size1();
620  const int nb_base_functions = data.getN().size2();
621  ublas::matrix<double, ublas::row_major, DoubleAllocator> &mat =
622  *this->dataPtr;
623  if (type == this->zeroType) {
624  mat.resize(Tensor_Dim0 * Tensor_Dim1, nb_gauss_pts, false);
625  mat.clear();
626  }
627  auto diff_base_function = data.getFTensor1DiffN<Tensor_Dim1>();
628  auto gradients_at_gauss_pts =
629  getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(mat);
632  int size = nb_dofs / Tensor_Dim0;
633  if (nb_dofs % Tensor_Dim0) {
634  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Data inconsistency");
635  }
636  for (int gg = 0; gg < nb_gauss_pts; ++gg) {
637  auto field_data = data.getFTensor1FieldData<Tensor_Dim0>();
638  int bb = 0;
639  for (; bb < size; ++bb) {
640  gradients_at_gauss_pts(I, J) += field_data(I) * diff_base_function(J);
641  ++field_data;
642  ++diff_base_function;
643  }
644  // Number of dofs can be smaller than number of Tensor_Dim0 x base functions
645  for (; bb != nb_base_functions; ++bb)
646  ++diff_base_function;
647  ++gradients_at_gauss_pts;
648  }
650 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getFTensor0FromVec()

template<class T , class A >
FTensor::Tensor0<FTensor::PackPtr<double *, 1> > MoFEM::getFTensor0FromVec ( ublas::vector< T, A > &  data)

Get tensor rank 0 (scalar) form data vectorExample how to use it.

vec.resize(nb_gauss_pts,false);
vec.clear();
auto t0 = getFTensor0FromData(data);
for(int gg = 0;gg!=nb_gauss_pts;gg++) {
++t0;
}
Examples:
HookeElement.cpp, PoissonOperators.hpp, and UnsaturatedFlow.hpp.

Definition at line 55 of file DataStructures.hpp.

55  {
56  static_assert(1, "not implemented");
57 }

◆ getFTensor1FromMat() [1/2]

template<int Tensor_Dim, class T , class L , class A >
FTensor::Tensor1<FTensor::PackPtr<T *, 1>, Tensor_Dim> MoFEM::getFTensor1FromMat ( ublas::matrix< T, L, A > &  data)

Get tensor rank 1 (vector) form data matrix.

Definition at line 79 of file DataStructures.hpp.

79  {
80  static_assert(1, "not implemented");
81 }

◆ getFTensor1FromMat() [2/2]

template<int Tensor_Dim>
FTensor::Tensor1<FTensor::PackPtr<double *, 1>, Tensor_Dim> MoFEM::getFTensor1FromMat ( MatrixDouble data)

Get tensor rank 1 (vector) form data matrix (specialization)

Definition at line 89 of file DataStructures.hpp.

89  {
90  return getFTensor1FromMat<Tensor_Dim, double, ublas::row_major,
91  DoubleAllocator>(data);
92 }
FTensor::Tensor1< FTensor::PackPtr< double *, 1 >, Tensor_Dim > getFTensor1FromMat(MatrixDouble &data)
Get tensor rank 1 (vector) form data matrix (specialization)
std::vector< double, std::allocator< double > > DoubleAllocator
Definition: Common.hpp:207

◆ getFTensor2FromMat() [1/3]

template<int Tensor_Dim0, int Tensor_Dim1, class T , class L , class A >
FTensor::Tensor2<FTensor::PackPtr<T *, 1>, Tensor_Dim0, Tensor_Dim1> MoFEM::getFTensor2FromMat ( ublas::matrix< T, L, A > &  data)

Get tensor rank 2 (matrix) form data matrix.

Definition at line 119 of file DataStructures.hpp.

119  {
120  static_assert(1, "not implemented");
121 }

◆ getFTensor2FromMat() [2/3]

template<>
FTensor::Tensor2<FTensor::PackPtr<double *, 1>, 3, 3> MoFEM::getFTensor2FromMat ( MatrixDouble data)

Get tensor rank 2 (matrix) form data matrix (specialization)

Template specialization for getFTensor2FromMat

Definition at line 145 of file DataStructures.hpp.

145  {
146  return getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1, double, ublas::row_major,
147  DoubleAllocator>(data);
148 }
FTensor::Tensor2< FTensor::PackPtr< double *, 1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2FromMat(MatrixDouble &data)
Get tensor rank 2 (matrix) form data matrix (specialization)
std::vector< double, std::allocator< double > > DoubleAllocator
Definition: Common.hpp:207

◆ getFTensor2FromMat() [3/3]

template<int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2<FTensor::PackPtr<double *, 1>, Tensor_Dim0, Tensor_Dim1> MoFEM::getFTensor2FromMat ( MatrixDouble data)

Get tensor rank 2 (matrix) form data matrix (specialization)

Template specialization for getFTensor2FromMat

Definition at line 145 of file DataStructures.hpp.

145  {
146  return getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1, double, ublas::row_major,
147  DoubleAllocator>(data);
148 }
FTensor::Tensor2< FTensor::PackPtr< double *, 1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2FromMat(MatrixDouble &data)
Get tensor rank 2 (matrix) form data matrix (specialization)
std::vector< double, std::allocator< double > > DoubleAllocator
Definition: Common.hpp:207

◆ getFTensor2SymmetricFromMat()

template<int Tensor_Dim, class T , class L , class A >
FTensor::Tensor2_symmetric<FTensor::PackPtr<T *, 1>, Tensor_Dim> MoFEM::getFTensor2SymmetricFromMat ( ublas::matrix< T, L, A > &  data)

Get symmetric tensor rank 2 (matrix) form data matrix.

Definition at line 165 of file DataStructures.hpp.

165  {
166  static_assert(1, "not implemented");
167 }