v0.15.0
Loading...
Searching...
No Matches
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
 

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.
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntData &row_data)
 Do calculations for the right hand side.
 

Public Attributes

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

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.
 
virtual MoFEMErrorCode aSsemble (EntData &row_data, EntData &col_data, const bool trans)
 
virtual MoFEMErrorCode iNtegrate (EntData &data)
 Class dedicated to integrate operator.
 
virtual MoFEMErrorCode aSsemble (EntData &data)
 
virtual size_t getNbOfBaseFunctions (EntitiesFieldData::EntData &data)
 Get number of base functions.
 

Protected Attributes

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

Detailed Description

template<AssemblyType A, typename EleOp>
struct MoFEM::OpBaseImpl< A, EleOp >
Examples
ThermoElasticOps.hpp, schur_test_diag_mat.cpp, and thermo_elastic.cpp.

Definition at line 178 of file FormsIntegrators.hpp.

Member Typedef Documentation

◆ EntData

Definition at line 180 of file FormsIntegrators.hpp.

◆ MatSetValuesHook

template<AssemblyType A, typename EleOp >
using MoFEM::OpBaseImpl< A, EleOp >::MatSetValuesHook
Initial value:
boost::function<MoFEMErrorCode(
ForcesAndSourcesCore::UserDataOperator *op_ptr,
const EntitiesFieldData::EntData &row_data,
const EntitiesFieldData::EntData &col_data, MatrixDouble &m)>
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
FTensor::Index< 'm', 3 > m

Definition at line 215 of file FormsIntegrators.hpp.

◆ OpType

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

Definition at line 179 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 182 of file FormsIntegrators.hpp.

184 : EleOp(row_field_name, col_field_name, type, false),
185 assembleTranspose(false), onlyTranspose(false), entsPtr(ents_ptr) {}
Ele::UserDataOperator EleOp
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

Definition at line 504 of file FormsIntegrators.hpp.

504 {
505 if (!this->timeScalingFun.empty())
506 this->locF *= this->timeScalingFun(this->getFEMethod()->ts_t);
507 if (!this->feScalingFun.empty())
508 this->locF *= this->feScalingFun(this->getFEMethod());
509
510 return VecSetValues<AssemblyTypeSelector<A>>(this->getKSPf(), data,
511 this->locF, ADD_VALUES);
512}
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
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

Definition at line 477 of file FormsIntegrators.hpp.

479 {
481
482 if (!this->timeScalingFun.empty())
483 this->locMat *= this->timeScalingFun(this->getFEMethod()->ts_t);
484 if (!this->feScalingFun.empty())
485 this->locMat *= this->feScalingFun(this->getFEMethod());
486
487 // Assemble transpose
488 if (transpose) {
489 this->locMatTranspose.resize(this->locMat.size2(), this->locMat.size1(),
490 false);
491 noalias(this->locMatTranspose) = trans(this->locMat);
492 CHKERR matSetValuesHook(this, col_data, row_data, this->locMatTranspose);
493 }
494
495 if (!this->onlyTranspose) {
496 // assemble local matrix
497 CHKERR matSetValuesHook(this, row_data, col_data, this->locMat);
498 }
499
501}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
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 446 of file FormsIntegrators.hpp.

447 {
449
450 if (entsPtr) {
451 if (entsPtr->find(this->getFEEntityHandle()) == entsPtr->end())
453 }
454
455 // get number of dofs on row
456 nbRows = row_data.getIndices().size();
457 rowSide = row_side;
458 rowType = row_type;
459
460 if (!nbRows)
462 // get number of integration points
463 nbIntegrationPts = EleOp::getGaussPts().size2();
464 // get row base functions
466 // resize and clear the right hand side vector
467 locF.resize(nbRows);
468 locF.clear();
469 // integrate local vector
470 CHKERR this->iNtegrate(row_data);
471 // assemble local vector
472 CHKERR this->aSsemble(row_data);
474}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
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.
virtual size_t getNbOfBaseFunctions(EntitiesFieldData::EntData &data)
Get number of base functions.
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 391 of file FormsIntegrators.hpp.

394 {
396
397 if (entsPtr) {
398 if (entsPtr->find(this->getFEEntityHandle()) == entsPtr->end())
400 }
401
402 // get number of dofs on row
403 nbRows = row_data.getIndices().size();
404 // if no dofs on row, exit that work, nothing to do here
405 if (!nbRows)
407 rowSide = row_side;
408 rowType = row_type;
409 // get number of dofs on column
410 nbCols = col_data.getIndices().size();
411 // if no dofs on column, exit nothing to do here
412 if (!nbCols)
414 colSide = col_side;
415 colType = col_type;
416 // get number of integration points
417 nbIntegrationPts = EleOp::getGaussPts().size2();
418 // get row base functions
420
421 // set size of local entity bock
422 locMat.resize(nbRows, nbCols, false);
423 // clear matrix
424 locMat.clear();
425 // integrate local matrix for entity block
426 CHKERR this->iNtegrate(row_data, col_data);
427
428 // assemble local matrix
429 auto check_if_assemble_transpose = [&] {
430 if (this->sYmm) {
431 if (row_side != col_side || row_type != col_type)
432 return true;
433 else
434 return false;
435 } else if (assembleTranspose) {
436 return true;
437 }
438
439 return false;
440 };
441 CHKERR aSsemble(row_data, col_data, check_if_assemble_transpose());
443}
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 232 of file FormsIntegrators.hpp.

232 {
234 }
FTensor::Tensor2< FTensor::PackPtr< double *, S >, DIM1, DIM2 > getFTensor2FromArray(MatrixDouble &data, const size_t rr, const size_t cc=0)

◆ getNbOfBaseFunctions()

template<AssemblyType A, typename EleOp >
size_t OpBaseImpl::getNbOfBaseFunctions ( EntitiesFieldData::EntData & data)
protectedvirtual

Get number of base functions.

Parameters
data
Returns
number of base functions

Definition at line 351 of file FormsIntegrators.hpp.

351 {
352 if (!data.getNSharedPtr(data.getBase())) {
353 #ifndef NDEBUG
354 MOFEM_LOG("SELF", Sev::warning)
355 << "Ptr to base " << ApproximationBaseNames[data.getBase()]
356 << " functions is null, returning 0";
357 #endif // NDEBUG
358 return 0;
359 }
360 auto nb_base_functions = data.getN().size2();
361 if (data.getBase() != USER_BASE) {
362 switch (data.getSpace()) {
363 case NOSPACE:
364 break;
365 case NOFIELD:
366 break;
367 case H1:
368 break;
369 case HCURL:
370 case HDIV:
371 nb_base_functions /= 3;
372#ifndef NDEBUG
373 if (data.getN().size2() % 3) {
374 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
375 "Number of base functions is not divisible by 3");
376 }
377#endif
378 break;
379 case L2:
380 break;
381 default:
382 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
383 "Space %s not implemented", FieldSpaceNames[data.getSpace()]);
384 }
385 }
386 return nb_base_functions;
387}
@ USER_BASE
user implemented approximation base
Definition definitions.h:68
@ L2
field with C-1 continuity
Definition definitions.h:88
@ NOFIELD
scalar or vector of scalars describe (no true field)
Definition definitions.h:84
@ H1
continuous field
Definition definitions.h:85
@ NOSPACE
Definition definitions.h:83
@ HCURL
field with continuous tangents
Definition definitions.h:86
@ HDIV
field with continuous normal traction
Definition definitions.h:87
static const char *const FieldSpaceNames[]
Definition definitions.h:92
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
static const char *const ApproximationBaseNames[]
Definition definitions.h:72
#define MOFEM_LOG(channel, severity)
Log.

◆ 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 226 of file FormsIntegrators.hpp.

226 {
228 }
auto getFTensor1FromArray(VectorDouble &data)
Get FTensor1 from array.

◆ 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 Example::OpFluxRhs, Example::OpRadiationRhs, MoFEM::OpBaseTimesScalarImpl< 1, S, GAUSS, OpBase >, MoFEM::OpBaseTimesVectorImpl< 1, FIELD_DIM, S, GAUSS, OpBase >, MoFEM::OpBaseTimesVectorImpl< 3, FIELD_DIM, S, GAUSS, OpBase >, MoFEM::OpBrokenSpaceConstrainDHybridImpl< FIELD_DIM, GAUSS, OpBase >, MoFEM::OpConvectiveTermRhsImpl< 1, 1, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpConvectiveTermRhsImpl< 1, FIELD_DIM, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpGradTimesSymTensorImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpGradTimesTensorImpl< 1, 1, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpGradTimesTensorImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpMixDivTimesUImpl< 1, FIELD_DIM, FIELD_DIM, GAUSS, OpBase, CoordSys >, MoFEM::OpMixDivTimesUImpl< 3, 1, SPACE_DIM, GAUSS, OpBase, CoordSys >, MoFEM::OpMixDivTimesUImpl< 3, FIELD_DIM, SPACE_DIM, GAUSS, OpBase, CoordSys >, MoFEM::OpMixTensorTimesGradUImpl< SPACE_DIM, GAUSS, OpBase >, MoFEM::OpMixVecTimesDivLambdaImpl< SPACE_DIM, GAUSS, OpBase >, MoFEM::OpNormalMixVecTimesScalarImpl< 2, GAUSS, OpBase >, MoFEM::OpNormalMixVecTimesScalarImpl< 3, GAUSS, OpBase >, MoFEM::OpNormalMixVecTimesVectorFieldImpl< SPACE_DIM, GAUSS, OpBase >, MoFEM::OpSourceImpl< 1, 1, GAUSS, SourceFunctionSpecialization::S< OpBase > >, MoFEM::OpSourceImpl< 1, FIELD_DIM, GAUSS, SourceFunctionSpecialization::S< OpBase > >, and MoFEM::OpSourceImpl< 3, FIELD_DIM, GAUSS, SourceFunctionSpecialization::S< OpBase > >.

Definition at line 271 of file FormsIntegrators.hpp.

271 {
273 }

◆ 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 Example::OpRadiationLhs, MoFEM::OpConvectiveTermLhsDuImpl< 1, 1, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpConvectiveTermLhsDuImpl< 1, FIELD_DIM, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpConvectiveTermLhsDyImpl< 1, 1, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpConvectiveTermLhsDyImpl< 1, FIELD_DIM, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpGradGradImpl< 1, 1, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpGradGradImpl< 1, FIELD_DIM, SPACE_DIM, GAUSS, OpBase >, MoFEM::OpGradGradSymTensorGradGradImpl< 1, 1, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpGradTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >, MoFEM::OpMassImpl< 1, 1, GAUSS, OpBase >, MoFEM::OpMassImpl< 1, FIELD_DIM, GAUSS, OpBase >, MoFEM::OpMassImpl< 3, 4, GAUSS, OpBase >, MoFEM::OpMassImpl< 3, 9, GAUSS, OpBase >, MoFEM::OpMassImpl< 3, FIELD_DIM, GAUSS, OpBase >, MoFEM::OpMixDivTimesScalarImpl< SPACE_DIM, GAUSS, OpBase >, MoFEM::OpMixDivTimesVecImpl< SPACE_DIM, GAUSS, OpBase, CoordSys >, MoFEM::OpMixScalarTimesDivImpl< SPACE_DIM, GAUSS, OpBase, COORDINATE_SYSTEM >, MoFEM::OpMixTensorTimesGradImpl< SPACE_DIM, GAUSS, OpBase >, MoFEM::OpMixVectorTimesGradImpl< 1, SPACE_DIM, SPACE_DIM, GAUSS, OpBase >, and MoFEM::OpMixVectorTimesGradImpl< 3, SPACE_DIM, SPACE_DIM, GAUSS, OpBase >.

Definition at line 259 of file FormsIntegrators.hpp.

259 {
261 }

Member Data Documentation

◆ assembleTranspose

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

Definition at line 246 of file FormsIntegrators.hpp.

◆ colSide

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

column side number

Definition at line 242 of file FormsIntegrators.hpp.

◆ colType

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

column type

Definition at line 244 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 213 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 212 of file FormsIntegrators.hpp.

◆ locF

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

local entity vector

Definition at line 251 of file FormsIntegrators.hpp.

◆ locMat

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

local entity block matrix

Definition at line 249 of file FormsIntegrators.hpp.

◆ locMatTranspose

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

local entity block matrix

Definition at line 250 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) {
op_ptr->getKSPB(), row_data, col_data, m, ADD_VALUES);
}
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.

Definition at line 220 of file FormsIntegrators.hpp.

◆ nbCols

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

number if dof on column

Definition at line 237 of file FormsIntegrators.hpp.

◆ nbIntegrationPts

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

number of integration points

Definition at line 238 of file FormsIntegrators.hpp.

◆ nbRowBaseFunctions

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

number or row base functions

Definition at line 239 of file FormsIntegrators.hpp.

◆ nbRows

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

number of dofs on rows

Definition at line 236 of file FormsIntegrators.hpp.

◆ onlyTranspose

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

Definition at line 247 of file FormsIntegrators.hpp.

◆ rowSide

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

row side number

Definition at line 241 of file FormsIntegrators.hpp.

◆ rowType

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

row type

Definition at line 243 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 211 of file FormsIntegrators.hpp.


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