v0.8.20
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 >
static FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > MoFEM::Types::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 >
static FTensor::Tensor1< FTensor::PackPtr< T *, 1 >, Tensor_Dim > MoFEM::Types::getFTensor1FromMat (ublas::matrix< T, L, A > &data)
 Get tensor rank 1 (vector) form data matrix. More...
 
template<int Tensor_Dim>
static FTensor::Tensor1< FTensor::PackPtr< double *, 1 >, Tensor_Dim > MoFEM::Types::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 >
static FTensor::Tensor2< FTensor::PackPtr< T *, 1 >, Tensor_Dim0, Tensor_Dim1 > MoFEM::Types::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::Types::getFTensor2FromMat (MatrixDouble &data)
 
template<int Tensor_Dim0, int Tensor_Dim1>
static FTensor::Tensor2< FTensor::PackPtr< double *, 1 >, Tensor_Dim0, Tensor_Dim1 > MoFEM::Types::getFTensor2FromMat (MatrixDouble &data)
 Get tensor rank 2 (matrix) form data matrix (specialization) More...
 
template<int Tensor_Dim, class T , class L , class A >
static FTensor::Tensor2_symmetric< FTensor::PackPtr< T *, 1 >, Tensor_Dim > MoFEM::Types::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 }
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:77
#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() [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 >
static FTensor::Tensor0<FTensor::PackPtr<double *, 1> > MoFEM::Types::getFTensor0FromVec ( ublas::vector< T, A > &  data)
static

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

Definition at line 162 of file Types.hpp.

162  {
163  static_assert(!std::is_same<T, T>::value, "not implemented");
164 }

◆ getFTensor1FromMat() [1/2]

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

Get tensor rank 1 (vector) form data matrix.

Definition at line 188 of file Types.hpp.

188  {
189  static_assert(!std::is_same<T, T>::value, "not implemented");
190 }

◆ getFTensor1FromMat() [2/2]

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

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

Definition at line 198 of file Types.hpp.

198  {
199  return getFTensor1FromMat<Tensor_Dim, double, ublas::row_major,
200  DoubleAllocator>(data);
201 }
static FTensor::Tensor1< FTensor::PackPtr< double *, 1 >, Tensor_Dim > getFTensor1FromMat(MatrixDouble &data)
Get tensor rank 1 (vector) form data matrix (specialization)
Definition: Types.hpp:198
std::vector< double, std::allocator< double > > DoubleAllocator
Definition: Types.hpp:70

◆ getFTensor2FromMat() [1/3]

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

Get tensor rank 2 (matrix) form data matrix.

Definition at line 242 of file Types.hpp.

242  {
243  static_assert(!std::is_same<T, T>::value, "not implemented");
244 }

◆ getFTensor2FromMat() [2/3]

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

Template specialization for getFTensor2FromMat

Definition at line 253 of file Types.hpp.

253  {
254  if (data.size1() != 9) {
255  THROW_MESSAGE("Wrong size of data matrix; numer of rows is " +
256  boost::lexical_cast<std::string>(data.size1()));
257  }
259  &data(0, 0), &data(1, 0), &data(2, 0), &data(3, 0), &data(4, 0),
260  &data(5, 0), &data(6, 0), &data(7, 0), &data(8, 0));
261 }
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:618

◆ getFTensor2FromMat() [3/3]

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

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

Definition at line 284 of file Types.hpp.

284  {
285  return getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1, double, ublas::row_major,
286  DoubleAllocator>(data);
287 }
static FTensor::Tensor2< FTensor::PackPtr< double *, 1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2FromMat(MatrixDouble &data)
Get tensor rank 2 (matrix) form data matrix (specialization)
Definition: Types.hpp:284
std::vector< double, std::allocator< double > > DoubleAllocator
Definition: Types.hpp:70

◆ getFTensor2SymmetricFromMat()

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

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

Definition at line 305 of file Types.hpp.

305  {
306  static_assert(!std::is_same<T, T>::value, "not implemented");
307 }