v0.14.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MoFEM::OpBaseImpl< A, EleOp > Struct Template Reference

#include <src/finite_elements/FormsIntegrators.hpp>

Inheritance diagram for MoFEM::OpBaseImpl< A, EleOp >:
[legend]
Collaboration diagram for MoFEM::OpBaseImpl< A, EleOp >:
[legend]

Public Types

using OpType = typename EleOp::OpType
 
using EntData = EntitiesFieldData::EntData
 
using MatSetValuesHook = boost::function< MoFEMErrorCode(ForcesAndSourcesCore::UserDataOperator *op_ptr, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, MatrixDouble &m)>
 

Public Member Functions

 OpBaseImpl (const std::string row_field_name, const std::string col_field_name, const OpType type, boost::shared_ptr< Range > ents_ptr=nullptr)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 Do calculations for the left hand side. More...
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntData &row_data)
 Do calculations for the right hand side. More...
 

Public Attributes

TimeFun timeScalingFun
 assumes that time variable is set More...
 
FEFun feScalingFun
 assumes that time variable is set More...
 
boost::shared_ptr< RangeentsPtr
 Entities on which element is run. More...
 

Static Public Attributes

static MatSetValuesHook matSetValuesHook
 

Protected Member Functions

template<int DIM>
FTensor::Tensor1< FTensor::PackPtr< double *, DIM >, DIM > getNf ()
 
template<int DIM>
FTensor::Tensor2< FTensor::PackPtr< double *, DIM >, DIM, DIM > getLocMat (const int rr)
 
virtual MoFEMErrorCode iNtegrate (EntData &row_data, EntData &col_data)
 Integrate grad-grad operator. More...
 
virtual MoFEMErrorCode aSsemble (EntData &row_data, EntData &col_data, const bool trans)
 
virtual MoFEMErrorCode iNtegrate (EntData &data)
 Class dedicated to integrate operator. More...
 
virtual MoFEMErrorCode aSsemble (EntData &data)
 

Protected Attributes

int nbRows
 number of dofs on rows More...
 
int nbCols
 number if dof on column More...
 
int nbIntegrationPts
 number of integration points More...
 
int nbRowBaseFunctions
 number or row base functions More...
 
int rowSide
 row side number More...
 
int colSide
 column side number More...
 
EntityType rowType
 row type More...
 
EntityType colType
 column type More...
 
bool assembleTranspose
 
bool onlyTranspose
 
MatrixDouble locMat
 local entity block matrix More...
 
MatrixDouble locMatTranspose
 local entity block matrix More...
 
VectorDouble locF
 local entity vector More...
 

Detailed Description

template<AssemblyType A, typename EleOp>
struct MoFEM::OpBaseImpl< A, EleOp >
Examples
PlasticOps.hpp, PlasticOpsGeneric.hpp, PlasticOpsLargeStrains.hpp, PlasticOpsSmallStrains.hpp, ThermoElasticOps.hpp, approx_sphere.cpp, free_surface.cpp, level_set.cpp, plastic.cpp, poisson_2d_homogeneous.hpp, shallow_wave.cpp, tensor_divergence_operator.cpp, and thermo_elastic.cpp.

Definition at line 170 of file FormsIntegrators.hpp.

Member Typedef Documentation

◆ EntData

template<AssemblyType A, typename EleOp >
using MoFEM::OpBaseImpl< A, EleOp >::EntData = EntitiesFieldData::EntData

Definition at line 172 of file FormsIntegrators.hpp.

◆ MatSetValuesHook

template<AssemblyType A, typename EleOp >
using MoFEM::OpBaseImpl< A, EleOp >::MatSetValuesHook = boost::function<MoFEMErrorCode( ForcesAndSourcesCore::UserDataOperator *op_ptr, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, MatrixDouble &m)>

Definition at line 207 of file FormsIntegrators.hpp.

◆ OpType

template<AssemblyType A, typename EleOp >
using MoFEM::OpBaseImpl< A, EleOp >::OpType = typename EleOp::OpType

Definition at line 171 of file FormsIntegrators.hpp.

Constructor & Destructor Documentation

◆ OpBaseImpl()

template<AssemblyType A, typename EleOp >
MoFEM::OpBaseImpl< A, EleOp >::OpBaseImpl ( const std::string  row_field_name,
const std::string  col_field_name,
const OpType  type,
boost::shared_ptr< Range ents_ptr = nullptr 
)
inline

Definition at line 174 of file FormsIntegrators.hpp.

176 : EleOp(row_field_name, col_field_name, type, false),
177 assembleTranspose(false), onlyTranspose(false), entsPtr(ents_ptr) {}
boost::shared_ptr< Range > entsPtr
Entities on which element is run.

Member Function Documentation

◆ aSsemble() [1/2]

template<AssemblyType A, typename EleOp >
MoFEMErrorCode OpBaseImpl::aSsemble ( EntData data)
protectedvirtual

Reimplemented in MoFEM::OpBaseImpl< USER_ASSEMBLE, EleOp >.

Definition at line 433 of file FormsIntegrators.hpp.

433 {
434 if (!this->timeScalingFun.empty())
435 this->locF *= this->timeScalingFun(this->getFEMethod()->ts_t);
436 if (!this->feScalingFun.empty())
437 this->locF *= this->feScalingFun(this->getFEMethod());
438
439 return VecSetValues<AssemblyTypeSelector<A>>(this->getKSPf(), data,
440 this->locF, ADD_VALUES);
441}
VectorDouble locF
local entity vector
TimeFun timeScalingFun
assumes that time variable is set
FEFun feScalingFun
assumes that time variable is set

◆ aSsemble() [2/2]

template<AssemblyType A, typename EleOp >
MoFEMErrorCode OpBaseImpl::aSsemble ( EntData row_data,
EntData col_data,
const bool  trans 
)
protectedvirtual

Reimplemented in MoFEM::OpBaseImpl< USER_ASSEMBLE, EleOp >.

Definition at line 406 of file FormsIntegrators.hpp.

408 {
410
411 if (!this->timeScalingFun.empty())
412 this->locMat *= this->timeScalingFun(this->getFEMethod()->ts_t);
413 if (!this->feScalingFun.empty())
414 this->locMat *= this->feScalingFun(this->getFEMethod());
415
416 // Assemble transpose
417 if (transpose) {
418 this->locMatTranspose.resize(this->locMat.size2(), this->locMat.size1(),
419 false);
420 noalias(this->locMatTranspose) = trans(this->locMat);
421 CHKERR matSetValuesHook(this, col_data, row_data, this->locMatTranspose);
422 }
423
424 if (!this->onlyTranspose) {
425 // assemble local matrix
426 CHKERR matSetValuesHook(this, row_data, col_data, this->locMat);
427 }
428
430}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
MatrixDouble locMatTranspose
local entity block matrix
static MatSetValuesHook matSetValuesHook
MatrixDouble locMat
local entity block matrix

◆ doWork() [1/2]

template<AssemblyType A, typename EleOp >
MoFEMErrorCode OpBaseImpl::doWork ( int  row_side,
EntityType  row_type,
EntData row_data 
)

Do calculations for the right hand side.

Parameters
row_side
row_type
row_data
Returns
MoFEMErrorCode

Definition at line 375 of file FormsIntegrators.hpp.

376 {
378
379 if (entsPtr) {
380 if (entsPtr->find(this->getFEEntityHandle()) == entsPtr->end())
382 }
383
384 // get number of dofs on row
385 nbRows = row_data.getIndices().size();
386 rowSide = row_side;
387 rowType = row_type;
388
389 if (!nbRows)
391 // get number of integration points
392 nbIntegrationPts = EleOp::getGaussPts().size2();
393 // get row base functions
394 nbRowBaseFunctions = row_data.getN().size2();
395 // resize and clear the right hand side vector
396 locF.resize(nbRows);
397 locF.clear();
398 // integrate local vector
399 CHKERR this->iNtegrate(row_data);
400 // assemble local vector
401 CHKERR this->aSsemble(row_data);
403}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorInt & getIndices() const
Get global indices of dofs on entity.
int rowSide
row side number
int nbRows
number of dofs on rows
int nbIntegrationPts
number of integration points
virtual MoFEMErrorCode aSsemble(EntData &row_data, EntData &col_data, const bool trans)
virtual MoFEMErrorCode iNtegrate(EntData &row_data, EntData &col_data)
Integrate grad-grad operator.
int nbRowBaseFunctions
number or row base functions
EntityType rowType
row type

◆ doWork() [2/2]

template<AssemblyType A, typename EleOp >
MoFEMErrorCode OpBaseImpl::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data 
)

Do calculations for the left hand side.

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
col_typetype of column entity
row_datadata for row
col_datadata for column
Returns
error code

Definition at line 321 of file FormsIntegrators.hpp.

324 {
326
327 if (entsPtr) {
328 if (entsPtr->find(this->getFEEntityHandle()) == entsPtr->end())
330 }
331
332 // get number of dofs on row
333 nbRows = row_data.getIndices().size();
334 // if no dofs on row, exit that work, nothing to do here
335 if (!nbRows)
337 rowSide = row_side;
338 rowType = row_type;
339 // get number of dofs on column
340 nbCols = col_data.getIndices().size();
341 // if no dofs on column, exit nothing to do here
342 if (!nbCols)
344 colSide = col_side;
345 colType = col_type;
346 // get number of integration points
347 nbIntegrationPts = EleOp::getGaussPts().size2();
348 // get row base functions
349 nbRowBaseFunctions = row_data.getN().size2();
350 // set size of local entity bock
351 locMat.resize(nbRows, nbCols, false);
352 // clear matrix
353 locMat.clear();
354 // integrate local matrix for entity block
355 CHKERR this->iNtegrate(row_data, col_data);
356
357 // assemble local matrix
358 auto check_if_assemble_transpose = [&] {
359 if (this->sYmm) {
360 if (row_side != col_side || row_type != col_type)
361 return true;
362 else
363 return false;
364 } else if (assembleTranspose) {
365 return true;
366 }
367
368 return false;
369 };
370 CHKERR aSsemble(row_data, col_data, check_if_assemble_transpose());
372}
int colSide
column side number
EntityType colType
column type
int nbCols
number if dof on column

◆ getLocMat()

template<AssemblyType A, typename EleOp >
template<int DIM>
FTensor::Tensor2< FTensor::PackPtr< double *, DIM >, DIM, DIM > MoFEM::OpBaseImpl< A, EleOp >::getLocMat ( const int  rr)
inlineprotected

Definition at line 223 of file FormsIntegrators.hpp.

223 {
224 return getFTensor2FromArray<DIM, DIM, DIM>(locMat, rr);
225 }

◆ getNf()

template<AssemblyType A, typename EleOp >
template<int DIM>
FTensor::Tensor1< FTensor::PackPtr< double *, DIM >, DIM > MoFEM::OpBaseImpl< A, EleOp >::getNf ( )
inlineprotected

Definition at line 217 of file FormsIntegrators.hpp.

217 {
218 return getFTensor1FromArray<DIM, DIM>(locF);
219 }

◆ iNtegrate() [1/2]

template<AssemblyType A, typename EleOp >
virtual MoFEMErrorCode MoFEM::OpBaseImpl< A, EleOp >::iNtegrate ( EntData data)
inlineprotectedvirtual

Class dedicated to integrate operator.

Parameters
dataentity data on element row
Returns
error code

Reimplemented in LevelSet::OpRhsDomain, OpDomainResidualVector, Example::OpRadiationRhs, Example::OpFluxRhs, MoFEM::OpSourceImpl< 1, 1, GAUSS, SourceFunctionSpecialization::S< OpBase > >, MoFEM::OpSourceImpl< 1, FIELD_DIM, GAUSS, SourceFunctionSpecialization::S< OpBase > >, MoFEM::OpSourceImpl< 3, FIELD_DIM, GAUSS, SourceFunctionSpecialization::S< OpBase > >, MoFEM::OpBaseTimesScalarImpl< 1, S, GAUSS, OpBase >, MoFEM::OpBaseTimesVectorImpl< 1, FIELD_DIM, S, GAUSS, OpBase >, MoFEM::OpBaseTimesVectorImpl< 3, FIELD_DIM, S, GAUSS, OpBase >, MoFEM::OpGradTimesTensorImpl< 1, 1, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpGradTimesTensorImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpGradTimesSymTensorImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpMixDivTimesUImpl< 3, FIELD_DIM, SPACE_DIM, GAUSS, OpBase, CoordSys >, MoFEM::OpMixDivTimesUImpl< 3, 1, SPACE_DIM, GAUSS, OpBase, CoordSys >, MoFEM::OpMixDivTimesUImpl< 1, FIELD_DIM, FIELD_DIM, GAUSS, OpBase, CoordSys >, MoFEM::OpMixVecTimesDivLambdaImpl< SPACE_DIM, GAUSS, OpBase >, MoFEM::OpMixTensorTimesGradUImpl< SPACE_DIM, GAUSS, OpBase >, MoFEM::OpNormalMixVecTimesScalarImpl< 3, GAUSS, OpBase >, MoFEM::OpNormalMixVecTimesScalarImpl< 2, GAUSS, OpBase >, MoFEM::OpNormalMixVecTimesVectorFieldImpl< SPACE_DIM, GAUSS, OpBase >, MoFEM::OpConvectiveTermRhsImpl< 1, 1, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpConvectiveTermRhsImpl< 1, FIELD_DIM, SPACE_DIM, GAUSS, OpBase >, OpRhs, and OpURhs.

Definition at line 262 of file FormsIntegrators.hpp.

262 {
264 }
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32

◆ iNtegrate() [2/2]

template<AssemblyType A, typename EleOp >
virtual MoFEMErrorCode MoFEM::OpBaseImpl< A, EleOp >::iNtegrate ( EntData row_data,
EntData col_data 
)
inlineprotectedvirtual

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

Reimplemented in LevelSet::OpLhsDomain, OpDomainTangentMatrix, Example::OpRadiationLhs, MoFEM::OpGradGradImpl< 1, 1, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpGradGradImpl< 1, FIELD_DIM, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >, MoFEM::OpMassImpl< 1, FIELD_DIM, GAUSS, OpBase >, MoFEM::OpMassImpl< 3, FIELD_DIM, GAUSS, OpBase >, MoFEM::OpMassImpl< 3, 4, GAUSS, OpBase >, MoFEM::OpMassImpl< 3, 9, GAUSS, OpBase >, MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpGradTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpGradGradSymTensorGradGradImpl< 1, 1, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpMixDivTimesScalarImpl< SPACE_DIM, GAUSS, OpBase >, MoFEM::OpMixDivTimesVecImpl< SPACE_DIM, GAUSS, OpBase, CoordSys >, MoFEM::OpMixScalarTimesDivImpl< SPACE_DIM, GAUSS, OpBase, COORDINATE_SYSTEM >, MoFEM::OpMixVectorTimesGradImpl< 3, SPACE_DIM, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpMixVectorTimesGradImpl< 1, SPACE_DIM, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpMixTensorTimesGradImpl< SPACE_DIM, GAUSS, OpBase >, MoFEM::OpConvectiveTermLhsDuImpl< 1, 1, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpConvectiveTermLhsDyImpl< 1, 1, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpConvectiveTermLhsDuImpl< 1, FIELD_DIM, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpConvectiveTermLhsDyImpl< 1, FIELD_DIM, SPACE_DIM, GAUSS, OpBase >, OpLhs, OpULhs_dU, and OpULhs_dH.

Definition at line 250 of file FormsIntegrators.hpp.

250 {
252 }

Member Data Documentation

◆ assembleTranspose

template<AssemblyType A, typename EleOp >
bool MoFEM::OpBaseImpl< A, EleOp >::assembleTranspose
protected

Definition at line 237 of file FormsIntegrators.hpp.

◆ colSide

template<AssemblyType A, typename EleOp >
int MoFEM::OpBaseImpl< A, EleOp >::colSide
protected

column side number

Examples
PlasticOpsLargeStrains.hpp.

Definition at line 233 of file FormsIntegrators.hpp.

◆ colType

template<AssemblyType A, typename EleOp >
EntityType MoFEM::OpBaseImpl< A, EleOp >::colType
protected

column type

Examples
PlasticOpsLargeStrains.hpp.

Definition at line 235 of file FormsIntegrators.hpp.

◆ entsPtr

template<AssemblyType A, typename EleOp >
boost::shared_ptr<Range> MoFEM::OpBaseImpl< A, EleOp >::entsPtr

Entities on which element is run.

Definition at line 205 of file FormsIntegrators.hpp.

◆ feScalingFun

template<AssemblyType A, typename EleOp >
FEFun MoFEM::OpBaseImpl< A, EleOp >::feScalingFun

assumes that time variable is set

Definition at line 204 of file FormsIntegrators.hpp.

◆ locF

template<AssemblyType A, typename EleOp >
VectorDouble MoFEM::OpBaseImpl< A, EleOp >::locF
protected

◆ locMat

template<AssemblyType A, typename EleOp >
MatrixDouble MoFEM::OpBaseImpl< A, EleOp >::locMat
protected

◆ locMatTranspose

template<AssemblyType A, typename EleOp >
MatrixDouble MoFEM::OpBaseImpl< A, EleOp >::locMatTranspose
protected

local entity block matrix

Definition at line 241 of file FormsIntegrators.hpp.

◆ matSetValuesHook

template<AssemblyType A, typename EleOp >
OpBaseImpl< A, EleOp >::MatSetValuesHook OpBaseImpl::matSetValuesHook
static
Initial value:
=
[](ForcesAndSourcesCore::UserDataOperator *op_ptr,
const EntitiesFieldData::EntData &row_data,
const EntitiesFieldData::EntData &col_data, MatrixDouble &m) {
return MatSetValues<AssemblyTypeSelector<A>>(
op_ptr->getKSPB(), row_data, col_data, m, ADD_VALUES);
}
FTensor::Index< 'm', SPACE_DIM > m
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77

Definition at line 212 of file FormsIntegrators.hpp.

◆ nbCols

template<AssemblyType A, typename EleOp >
int MoFEM::OpBaseImpl< A, EleOp >::nbCols
protected

◆ nbIntegrationPts

template<AssemblyType A, typename EleOp >
int MoFEM::OpBaseImpl< A, EleOp >::nbIntegrationPts
protected

number of integration points

Examples
approx_sphere.cpp, and shallow_wave.cpp.

Definition at line 229 of file FormsIntegrators.hpp.

◆ nbRowBaseFunctions

template<AssemblyType A, typename EleOp >
int MoFEM::OpBaseImpl< A, EleOp >::nbRowBaseFunctions
protected

number or row base functions

Examples
approx_sphere.cpp, and shallow_wave.cpp.

Definition at line 230 of file FormsIntegrators.hpp.

◆ nbRows

template<AssemblyType A, typename EleOp >
int MoFEM::OpBaseImpl< A, EleOp >::nbRows
protected

◆ onlyTranspose

template<AssemblyType A, typename EleOp >
bool MoFEM::OpBaseImpl< A, EleOp >::onlyTranspose
protected

Definition at line 238 of file FormsIntegrators.hpp.

◆ rowSide

template<AssemblyType A, typename EleOp >
int MoFEM::OpBaseImpl< A, EleOp >::rowSide
protected

row side number

Examples
PlasticOpsLargeStrains.hpp.

Definition at line 232 of file FormsIntegrators.hpp.

◆ rowType

template<AssemblyType A, typename EleOp >
EntityType MoFEM::OpBaseImpl< A, EleOp >::rowType
protected

row type

Examples
PlasticOpsLargeStrains.hpp.

Definition at line 234 of file FormsIntegrators.hpp.

◆ timeScalingFun

template<AssemblyType A, typename EleOp >
TimeFun MoFEM::OpBaseImpl< A, EleOp >::timeScalingFun

assumes that time variable is set

Definition at line 203 of file FormsIntegrators.hpp.


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