v0.8.19
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::OpCalculateTensor2FieldValuesDot< Tensor_Dim0, Tensor_Dim1 >
 Get time direvarive 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:475
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405

◆ 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:475
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:506
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:405

◆ 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 753 of file UserDataOperators.hpp.

754  {
756  const int nb_dofs = data.getFieldData().size();
757  if (!this->dataPtr) {
758  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
759  "Data pointer not allocated");
760  }
761  if (!nb_dofs && type == this->zeroType) {
762  this->dataPtr->resize(Tensor_Dim, 0, false);
764  }
765  if (!nb_dofs) {
767  }
768  const int nb_gauss_pts = data.getN().size1();
769  const int nb_base_functions = data.getN().size2();
770  ublas::matrix<double, ublas::row_major, DoubleAllocator> &mat =
771  *this->dataPtr;
772  if (type == this->zeroType) {
773  mat.resize(Tensor_Dim, nb_gauss_pts, false);
774  mat.clear();
775  }
776  auto diff_base_function = data.getFTensor1DiffN<Tensor_Dim>();
777  auto gradients_at_gauss_pts = getFTensor1FromMat<Tensor_Dim>(mat);
779  for (int gg = 0; gg < nb_gauss_pts; ++gg) {
780  auto field_data = data.getFTensor0FieldData();
781  int bb = 0;
782  for (; bb < nb_dofs; ++bb) {
783  gradients_at_gauss_pts(I) += field_data * diff_base_function(I);
784  ++field_data;
785  ++diff_base_function;
786  }
787  // Number of dofs can be smaller than number of base functions
788  for (; bb != nb_base_functions; ++bb)
789  ++diff_base_function;
790  ++gradients_at_gauss_pts;
791  }
793 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:506
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405

◆ 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 861 of file UserDataOperators.hpp.

862  {
864  const int nb_dofs = data.getFieldData().size();
865  if (!nb_dofs && type == this->zeroType) {
866  this->dataPtr->resize(Tensor_Dim0 * Tensor_Dim1, 0, false);
868  }
869  if (!nb_dofs) {
871  }
872  const int nb_gauss_pts = data.getN().size1();
873  const int nb_base_functions = data.getN().size2();
874  ublas::matrix<double, ublas::row_major, DoubleAllocator> &mat =
875  *this->dataPtr;
876  if (type == this->zeroType) {
877  mat.resize(Tensor_Dim0 * Tensor_Dim1, nb_gauss_pts, false);
878  mat.clear();
879  }
880  auto diff_base_function = data.getFTensor1DiffN<Tensor_Dim1>();
881  auto gradients_at_gauss_pts =
882  getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(mat);
885  int size = nb_dofs / Tensor_Dim0;
886  if (nb_dofs % Tensor_Dim0) {
887  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Data inconsistency");
888  }
889  for (int gg = 0; gg < nb_gauss_pts; ++gg) {
890  auto field_data = data.getFTensor1FieldData<Tensor_Dim0>();
891  int bb = 0;
892  for (; bb < size; ++bb) {
893  gradients_at_gauss_pts(I, J) += field_data(I) * diff_base_function(J);
894  ++field_data;
895  ++diff_base_function;
896  }
897  // Number of dofs can be smaller than number of Tensor_Dim0 x base functions
898  for (; bb != nb_base_functions; ++bb)
899  ++diff_base_function;
900  ++gradients_at_gauss_pts;
901  }
903 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:506
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405

◆ 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:
ElasticityMixedFormulation.hpp, HookeElement.cpp, PoissonOperators.hpp, Remodeling.cpp, and UnsaturatedFlow.hpp.

Definition at line 55 of file DataStructures.hpp.

55  {
56  static_assert(!std::is_same<T, T>::value, "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(!std::is_same<T, T>::value, "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(!std::is_same<T, T>::value, "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(!std::is_same<T, T>::value, "not implemented");
167 }