v0.9.1
Public Member Functions | Public Attributes | Private Member Functions | List of all members
MoFEM::DataOperator Struct Reference

base operator to do operations at Gauss Pt. level More...

#include <src/finite_elements/DataOperators.hpp>

Inheritance diagram for MoFEM::DataOperator:
[legend]
Collaboration diagram for MoFEM::DataOperator:
[legend]

Public Member Functions

 DataOperator (const bool symm=true)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not. More...
 
void setSymm ()
 set if operator is executed taking in account symmetry More...
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem More...
 

Public Attributes

bool sYmm
 If true assume that matrix is symmetric structure. More...
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity. More...
 
booldoVertices
 \deprectaed If false skip vertices More...
 
booldoEdges
 \deprectaed If false skip edges More...
 
booldoQuads
 \deprectaed More...
 
booldoTris
 \deprectaed More...
 
booldoTets
 \deprectaed More...
 
booldoPrisms
 \deprectaed More...
 

Private Member Functions

template<bool Symm>
MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data)
 
template<bool ErrorIfNoBase>
MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const std::array< bool, MBMAXTYPE > &do_entities)
 

Detailed Description

base operator to do operations at Gauss Pt. level

Definition at line 36 of file DataOperators.hpp.

Constructor & Destructor Documentation

◆ DataOperator()

MoFEM::DataOperator::DataOperator ( const bool  symm = true)

Definition at line 33 of file DataOperators.cpp.

34  :
35 
36  sYmm(symm),
37 
38  doEntities{true, true, true, true, true, true,
39  true, true, true, true, true, true},
40 
41  doVertices(doEntities[MBVERTEX]), doEdges(doEntities[MBEDGE]),
42  doQuads(doEntities[MBQUAD]), doTris(doEntities[MBTRI]),
43  doTets(doEntities[MBTET]), doPrisms(doEntities[MBPRISM]) {
44 
45  /// This not yet implemented, switch off.
46  doEntities[MBPOLYGON] = false;
47  doEntities[MBPYRAMID] = false;
48  doEntities[MBKNIFE] = false;
49  doEntities[MBHEX] = false;
50  doEntities[MBPOLYHEDRON] = false;
51 }
bool & doTris
\deprectaed
bool & doVertices
\deprectaed If false skip vertices
bool & doPrisms
\deprectaed
std::array< bool, MBMAXTYPE > doEntities
If true operator is executed for entity.
bool sYmm
If true assume that matrix is symmetric structure.
bool & doEdges
\deprectaed If false skip edges
bool & doQuads
\deprectaed
bool & doTets
\deprectaed

◆ ~DataOperator()

virtual MoFEM::DataOperator::~DataOperator ( )
virtualdefault

Member Function Documentation

◆ doWork() [1/2]

virtual MoFEMErrorCode MoFEM::DataOperator::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
DataForcesAndSourcesCore::EntData row_data,
DataForcesAndSourcesCore::EntData col_data 
)
virtual

Operator for bi-linear form, usually to calculate values on left hand side.

Reimplemented in HookeElement::OpAssemble, ReactionDiffusionEquation::OpAssembleStiffLhs< DIM >, MyOp2, CallingOp, OpAssembleMat, OpFace, PrismOpLhs, QuadOpLhs, AnalyticalDirichletBC::ApproxField::OpLhs, MyOp, ReactionDiffusionEquation::OpAssembleMass, OpRowCol, OpVolume, and OpAssembleMat.

Definition at line 45 of file DataOperators.hpp.

48  {
50  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
52  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:506
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:513

◆ doWork() [2/2]

virtual MoFEMErrorCode MoFEM::DataOperator::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)
virtual

Operator for linear form, usually to calculate values on right hand side.

Reimplemented in FractureMechanics::OpPrint, MoFEM::OpSetInvJacH1ForFlatPrism, MoFEM::OpCalculateInvJacForFlatPrism, MoFEM::OpSetInvJacH1ForFatPrism, MoFEM::OpCalculateInvJacForFatPrism, MoFEM::OpSetContrariantPiolaTransformOnEdge, MoFEM::OpSetContravariantPiolaTransformFace, MoFEM::OpMakeHdivFromHcurl, MoFEM::OpSetInvJacHcurlFace, MoFEM::OpSetInvJacH1ForFace, MoFEM::OpCalculateInvJacForFace, MoFEM::OpCalculateJacForFace, MoFEM::OpCalculateHVecTensorDivergence< Tensor_Dim0, Tensor_Dim1 >, MoFEM::OpCalculateHTensorTensorField< Tensor_Dim0, Tensor_Dim1 >, MoFEM::OpCalculateHVecTensorField< Tensor_Dim0, Tensor_Dim1 >, MoFEM::OpCalculateHcurlVectorCurl< Tensor_Dim >, MoFEM::OpCalculateHdivVectorDivergence< Tensor_Dim1, Tensor_Dim2 >, MoFEM::OpCalculateHdivVectorField_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >, MoFEM::OpCalculateHdivVectorField_General< Tensor_Dim0, T, L, A >, MoFEM::OpCalculateVectorFieldGradientDot< Tensor_Dim0, Tensor_Dim1 >, MoFEM::OpCalculateVectorFieldGradient_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >, MoFEM::OpCalculateScalarFieldGradient_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >, MoFEM::OpCalculateTensor2SymmetricFieldValuesDot< Tensor_Dim >, MoFEM::OpCalculateTensor2SymmetricFieldValues< Tensor_Dim >, MoFEM::OpCalculateTensor2FieldValuesDot< Tensor_Dim0, Tensor_Dim1 >, MoFEM::OpSetCovariantPiolaTransformOnEdge, MoFEM::OpGetHoTangentOnEdge, MoFEM::OpSetCovariantPiolaTransformOnFace, MoFEM::OpSetContravariantPiolaTransformOnFace, MoFEM::OpGetCoordsAndNormalsOnPrism, MoFEM::OpCalculateTensor2FieldValues_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >, MoFEM::OpGetCoordsAndNormalsOnFace, MoFEM::OpCalculateTensor2FieldValues_General< Tensor_Dim0, Tensor_Dim1, T, L, A >, HookeElement::OpAleLhsPre_dX_dx< S >, MoFEM::OpCalculateVectorFieldValuesDot< Tensor_Dim >, MoFEM::OpGetDataAndGradient< RANK, DIM >, MoFEM::OpGetDataAndGradient< 3, 3 >, MoFEM::OpSetCovariantPiolaTransform, MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >, MoFEM::OpSetHoCovariantPiolaTransform, MoFEM::OpSetHoContravariantPiolaTransform, HookeElement::OpAssemble, MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, T, L, A >, MoFEM::OpSetContravariantPiolaTransform, HookeElement::OpCalculateStiffnessScaledByDensityField, OpCheckValsDiffVals, HookeElement::OpCalculateHomogeneousStiffness< S >, MoFEM::OpSetHoInvJacHdivAndHcurl, OpCheckValsDiffVals, HookeElement::OpCalculateEshelbyStress, MoFEM::OpSetHoInvJacH1, HookeElement::OpCalculateEnergy, OpValsDiffVals, ReactionDiffusionEquation::OpAssembleStiffRhs< DIM >, HookeElement::OpCalculateStress< S >, MoFEM::OpSetInvJacHdivAndHcurl, MoFEM::OpCalculateScalarFieldValuesDot, MyOp2, HookeElement::OpCalculateStrainAle, OpAssembleVec, MoFEM::OpSetInvJacH1, OpValsDiffVals, OpVolumeSide, HookeElement::OpCalculateStrain< D >, ReactionDiffusionEquation::OpAssembleSlowRhs, AnalyticalDirichletBC::ApproxField::OpRhs< FUNEVAL >, CallingOp, MoFEM::OpCalculateScalarFieldValues, Example::OpSecond, OpAssembleVec, OpFace, Example::OpFirst, Example::OpError, PrismOpRhs, OpVolume, QuadOpRhs, Example::OpZero, Example::OpError, OpFace, PrismOpCheck, QuadOpCheck, PrismOp, MoFEM::OpCalculateScalarFieldValues_General< T, A >, MoFEM::OpCalculateScalarFieldValues_General< double, DoubleAllocator >, SkeletonFE::OpFaceSide, OpDivergence, OpGetDensityField< ALE >, OpTetCurl, OpFace, OpTetDivergence, MyOp, OpRow, OpVolume, and OpCheck.

Definition at line 60 of file DataOperators.hpp.

61  {
63  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
65  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:506
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:513

◆ getSymm()

bool MoFEM::DataOperator::getSymm ( ) const

Get if operator uses symmetry of DOFs or not.

If symmetry is used, only not repeating combinations of entities are looped. For an example pair of (Vertex, Edge_0) and (Edge_0, Vertex) will calculate the same matrices only transposed. Implementing that this can be exploited by integrating only one pair.

Returns
true if symmetry

Definition at line 95 of file DataOperators.hpp.

95 { return sYmm; }
bool sYmm
If true assume that matrix is symmetric structure.

◆ opLhs() [1/2]

MoFEMErrorCode MoFEM::DataOperator::opLhs ( DataForcesAndSourcesCore row_data,
DataForcesAndSourcesCore col_data 
)
virtual

Definition at line 111 of file DataOperators.cpp.

112  {
113  if (getSymm())
114  return opLhs<true>(row_data, col_data);
115  else
116  return opLhs<false>(row_data, col_data);
117 }
bool getSymm() const
Get if operator uses symmetry of DOFs or not.

◆ opLhs() [2/2]

template<bool Symm>
MoFEMErrorCode MoFEM::DataOperator::opLhs ( DataForcesAndSourcesCore row_data,
DataForcesAndSourcesCore col_data 
)
private

Definition at line 54 of file DataOperators.cpp.

55  {
57 
58  auto do_col_entity =
59  [&](boost::ptr_vector<DataForcesAndSourcesCore::EntData> &row_ent_data,
60  const int ss, const EntityType row_type, const EntityType low_type,
61  const EntityType hi_type) {
63  for (EntityType col_type = low_type; col_type != hi_type; ++col_type) {
64  auto &col_ent_data = col_data.dataOnEntities[col_type];
65  for (size_t SS = 0; SS != col_ent_data.size(); SS++) {
66  if (col_ent_data[SS].getFieldData().size())
67  CHKERR doWork(ss, SS, row_type, col_type, row_ent_data[ss],
68  col_ent_data[SS]);
69  }
70  }
72  };
73 
74  auto do_row_entity = [&](const EntityType type) {
76  auto &row_ent_data = row_data.dataOnEntities[type];
77  for (size_t ss = 0; ss != row_ent_data.size(); ++ss) {
78  size_t SS = 0;
79  if (Symm)
80  SS = ss;
81  for (; SS < col_data.dataOnEntities[type].size(); SS++) {
82  CHKERR doWork(ss, SS, type, type, row_ent_data[ss],
83  col_data.dataOnEntities[type][SS]);
84  }
85  if (!Symm)
86  CHKERR do_col_entity(row_ent_data, ss, type, MBVERTEX, type);
87  CHKERR do_col_entity(row_ent_data, ss, type,
88  static_cast<EntityType>(type + 1), MBMAXTYPE);
89  }
91  };
92 
93  for (EntityType row_type = MBVERTEX; row_type != MBENTITYSET; ++row_type) {
94  if (doEntities[row_type]) {
95  CHKERR do_row_entity(row_type);
96  }
97  }
98 
99  if (doEntities[MBENTITYSET]) {
100  for (unsigned int mm = 0; mm != row_data.dataOnEntities[MBENTITYSET].size();
101  ++mm) {
102  if (!row_data.dataOnEntities[MBENTITYSET][mm].getFieldData().empty()) {
103  CHKERR do_row_entity(MBENTITYSET);
104  }
105  }
106  }
107 
109 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:506
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:482
std::array< bool, MBMAXTYPE > doEntities
If true operator is executed for entity.
virtual MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
Operator for bi-linear form, usually to calculate values on left hand side.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:513
#define CHKERR
Inline error check.
Definition: definitions.h:601
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:412

◆ opRhs() [1/2]

MoFEMErrorCode MoFEM::DataOperator::opRhs ( DataForcesAndSourcesCore data,
const bool  error_if_no_base = false 
)
virtual

Definition at line 171 of file DataOperators.cpp.

172  {
173  if (error_if_no_base)
174  return opRhs<true>(data, doEntities);
175  else
176  return opRhs<false>(data, doEntities);
177 }
std::array< bool, MBMAXTYPE > doEntities
If true operator is executed for entity.

◆ opRhs() [2/2]

template<bool ErrorIfNoBase>
MoFEMErrorCode MoFEM::DataOperator::opRhs ( DataForcesAndSourcesCore data,
const std::array< bool, MBMAXTYPE > &  do_entities 
)
private

Definition at line 121 of file DataOperators.cpp.

122  {
124 
125  auto do_entity = [&](auto type) {
127 
128  auto &ent_data = data.dataOnEntities[type];
129  const size_t size = ent_data.size();
130  for (size_t ss = 0; ss != size; ++ss) {
131 
132  auto &side_data = ent_data[ss];
133 
134  if (ErrorIfNoBase) {
135  if (side_data.getFieldData().size() &&
136  (side_data.getBase() == NOBASE ||
137  side_data.getBase() == LASTBASE)) {
138  for (VectorDofs::iterator it = side_data.getFieldDofs().begin();
139  it != side_data.getFieldDofs().end(); it++)
140  if ((*it) && (*it)->getActive())
141  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "No base on");
142  }
143  }
144 
145  CHKERR doWork(ss, type, side_data);
146  }
147 
149  };
150 
151  for (EntityType row_type = MBVERTEX; row_type != MBENTITYSET; ++row_type) {
152  if (do_entities[row_type]) {
153  CHKERR do_entity(row_type);
154  }
155  }
156 
157  if (do_entities[MBENTITYSET]) {
158  // This is odd behaviour, diffrent than for other entities. Should be
159  // changed that behaviour is consistent,
160  for (unsigned int mm = 0; mm != data.dataOnEntities[MBENTITYSET].size();
161  ++mm) {
162  if (!data.dataOnEntities[MBENTITYSET][mm].getFieldData().empty()) {
163  CHKERR doWork(mm, MBENTITYSET, data.dataOnEntities[MBENTITYSET][mm]);
164  }
165  }
166  }
167 
169 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:482
virtual MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
Operator for bi-linear form, usually to calculate values on left hand side.
#define CHKERR
Inline error check.
Definition: definitions.h:601
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:412

◆ setSymm()

void MoFEM::DataOperator::setSymm ( )

set if operator is executed taking in account symmetry

Definition at line 98 of file DataOperators.hpp.

98 { sYmm = true; }
bool sYmm
If true assume that matrix is symmetric structure.

◆ unSetSymm()

void MoFEM::DataOperator::unSetSymm ( )

unset if operator is executed for non symmetric problem

Definition at line 101 of file DataOperators.hpp.

101 { sYmm = false; }
bool sYmm
If true assume that matrix is symmetric structure.

Member Data Documentation

◆ doEdges

bool& MoFEM::DataOperator::doEdges

\deprectaed If false skip edges

Examples
ElasticityMixedFormulation.hpp.

Definition at line 79 of file DataOperators.hpp.

◆ doEntities

std::array<bool, MBMAXTYPE> MoFEM::DataOperator::doEntities

If true operator is executed for entity.

Definition at line 73 of file DataOperators.hpp.

◆ doPrisms

bool& MoFEM::DataOperator::doPrisms

\deprectaed

Examples
ElasticityMixedFormulation.hpp.

Definition at line 83 of file DataOperators.hpp.

◆ doQuads

bool& MoFEM::DataOperator::doQuads

\deprectaed

Examples
ElasticityMixedFormulation.hpp.

Definition at line 80 of file DataOperators.hpp.

◆ doTets

bool& MoFEM::DataOperator::doTets

\deprectaed

Examples
ElasticityMixedFormulation.hpp.

Definition at line 82 of file DataOperators.hpp.

◆ doTris

bool& MoFEM::DataOperator::doTris

\deprectaed

Examples
ElasticityMixedFormulation.hpp.

Definition at line 81 of file DataOperators.hpp.

◆ doVertices

bool& MoFEM::DataOperator::doVertices

\deprectaed If false skip vertices

Examples
ElasticityMixedFormulation.hpp.

Definition at line 78 of file DataOperators.hpp.

◆ sYmm

bool MoFEM::DataOperator::sYmm

If true assume that matrix is symmetric structure.

Examples
MagneticElement.hpp, and UnsaturatedFlow.hpp.

Definition at line 70 of file DataOperators.hpp.


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