v0.13.1
Classes | Functions
Distributed mesh manager

Implementation of PETSc DM, managing interactions between mesh data structures and vectors and matrices. More...

Collaboration diagram for Distributed mesh manager:

Classes

struct  MoFEM::DMCtx
 PETSc Discrete Manager data structure. More...
 
struct  DMMGViaApproxOrdersCtx
 Structure for DM for multi-grid via approximation orders. More...
 

Functions

PetscErrorCode MoFEM::DMRegister_MoFEM (const char sname[])
 Register MoFEM problem. More...
 
PetscErrorCode MoFEM::DMMoFEMCreateMoFEM (DM dm, MoFEM::Interface *m_field_ptr, const char problem_name[], const MoFEM::BitRefLevel bit_level, const MoFEM::BitRefLevel bit_mask=MoFEM::BitRefLevel().set())
 Must be called by user to set MoFEM data structures. More...
 
PetscErrorCode MoFEM::DMMoFEMCreateSubDM (DM subdm, DM dm, const char problem_name[])
 Must be called by user to set Sub DM MoFEM data structures. More...
 
PetscErrorCode MoFEM::DMoFEMGetInterfacePtr (DM dm, MoFEM::Interface **m_field_ptr)
 Get pointer to MoFEM::Interface. More...
 
PetscErrorCode MoFEM::DMMoFEMGetProblemPtr (DM dm, const MoFEM::Problem **problem_ptr)
 Get pointer to problem data structure. More...
 
PetscErrorCode MoFEM::DMMoFEMSetSquareProblem (DM dm, PetscBool square_problem)
 set squared problem More...
 
PetscErrorCode MoFEM::DMMoFEMGetSquareProblem (DM dm, PetscBool *square_problem)
 get squared problem More...
 
PetscErrorCode MoFEM::DMMoFEMResolveSharedFiniteElements (DM dm, const char fe_name[])
 Resolve shared entities. More...
 
PetscErrorCode MoFEM::DMMoFEMGetProblemFiniteElementLayout (DM dm, const char fe_name[], PetscLayout *layout)
 Get finite elements layout in the problem. More...
 
PetscErrorCode MoFEM::DMMoFEMAddElement (DM dm, const char fe_name[])
 add element to dm More...
 
PetscErrorCode MoFEM::DMMoFEMUnSetElement (DM dm, const char fe_name[])
 unset element from dm More...
 
PetscErrorCode MoFEM::DMoFEMMeshToLocalVector (DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
 set local (or ghosted) vector values on mesh for partition only More...
 
PetscErrorCode MoFEM::DMoFEMMeshToGlobalVector (DM dm, Vec g, InsertMode mode, ScatterMode scatter_mode)
 set ghosted vector values on all existing mesh entities More...
 
PetscErrorCode MoFEM::DMoFEMPreProcessFiniteElements (DM dm, MoFEM::FEMethod *method)
 execute finite element method for each element in dm (problem) More...
 
PetscErrorCode MoFEM::DMoFEMPostProcessFiniteElements (DM dm, MoFEM::FEMethod *method)
 execute finite element method for each element in dm (problem) More...
 
PetscErrorCode MoFEM::DMoFEMLoopFiniteElementsUpAndLowRank (DM dm, const char fe_name[], MoFEM::FEMethod *method, int low_rank, int up_rank, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
 Executes FEMethod for finite elements in DM. More...
 
PetscErrorCode MoFEM::DMoFEMLoopFiniteElementsUpAndLowRank (DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, int low_rank, int up_rank, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
 Executes FEMethod for finite elements in DM. More...
 
PetscErrorCode MoFEM::DMoFEMLoopFiniteElements (DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
 Executes FEMethod for finite elements in DM. More...
 
PetscErrorCode MoFEM::DMoFEMLoopFiniteElements (DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
 Executes FEMethod for finite elements in DM. More...
 
PetscErrorCode MoFEM::DMoFEMLoopDofs (DM dm, const char field_name[], MoFEM::DofMethod *method)
 execute method for dofs on field in problem More...
 
PetscErrorCode MoFEM::DMMoFEMKSPSetComputeRHS (DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
 set KSP right hand side evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMKSPSetComputeRHS (DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
 set KSP right hand side evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMKSPSetComputeOperators (DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
 Set KSP operators and push mofem finite element methods. More...
 
PetscErrorCode MoFEM::DMMoFEMKSPSetComputeOperators (DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
 Set KSP operators and push mofem finite element methods. More...
 
PetscErrorCode MoFEM::DMMoFEMSNESSetFunction (DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
 set SNES residual evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMSNESSetFunction (DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
 set SNES residual evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMSNESSetJacobian (DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
 set SNES Jacobian evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMSNESSetJacobian (DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
 set SNES Jacobian evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMTSSetIFunction (DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
 set TS implicit function evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMTSSetIFunction (DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
 set TS implicit function evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMTSSetIJacobian (DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
 set TS Jacobian evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMTSSetIJacobian (DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
 set TS Jacobian evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMTSSetI2Function (DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
 set TS implicit function evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMTSSetI2Function (DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
 set TS implicit function evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMTSSetI2Jacobian (DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
 set TS Jacobian evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMTSSetI2Jacobian (DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
 set TS Jacobian evaluation function More...
 
PetscErrorCode MoFEM::DMMoFEMGetKspCtx (DM dm, MoFEM::KspCtx **ksp_ctx)
 get MoFEM::KspCtx data structure More...
 
PetscErrorCode MoFEM::DMMoFEMGetKspCtx (DM dm, const boost::shared_ptr< MoFEM::KspCtx > &ksp_ctx)
 get MoFEM::KspCtx data structure More...
 
PetscErrorCode MoFEM::DMMoFEMSetKspCtx (DM dm, boost::shared_ptr< MoFEM::KspCtx > ksp_ctx)
 set MoFEM::KspCtx data structure More...
 
PetscErrorCode MoFEM::DMMoFEMGetSnesCtx (DM dm, MoFEM::SnesCtx **snes_ctx)
 get MoFEM::SnesCtx data structure More...
 
PetscErrorCode MoFEM::DMMoFEMGetSnesCtx (DM dm, const boost::shared_ptr< MoFEM::SnesCtx > &snes_ctx)
 get MoFEM::SnesCtx data structure More...
 
PetscErrorCode MoFEM::DMMoFEMSetSnesCtx (DM dm, boost::shared_ptr< MoFEM::SnesCtx > snes_ctx)
 Set MoFEM::SnesCtx data structure. More...
 
PetscErrorCode MoFEM::DMMoFEMGetTsCtx (DM dm, MoFEM::TsCtx **ts_ctx)
 get MoFEM::TsCtx data structure More...
 
PetscErrorCode MoFEM::DMMoFEMGetTsCtx (DM dm, const boost::shared_ptr< MoFEM::TsCtx > &ts_ctx)
 get MoFEM::TsCtx data structure More...
 
PetscErrorCode MoFEM::DMMoFEMSetTsCtx (DM dm, boost::shared_ptr< MoFEM::TsCtx > ts_ctx)
 Set MoFEM::TsCtx data structure. More...
 
PetscErrorCode MoFEM::DMMoFEMSetIsPartitioned (DM dm, PetscBool is_partitioned)
 
PetscErrorCode MoFEM::DMMoFEMGetIsPartitioned (DM dm, PetscBool *is_partitioned)
 
PetscErrorCode MoFEM::DMSetOperators_MoFEM (DM dm)
 Set operators for MoFEM dm. More...
 
PetscErrorCode MoFEM::DMCreate_MoFEM (DM dm)
 Create dm data structure with MoFEM data structure. More...
 
PetscErrorCode MoFEM::DMDestroy_MoFEM (DM dm)
 Destroys dm with MoFEM data structure. More...
 
PetscErrorCode MoFEM::DMCreateGlobalVector_MoFEM (DM dm, Vec *g)
 DMShellSetCreateGlobalVector. More...
 
PetscErrorCode MoFEM::DMCreateGlobalVector_MoFEM (DM dm, SmartPetscObj< Vec > &g_ptr)
 DMShellSetCreateGlobalVector. More...
 
PetscErrorCode MoFEM::DMCreateLocalVector_MoFEM (DM dm, Vec *l)
 DMShellSetCreateLocalVector. More...
 
PetscErrorCode MoFEM::DMCreateMatrix_MoFEM (DM dm, Mat *M)
 
PetscErrorCode MoFEM::DMCreateMatrix_MoFEM (DM dm, SmartPetscObj< Mat > &M)
 
PetscErrorCode MoFEM::DMSetFromOptions_MoFEM (DM dm)
 
PetscErrorCode MoFEM::DMSetUp_MoFEM (DM dm)
 
PetscErrorCode MoFEM::DMSubDMSetUp_MoFEM (DM subdm)
 
PetscErrorCode MoFEM::DMMoFEMAddSubFieldRow (DM dm, const char field_name[], EntityType lo_type=MBVERTEX, EntityType hi_type=MBMAXTYPE)
 
PetscErrorCode MoFEM::DMMoFEMAddSubFieldCol (DM dm, const char field_name[], EntityType lo_type=MBVERTEX, EntityType hi_type=MBMAXTYPE)
 
PetscErrorCode MoFEM::DMMoFEMGetIsSubDM (DM dm, PetscBool *is_sub_dm)
 
PetscErrorCode MoFEM::DMMoFEMAddRowCompositeProblem (DM dm, const char prb_name[])
 Add problem to composite DM on row. More...
 
PetscErrorCode MoFEM::DMMoFEMAddColCompositeProblem (DM dm, const char prb_name[])
 Add problem to composite DM on col. More...
 
PetscErrorCode MoFEM::DMMoFEMGetIsCompDM (DM dm, PetscBool *is_comp_dm)
 Get if this DM is composite DM. More...
 
PetscErrorCode MoFEM::DMGlobalToLocalBegin_MoFEM (DM dm, Vec, InsertMode, Vec)
 
PetscErrorCode MoFEM::DMGlobalToLocalEnd_MoFEM (DM dm, Vec, InsertMode, Vec)
 
PetscErrorCode MoFEM::DMLocalToGlobalBegin_MoFEM (DM, Vec, InsertMode, Vec)
 
PetscErrorCode MoFEM::DMLocalToGlobalEnd_MoFEM (DM, Vec, InsertMode, Vec)
 
PetscErrorCode MoFEM::DMCreateFieldIS_MoFEM (DM dm, PetscInt *numFields, char ***fieldNames, IS **fields)
 
PetscErrorCode MoFEM::DMMoFEMGetFieldIS (DM dm, RowColData rc, const char field_name[], IS *is)
 get field is in the problem More...
 
auto MoFEM::smartCreateDMMatrix (DM dm)
 Get smart matrix from DM. More...
 
auto MoFEM::smartCreateDMVector (DM dm)
 Get smart vector from DM. More...
 
MoFEMErrorCode DMMGViaApproxOrdersPushBackCoarseningIS (DM, IS is, Mat A, Mat *subA, bool create_sub_matrix, bool shell_sub_a)
 Push back coarsening level to MG via approximation orders. More...
 
MoFEMErrorCode DMMGViaApproxOrdersPopBackCoarseningIS (DM)
 Pop is form MG via approximation orders. More...
 
MoFEMErrorCode DMMGViaApproxOrdersClearCoarseningIS (DM)
 Clear approximation orders. More...
 
MoFEMErrorCode DMRegister_MGViaApproxOrders (const char sname[])
 Register DM for Multi-Grid via approximation orders. More...
 
MoFEMErrorCode DMCreateMatrix_MGViaApproxOrders (DM dm, Mat *M)
 Create matrix for Multi-Grid via approximation orders. More...
 
MoFEMErrorCode DMCoarsen_MGViaApproxOrders (DM dm, MPI_Comm comm, DM *dmc)
 Coarsen DM. More...
 

Detailed Description

Implementation of PETSc DM, managing interactions between mesh data structures and vectors and matrices.

DM objects are used to manage communication between the algebraic structures in PETSc (Vec and Mat) and mesh data structures in PDE-based (or other) simulations.

DM is abstract interface, here is it particular implementation for MoFEM code.

Function Documentation

◆ DMCoarsen_MGViaApproxOrders()

MoFEMErrorCode DMCoarsen_MGViaApproxOrders ( DM  dm,
MPI_Comm  comm,
DM *  dmc 
)

Coarsen DM.

Not used directly by user

Parameters
dmDistributed mesh data structure
commCommunicator
dmcCoarse distributed mesh data structure
Returns
Error code

Definition at line 473 of file PCMGSetUpViaApproxOrders.cpp.

473 {
474 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
476 GET_DM_FIELD(dm);
477 CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
478 CHKERR DMCreate(comm, dmc);
479 (*dmc)->data = dm->data;
480 DMType type;
481 CHKERR DMGetType(dm, &type);
482 CHKERR DMSetType(*dmc, type);
483 CHKERR PetscObjectReference((PetscObject)(*dmc));
484 PetscInfo1(dm, "Coarsen DMMGViaApproxOrders leveldown = %d\n", dm->leveldown);
486}
#define GET_DM_FIELD(DM)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
#define CHKERR
Inline error check.
Definition: definitions.h:548

◆ DMCreate_MoFEM()

PetscErrorCode MoFEM::DMCreate_MoFEM ( DM  dm)

Create dm data structure with MoFEM data structure.

Definition at line 87 of file DMMMoFEM.cpp.

87 {
88 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
90 dm->data = new DMCtx();
93}
PetscErrorCode DMSetOperators_MoFEM(DM dm)
Set operators for MoFEM dm.
Definition: DMMMoFEM.cpp:65

◆ DMCreateFieldIS_MoFEM()

PetscErrorCode MoFEM::DMCreateFieldIS_MoFEM ( DM  dm,
PetscInt *  numFields,
char ***  fieldNames,
IS **  fields 
)

Creates a set of IS objects with the global indices of dofs for each field

Parameters
dmThe number of fields (or NULL if not requested)

Output:

Parameters
numFieldsThe number of fields (or NULL if not requested)
fieldNamesThe name for each field (or NULL if not requested)
fieldsThe global indices for each field (or NULL if not requested)
Returns
error code
Note
The user is responsible for freeing all requested arrays. In particular, every entry of names should be freed with PetscFree(), every entry of fields should be destroyed with ISDestroy(), and both arrays should be freed with PetscFree().

Definition at line 1390 of file DMMMoFEM.cpp.

1391 {
1392 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1394
1395 if (numFields) {
1396 *numFields = 0;
1397 }
1398 if (fieldNames) {
1399 *fieldNames = NULL;
1400 }
1401 if (fields) {
1402 *fields = NULL;
1403 }
1404
1405 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1406 auto fields_ptr = dm_field->mField_ptr->get_fields();
1407 Field_multiIndex::iterator fit, hi_fit;
1408 fit = fields_ptr->begin();
1409 hi_fit = fields_ptr->end();
1410 *numFields = std::distance(fit, hi_fit);
1411
1412 if (fieldNames) {
1413 CHKERR PetscMalloc1(*numFields, fieldNames);
1414 }
1415 if (fields) {
1416 CHKERR PetscMalloc1(*numFields, fields);
1417 }
1418
1419 for (int f = 0; fit != hi_fit; fit++, f++) {
1420 if (fieldNames) {
1421 CHKERR PetscStrallocpy(fit->get()->getName().c_str(),
1422 (char **)&(*fieldNames)[f]);
1423 }
1424 if (fields) {
1425 CHKERR dm_field->mField_ptr->getInterface<ISManager>()
1426 ->isCreateProblemFieldAndRank(
1427 dm_field->problemPtr->getName(), ROW, fit->get()->getName(), 0,
1428 fit->get()->getNbOfCoeffs(), &(*fields)[f]);
1429 }
1430 }
1431
1433}
@ ROW
Definition: definitions.h:136

◆ DMCreateGlobalVector_MoFEM() [1/2]

PetscErrorCode MoFEM::DMCreateGlobalVector_MoFEM ( DM  dm,
SmartPetscObj< Vec > &  g_ptr 
)

DMShellSetCreateGlobalVector.

sets the routine to create a global vector associated with the shell DM

Definition at line 1136 of file DMMMoFEM.cpp.

1136 {
1137 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1139 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1140 CHKERR dm_field->mField_ptr->getInterface<VecManager>()->vecCreateGhost(
1141 dm_field->problemName, COL, g_ptr);
1142 CHKERR VecSetDM(g_ptr, dm);
1144}
@ COL
Definition: definitions.h:136
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453

◆ DMCreateGlobalVector_MoFEM() [2/2]

PetscErrorCode MoFEM::DMCreateGlobalVector_MoFEM ( DM  dm,
Vec *  g 
)

DMShellSetCreateGlobalVector.

sets the routine to create a global vector associated with the shell DM

Examples
elasticity.cpp, elasticity_mixed_formulation.cpp, ep.cpp, reaction_diffusion.cpp, and test_cache_on_entities.cpp.

Definition at line 1126 of file DMMMoFEM.cpp.

1126 {
1127 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1129 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1130 CHKERR dm_field->mField_ptr->getInterface<VecManager>()->vecCreateGhost(
1131 dm_field->problemName, COL, g);
1132 CHKERR VecSetDM(*g, dm);
1134}
constexpr double g

◆ DMCreateLocalVector_MoFEM()

PetscErrorCode MoFEM::DMCreateLocalVector_MoFEM ( DM  dm,
Vec *  l 
)

DMShellSetCreateLocalVector.

sets the routine to create a local vector associated with the shell DM

Definition at line 1146 of file DMMMoFEM.cpp.

1146 {
1147 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1149 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1150 CHKERR dm_field->mField_ptr->getInterface<VecManager>()->vecCreateSeq(
1151 dm_field->problemName, COL, l);
1152 CHKERR VecSetDM(*l, dm);
1154}
FTensor::Index< 'l', 3 > l

◆ DMCreateMatrix_MGViaApproxOrders()

MoFEMErrorCode DMCreateMatrix_MGViaApproxOrders ( DM  dm,
Mat *  M 
)

Create matrix for Multi-Grid via approximation orders.

Not used directly by user

Parameters
dmDistributed mesh data structure
MMatrix
Returns
Error code

Definition at line 441 of file PCMGSetUpViaApproxOrders.cpp.

441 {
442
443 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
445 GET_DM_FIELD(dm);
446
447 int leveldown = dm->leveldown;
448
449 if (dm_field->kspOperators.empty()) {
451 } else {
452 MPI_Comm comm;
453 CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
454 if (dm_field->kspOperators.empty()) {
455 SETERRQ(comm, MOFEM_DATA_INCONSISTENCY,
456 "data inconsistency, operator can not be set");
457 }
458 if (static_cast<int>(dm_field->kspOperators.size()) < leveldown) {
459 SETERRQ(comm, MOFEM_DATA_INCONSISTENCY,
460 "data inconsistency, no IS for that level");
461 }
462 *M = dm_field->kspOperators[dm_field->kspOperators.size() - 1 - leveldown];
463 CHKERR PetscObjectReference((PetscObject)*M);
464 CHKERR MatSetDM(*M, dm);
465 }
466
467 PetscInfo1(dm, "Create Matrix DMMGViaApproxOrders leveldown = %d\n",
468 leveldown);
469
471}
static Index< 'M', 3 > M
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:44
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
Definition: DMMMoFEM.cpp:1156

◆ DMCreateMatrix_MoFEM() [1/2]

PetscErrorCode MoFEM::DMCreateMatrix_MoFEM ( DM  dm,
Mat *  M 
)

DMShellSetCreateMatrix

sets the routine to create a matrix associated with the shell DM

Examples
EshelbianPlasticity.cpp, dm_build_partitioned_mesh.cpp, eigen_elastic.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, ep.cpp, and reaction_diffusion.cpp.

Definition at line 1156 of file DMMMoFEM.cpp.

1156 {
1157 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1159 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1160 if (strcmp(dm->mattype, MATMPIAIJ) == 0) {
1161 CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1162 ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(dm_field->problemName,
1163 M);
1164 } else if (strcmp(dm->mattype, MATAIJ) == 0) {
1165 CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1166 ->createSeqAIJWithArrays<PetscLocalIdx_mi_tag>(dm_field->problemName,
1167 M);
1168 } else {
1169 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
1170 "Matrix type not implemented");
1171 }
1172 CHKERR MatSetDM(*M, dm);
1174}
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:45

◆ DMCreateMatrix_MoFEM() [2/2]

PetscErrorCode MoFEM::DMCreateMatrix_MoFEM ( DM  dm,
SmartPetscObj< Mat > &  M 
)

DMShellSetCreateMatrix

sets the routine to create a matrix associated with the shell DM

Definition at line 1176 of file DMMMoFEM.cpp.

1176 {
1177 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1179 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1180 if (strcmp(dm->mattype, MATMPIAIJ) == 0) {
1181 CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1182 ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(dm_field->problemName,
1183 M);
1184 } else if (strcmp(dm->mattype, MATAIJ) == 0) {
1185 CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1186 ->createSeqAIJWithArrays<PetscLocalIdx_mi_tag>(dm_field->problemName,
1187 M);
1188 } else {
1189 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
1190 "Matrix type not implemented");
1191 }
1192 CHKERR MatSetDM(M, dm);
1194}

◆ DMDestroy_MoFEM()

PetscErrorCode MoFEM::DMDestroy_MoFEM ( DM  dm)

Destroys dm with MoFEM data structure.

destroy the MoFEM structure

Definition at line 95 of file DMMMoFEM.cpp.

95 {
96 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
97 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
99
100 MPI_Comm comm;
101 CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
102
103 int result;
104 MPI_Comm_compare(comm, PETSC_COMM_SELF, &result);
105 if (result == MPI_IDENT)
106 MOFEM_LOG("DMSELF", Sev::noisy)
107 << "MoFEM DM destroy for problem " << dm_field->problemName
108 << " referenceNumber " << dm_field->referenceNumber;
109 else
110 MOFEM_LOG("DMWORLD", Sev::noisy)
111 << "MoFEM DM destroy for problem " << dm_field->problemName
112 << " referenceNumber " << dm_field->referenceNumber;
113
114 if (dm_field->referenceNumber == 0) {
115 if (dm_field->destroyProblem) {
116
117 if (dm_field->mField_ptr->check_problem(dm_field->problemName)) {
118 dm_field->mField_ptr->delete_problem(dm_field->problemName);
119 } // else problem has to be deleted by the user
120 }
121
122 delete static_cast<DMCtx *>(dm->data);
123
124 } else
125 --dm_field->referenceNumber;
126
128}
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:311

◆ DMGlobalToLocalBegin_MoFEM()

PetscErrorCode MoFEM::DMGlobalToLocalBegin_MoFEM ( DM  dm,
Vec  g,
InsertMode  mode,
Vec  l 
)

DMShellSetGlobalToLocal

the routine that begins the global to local scatter

Definition at line 1318 of file DMMMoFEM.cpp.

1319 {
1320 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1322 CHKERR VecGhostUpdateBegin(g, INSERT_VALUES, SCATTER_FORWARD);
1324}

◆ DMGlobalToLocalEnd_MoFEM()

PetscErrorCode MoFEM::DMGlobalToLocalEnd_MoFEM ( DM  dm,
Vec  g,
InsertMode  mode,
Vec  l 
)

DMShellSetGlobalToLocal

the routine that begins the global to local scatter

Definition at line 1326 of file DMMMoFEM.cpp.

1326 {
1328 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1330
1331 CHKERR VecGhostUpdateEnd(g, INSERT_VALUES, SCATTER_FORWARD);
1332
1333 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1334 int nb_dofs = dm_field->problemPtr->getNbLocalDofsRow();
1335 int nb_ghost = dm_field->problemPtr->getNbGhostDofsRow();
1336
1337 double *array_loc, *array_glob;
1338 CHKERR VecGetArray(l, &array_loc);
1339 CHKERR VecGetArray(g, &array_glob);
1340 switch (mode) {
1341 case INSERT_VALUES:
1342 cblas_dcopy(nb_dofs + nb_ghost, array_glob, 1, array_loc, 1);
1343 break;
1344 case ADD_VALUES:
1345 cblas_daxpy(nb_dofs + nb_ghost, 1, array_glob, 1, array_loc, 1);
1346 break;
1347 default:
1348 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1349 }
1350 CHKERR VecRestoreArray(l, &array_loc);
1351 CHKERR VecRestoreArray(g, &array_glob);
1353}

◆ DMLocalToGlobalBegin_MoFEM()

PetscErrorCode MoFEM::DMLocalToGlobalBegin_MoFEM ( DM  dm,
Vec  l,
InsertMode  mode,
Vec  g 
)

DMShellSetLocalToGlobal

the routine that begins the local to global scatter

DMShellSetLocalToGlobal

the routine that ends the local to global scatter

Definition at line 1355 of file DMMMoFEM.cpp.

1356 {
1357
1358 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1360
1361 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1362 int nb_dofs = dm_field->problemPtr->getNbLocalDofsRow();
1363 int nb_ghost = dm_field->problemPtr->getNbGhostDofsRow();
1364
1365 double *array_loc, *array_glob;
1366 CHKERR VecGetArray(l, &array_loc);
1367 CHKERR VecGetArray(g, &array_glob);
1368 switch (mode) {
1369 case INSERT_VALUES:
1370 cblas_dcopy(nb_dofs + nb_ghost, array_loc, 1, array_glob, 1);
1371 break;
1372 case ADD_VALUES:
1373 cblas_daxpy(nb_dofs + nb_ghost, 1, array_loc, 1, array_glob, 1);
1374 break;
1375 default:
1376 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1377 }
1378 CHKERR VecRestoreArray(l, &array_loc);
1379 CHKERR VecRestoreArray(g, &array_glob);
1380
1382}

◆ DMLocalToGlobalEnd_MoFEM()

PetscErrorCode MoFEM::DMLocalToGlobalEnd_MoFEM ( DM  ,
Vec  l,
InsertMode  mode,
Vec  g 
)

DMShellSetLocalToGlobal

the routine that ends the local to global scatter

Definition at line 1384 of file DMMMoFEM.cpp.

1384 {
1385 //
1388}

◆ DMMGViaApproxOrdersClearCoarseningIS()

MoFEMErrorCode DMMGViaApproxOrdersClearCoarseningIS ( DM  dm)

Clear approximation orders.

Parameters
DMdm
Returns
Error code

Definition at line 287 of file PCMGSetUpViaApproxOrders.cpp.

287 {
288 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
290 GET_DM_FIELD(dm);
291 CHKERR dm_field->destroyCoarseningIS();
292 PetscInfo(dm, "Clear DMs data structures\n");
294}

◆ DMMGViaApproxOrdersPopBackCoarseningIS()

MoFEMErrorCode DMMGViaApproxOrdersPopBackCoarseningIS ( DM  dm)

Pop is form MG via approximation orders.

Parameters
DMdm
ispop back IS
Returns
error code

Definition at line 271 of file PCMGSetUpViaApproxOrders.cpp.

271 {
272 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
274 GET_DM_FIELD(dm);
275 if (dm_field->coarseningIS.back()) {
276 CHKERR ISDestroy(&dm_field->coarseningIS.back());
277 dm_field->coarseningIS.pop_back();
278 }
279 if (dm_field->kspOperators.back()) {
280 CHKERR MatDestroy(&dm_field->kspOperators.back());
281 }
282 dm_field->kspOperators.pop_back();
283 PetscInfo(dm, "Pop back IS to DMMGViaApproxOrders\n");
285}

◆ DMMGViaApproxOrdersPushBackCoarseningIS()

MoFEMErrorCode DMMGViaApproxOrdersPushBackCoarseningIS ( DM  dm,
IS  is,
Mat  A,
Mat *  subA,
bool  create_sub_matrix,
bool  shell_sub_a 
)

Push back coarsening level to MG via approximation orders.

Parameters
DMdiscrete manager
isPush back IS used for coarsening
AGet sub-matrix of A using is (that sets operators for coarsening levels)
subAReturning pointer to created sub matrix
subAIf true create sub matrix, otherwise in subA has to be valid pointer to subA
Returns
Error code

Definition at line 217 of file PCMGSetUpViaApproxOrders.cpp.

220 {
221 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
223 GET_DM_FIELD(dm);
224 dm_field->coarseningIS.push_back(is);
225 dm_field->shellMatrixCtxPtr.push_back(new PCMGSubMatrixCtx_private(A, is));
226 if (is) {
227 CHKERR PetscObjectReference((PetscObject)is);
228 }
229 if (is) {
230 IS is2 = is;
231 if (dm_field->aO) {
232 CHKERR ISDuplicate(is, &is2);
233 CHKERR ISCopy(is, is2);
234 CHKERR AOApplicationToPetscIS(dm_field->aO, is2);
235 }
236 if (create_sub_matrix) {
237 if (shell_sub_a) {
238 int n, N;
239 CHKERR ISGetSize(is, &N);
240 CHKERR ISGetLocalSize(is, &n);
241 MPI_Comm comm;
242 CHKERR PetscObjectGetComm((PetscObject)A, &comm);
243 CHKERR MatCreateShell(comm, n, n, N, N,
244 &(dm_field->shellMatrixCtxPtr.back()), subA);
245 CHKERR MatShellSetOperation(*subA, MATOP_MULT,
246 (void (*)(void))sub_mat_mult);
247 CHKERR MatShellSetOperation(*subA, MATOP_MULT_ADD,
248 (void (*)(void))sub_mat_mult_add);
249 CHKERR MatShellSetOperation(*subA, MATOP_SOR,
250 (void (*)(void))sub_mat_sor);
251 } else {
252#if PETSC_VERSION_GE(3, 8, 0)
253 CHKERR MatCreateSubMatrix(A, is2, is2, MAT_INITIAL_MATRIX, subA);
254#else
255 CHKERR MatGetSubMatrix(A, is2, is2, MAT_INITIAL_MATRIX, subA);
256#endif
257 }
258 }
259 if (dm_field->aO) {
260 CHKERR ISDestroy(&is2);
261 }
262 dm_field->kspOperators.push_back(*subA);
263 CHKERR PetscObjectReference((PetscObject)(*subA));
264 } else {
265 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
266 }
267 PetscInfo(dm, "Push back IS to DMMGViaApproxOrders\n");
269}
static Index< 'n', 3 > n
MoFEMErrorCode sub_mat_mult(Mat a, Vec x, Vec f)
MoFEMErrorCode sub_mat_sor(Mat mat, Vec b, PetscReal omega, MatSORType flag, PetscReal shift, PetscInt its, PetscInt lits, Vec x)
MoFEMErrorCode sub_mat_mult_add(Mat a, Vec x, Vec f)
double A
const int N
Definition: speed_test.cpp:3

◆ DMMoFEMAddColCompositeProblem()

PetscErrorCode MoFEM::DMMoFEMAddColCompositeProblem ( DM  dm,
const char  prb_name[] 
)

Add problem to composite DM on col.

This create block on col with DOFs from problem of given name

Parameters
dmthe DM object
prb_nameadd problem name
Returns
error code

Definition at line 344 of file DMMMoFEM.cpp.

344 {
345 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
347 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
348 if (!dm->data) {
349 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
350 "data structure for MoFEM not yet created");
351 }
352 if (!dm_field->isCompDM) {
353 dm_field->isCompDM = PETSC_TRUE;
354 }
355 if (dm_field->isSquareMatrix) {
356 SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
357 "No need to add problem on column when problem block structurally "
358 "symmetric");
359 }
360 dm_field->colCompPrb.push_back(prb_name);
362}
@ MOFEM_INVALID_DATA
Definition: definitions.h:49

◆ DMMoFEMAddElement()

PetscErrorCode MoFEM::DMMoFEMAddElement ( DM  dm,
const char  fe_name[] 
)

add element to dm

Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.
Examples
EshelbianPlasticity.cpp, MagneticElement.hpp, NonlinearElasticElementInterface.hpp, Remodeling.cpp, UnsaturatedFlow.hpp, analytical_poisson_field_split.cpp, cell_forces.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, free_surface.cpp, lorentz_force.cpp, minimal_surface_area.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, photon_diffusion.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, and test_jacobian_of_simple_contact_element.cpp.

Definition at line 462 of file DMMMoFEM.cpp.

462 {
463 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
465 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
466 ierr = dm_field->mField_ptr->modify_problem_add_finite_element(
467 dm_field->problemName, fe_name);
468 CHKERRG(ierr);
470}
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:496
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87

◆ DMMoFEMAddRowCompositeProblem()

PetscErrorCode MoFEM::DMMoFEMAddRowCompositeProblem ( DM  dm,
const char  prb_name[] 
)

Add problem to composite DM on row.

This create block on row with DOFs from problem of given name

Parameters
dmthe DM object
prb_nameadd problem name
Returns
error code

Definition at line 326 of file DMMMoFEM.cpp.

326 {
327 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
329 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
330 if (!dm->data) {
331 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
332 "data structure for MoFEM not yet created");
333 }
334 if (!dm_field->isCompDM) {
335 dm_field->isCompDM = PETSC_TRUE;
336 }
337 dm_field->rowCompPrb.push_back(prb_name);
338 if (dm_field->isSquareMatrix) {
339 dm_field->colCompPrb.push_back(prb_name);
340 }
342}

◆ DMMoFEMAddSubFieldCol()

PetscErrorCode MoFEM::DMMoFEMAddSubFieldCol ( DM  dm,
const char  field_name[],
EntityType  lo_type = MBVERTEX,
EntityType  hi_type = MBMAXTYPE 
)

Add field to sub dm problem on columns

Examples
analytical_poisson_field_split.cpp, cell_forces.cpp, dm_create_subdm.cpp, and free_surface.cpp.

Definition at line 258 of file DMMMoFEM.cpp.

259 {
260 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
262 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
263 if (!dm->data) {
264 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
265 "data structure for MoFEM not yet created");
266 }
267 if (!dm_field->isSubDM) {
268 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "this is not sub-dm");
269 }
270 dm_field->colFields.push_back(field_name);
271 if (lo_type != MBVERTEX || hi_type != MBMAXTYPE) {
272 if (!dm_field->mapTypeCol)
273 dm_field->mapTypeCol = boost::make_shared<
274 std::map<std::string, std::pair<EntityType, EntityType>>>();
275 (*dm_field->mapTypeCol)[field_name] =
276 std::pair<EntityType, EntityType>(lo_type, hi_type);
277 }
279}
constexpr auto field_name

◆ DMMoFEMAddSubFieldRow()

PetscErrorCode MoFEM::DMMoFEMAddSubFieldRow ( DM  dm,
const char  field_name[],
EntityType  lo_type = MBVERTEX,
EntityType  hi_type = MBMAXTYPE 
)

Add field to sub dm problem on rows

Examples
EshelbianPlasticity.cpp, analytical_poisson_field_split.cpp, cell_forces.cpp, dm_create_subdm.cpp, and free_surface.cpp.

Definition at line 235 of file DMMMoFEM.cpp.

236 {
237 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
239 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
240 if (!dm->data) {
241 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
242 "data structure for MoFEM not yet created");
243 }
244 if (!dm_field->isSubDM) {
245 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "this is not sub-dm");
246 }
247 dm_field->rowFields.push_back(field_name);
248 if (lo_type != MBVERTEX || hi_type != MBMAXTYPE) {
249 if (!dm_field->mapTypeRow)
250 dm_field->mapTypeRow = boost::make_shared<
251 std::map<std::string, std::pair<EntityType, EntityType>>>();
252 (*dm_field->mapTypeRow)[field_name] =
253 std::pair<EntityType, EntityType>(lo_type, hi_type);
254 }
256}

◆ DMMoFEMCreateMoFEM()

PetscErrorCode MoFEM::DMMoFEMCreateMoFEM ( DM  dm,
MoFEM::Interface m_field_ptr,
const char  problem_name[],
const MoFEM::BitRefLevel  bit_level,
const MoFEM::BitRefLevel  bit_mask = MoFEM::BitRefLevel().set() 
)

Must be called by user to set MoFEM data structures.

Examples
EshelbianPlasticity.cpp, MagneticElement.hpp, Remodeling.cpp, UnsaturatedFlow.hpp, cell_forces.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, lorentz_force.cpp, minimal_surface_area.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, simple_contact.cpp, simple_contact_thermal.cpp, and test_jacobian_of_simple_contact_element.cpp.

Definition at line 130 of file DMMMoFEM.cpp.

133 {
135
136 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
137 if (!dm->data) {
138 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
139 "data structure for MoFEM not yet created");
140 }
141 if (!m_field_ptr) {
142 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
143 "DM function not implemented into MoFEM");
144 }
145 dm_field->mField_ptr = m_field_ptr;
146 dm_field->problemName = problem_name;
147 if (!m_field_ptr->check_problem(dm_field->problemName)) {
148 // problem is not defined, declare problem internally set bool to
149 // destroyProblem problem with DM
150 dm_field->destroyProblem = PETSC_TRUE;
151 CHKERR dm_field->mField_ptr->add_problem(dm_field->problemName, MF_EXCL,
152 dm_field->verbosity);
153 } else {
154 dm_field->destroyProblem = PETSC_FALSE;
155 }
156 CHKERR dm_field->mField_ptr->modify_problem_ref_level_add_bit(
157 dm_field->problemName, bit_level);
158 CHKERR dm_field->mField_ptr->modify_problem_mask_ref_level_add_bit(
159 dm_field->problemName, bit_mask);
160 dm_field->kspCtx =
161 boost::shared_ptr<KspCtx>(new KspCtx(*m_field_ptr, problem_name));
162 dm_field->snesCtx =
163 boost::shared_ptr<SnesCtx>(new SnesCtx(*m_field_ptr, problem_name));
164 dm_field->tsCtx =
165 boost::shared_ptr<TsCtx>(new TsCtx(*m_field_ptr, problem_name));
166
167 MPI_Comm comm;
168 CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
169 int result = 0;
170 MPI_Comm_compare(comm, m_field_ptr->get_comm(), &result);
171 if (result > MPI_CONGRUENT) {
172 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
173 "MoFEM and DM using different communicators");
174 }
175 MPI_Comm_size(comm, &dm_field->sIze);
176 MPI_Comm_rank(comm, &dm_field->rAnk);
177
178 // problem structure
179 CHKERR dm_field->mField_ptr->get_problem(dm_field->problemName,
180 &dm_field->problemPtr);
181
182 MPI_Comm_compare(comm, PETSC_COMM_SELF, &result);
183 if (result == MPI_IDENT) {
184 MOFEM_LOG("DMSELF", Sev::noisy)
185 << "MoFEM DM created for problem " << dm_field->problemName;
186 MOFEM_LOG("DMSELF", Sev::noisy) << *dm_field->problemPtr;
187 } else {
188 MOFEM_LOG("DMWORLD", Sev::noisy)
189 << "MoFEM DM created for problem " << dm_field->problemName;
190 MOFEM_LOG("DMWORLD", Sev::noisy) << *dm_field->problemPtr;
191 }
192
194}
@ MF_EXCL
Definition: definitions.h:112
virtual bool check_problem(const std::string name)=0
check if problem exist
virtual MPI_Comm & get_comm() const =0

◆ DMMoFEMCreateSubDM()

PetscErrorCode MoFEM::DMMoFEMCreateSubDM ( DM  subdm,
DM  dm,
const char  problem_name[] 
)

Must be called by user to set Sub DM MoFEM data structures.

Examples
EshelbianPlasticity.cpp, analytical_poisson_field_split.cpp, cell_forces.cpp, dm_create_subdm.cpp, and free_surface.cpp.

Definition at line 213 of file DMMMoFEM.cpp.

213 {
215
216 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
217 if (!dm->data) {
218 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
219 "data structure for MoFEM not yet created");
220 }
221 CHKERR DMMoFEMCreateMoFEM(subdm, dm_field->mField_ptr, problem_name,
222 dm_field->problemPtr->getBitRefLevel(),
223 dm_field->problemPtr->getBitRefLevelMask());
224
225 DMCtx *subdm_field = (DMCtx *)subdm->data;
226 subdm_field->isSubDM = PETSC_TRUE;
227 subdm_field->problemMainOfSubPtr = dm_field->problemPtr;
228 subdm_field->isPartitioned = dm_field->isPartitioned;
229 subdm_field->isSquareMatrix = PETSC_FALSE;
230 subdm->ops->setup = DMSubDMSetUp_MoFEM;
231
233}
PetscErrorCode DMMoFEMCreateMoFEM(DM dm, MoFEM::Interface *m_field_ptr, const char problem_name[], const MoFEM::BitRefLevel bit_level, const MoFEM::BitRefLevel bit_mask=MoFEM::BitRefLevel().set())
Must be called by user to set MoFEM data structures.
Definition: DMMMoFEM.cpp:130
PetscErrorCode DMSubDMSetUp_MoFEM(DM subdm)
Definition: DMMMoFEM.cpp:1271

◆ DMMoFEMGetFieldIS()

PetscErrorCode MoFEM::DMMoFEMGetFieldIS ( DM  dm,
RowColData  rc,
const char  field_name[],
IS *  is 
)

get field is in the problem

Parameters
dmthe DM objects
rcROW or COL (no difference is problem is squared)
field_namename of the field
isreturned the IS object
Returns
error code
IS is;
ierr = DMMoFEMGetFieldIS(dm,ROW,"DISP",&is_disp); CHKERRG(ierr);
PetscErrorCode DMMoFEMGetFieldIS(DM dm, RowColData rc, const char field_name[], IS *is)
get field is in the problem
Definition: DMMMoFEM.cpp:1435

Definition at line 1435 of file DMMMoFEM.cpp.

1436 {
1437 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1439 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1440 CHKERR dm_field->mField_ptr->getInterface<ISManager>()
1441 ->isCreateProblemFieldAndRank(dm_field->problemPtr->getName(), ROW,
1442 field_name, 0, 1000, is);
1444}

◆ DMMoFEMGetIsCompDM()

PetscErrorCode MoFEM::DMMoFEMGetIsCompDM ( DM  dm,
PetscBool *  is_comp_dm 
)

Get if this DM is composite DM.

Parameters
dmthe DM object
is_comp_dmreturn true if composite problem here
Returns
error code

Definition at line 364 of file DMMMoFEM.cpp.

364 {
366 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
368 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
369 *is_comp_dm = dm_field->isCompDM;
371}

◆ DMMoFEMGetIsPartitioned()

PetscErrorCode MoFEM::DMMoFEMGetIsPartitioned ( DM  dm,
PetscBool *  is_partitioned 
)

get if read mesh is partitioned

Definition at line 1093 of file DMMMoFEM.cpp.

1093 {
1094 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1096 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1097 *is_partitioned = dm_field->isPartitioned;
1099}

◆ DMMoFEMGetIsSubDM()

PetscErrorCode MoFEM::DMMoFEMGetIsSubDM ( DM  dm,
PetscBool *  is_sub_dm 
)

Return true if this DM is sub problem

Parameters
dmthe DM object
is_subproblemtrue if subproblem
Returns
error code

Definition at line 281 of file DMMMoFEM.cpp.

281 {
283 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
285 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
286 *is_sub_dm = dm_field->isSubDM;
288}

◆ DMMoFEMGetKspCtx() [1/2]

PetscErrorCode MoFEM::DMMoFEMGetKspCtx ( DM  dm,
const boost::shared_ptr< MoFEM::KspCtx > &  ksp_ctx 
)

get MoFEM::KspCtx data structure

Definition at line 1036 of file DMMMoFEM.cpp.

1036 {
1037 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1039 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1040 const_cast<boost::shared_ptr<MoFEM::KspCtx> &>(ksp_ctx) = dm_field->kspCtx;
1042}

◆ DMMoFEMGetKspCtx() [2/2]

PetscErrorCode MoFEM::DMMoFEMGetKspCtx ( DM  dm,
MoFEM::KspCtx **  ksp_ctx 
)

get MoFEM::KspCtx data structure

Definition at line 1027 of file DMMMoFEM.cpp.

1027 {
1028 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1030 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1031 *ksp_ctx = dm_field->kspCtx.get();
1033}

◆ DMMoFEMGetProblemFiniteElementLayout()

PetscErrorCode MoFEM::DMMoFEMGetProblemFiniteElementLayout ( DM  dm,
const char  fe_name[],
PetscLayout *  layout 
)

Get finite elements layout in the problem.

In layout is stored information how many elements is on each processor, for more information look int petsc documentation http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/IS/PetscLayoutCreate.html#PetscLayoutCreate

Parameters
dmdiscrete manager for this problem
fe_namefinite element name
layoutpointer to layout, for created layout user takes responsibility for destroying it.
Returns
error code

Definition at line 438 of file DMMMoFEM.cpp.

439 {
441 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
443 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
444
445 MPI_Comm comm;
446 CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
447 CHKERR dm_field->problemPtr->getNumberOfElementsByNameAndPart(comm, fe_name,
448 layout);
450}

◆ DMMoFEMGetProblemPtr()

PetscErrorCode MoFEM::DMMoFEMGetProblemPtr ( DM  dm,
const MoFEM::Problem **  problem_ptr 
)

Get pointer to problem data structure.

Examples
EshelbianPlasticity.cpp, MagneticElement.hpp, Remodeling.cpp, field_evaluator.cpp, loop_entities.cpp, lorentz_force.cpp, partition_mesh.cpp, poisson_2d_dis_galerkin.cpp, and test_cache_on_entities.cpp.

Definition at line 385 of file DMMMoFEM.cpp.

385 {
386 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
388 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
389 if (!dm->data) {
390 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
391 "data structure for MoFEM not yet created");
392 }
393 *problem_ptr = dm_field->problemPtr;
395}

◆ DMMoFEMGetSnesCtx() [1/2]

PetscErrorCode MoFEM::DMMoFEMGetSnesCtx ( DM  dm,
const boost::shared_ptr< MoFEM::SnesCtx > &  snes_ctx 
)

get MoFEM::SnesCtx data structure

Definition at line 1062 of file DMMMoFEM.cpp.

1062 {
1063 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1065 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1066 const_cast<boost::shared_ptr<MoFEM::SnesCtx> &>(snes_ctx) = dm_field->snesCtx;
1068}

◆ DMMoFEMGetSnesCtx() [2/2]

PetscErrorCode MoFEM::DMMoFEMGetSnesCtx ( DM  dm,
MoFEM::SnesCtx **  snes_ctx 
)

get MoFEM::SnesCtx data structure

Examples
minimal_surface_area.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, simple_contact.cpp, simple_contact_thermal.cpp, test_jacobian_of_simple_contact_element.cpp, testing_jacobian_of_hook_element.cpp, and testing_jacobian_of_hook_scaled_with_density_element.cpp.

Definition at line 1053 of file DMMMoFEM.cpp.

1053 {
1054 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1056 DMCtx *dm_field = (DMCtx *)dm->data;
1057 *snes_ctx = dm_field->snesCtx.get();
1059}

◆ DMMoFEMGetSquareProblem()

PetscErrorCode MoFEM::DMMoFEMGetSquareProblem ( DM  dm,
PetscBool *  square_problem 
)

get squared problem

It if true is assumed that matrix has the same indexing on rows and columns. This reduces interprocessor communication.

Definition at line 452 of file DMMMoFEM.cpp.

452 {
455 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
457 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
458 *square_problem = dm_field->isSquareMatrix;
460}

◆ DMMoFEMGetTsCtx() [1/2]

PetscErrorCode MoFEM::DMMoFEMGetTsCtx ( DM  dm,
const boost::shared_ptr< MoFEM::TsCtx > &  ts_ctx 
)

get MoFEM::TsCtx data structure

Definition at line 1109 of file DMMMoFEM.cpp.

1110 {
1111 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1113 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1114 const_cast<boost::shared_ptr<MoFEM::TsCtx> &>(ts_ctx) = dm_field->tsCtx;
1116}

◆ DMMoFEMGetTsCtx() [2/2]

PetscErrorCode MoFEM::DMMoFEMGetTsCtx ( DM  dm,
MoFEM::TsCtx **  ts_ctx 
)

get MoFEM::TsCtx data structure

Examples
EshelbianPlasticity.cpp, Remodeling.cpp, and UnsaturatedFlow.hpp.

Definition at line 1101 of file DMMMoFEM.cpp.

1101 {
1102 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1104 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1105 *ts_ctx = dm_field->tsCtx.get();
1107}

◆ DMMoFEMKSPSetComputeOperators() [1/2]

PetscErrorCode MoFEM::DMMoFEMKSPSetComputeOperators ( DM  dm,
const char  fe_name[],
MoFEM::FEMethod method,
MoFEM::BasicMethod pre_only,
MoFEM::BasicMethod post_only 
)

Set KSP operators and push mofem finite element methods.

Parameters
dmDM
fe_namefinite element name
methodmethod on the element (executed for each element in the problem which given name)
pre_onlymethod for pre-process before element method
post_onlymethod for post-process after element method
Returns
error code
Examples
analytical_poisson.cpp, elasticity_mixed_formulation.cpp, and simple_elasticity.cpp.

Definition at line 637 of file DMMMoFEM.cpp.

640 {
641 return DMMoFEMKSPSetComputeOperators<const char *, MoFEM::FEMethod *,
644 dm, fe_name, method, pre_only, post_only);
645}
static PetscErrorCode DMMoFEMKSPSetComputeOperators(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:618
Data structure to exchange data between mofem and User Loop Methods.
structure for User Loop Methods on finite elements

◆ DMMoFEMKSPSetComputeOperators() [2/2]

PetscErrorCode MoFEM::DMMoFEMKSPSetComputeOperators ( DM  dm,
const std::string  fe_name,
boost::shared_ptr< MoFEM::FEMethod method,
boost::shared_ptr< MoFEM::BasicMethod pre_only,
boost::shared_ptr< MoFEM::BasicMethod post_only 
)

Set KSP operators and push mofem finite element methods.

Parameters
dmDM
fe_namefinite element name
methodmethod on the element (executed for each element in the problem which given name)
pre_onlymethod for pre-process before element method
post_onlymethod for post-process after element method
Returns
error code

Definition at line 648 of file DMMMoFEM.cpp.

651 {
652 return DMMoFEMKSPSetComputeOperators<const std::string,
653 boost::shared_ptr<MoFEM::FEMethod>>(
654 dm, fe_name, method, pre_only, post_only);
655}

◆ DMMoFEMKSPSetComputeRHS() [1/2]

PetscErrorCode MoFEM::DMMoFEMKSPSetComputeRHS ( DM  dm,
const char  fe_name[],
MoFEM::FEMethod method,
MoFEM::BasicMethod pre_only,
MoFEM::BasicMethod post_only 
)

set KSP right hand side evaluation function

Examples
analytical_poisson.cpp, and simple_elasticity.cpp.

Definition at line 596 of file DMMMoFEM.cpp.

599 {
600 return DMMoFEMKSPSetComputeRHS<const char *, MoFEM::FEMethod *,
602 dm, fe_name, method, pre_only, post_only);
603}
static PetscErrorCode DMMoFEMKSPSetComputeRHS(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:577

◆ DMMoFEMKSPSetComputeRHS() [2/2]

PetscErrorCode MoFEM::DMMoFEMKSPSetComputeRHS ( DM  dm,
const std::string  fe_name,
boost::shared_ptr< MoFEM::FEMethod method,
boost::shared_ptr< MoFEM::BasicMethod pre_only,
boost::shared_ptr< MoFEM::BasicMethod post_only 
)

set KSP right hand side evaluation function

Definition at line 606 of file DMMMoFEM.cpp.

609 {
610 return DMMoFEMKSPSetComputeRHS<const std::string,
611 boost::shared_ptr<MoFEM::FEMethod>,
612 boost::shared_ptr<MoFEM::BasicMethod>,
613 boost::shared_ptr<MoFEM::BasicMethod>>(
614 dm, fe_name, method, pre_only, post_only);
615}

◆ DMMoFEMResolveSharedFiniteElements()

PetscErrorCode MoFEM::DMMoFEMResolveSharedFiniteElements ( DM  dm,
const char  fe_name[] 
)

Resolve shared entities.

Parameters
dmdm
fe_namefinite element for which shared entities are resolved
Returns
error code
Note
This function is valid for parallel algebra and serial mesh. It should be run collectively, i.e. on all processors.

This allows for tag reduction or tag exchange, f.e.

Tag th;
CHKERR mField.get_moab().tag_get_handle("ADAPT_ORDER",th);
ParallelComm* pcomm =
ParallelComm::get_pcomm(&mField.get_moab(),MYPCOMM_INDEX);
// CHKERR pcomm->reduce_tags(th,MPI_SUM,prisms);
CHKERR pcomm->exchange_tags(th,prisms);
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:228
PetscErrorCode DMMoFEMResolveSharedFiniteElements(DM dm, const char fe_name[])
Resolve shared entities.
Definition: DMMMoFEM.cpp:424

Definition at line 424 of file DMMMoFEM.cpp.

424 {
426 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
428 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
429 CHKERR dm_field->mField_ptr->getInterface<CommInterface>()
430 ->resolveSharedFiniteElements(dm_field->problemPtr, fe_name);
432}

◆ DMMoFEMSetIsPartitioned()

PetscErrorCode MoFEM::DMMoFEMSetIsPartitioned ( DM  dm,
PetscBool  is_partitioned 
)

sets if read mesh is partitioned

get if read mesh is partitioned

Examples
EshelbianPlasticity.cpp, MagneticElement.hpp, Remodeling.cpp, UnsaturatedFlow.hpp, cell_forces.cpp, dm_build_partitioned_mesh.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, and test_jacobian_of_simple_contact_element.cpp.

Definition at line 1082 of file DMMMoFEM.cpp.

1082 {
1083 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1085 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1086 dm_field->isPartitioned = is_partitioned;
1088}

◆ DMMoFEMSetKspCtx()

PetscErrorCode MoFEM::DMMoFEMSetKspCtx ( DM  dm,
boost::shared_ptr< MoFEM::KspCtx ksp_ctx 
)

set MoFEM::KspCtx data structure

Definition at line 1044 of file DMMMoFEM.cpp.

1045 {
1046 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1048 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1049 dm_field->kspCtx = ksp_ctx;
1051}

◆ DMMoFEMSetSnesCtx()

PetscErrorCode MoFEM::DMMoFEMSetSnesCtx ( DM  dm,
boost::shared_ptr< MoFEM::SnesCtx snes_ctx 
)

Set MoFEM::SnesCtx data structure.

Definition at line 1070 of file DMMMoFEM.cpp.

1071 {
1072 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1074 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1075 dm_field->snesCtx = snes_ctx;
1077}

◆ DMMoFEMSetSquareProblem()

PetscErrorCode MoFEM::DMMoFEMSetSquareProblem ( DM  dm,
PetscBool  square_problem 
)

set squared problem

It if true is assumed that matrix has the same indexing on rows and columns. This reduces interprocessor communication.

Examples
EshelbianPlasticity.cpp, analytical_poisson_field_split.cpp, cell_forces.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, and free_surface.cpp.

Definition at line 415 of file DMMMoFEM.cpp.

415 {
417 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
419 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
420 dm_field->isSquareMatrix = square_problem;
422}

◆ DMMoFEMSetTsCtx()

PetscErrorCode MoFEM::DMMoFEMSetTsCtx ( DM  dm,
boost::shared_ptr< MoFEM::TsCtx ts_ctx 
)

Set MoFEM::TsCtx data structure.

It take over pointer, do not delete it, DM will destroy pointer when is destroyed.

Definition at line 1118 of file DMMMoFEM.cpp.

1118 {
1119 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1121 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1122 dm_field->tsCtx = ts_ctx;
1124}

◆ DMMoFEMSNESSetFunction() [1/2]

PetscErrorCode MoFEM::DMMoFEMSNESSetFunction ( DM  dm,
const char  fe_name[],
MoFEM::FEMethod method,
MoFEM::BasicMethod pre_only,
MoFEM::BasicMethod post_only 
)

◆ DMMoFEMSNESSetFunction() [2/2]

PetscErrorCode MoFEM::DMMoFEMSNESSetFunction ( DM  dm,
const std::string  fe_name,
boost::shared_ptr< MoFEM::FEMethod method,
boost::shared_ptr< MoFEM::BasicMethod pre_only,
boost::shared_ptr< MoFEM::BasicMethod post_only 
)

set SNES residual evaluation function

Definition at line 687 of file DMMMoFEM.cpp.

690 {
691 return DMMoFEMSNESSetFunction<const std::string,
692 boost::shared_ptr<MoFEM::FEMethod>,
693 boost::shared_ptr<MoFEM::BasicMethod>,
694 boost::shared_ptr<MoFEM::BasicMethod>>(
695 dm, fe_name, method, pre_only, post_only);
696}

◆ DMMoFEMSNESSetJacobian() [1/2]

PetscErrorCode MoFEM::DMMoFEMSNESSetJacobian ( DM  dm,
const char  fe_name[],
MoFEM::FEMethod method,
MoFEM::BasicMethod pre_only,
MoFEM::BasicMethod post_only 
)

◆ DMMoFEMSNESSetJacobian() [2/2]

PetscErrorCode MoFEM::DMMoFEMSNESSetJacobian ( DM  dm,
const std::string  fe_name,
boost::shared_ptr< MoFEM::FEMethod method,
boost::shared_ptr< MoFEM::BasicMethod pre_only,
boost::shared_ptr< MoFEM::BasicMethod post_only 
)

set SNES Jacobian evaluation function

Definition at line 728 of file DMMMoFEM.cpp.

731 {
732 return DMMoFEMSNESSetJacobian<const std::string,
733 boost::shared_ptr<MoFEM::FEMethod>,
734 boost::shared_ptr<MoFEM::BasicMethod>,
735 boost::shared_ptr<MoFEM::BasicMethod>>(
736 dm, fe_name, method, pre_only, post_only);
737}

◆ DMMoFEMTSSetI2Function() [1/2]

PetscErrorCode MoFEM::DMMoFEMTSSetI2Function ( DM  dm,
const char  fe_name[],
MoFEM::FEMethod method,
MoFEM::BasicMethod pre_only,
MoFEM::BasicMethod post_only 
)

set TS implicit function evaluation function

Definition at line 923 of file DMMMoFEM.cpp.

926 {
927 return DMMoFEMTSSetI2Function<const char *, MoFEM::FEMethod *,
929 dm, fe_name, method, pre_only, post_only);
931}
static PetscErrorCode DMMoFEMTSSetI2Function(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:904

◆ DMMoFEMTSSetI2Function() [2/2]

PetscErrorCode MoFEM::DMMoFEMTSSetI2Function ( DM  dm,
const std::string  fe_name,
boost::shared_ptr< MoFEM::FEMethod method,
boost::shared_ptr< MoFEM::BasicMethod pre_only,
boost::shared_ptr< MoFEM::BasicMethod post_only 
)

set TS implicit function evaluation function

Examples
EshelbianPlasticity.cpp, and NonlinearElasticElementInterface.hpp.

Definition at line 934 of file DMMMoFEM.cpp.

937 {
938 return DMMoFEMTSSetI2Function<const std::string,
939 boost::shared_ptr<MoFEM::FEMethod>,
940 boost::shared_ptr<MoFEM::BasicMethod>,
941 boost::shared_ptr<MoFEM::BasicMethod>>(
942 dm, fe_name, method, pre_only, post_only);
944}

◆ DMMoFEMTSSetI2Jacobian() [1/2]

PetscErrorCode MoFEM::DMMoFEMTSSetI2Jacobian ( DM  dm,
const char  fe_name[],
MoFEM::FEMethod method,
MoFEM::BasicMethod pre_only,
MoFEM::BasicMethod post_only 
)

set TS Jacobian evaluation function

Definition at line 966 of file DMMMoFEM.cpp.

969 {
970 return DMMoFEMTSSetI2Jacobian<const char *, FEMethod *, MoFEM::BasicMethod *,
971 MoFEM::BasicMethod *>(dm, fe_name, method,
972 pre_only, post_only);
973}
static PetscErrorCode DMMoFEMTSSetI2Jacobian(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:947

◆ DMMoFEMTSSetI2Jacobian() [2/2]

PetscErrorCode MoFEM::DMMoFEMTSSetI2Jacobian ( DM  dm,
const std::string  fe_name,
boost::shared_ptr< MoFEM::FEMethod method,
boost::shared_ptr< MoFEM::BasicMethod pre_only,
boost::shared_ptr< MoFEM::BasicMethod post_only 
)

set TS Jacobian evaluation function

Examples
EshelbianPlasticity.cpp, and NonlinearElasticElementInterface.hpp.

Definition at line 976 of file DMMMoFEM.cpp.

979 {
980 return DMMoFEMTSSetI2Jacobian<const std::string,
981 boost::shared_ptr<MoFEM::FEMethod>,
982 boost::shared_ptr<MoFEM::BasicMethod>,
983 boost::shared_ptr<MoFEM::BasicMethod>>(
984 dm, fe_name, method, pre_only, post_only);
985}

◆ DMMoFEMTSSetIFunction() [1/2]

PetscErrorCode MoFEM::DMMoFEMTSSetIFunction ( DM  dm,
const char  fe_name[],
MoFEM::FEMethod method,
MoFEM::BasicMethod pre_only,
MoFEM::BasicMethod post_only 
)

set TS implicit function evaluation function

Examples
EshelbianPlasticity.cpp, NonlinearElasticElementInterface.hpp, UnsaturatedFlow.hpp, bone_adaptation.cpp, plastic.cpp, reaction_diffusion.cpp, and thermo_plastic.cpp.

Definition at line 759 of file DMMMoFEM.cpp.

762 {
763 return DMMoFEMTSSetIFunction<const char *, MoFEM::FEMethod *,
765 dm, fe_name, method, pre_only, post_only);
767}
static PetscErrorCode DMMoFEMTSSetIFunction(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:740

◆ DMMoFEMTSSetIFunction() [2/2]

PetscErrorCode MoFEM::DMMoFEMTSSetIFunction ( DM  dm,
const std::string  fe_name,
boost::shared_ptr< MoFEM::FEMethod method,
boost::shared_ptr< MoFEM::BasicMethod pre_only,
boost::shared_ptr< MoFEM::BasicMethod post_only 
)

set TS implicit function evaluation function

Definition at line 770 of file DMMMoFEM.cpp.

773 {
774 return DMMoFEMTSSetIFunction<const std::string,
775 boost::shared_ptr<MoFEM::FEMethod>,
776 boost::shared_ptr<MoFEM::BasicMethod>,
777 boost::shared_ptr<MoFEM::BasicMethod>>(
778 dm, fe_name, method, pre_only, post_only);
780}

◆ DMMoFEMTSSetIJacobian() [1/2]

PetscErrorCode MoFEM::DMMoFEMTSSetIJacobian ( DM  dm,
const char  fe_name[],
MoFEM::FEMethod method,
MoFEM::BasicMethod pre_only,
MoFEM::BasicMethod post_only 
)

set TS Jacobian evaluation function

Definition at line 802 of file DMMMoFEM.cpp.

805 {
806 return DMMoFEMTSSetIJacobian<const char *, FEMethod *, MoFEM::BasicMethod *,
807 MoFEM::BasicMethod *>(dm, fe_name, method,
808 pre_only, post_only);
809}
static PetscErrorCode DMMoFEMTSSetIJacobian(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:783

◆ DMMoFEMTSSetIJacobian() [2/2]

PetscErrorCode MoFEM::DMMoFEMTSSetIJacobian ( DM  dm,
const std::string  fe_name,
boost::shared_ptr< MoFEM::FEMethod method,
boost::shared_ptr< MoFEM::BasicMethod pre_only,
boost::shared_ptr< MoFEM::BasicMethod post_only 
)

set TS Jacobian evaluation function

Examples
EshelbianPlasticity.cpp, NonlinearElasticElementInterface.hpp, UnsaturatedFlow.hpp, bone_adaptation.cpp, plastic.cpp, reaction_diffusion.cpp, and thermo_plastic.cpp.

Definition at line 812 of file DMMMoFEM.cpp.

815 {
816 return DMMoFEMTSSetIJacobian<const std::string,
817 boost::shared_ptr<MoFEM::FEMethod>,
818 boost::shared_ptr<MoFEM::BasicMethod>,
819 boost::shared_ptr<MoFEM::BasicMethod>>(
820 dm, fe_name, method, pre_only, post_only);
821}

◆ DMMoFEMUnSetElement()

PetscErrorCode MoFEM::DMMoFEMUnSetElement ( DM  dm,
const char  fe_name[] 
)

unset element from dm

Definition at line 472 of file DMMMoFEM.cpp.

472 {
473 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
475 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
476 ierr = dm_field->mField_ptr->modify_problem_unset_finite_element(
477 dm_field->problemName, fe_name);
478 CHKERRG(ierr);
480}

◆ DMoFEMGetInterfacePtr()

PetscErrorCode MoFEM::DMoFEMGetInterfacePtr ( DM  dm,
MoFEM::Interface **  m_field_ptr 
)

Get pointer to MoFEM::Interface.

Parameters
dmDistributed mesh manager
m_field_ptrPointer to pointer of field interface
Returns
Error code
Examples
HookeElement.cpp, and mesh_smoothing.cpp.

Definition at line 373 of file DMMMoFEM.cpp.

373 {
374 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
376 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
377 if (!dm->data) {
378 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
379 "data structure for MoFEM not yet created");
380 }
381 *m_field_ptr = dm_field->mField_ptr;
383}

◆ DMoFEMLoopDofs()

PetscErrorCode MoFEM::DMoFEMLoopDofs ( DM  dm,
const char  field_name[],
MoFEM::DofMethod method 
)

execute method for dofs on field in problem

Definition at line 564 of file DMMMoFEM.cpp.

565 {
566 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
568 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
569 ierr =
570 dm_field->mField_ptr->loop_dofs(dm_field->problemPtr, field_name, COL,
571 *method, dm_field->rAnk, dm_field->rAnk);
572 CHKERRG(ierr);
574}

◆ DMoFEMLoopFiniteElements() [1/2]

PetscErrorCode MoFEM::DMoFEMLoopFiniteElements ( DM  dm,
const char  fe_name[],
MoFEM::FEMethod method,
CacheTupleWeakPtr  cache_ptr = CacheTupleSharedPtr() 
)

Executes FEMethod for finite elements in DM.

Parameters
dmMoFEM discrete manager
fe_namename of element
methodpointer to MOFEM::FEMethod
Returns
Error code
Examples
EshelbianPlasticity.cpp, HookeElement.cpp, MagneticElement.hpp, NonlinearElasticElementInterface.hpp, PlasticOpsMonitor.hpp, Remodeling.cpp, UnsaturatedFlow.hpp, analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, approx_sphere.cpp, boundary_marker.cpp, cell_forces.cpp, continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, dm_build_partitioned_mesh.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, free_surface.cpp, heat_equation.cpp, mesh_smoothing.cpp, minimal_surface_area.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, nonlinear_elastic.cpp, photon_diffusion.cpp, reaction_diffusion.cpp, shallow_wave.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, simple_interface.cpp, test_cache_on_entities.cpp, and wave_equation.cpp.

Definition at line 545 of file DMMMoFEM.cpp.

547 {
548 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
550 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
552 dm, fe_name, method, dm_field->rAnk, dm_field->rAnk, cache_ptr);
553 CHKERRG(ierr);
555}
PetscErrorCode DMoFEMLoopFiniteElementsUpAndLowRank(DM dm, const char fe_name[], MoFEM::FEMethod *method, int low_rank, int up_rank, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition: DMMMoFEM.cpp:526

◆ DMoFEMLoopFiniteElements() [2/2]

PetscErrorCode MoFEM::DMoFEMLoopFiniteElements ( DM  dm,
const std::string  fe_name,
boost::shared_ptr< MoFEM::FEMethod method,
CacheTupleWeakPtr  cache_ptr = CacheTupleSharedPtr() 
)

Executes FEMethod for finite elements in DM.

Parameters
dmMoFEM discrete manager
fe_namename of element
methodpointer to MOFEM::FEMethod
Returns
Error code

Definition at line 558 of file DMMMoFEM.cpp.

560 {
561 return DMoFEMLoopFiniteElements(dm, fe_name.c_str(), method.get(), cache_ptr);
562}
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition: DMMMoFEM.cpp:545

◆ DMoFEMLoopFiniteElementsUpAndLowRank() [1/2]

PetscErrorCode MoFEM::DMoFEMLoopFiniteElementsUpAndLowRank ( DM  dm,
const char  fe_name[],
MoFEM::FEMethod method,
int  low_rank,
int  up_rank,
CacheTupleWeakPtr  cache_ptr = CacheTupleSharedPtr() 
)

Executes FEMethod for finite elements in DM.

Parameters
dmMoFEM discrete manager
fe_namename of finite element
methodpointer to MoFEM::FEMethod
low_ranklowest rank of processor
up_rankupper run of processor
Returns
Error code
Examples
mortar_contact_thermal.cpp, and simple_contact_thermal.cpp.

Definition at line 526 of file DMMMoFEM.cpp.

528 {
530 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
531 ierr = dm_field->mField_ptr->loop_finite_elements(
532 dm_field->problemPtr, fe_name, *method, low_rank, up_rank, nullptr,
533 MF_EXIST, cache_ptr);
534 CHKERRG(ierr);
536}
@ MF_EXIST
Definition: definitions.h:113

◆ DMoFEMLoopFiniteElementsUpAndLowRank() [2/2]

PetscErrorCode MoFEM::DMoFEMLoopFiniteElementsUpAndLowRank ( DM  dm,
const std::string  fe_name,
boost::shared_ptr< MoFEM::FEMethod method,
int  low_rank,
int  up_rank,
CacheTupleWeakPtr  cache_ptr = CacheTupleSharedPtr() 
)

Executes FEMethod for finite elements in DM.

Parameters
dmMoFEM discrete manager
fe_namename of finite element
methodpointer to MoFEM::FEMethod
low_ranklowest rank of processor
up_rankupper run of processor
Returns
Error code

Definition at line 538 of file DMMMoFEM.cpp.

540 {
541 return DMoFEMLoopFiniteElementsUpAndLowRank(dm, fe_name.c_str(), method.get(),
542 low_rank, up_rank, cache_ptr);
543}

◆ DMoFEMMeshToGlobalVector()

PetscErrorCode MoFEM::DMoFEMMeshToGlobalVector ( DM  dm,
Vec  g,
InsertMode  mode,
ScatterMode  scatter_mode 
)

set ghosted vector values on all existing mesh entities

Parameters
gvector
modesee petsc manual for VecSetValue (ADD_VALUES or INSERT_VALUES)
scatter_modesee petsc manual for ScatterMode (The available modes are: SCATTER_FORWARD or SCATTER_REVERSE)

SCATTER_REVERSE set data to field entities from V vector.

SCATTER_FORWARD set vector V from data field entities

Examples
analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, elasticity_mixed_formulation.cpp, mesh_smoothing.cpp, minimal_surface_area.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, simple_contact.cpp, simple_contact_thermal.cpp, and simple_elasticity.cpp.

Definition at line 494 of file DMMMoFEM.cpp.

495 {
496 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
498 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
499 ierr = dm_field->mField_ptr->getInterface<VecManager>()->setGlobalGhostVector(
500 dm_field->problemPtr, COL, g, mode, scatter_mode);
501 CHKERRG(ierr);
503}

◆ DMoFEMMeshToLocalVector()

PetscErrorCode MoFEM::DMoFEMMeshToLocalVector ( DM  dm,
Vec  l,
InsertMode  mode,
ScatterMode  scatter_mode 
)

set local (or ghosted) vector values on mesh for partition only

Parameters
lvector
modesee petsc manual for VecSetValue (ADD_VALUES or INSERT_VALUES)
scatter_modesee petsc manual for ScatterMode (The available modes are: SCATTER_FORWARD or SCATTER_REVERSE)

SCATTER_REVERSE set data to field entities from V vector.

SCATTER_FORWARD set vector V from data field entities

Examples
EshelbianPlasticity.cpp, MagneticElement.hpp, UnsaturatedFlow.hpp, approx_sphere.cpp, bone_adaptation.cpp, cell_forces.cpp, child_and_parent.cpp, contact.cpp, eigen_elastic.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, ep.cpp, free_surface.cpp, hanging_node_approx.cpp, hcurl_check_approx_in_2d.cpp, heat_equation.cpp, heat_method.cpp, helmholtz.cpp, higher_derivatives.cpp, mesh_smoothing.cpp, minimal_surface_area.cpp, mixed_poisson.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, nonlinear_elastic.cpp, phase.cpp, photon_diffusion.cpp, plastic.cpp, plate.cpp, poisson_2d_dis_galerkin.cpp, poisson_2d_homogeneous.cpp, reaction_diffusion.cpp, scalar_check_approximation.cpp, shallow_wave.cpp, simple_contact.cpp, simple_contact_thermal.cpp, test_cache_on_entities.cpp, test_jacobian_of_simple_contact_element.cpp, testing_jacobian_of_hook_element.cpp, testing_jacobian_of_hook_scaled_with_density_element.cpp, thermo_plastic.cpp, and wave_equation.cpp.

Definition at line 482 of file DMMMoFEM.cpp.

483 {
485 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
487 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
488 ierr = dm_field->mField_ptr->getInterface<VecManager>()->setLocalGhostVector(
489 dm_field->problemPtr, COL, l, mode, scatter_mode);
490 CHKERRG(ierr);
492}

◆ DMoFEMPostProcessFiniteElements()

PetscErrorCode MoFEM::DMoFEMPostProcessFiniteElements ( DM  dm,
MoFEM::FEMethod method 
)

execute finite element method for each element in dm (problem)

Examples
cell_forces.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, and simple_elasticity.cpp.

Definition at line 515 of file DMMMoFEM.cpp.

515 {
516 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
518 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
519 ierr = dm_field->mField_ptr->problem_basic_method_postProcess(
520 dm_field->problemPtr, *method);
521 CHKERRG(ierr);
523}

◆ DMoFEMPreProcessFiniteElements()

PetscErrorCode MoFEM::DMoFEMPreProcessFiniteElements ( DM  dm,
MoFEM::FEMethod method 
)

execute finite element method for each element in dm (problem)

Examples
cell_forces.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, simple_contact.cpp, and simple_contact_thermal.cpp.

Definition at line 505 of file DMMMoFEM.cpp.

505 {
506 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
508 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
509 ierr = dm_field->mField_ptr->problem_basic_method_preProcess(
510 dm_field->problemPtr, *method);
511 CHKERRG(ierr);
513}

◆ DMRegister_MGViaApproxOrders()

MoFEMErrorCode DMRegister_MGViaApproxOrders ( const char  sname[])

Register DM for Multi-Grid via approximation orders.

Parameters
snameproblem/dm registered name
Returns
error code

Definition at line 387 of file PCMGSetUpViaApproxOrders.cpp.

387 {
389 CHKERR DMRegister(sname, DMCreate_MGViaApproxOrders);
391}
MoFEMErrorCode DMCreate_MGViaApproxOrders(DM dm)
Create DM data structure for Multi-Grid via approximation orders.

◆ DMRegister_MoFEM()

PetscErrorCode MoFEM::DMRegister_MoFEM ( const char  sname[])

Register MoFEM problem.

Examples
MagneticElement.hpp, Remodeling.cpp, analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, approx_sphere.cpp, boundary_marker.cpp, cell_forces.cpp, child_and_parent.cpp, contact.cpp, continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, eigen_elastic.cpp, elasticity_mixed_formulation.cpp, ep.cpp, field_evaluator.cpp, free_surface.cpp, hanging_node_approx.cpp, hcurl_check_approx_in_2d.cpp, hcurl_curl_operator.cpp, hdiv_divergence_operator.cpp, heat_equation.cpp, heat_method.cpp, hello_world.cpp, helmholtz.cpp, higher_derivatives.cpp, loop_entities.cpp, lorentz_force.cpp, mesh_smoothing.cpp, minimal_surface_area.cpp, mixed_poisson.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, nonlinear_elastic.cpp, partition_mesh.cpp, phase.cpp, photon_diffusion.cpp, plastic.cpp, plate.cpp, plot_base.cpp, poisson_2d_dis_galerkin.cpp, poisson_2d_homogeneous.cpp, reaction_diffusion.cpp, scalar_check_approximation.cpp, shallow_wave.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, simple_interface.cpp, simple_l2_only.cpp, test_cache_on_entities.cpp, test_jacobian_of_simple_contact_element.cpp, testing_jacobian_of_hook_element.cpp, testing_jacobian_of_hook_scaled_with_density_element.cpp, thermo_plastic.cpp, unsaturated_transport.cpp, and wave_equation.cpp.

Definition at line 59 of file DMMMoFEM.cpp.

59 {
61 CHKERR DMRegister(sname, DMCreate_MoFEM);
63}
PetscErrorCode DMCreate_MoFEM(DM dm)
Create dm data structure with MoFEM data structure.
Definition: DMMMoFEM.cpp:87

◆ DMSetFromOptions_MoFEM()

PetscErrorCode MoFEM::DMSetFromOptions_MoFEM ( DM  dm)

Set options for MoFEM DM

Definition at line 1202 of file DMMMoFEM.cpp.

1202 {
1203#endif
1204
1205 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1207 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1208#if PETSC_VERSION_GE(3, 5, 3)
1209 ierr = PetscOptionsHead(PetscOptionsObject, "DMMoFEM Options");
1210 CHKERRG(ierr);
1211#else
1212 ierr = PetscOptionsHead("DMMoFEM Options");
1213 CHKERRG(ierr);
1214#endif
1215 ierr = PetscOptionsBool("-dm_is_partitioned",
1216 "set if mesh is partitioned (works which native MOAB "
1217 "file format, i.e. h5m",
1218 "DMSetUp", dm_field->isPartitioned,
1219 &dm_field->isPartitioned, NULL);
1220 CHKERRG(ierr);
1222}

◆ DMSetOperators_MoFEM()

PetscErrorCode MoFEM::DMSetOperators_MoFEM ( DM  dm)

Set operators for MoFEM dm.

Parameters
dm
Returns
error code

Definition at line 65 of file DMMMoFEM.cpp.

65 {
66 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
68
69 dm->ops->createglobalvector = DMCreateGlobalVector_MoFEM;
70 dm->ops->createlocalvector = DMCreateLocalVector_MoFEM;
71 dm->ops->creatematrix = DMCreateMatrix_MoFEM;
72 dm->ops->setup = DMSetUp_MoFEM;
73 dm->ops->destroy = DMDestroy_MoFEM;
74 dm->ops->setfromoptions = DMSetFromOptions_MoFEM;
75 dm->ops->globaltolocalbegin = DMGlobalToLocalBegin_MoFEM;
76 dm->ops->globaltolocalend = DMGlobalToLocalEnd_MoFEM;
77 dm->ops->localtoglobalbegin = DMLocalToGlobalBegin_MoFEM;
78 dm->ops->localtoglobalend = DMLocalToGlobalEnd_MoFEM;
79 dm->ops->createfieldis = DMCreateFieldIS_MoFEM;
80
81 // Default matrix type
82 CHKERR DMSetMatType(dm, MATMPIAIJ);
83
85}
PetscErrorCode DMGlobalToLocalBegin_MoFEM(DM dm, Vec, InsertMode, Vec)
Definition: DMMMoFEM.cpp:1318
PetscErrorCode DMGlobalToLocalEnd_MoFEM(DM dm, Vec, InsertMode, Vec)
Definition: DMMMoFEM.cpp:1326
PetscErrorCode DMCreateLocalVector_MoFEM(DM dm, Vec *l)
DMShellSetCreateLocalVector.
Definition: DMMMoFEM.cpp:1146
PetscErrorCode DMDestroy_MoFEM(DM dm)
Destroys dm with MoFEM data structure.
Definition: DMMMoFEM.cpp:95
PetscErrorCode DMLocalToGlobalBegin_MoFEM(DM, Vec, InsertMode, Vec)
Definition: DMMMoFEM.cpp:1355
PetscErrorCode DMSetFromOptions_MoFEM(DM dm)
Definition: DMMMoFEM.cpp:1202
PetscErrorCode DMCreateGlobalVector_MoFEM(DM dm, Vec *g)
DMShellSetCreateGlobalVector.
Definition: DMMMoFEM.cpp:1126
PetscErrorCode DMCreateFieldIS_MoFEM(DM dm, PetscInt *numFields, char ***fieldNames, IS **fields)
Definition: DMMMoFEM.cpp:1390
PetscErrorCode DMSetUp_MoFEM(DM dm)
Definition: DMMMoFEM.cpp:1224
PetscErrorCode DMLocalToGlobalEnd_MoFEM(DM, Vec, InsertMode, Vec)
Definition: DMMMoFEM.cpp:1384

◆ DMSetUp_MoFEM()

PetscErrorCode MoFEM::DMSetUp_MoFEM ( DM  dm)

sets up the MoFEM structures inside a DM object

Examples
mixed_poisson.cpp.

Definition at line 1224 of file DMMMoFEM.cpp.

1224 {
1225 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1226 ProblemsManager *prb_mng_ptr;
1228 DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1229 CHKERR dm_field->mField_ptr->getInterface(prb_mng_ptr);
1230
1231 if (dm_field->isCompDM) {
1232 // It is composite probelm
1233 CHKERR prb_mng_ptr->buildComposedProblem(
1234 dm_field->problemName, dm_field->rowCompPrb, dm_field->colCompPrb,
1235 dm_field->isSquareMatrix == PETSC_TRUE, dm_field->verbosity);
1236 } else {
1237 if (dm_field->isPartitioned) {
1238 CHKERR prb_mng_ptr->buildProblemOnDistributedMesh(
1239 dm_field->problemName, dm_field->isSquareMatrix == PETSC_TRUE,
1240 dm_field->verbosity);
1241 } else {
1242 CHKERR prb_mng_ptr->buildProblem(dm_field->problemName,
1243 dm_field->isSquareMatrix == PETSC_TRUE,
1244 dm_field->verbosity);
1245 CHKERR prb_mng_ptr->partitionProblem(dm_field->problemName,
1246 dm_field->verbosity);
1247 }
1248 }
1249
1250 // Partition finite elements
1251 if (dm_field->isPartitioned) {
1252 CHKERR prb_mng_ptr->partitionFiniteElements(
1253 dm_field->problemName, true, 0, dm_field->sIze, dm_field->verbosity);
1254 CHKERR prb_mng_ptr->partitionGhostDofsOnDistributedMesh(
1255 dm_field->problemName, dm_field->verbosity);
1256 } else {
1257 // partition finite elemnets
1258 CHKERR prb_mng_ptr->partitionFiniteElements(dm_field->problemName, false,
1259 -1, -1, dm_field->verbosity);
1260 // Get ghost DOFs
1261 CHKERR prb_mng_ptr->partitionGhostDofs(dm_field->problemName,
1262 dm_field->verbosity);
1263 }
1264
1265 // Set flag that problem is build and partitioned
1266 dm_field->isProblemBuild = PETSC_TRUE;
1267
1269}

◆ DMSubDMSetUp_MoFEM()

PetscErrorCode MoFEM::DMSubDMSetUp_MoFEM ( DM  subdm)

Sets up the MoFEM structures inside a DM object for sub dm

Definition at line 1271 of file DMMMoFEM.cpp.

1271 {
1272 PetscValidHeaderSpecific(subdm, DM_CLASSID, 1);
1273 ProblemsManager *prb_mng_ptr;
1275
1276 DMCtx *subdm_field = static_cast<DMCtx *>(subdm->data);
1277
1278 // build sub dm problem
1279 CHKERR subdm_field->mField_ptr->getInterface(prb_mng_ptr);
1280
1281 map<std::string, std::pair<EntityType, EntityType>> *entity_map_row = nullptr;
1282 map<std::string, std::pair<EntityType, EntityType>> *entity_map_col = nullptr;
1283
1284 if (subdm_field->mapTypeRow)
1285 entity_map_row = subdm_field->mapTypeRow.get();
1286 if (subdm_field->mapTypeCol)
1287 entity_map_row = subdm_field->mapTypeCol.get();
1288
1289 CHKERR prb_mng_ptr->buildSubProblem(
1290 subdm_field->problemName, subdm_field->rowFields, subdm_field->colFields,
1291 subdm_field->problemMainOfSubPtr->getName(),
1292 subdm_field->isSquareMatrix == PETSC_TRUE, entity_map_row, entity_map_col,
1293 subdm_field->verbosity);
1294
1295 // partition problem
1296 subdm_field->isPartitioned = subdm_field->isPartitioned;
1297 if (subdm_field->isPartitioned) {
1298 CHKERR prb_mng_ptr->partitionFiniteElements(subdm_field->problemName, true,
1299 0, subdm_field->sIze,
1300 subdm_field->verbosity);
1301 // set ghost nodes
1302 CHKERR prb_mng_ptr->partitionGhostDofsOnDistributedMesh(
1303 subdm_field->problemName, subdm_field->verbosity);
1304 } else {
1305 // partition finite elements
1306 CHKERR prb_mng_ptr->partitionFiniteElements(subdm_field->problemName, false,
1307 -1, -1, subdm_field->verbosity);
1308 // set ghost nodes
1309 CHKERR prb_mng_ptr->partitionGhostDofs(subdm_field->problemName,
1310 subdm_field->verbosity);
1311 }
1312
1313 subdm_field->isProblemBuild = PETSC_TRUE;
1314
1316}

◆ smartCreateDMMatrix()

auto MoFEM::smartCreateDMMatrix ( DM  dm)

Get smart matrix from DM.

Examples
mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_interface.cpp, and test_jacobian_of_simple_contact_element.cpp.

Definition at line 965 of file DMMoFEM.hpp.

965 {
966 SmartPetscObj<Mat> a;
968 CHKERRABORT(getCommFromPetscObject(reinterpret_cast<PetscObject>(dm)), ierr);
969 return a;
970};
constexpr double a
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, SmartPetscObj< Mat > &M)
Definition: DMMMoFEM.cpp:1176
MPI_Comm getCommFromPetscObject(PetscObject obj)
Get the Comm From Petsc Object object.

◆ smartCreateDMVector()

auto MoFEM::smartCreateDMVector ( DM  dm)