v0.14.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OpS Struct Reference
Inheritance diagram for OpS:
[legend]
Collaboration diagram for OpS:
[legend]

Public Member Functions

 OpS (const bool beta=1)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Do calculations for give operator. More...
 
- Public Member Functions inherited from MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
double getArea ()
 get area of face More...
 
VectorDoublegetNormal ()
 get triangle normal More...
 
VectorDoublegetTangent1 ()
 get triangle tangent 1 More...
 
VectorDoublegetTangent2 ()
 get triangle tangent 2 More...
 
auto getFTensor1Normal ()
 get normal as tensor More...
 
auto getFTensor1Tangent1 ()
 get tangentOne as tensor More...
 
auto getFTensor1Tangent2 ()
 get tangentTwo as tensor More...
 
int getNumNodes ()
 get element number of nodes More...
 
const EntityHandlegetConn ()
 get element connectivity More...
 
VectorDoublegetCoords ()
 get triangle coordinates More...
 
auto getFTensor1Coords ()
 get get coords at gauss points More...
 
MatrixDoublegetNormalsAtGaussPts ()
 if higher order geometry return normals at Gauss pts. More...
 
ublas::matrix_row< MatrixDoublegetNormalsAtGaussPts (const int gg)
 if higher order geometry return normals at Gauss pts. More...
 
MatrixDoublegetTangent1AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
MatrixDoublegetTangent2AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
auto getFTensor1NormalsAtGaussPts ()
 get normal at integration points More...
 
auto getFTensor1Tangent1AtGaussPts ()
 get tangent 1 at integration points More...
 
auto getFTensor1Tangent2AtGaussPts ()
 get tangent 2 at integration points More...
 
FaceElementForcesAndSourcesCoregetFaceFE ()
 return pointer to Generic Triangle Finite Element object More...
 
MoFEMErrorCode loopSideVolumes (const string fe_name, VolumeElementForcesAndSourcesCoreOnSide &fe_method)
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPSPACE, const bool symm=true)
 
 UserDataOperator (const std::string field_name, const char type, const bool symm=true)
 
 UserDataOperator (const std::string row_field_name, const std::string col_field_name, const char type, const bool symm=true)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
int getFEDim () const
 Get dimension of finite element. More...
 
EntityType getFEType () const
 Get dimension of finite element. More...
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer. More...
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity. More...
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object. More...
 
int getOpType () const
 Get operator types. More...
 
void setOpType (const OpType type)
 Set operator type. More...
 
void addOpType (const OpType type)
 Add operator type. More...
 
int getNinTheLoop () const
 get number of finite element in the loop More...
 
int getLoopSize () const
 get size of elements in the loop More...
 
std::string getFEName () const
 Get name of the element. More...
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
ForcesAndSourcesCoregetRefinePtrFE () const
 
const PetscData::SwitchesgetDataCtx () const
 
const KspMethod::KSPContext getKSPCtx () const
 
const SnesMethod::SNESContext getSNESCtx () const
 
const TSMethod::TSContext getTSCtx () const
 
Vec getKSPf () const
 
Mat getKSPA () const
 
Mat getKSPB () const
 
Vec getSNESf () const
 
Vec getSNESx () const
 
Mat getSNESA () const
 
Mat getSNESB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSu_tt () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTStimeStep () const
 
double getTSa () const
 
double getTSaa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
double getMeasure () const
 get measure of element More...
 
doublegetMeasure ()
 get measure of element More...
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy, AdjCache *adj_cache=nullptr)
 User calls this function to loop over elements on the side of face. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopThis (const string &fe_name, ForcesAndSourcesCore *this_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over the same element using a different set of integration points. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopParent (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopChildren (const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations. More...
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &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...
 

Private Member Functions

MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Integrate grad-grad operator. More...
 
MoFEMErrorCode aSsemble (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Assemble local entity block matrix. More...
 

Private Attributes

const double bEta
 error code More...
 
int nbRows
 number of dofs on rows More...
 
int nbCols
 number if dof on column More...
 
int nbIntegrationPts
 number of integration points More...
 
bool isDiag
 true if this block is on diagonal More...
 
FTensor::Index< 'i', 3 > i
 summit Index More...
 
MatrixDouble locMat
 local entity block matrix More...
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType {
  OPROW = 1 << 0, OPCOL = 1 << 1, OPROWCOL = 1 << 2, OPSPACE = 1 << 3,
  OPLAST = 1 << 3
}
 Controls loop over entities on element. More...
 
using AdjCache = std::map< EntityHandle, std::vector< boost::weak_ptr< NumeredEntFiniteElement > >>
 
- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)>
 
using DoWorkRhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int side, EntityType type, EntitiesFieldData::EntData &data)>
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
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...
 
- Static Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
static const char *const OpTypeNames []
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Examples
analytical_poisson_field_split.cpp.

Definition at line 73 of file analytical_poisson_field_split.cpp.

Constructor & Destructor Documentation

◆ OpS()

OpS::OpS ( const bool  beta = 1)
inline
Examples
analytical_poisson_field_split.cpp.

Definition at line 75 of file analytical_poisson_field_split.cpp.

77  true),
78  bEta(beta) {}

Member Function Documentation

◆ aSsemble()

MoFEMErrorCode OpS::aSsemble ( EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data 
)
inlineprivate

Assemble local entity block matrix.

Parameters
row_datarow data (consist base functions on row entity)
col_datacolumn data (consist base functions on column entity)
Returns
error code
Examples
analytical_poisson_field_split.cpp.

Definition at line 184 of file analytical_poisson_field_split.cpp.

185  {
187  // get pointer to first global index on row
188  const int *row_indices = &*row_data.getIndices().data().begin();
189  // get pointer to first global index on column
190  const int *col_indices = &*col_data.getIndices().data().begin();
191  Mat B = getFEMethod()->ksp_B != PETSC_NULL ? getFEMethod()->ksp_B
192  : getFEMethod()->snes_B;
193  // assemble local matrix
194  CHKERR MatSetValues(B, nbRows, row_indices, nbCols, col_indices,
195  &*locMat.data().begin(), ADD_VALUES);
196  if (!isDiag) {
197  // if not diagonal term and since global matrix is symmetric assemble
198  // transpose term.
199  locMat = trans(locMat);
200  CHKERR MatSetValues(B, nbCols, col_indices, nbRows, row_indices,
201  &*locMat.data().begin(), ADD_VALUES);
202  }
204  }

◆ doWork()

MoFEMErrorCode OpS::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data 
)
inlinevirtual

Do calculations for give operator.

Parameters
row_siderow side number (local number) of entity on element
col_sidecolumn side number (local number) of entity on element
row_typetype of row entity MBVERTEX, MBEDGE, MBTRI or MBTET
col_typetype of column entity MBVERTEX, MBEDGE, MBTRI or MBTET
row_datadata for row
col_datadata for column
Returns
error code

Reimplemented from MoFEM::DataOperator.

Examples
analytical_poisson_field_split.cpp.

Definition at line 90 of file analytical_poisson_field_split.cpp.

93  {
95  // get number of dofs on row
96  nbRows = row_data.getIndices().size();
97  // if no dofs on row, exit that work, nothing to do here
98  if (!nbRows)
100  // get number of dofs on column
101  nbCols = col_data.getIndices().size();
102  // if no dofs on Columbia, exit nothing to do here
103  if (!nbCols)
105  // get number of integration points
106  nbIntegrationPts = getGaussPts().size2();
107  // check if entity block is on matrix diagonal
108  if (row_side == col_side && row_type == col_type) {
109  isDiag = true; // yes, it is
110  } else {
111  isDiag = false;
112  }
113  // integrate local matrix for entity block
114  CHKERR iNtegrate(row_data, col_data);
115  // assemble local matrix
116  CHKERR aSsemble(row_data, col_data);
118  }

◆ iNtegrate()

MoFEMErrorCode OpS::iNtegrate ( EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data 
)
inlineprivate

Integrate grad-grad operator.

Parameters
row_datarow data (consist base functions on row entity)
col_datacolumn data (consist base functions on column entity)
Returns
error code
Examples
analytical_poisson_field_split.cpp.

Definition at line 139 of file analytical_poisson_field_split.cpp.

140  {
142  // set size of local entity bock
143  locMat.resize(nbRows, nbCols, false);
144  // clear matrix
145  locMat.clear();
146  // get element area
147  double area = getArea() * bEta;
148  // get integration weights
149  auto t_w = getFTensor0IntegrationWeight();
150  // get base function gradient on rows
151  auto t_row_base = row_data.getFTensor0N();
152  // loop over integration points
153  for (int gg = 0; gg != nbIntegrationPts; gg++) {
154  // take into account Jacobean
155  const double alpha = t_w * area;
156  // take fist element to local matrix
158  &*locMat.data().begin());
159  // loop over rows base functions
160  for (int rr = 0; rr != nbRows; rr++) {
161  // get column base functions gradient at gauss point gg
162  auto t_col_base = col_data.getFTensor0N(gg, 0);
163  // loop over columns
164  for (int cc = 0; cc != nbCols; cc++) {
165  // calculate element of local matrix
166  a += alpha * t_row_base * t_col_base;
167  ++t_col_base; // move to another gradient of base function on column
168  ++a; // move to another element of local matrix in column
169  }
170  ++t_row_base; // move to another element of gradient of base function on
171  // row
172  }
173  ++t_w; // move to another integration weight
174  }
176  }

Member Data Documentation

◆ bEta

const double OpS::bEta
private

error code

Examples
analytical_poisson_field_split.cpp.

Definition at line 121 of file analytical_poisson_field_split.cpp.

◆ i

FTensor::Index<'i', 3> OpS::i
private

◆ isDiag

bool OpS::isDiag
private

true if this block is on diagonal

Examples
analytical_poisson_field_split.cpp.

Definition at line 128 of file analytical_poisson_field_split.cpp.

◆ locMat

MatrixDouble OpS::locMat
private

local entity block matrix

Examples
analytical_poisson_field_split.cpp.

Definition at line 131 of file analytical_poisson_field_split.cpp.

◆ nbCols

int OpS::nbCols
private

number if dof on column

Examples
analytical_poisson_field_split.cpp.

Definition at line 126 of file analytical_poisson_field_split.cpp.

◆ nbIntegrationPts

int OpS::nbIntegrationPts
private

number of integration points

Examples
analytical_poisson_field_split.cpp.

Definition at line 127 of file analytical_poisson_field_split.cpp.

◆ nbRows

int OpS::nbRows
private

number of dofs on rows

Examples
analytical_poisson_field_split.cpp.

Definition at line 125 of file analytical_poisson_field_split.cpp.


The documentation for this struct was generated from the following file:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
MoFEM::MatSetValues
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
Definition: EntitiesFieldData.hpp:1631
MoFEM::KspMethod::ksp_B
Mat & ksp_B
Definition: LoopMethods.hpp:91
MoFEM::SnesMethod::snes_B
Mat & snes_B
preconditioner of jacobian matrix
Definition: LoopMethods.hpp:124
OpS::iNtegrate
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
Integrate grad-grad operator.
Definition: analytical_poisson_field_split.cpp:139
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROWCOL
@ OPROWCOL
operator doWork is executed on FE rows &columns
Definition: ForcesAndSourcesCore.hpp:569
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFTensor0IntegrationWeight
auto getFTensor0IntegrationWeight()
Get integration weights.
Definition: ForcesAndSourcesCore.hpp:1239
MoFEM::ForcesAndSourcesCore::UserDataOperator::getGaussPts
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
Definition: ForcesAndSourcesCore.hpp:1235
MoFEM::EntitiesFieldData::EntData::getFTensor0N
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
Definition: EntitiesFieldData.hpp:1489
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
a
constexpr double a
Definition: approx_sphere.cpp:30
OpS::nbRows
int nbRows
number of dofs on rows
Definition: analytical_poisson_field_split.cpp:125
OpS::isDiag
bool isDiag
true if this block is on diagonal
Definition: analytical_poisson_field_split.cpp:128
OpS::bEta
const double bEta
error code
Definition: analytical_poisson_field_split.cpp:121
MoFEM::EntitiesFieldData::EntData::getIndices
const VectorInt & getIndices() const
Get global indices of dofs on entity.
Definition: EntitiesFieldData.hpp:1201
OpS::locMat
MatrixDouble locMat
local entity block matrix
Definition: analytical_poisson_field_split.cpp:131
OpS::nbCols
int nbCols
number if dof on column
Definition: analytical_poisson_field_split.cpp:126
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEMethod
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
Definition: ForcesAndSourcesCore.hpp:1041
OpS::nbIntegrationPts
int nbIntegrationPts
number of integration points
Definition: analytical_poisson_field_split.cpp:127
FTensor::Tensor0
Definition: Tensor0.hpp:16
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator::getArea
double getArea()
get area of face
Definition: FaceElementForcesAndSourcesCore.hpp:239
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
OpS::aSsemble
MoFEMErrorCode aSsemble(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
Assemble local entity block matrix.
Definition: analytical_poisson_field_split.cpp:184