v0.8.23
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, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Do calculations for give operator. More...
 
- Public Member Functions inherited from MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space)
 
 UserDataOperator (const std::string &field_name, const char type)
 
 UserDataOperator (const std::string &row_field_name, const std::string &col_field_name, const char type, const bool symm=true)
 
double getArea ()
 get area of face More...
 
double getMeasure ()
 get measure of element 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...
 
DEPRECATED auto getTensor1Normal ()
 
auto getFTensor1Tangent1 ()
 get tangentOne as tensor More...
 
DEPRECATED auto getTensor1Tangent1 ()
 
auto getFTensor2Tangent1 ()
 get tangentTwo as tensor More...
 
DEPRECATED auto getTensor2Tangent1 ()
 
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...
 
DEPRECATED auto getTensor1Coords ()
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
auto getFTensor1CoordsAtGaussPts ()
 get coordinates at Gauss pts. More...
 
DEPRECATED auto getTensor1CoordsAtGaussPts ()
 
MatrixDoublegetHoCoordsAtGaussPts ()
 coordinate at Gauss points (if hierarchical approximation of element geometry) More...
 
auto getFTensor1HoCoordsAtGaussPts ()
 get coordinates at Gauss pts (takes in account ho approx. of geometry) More...
 
DEPRECATED auto getTensor1HoCoordsAtGaussPts ()
 
MatrixDoublegetNormalsAtGaussPts ()
 if higher order geometry return normals at Gauss pts. More...
 
DEPRECATED MatrixDoublegetNormalsAtGaussPt ()
 
ublas::matrix_row< MatrixDoublegetNormalsAtGaussPts (const int gg)
 if higher order geometry return normals at Gauss pts. More...
 
DEPRECATED auto getNormalsAtGaussPt (const int gg)
 
MatrixDoublegetTangent1AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
DEPRECATED MatrixDoublegetTangent1AtGaussPt ()
 
MatrixDoublegetTangent2AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
DEPRECATED MatrixDoublegetTangent2AtGaussPt ()
 
auto getFTensor1NormalsAtGaussPts ()
 get normal at integration points More...
 
DEPRECATED auto getTensor1NormalsAtGaussPt ()
 
auto getFTensor1Tangent1AtGaussPts ()
 get tangent 1 at integration points More...
 
DEPRECATED auto getTensor1Tangent1AtGaussPt ()
 
auto getFTensor1Tangent2AtGaussPts ()
 get tangent 2 at integration points More...
 
DEPRECATED auto getTensor1Tangent2AtGaussPt ()
 
DEPRECATED const FaceElementForcesAndSourcesCoregetFaceElementForcesAndSourcesCore ()
 
DEPRECATED const FaceElementForcesAndSourcesCoregetTriFE ()
 
const FaceElementForcesAndSourcesCoregetFaceFE ()
 return pointer to Generic Triangle Finite Element object More...
 
MoFEMErrorCode loopSideVolumes (const string &fe_name, VolumeElementForcesAndSourcesCoreOnSide &method)
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPLAST, 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)
 
virtual ~UserDataOperator ()
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. 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...
 
virtual MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
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...
 
const std::string & getFEName () const
 Get name of the element. More...
 
Vec getSnesF () const
 
Vec getSnesX () const
 
Mat getSnesA () const
 
Mat getSnesB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTSa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
DEPRECATED MoFEMErrorCode getPorblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
DEPRECATED MoFEMErrorCode getPorblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true, const bool do_vertices=true, const bool do_edges=true, const bool do_quads=true, const bool do_tris=true, const bool do_tets=true, const bool do_prisms=true)
 
virtual ~DataOperator ()
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data, bool symm=true)
 
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 do_vertices, const bool do_edges, const bool do_quads, const bool do_tris, const bool do_tets, const bool do_prisms, const bool error_if_no_base=true)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool error_if_no_base=true)
 
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 (DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Integrate grad-grad operator. More...
 
MoFEMErrorCode aSsemble (DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::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, OPLAST = 1 << 3 }
 Controls loop over entities on element. More...
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
bool doVertices
 If false skip vertices. More...
 
bool doEdges
 If false skip edges. More...
 
bool doQuads
 
bool doTris
 
bool doTets
 
bool doPrisms
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Examples
analytical_poisson_field_split.cpp.

Definition at line 85 of file analytical_poisson_field_split.cpp.

Constructor & Destructor Documentation

◆ OpS()

OpS::OpS ( const bool  beta = 1)

Member Function Documentation

◆ aSsemble()

MoFEMErrorCode OpS::aSsemble ( DataForcesAndSourcesCore::EntData row_data,
DataForcesAndSourcesCore::EntData col_data 
)
private

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 196 of file analytical_poisson_field_split.cpp.

197  {
199  // get pointer to first global index on row
200  const int *row_indices = &*row_data.getIndices().data().begin();
201  // get pointer to first global index on column
202  const int *col_indices = &*col_data.getIndices().data().begin();
203  Mat B = getFEMethod()->ksp_B != PETSC_NULL ? getFEMethod()->ksp_B
204  : getFEMethod()->snes_B;
205  // assemble local matrix
206  CHKERR MatSetValues(B, nbRows, row_indices, nbCols, col_indices,
207  &*locMat.data().begin(), ADD_VALUES);
208  if (!isDiag) {
209  // if not diagonal term and since global matrix is symmetric assemble
210  // transpose term.
211  locMat = trans(locMat);
212  CHKERR MatSetValues(B, nbCols, col_indices, nbRows, row_indices,
213  &*locMat.data().begin(), ADD_VALUES);
214  }
216  }
Mat ksp_B
preconditioner matrix
Definition: LoopMethods.hpp:94
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
int nbCols
number if dof on column
MatrixDouble locMat
local entity block matrix
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
bool isDiag
true if this block is on diagonal
MoFEMErrorCode MatSetValues(Mat M, const DataForcesAndSourcesCore::EntData &row_data, const DataForcesAndSourcesCore::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
#define CHKERR
Inline error check.
Definition: definitions.h:595
int nbRows
number of dofs on rows
const VectorInt & getIndices() const
Get global indices of dofs on entity.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406

◆ doWork()

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

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 102 of file analytical_poisson_field_split.cpp.

105  {
107  // get number of dofs on row
108  nbRows = row_data.getIndices().size();
109  // if no dofs on row, exit that work, nothing to do here
110  if (!nbRows)
112  // get number of dofs on column
113  nbCols = col_data.getIndices().size();
114  // if no dofs on Columbia, exit nothing to do here
115  if (!nbCols)
117  // get number of integration points
118  nbIntegrationPts = getGaussPts().size2();
119  // check if entity block is on matrix diagonal
120  if (row_side == col_side && row_type == col_type) {
121  isDiag = true; // yes, it is
122  } else {
123  isDiag = false;
124  }
125  // integrate local matrix for entity block
126  CHKERR iNtegrate(row_data, col_data);
127  // assemble local matrix
128  CHKERR aSsemble(row_data, col_data);
130  }
int nbIntegrationPts
number of integration points
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:507
int nbCols
number if dof on column
bool isDiag
true if this block is on diagonal
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
#define CHKERR
Inline error check.
Definition: definitions.h:595
MoFEMErrorCode iNtegrate(DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
Integrate grad-grad operator.
int nbRows
number of dofs on rows
const VectorInt & getIndices() const
Get global indices of dofs on entity.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406
MoFEMErrorCode aSsemble(DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
Assemble local entity block matrix.

◆ iNtegrate()

MoFEMErrorCode OpS::iNtegrate ( DataForcesAndSourcesCore::EntData row_data,
DataForcesAndSourcesCore::EntData col_data 
)
private

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 151 of file analytical_poisson_field_split.cpp.

152  {
154  // set size of local entity bock
155  locMat.resize(nbRows, nbCols, false);
156  // clear matrix
157  locMat.clear();
158  // get element area
159  double area = getArea() * bEta;
160  // get integration weights
161  auto t_w = getFTensor0IntegrationWeight();
162  // get base function gradient on rows
163  auto t_row_base = row_data.getFTensor0N();
164  // loop over integration points
165  for (int gg = 0; gg != nbIntegrationPts; gg++) {
166  // take into account Jacobean
167  const double alpha = t_w * area;
168  // take fist element to local matrix
170  &*locMat.data().begin());
171  // loop over rows base functions
172  for (int rr = 0; rr != nbRows; rr++) {
173  // get column base functions gradient at gauss point gg
174  auto t_col_base = col_data.getFTensor0N(gg, 0);
175  // loop over columns
176  for (int cc = 0; cc != nbCols; cc++) {
177  // calculate element of local matrix
178  a += alpha * t_row_base * t_col_base;
179  ++t_col_base; // move to another gradient of base function on column
180  ++a; // move to another element of local matrix in column
181  }
182  ++t_row_base; // move to another element of gradient of base function on
183  // row
184  }
185  ++t_w; // move to another integration weight
186  }
188  }
int nbIntegrationPts
number of integration points
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
const double bEta
error code
int nbCols
number if dof on column
MatrixDouble locMat
local entity block matrix
auto getFTensor0IntegrationWeight()
Get integration weights.
int nbRows
number of dofs on rows
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.

Member Data Documentation

◆ bEta

const double OpS::bEta
private

error code

Examples
analytical_poisson_field_split.cpp.

Definition at line 133 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 140 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 143 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 138 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 139 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 137 of file analytical_poisson_field_split.cpp.


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