v0.14.0
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:

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, std::string fe_name)
 Resolve shared entities. More...
 
PetscErrorCode MoFEM::DMMoFEMGetProblemFiniteElementLayout (DM dm, std::string fe_name, PetscLayout *layout)
 Get finite elements layout in the problem. More...
 
PetscErrorCode MoFEM::DMMoFEMAddElement (DM dm, std::string fe_name)
 add element to dm More...
 
PetscErrorCode MoFEM::DMMoFEMAddElement (DM dm, std::vector< std::string > fe_name)
 add element to dm More...
 
PetscErrorCode MoFEM::DMMoFEMUnSetElement (DM dm, std::string 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[])
 
PetscErrorCode MoFEM::DMMoFEMAddSubFieldRow (DM dm, const char field_name[], boost::shared_ptr< Range > r_ptr)
 Add field to sub dm problem on rows. More...
 
PetscErrorCode MoFEM::DMMoFEMAddSubFieldCol (DM dm, const char field_name[])
 
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::createDMMatrix (DM dm)
 Get smart matrix from DM. More...
 
auto MoFEM::createDMVector (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

◆ createDMMatrix()

auto MoFEM::createDMMatrix ( DM  dm)
inline

Get smart matrix from DM.

Examples
free_surface.cpp, level_set.cpp, navier_stokes.cpp, plastic.cpp, and simple_interface.cpp.

Definition at line 1003 of file DMMoFEM.hpp.

1003  {
1004  SmartPetscObj<Mat> a;
1005  ierr = DMCreateMatrix_MoFEM(dm, a);
1006  CHKERRABORT(getCommFromPetscObject(reinterpret_cast<PetscObject>(dm)), ierr);
1007  return a;
1008 };

◆ createDMVector()

auto MoFEM::createDMVector ( DM  dm)
inline

◆ 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 462 of file PCMGSetUpViaApproxOrders.cpp.

462  {
463  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
465  GET_DM_FIELD(dm);
466  CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
467  CHKERR DMCreate(comm, dmc);
468  (*dmc)->data = dm->data;
469  DMType type;
470  CHKERR DMGetType(dm, &type);
471  CHKERR DMSetType(*dmc, type);
472  CHKERR PetscObjectReference((PetscObject)(*dmc));
473  PetscInfo1(dm, "Coarsen DMMGViaApproxOrders leveldown = %d\n", dm->leveldown);
475 }

◆ DMCreate_MoFEM()

PetscErrorCode MoFEM::DMCreate_MoFEM ( DM  dm)

Create dm data structure with MoFEM data structure.

Definition at line 75 of file DMMoFEM.cpp.

75  {
76  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
78  dm->data = new DMCtx();
81 }

◆ 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 1451 of file DMMoFEM.cpp.

1452  {
1453  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1455 
1456  if (numFields) {
1457  *numFields = 0;
1458  }
1459  if (fieldNames) {
1460  *fieldNames = NULL;
1461  }
1462  if (fields) {
1463  *fields = NULL;
1464  }
1465 
1466  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1467  auto fields_ptr = dm_field->mField_ptr->get_fields();
1468  Field_multiIndex::iterator fit, hi_fit;
1469  fit = fields_ptr->begin();
1470  hi_fit = fields_ptr->end();
1471  *numFields = std::distance(fit, hi_fit);
1472 
1473  if (fieldNames) {
1474  CHKERR PetscMalloc1(*numFields, fieldNames);
1475  }
1476  if (fields) {
1477  CHKERR PetscMalloc1(*numFields, fields);
1478  }
1479 
1480  for (int f = 0; fit != hi_fit; fit++, f++) {
1481  if (fieldNames) {
1482  CHKERR PetscStrallocpy(fit->get()->getName().c_str(),
1483  (char **)&(*fieldNames)[f]);
1484  }
1485  if (fields) {
1486  CHKERR dm_field->mField_ptr->getInterface<ISManager>()
1487  ->isCreateProblemFieldAndRank(
1488  dm_field->problemPtr->getName(), ROW, fit->get()->getName(), 0,
1489  fit->get()->getNbOfCoeffs(), &(*fields)[f]);
1490  }
1491  }
1492 
1494 }

◆ 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 1181 of file DMMoFEM.cpp.

1181  {
1182  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1184  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1185  CHKERR dm_field->mField_ptr->getInterface<VecManager>()->vecCreateGhost(
1186  dm_field->problemName, COL, g_ptr);
1187  CHKERR VecSetDM(g_ptr, dm);
1189 }

◆ 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 1171 of file DMMoFEM.cpp.

1171  {
1172  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1174  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1175  CHKERR dm_field->mField_ptr->getInterface<VecManager>()->vecCreateGhost(
1176  dm_field->problemName, COL, g);
1177  CHKERR VecSetDM(*g, dm);
1179 }

◆ 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 1191 of file DMMoFEM.cpp.

1191  {
1192  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1194  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1195  CHKERR dm_field->mField_ptr->getInterface<VecManager>()->vecCreateSeq(
1196  dm_field->problemName, COL, l);
1197  CHKERR VecSetDM(*l, dm);
1199 }

◆ 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 430 of file PCMGSetUpViaApproxOrders.cpp.

430  {
431 
432  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
434  GET_DM_FIELD(dm);
435 
436  int leveldown = dm->leveldown;
437 
438  if (dm_field->kspOperators.empty()) {
440  } else {
441  MPI_Comm comm;
442  CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
443  if (dm_field->kspOperators.empty()) {
444  SETERRQ(comm, MOFEM_DATA_INCONSISTENCY,
445  "data inconsistency, operator can not be set");
446  }
447  if (static_cast<int>(dm_field->kspOperators.size()) < leveldown) {
448  SETERRQ(comm, MOFEM_DATA_INCONSISTENCY,
449  "data inconsistency, no IS for that level");
450  }
451  *M = dm_field->kspOperators[dm_field->kspOperators.size() - 1 - leveldown];
452  CHKERR PetscObjectReference((PetscObject)*M);
453  CHKERR MatSetDM(*M, dm);
454  }
455 
456  PetscInfo1(dm, "Create Matrix DMMGViaApproxOrders leveldown = %d\n",
457  leveldown);
458 
460 }

◆ 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
dm_build_partitioned_mesh.cpp, dynamic_first_order_con_law.cpp, eigen_elastic.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, ep.cpp, and reaction_diffusion.cpp.

Definition at line 1201 of file DMMoFEM.cpp.

1201  {
1202  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1204  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1205  if (strcmp(dm->mattype, MATMPIAIJ) == 0) {
1206  CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1207  ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(dm_field->problemName,
1208  M);
1209  } else if (strcmp(dm->mattype, MATAIJ) == 0) {
1210  CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1211  ->createSeqAIJWithArrays<PetscLocalIdx_mi_tag>(dm_field->problemName,
1212  M);
1213  } else if (strcmp(dm->mattype, MATAIJCUSPARSE) == 0) {
1214  CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1215  ->createMPIAIJCUSPARSEWithArrays<PetscGlobalIdx_mi_tag>(
1216  dm_field->problemName, M);
1217  } else if (strcmp(dm->mattype, MATSEQAIJCUSPARSE) == 0) {
1218  CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1219  ->createSeqAIJCUSPARSEWithArrays<PetscLocalIdx_mi_tag>(
1220  dm_field->problemName, M);
1221  } else {
1222  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
1223  "Matrix type not implemented");
1224  }
1225  CHKERR MatSetDM(*M, dm);
1227 }

◆ 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 1229 of file DMMoFEM.cpp.

1229  {
1230  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1232  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1233  if (strcmp(dm->mattype, MATMPIAIJ) == 0) {
1234  CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1235  ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(dm_field->problemName,
1236  M);
1237  } else if (strcmp(dm->mattype, MATAIJ) == 0) {
1238  CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1239  ->createSeqAIJWithArrays<PetscLocalIdx_mi_tag>(dm_field->problemName,
1240  M);
1241  } else if (strcmp(dm->mattype, MATAIJCUSPARSE) == 0) {
1242  CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1243  ->createMPIAIJCUSPARSEWithArrays<PetscGlobalIdx_mi_tag>(
1244  dm_field->problemName, M);
1245  } else if (strcmp(dm->mattype, MATSEQAIJCUSPARSE) == 0) {
1246  CHKERR dm_field->mField_ptr->getInterface<MatrixManager>()
1247  ->createSeqAIJCUSPARSEWithArrays<PetscLocalIdx_mi_tag>(
1248  dm_field->problemName, M);
1249  } else {
1250  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
1251  "Matrix type not implemented");
1252  }
1253  CHKERR MatSetDM(M, dm);
1255 }

◆ DMDestroy_MoFEM()

PetscErrorCode MoFEM::DMDestroy_MoFEM ( DM  dm)

Destroys dm with MoFEM data structure.

destroy the MoFEM structure

Definition at line 83 of file DMMoFEM.cpp.

83  {
84  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
85  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
87 
88  MPI_Comm comm;
89  CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
90 
91  int result;
92  MPI_Comm_compare(comm, PETSC_COMM_SELF, &result);
93  if (result == MPI_IDENT)
94  MOFEM_LOG("DMSELF", Sev::noisy)
95  << "MoFEM DM destroy for problem " << dm_field->problemName
96  << " referenceNumber " << dm_field->referenceNumber;
97  else
98  MOFEM_LOG("DMWORLD", Sev::noisy)
99  << "MoFEM DM destroy for problem " << dm_field->problemName
100  << " referenceNumber " << dm_field->referenceNumber;
101 
102  if (dm_field->referenceNumber == 0) {
103  if (dm_field->destroyProblem) {
104 
105  if (dm_field->mField_ptr->check_problem(dm_field->problemName)) {
106  dm_field->mField_ptr->delete_problem(dm_field->problemName);
107  } // else problem has to be deleted by the user
108  }
109 
110  delete static_cast<DMCtx *>(dm->data);
111 
112  } else
113  --dm_field->referenceNumber;
114 
116 }

◆ 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 1379 of file DMMoFEM.cpp.

1380  {
1381  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1383  CHKERR VecGhostUpdateBegin(g, INSERT_VALUES, SCATTER_FORWARD);
1385 }

◆ 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 1387 of file DMMoFEM.cpp.

1387  {
1389  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1391 
1392  CHKERR VecGhostUpdateEnd(g, INSERT_VALUES, SCATTER_FORWARD);
1393 
1394  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1395  int nb_dofs = dm_field->problemPtr->getNbLocalDofsRow();
1396  int nb_ghost = dm_field->problemPtr->getNbGhostDofsRow();
1397 
1398  double *array_loc, *array_glob;
1399  CHKERR VecGetArray(l, &array_loc);
1400  CHKERR VecGetArray(g, &array_glob);
1401  switch (mode) {
1402  case INSERT_VALUES:
1403  cblas_dcopy(nb_dofs + nb_ghost, array_glob, 1, array_loc, 1);
1404  break;
1405  case ADD_VALUES:
1406  cblas_daxpy(nb_dofs + nb_ghost, 1, array_glob, 1, array_loc, 1);
1407  break;
1408  default:
1409  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1410  }
1411  CHKERR VecRestoreArray(l, &array_loc);
1412  CHKERR VecRestoreArray(g, &array_glob);
1414 }

◆ 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 1416 of file DMMoFEM.cpp.

1417  {
1418 
1419  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1421 
1422  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1423  int nb_dofs = dm_field->problemPtr->getNbLocalDofsRow();
1424  int nb_ghost = dm_field->problemPtr->getNbGhostDofsRow();
1425 
1426  double *array_loc, *array_glob;
1427  CHKERR VecGetArray(l, &array_loc);
1428  CHKERR VecGetArray(g, &array_glob);
1429  switch (mode) {
1430  case INSERT_VALUES:
1431  cblas_dcopy(nb_dofs + nb_ghost, array_loc, 1, array_glob, 1);
1432  break;
1433  case ADD_VALUES:
1434  cblas_daxpy(nb_dofs + nb_ghost, 1, array_loc, 1, array_glob, 1);
1435  break;
1436  default:
1437  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1438  }
1439  CHKERR VecRestoreArray(l, &array_loc);
1440  CHKERR VecRestoreArray(g, &array_glob);
1441 
1443 }

◆ 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 1445 of file DMMoFEM.cpp.

1445  {
1446  //
1449 }

◆ DMMGViaApproxOrdersClearCoarseningIS()

MoFEMErrorCode DMMGViaApproxOrdersClearCoarseningIS ( DM  )

Clear approximation orders.

Parameters
DMdm
Returns
Error code

Definition at line 276 of file PCMGSetUpViaApproxOrders.cpp.

276  {
277  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
279  GET_DM_FIELD(dm);
280  CHKERR dm_field->destroyCoarseningIS();
281  PetscInfo(dm, "Clear DMs data structures\n");
283 }

◆ DMMGViaApproxOrdersPopBackCoarseningIS()

MoFEMErrorCode DMMGViaApproxOrdersPopBackCoarseningIS ( DM  )

Pop is form MG via approximation orders.

Parameters
DMdm
ispop back IS
Returns
error code

Definition at line 260 of file PCMGSetUpViaApproxOrders.cpp.

260  {
261  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
263  GET_DM_FIELD(dm);
264  if (dm_field->coarseningIS.back()) {
265  CHKERR ISDestroy(&dm_field->coarseningIS.back());
266  dm_field->coarseningIS.pop_back();
267  }
268  if (dm_field->kspOperators.back()) {
269  CHKERR MatDestroy(&dm_field->kspOperators.back());
270  }
271  dm_field->kspOperators.pop_back();
272  PetscInfo(dm, "Pop back IS to DMMGViaApproxOrders\n");
274 }

◆ DMMGViaApproxOrdersPushBackCoarseningIS()

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.

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 206 of file PCMGSetUpViaApproxOrders.cpp.

209  {
210  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
212  GET_DM_FIELD(dm);
213  dm_field->coarseningIS.push_back(is);
214  dm_field->shellMatrixCtxPtr.push_back(new PCMGSubMatrixCtx_private(A, is));
215  if (is) {
216  CHKERR PetscObjectReference((PetscObject)is);
217  }
218  if (is) {
219  IS is2 = is;
220  if (dm_field->aO) {
221  CHKERR ISDuplicate(is, &is2);
222  CHKERR ISCopy(is, is2);
223  CHKERR AOApplicationToPetscIS(dm_field->aO, is2);
224  }
225  if (create_sub_matrix) {
226  if (shell_sub_a) {
227  int n, N;
228  CHKERR ISGetSize(is, &N);
229  CHKERR ISGetLocalSize(is, &n);
230  MPI_Comm comm;
231  CHKERR PetscObjectGetComm((PetscObject)A, &comm);
232  CHKERR MatCreateShell(comm, n, n, N, N,
233  &(dm_field->shellMatrixCtxPtr.back()), subA);
234  CHKERR MatShellSetOperation(*subA, MATOP_MULT,
235  (void (*)(void))sub_mat_mult);
236  CHKERR MatShellSetOperation(*subA, MATOP_MULT_ADD,
237  (void (*)(void))sub_mat_mult_add);
238  CHKERR MatShellSetOperation(*subA, MATOP_SOR,
239  (void (*)(void))sub_mat_sor);
240  } else {
241 #if PETSC_VERSION_GE(3, 8, 0)
242  CHKERR MatCreateSubMatrix(A, is2, is2, MAT_INITIAL_MATRIX, subA);
243 #else
244  CHKERR MatGetSubMatrix(A, is2, is2, MAT_INITIAL_MATRIX, subA);
245 #endif
246  }
247  }
248  if (dm_field->aO) {
249  CHKERR ISDestroy(&is2);
250  }
251  dm_field->kspOperators.push_back(*subA);
252  CHKERR PetscObjectReference((PetscObject)(*subA));
253  } else {
254  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
255  }
256  PetscInfo(dm, "Push back IS to DMMGViaApproxOrders\n");
258 }

◆ 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 389 of file DMMoFEM.cpp.

389  {
390  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
392  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
393  if (!dm->data) {
394  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
395  "data structure for MoFEM not yet created");
396  }
397  if (!dm_field->isCompDM) {
398  dm_field->isCompDM = PETSC_TRUE;
399  }
400  if (dm_field->isSquareMatrix) {
401  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
402  "No need to add problem on column when problem block structurally "
403  "symmetric");
404  }
405  dm_field->colCompPrb.push_back(prb_name);
407 }

◆ DMMoFEMAddElement() [1/2]

PetscErrorCode MoFEM::DMMoFEMAddElement ( DM  dm,
std::string  fe_name 
)

add element to dm

Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.
Examples
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, EshelbianPlasticity.cpp, free_surface.cpp, level_set.cpp, lorentz_force.cpp, MagneticElement.hpp, minimal_surface_area.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, NonlinearElasticElementInterface.hpp, photon_diffusion.cpp, plastic.cpp, Remodeling.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, test_jacobian_of_simple_contact_element.cpp, and UnsaturatedFlow.hpp.

Definition at line 501 of file DMMoFEM.cpp.

501  {
502  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
504  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
505  CHKERR dm_field->mField_ptr->modify_problem_add_finite_element(
506  dm_field->problemName, fe_name);
508 }

◆ DMMoFEMAddElement() [2/2]

PetscErrorCode MoFEM::DMMoFEMAddElement ( DM  dm,
std::vector< std::string >  fe_name 
)

add element to dm

Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.

Definition at line 510 of file DMMoFEM.cpp.

510  {
512  for (auto fe : fe_name) {
513  CHKERR DMMoFEMAddElement(dm, fe);
514  }
516 }

◆ 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 371 of file DMMoFEM.cpp.

371  {
372  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
374  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
375  if (!dm->data) {
376  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
377  "data structure for MoFEM not yet created");
378  }
379  if (!dm_field->isCompDM) {
380  dm_field->isCompDM = PETSC_TRUE;
381  }
382  dm_field->rowCompPrb.push_back(prb_name);
383  if (dm_field->isSquareMatrix) {
384  dm_field->colCompPrb.push_back(prb_name);
385  }
387 }

◆ DMMoFEMAddSubFieldCol()

PetscErrorCode MoFEM::DMMoFEMAddSubFieldCol ( DM  dm,
const char  field_name[] 
)

Add field to sub dm problem on columns

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

Definition at line 284 of file DMMoFEM.cpp.

284  {
285  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
287  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
288  if (!dm->data) {
289  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
290  "data structure for MoFEM not yet created");
291  }
292  if (!dm_field->isSubDM) {
293  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "this is not sub-dm");
294  }
295  dm_field->colFields.push_back(field_name);
296  dm_field->mapTypeCol.erase(field_name);
298 }

◆ DMMoFEMAddSubFieldRow() [1/2]

PetscErrorCode MoFEM::DMMoFEMAddSubFieldRow ( DM  dm,
const char  field_name[] 
)

Add field to sub dm problem on rows

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

Definition at line 242 of file DMMoFEM.cpp.

242  {
243  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
245  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
246  if (!dm->data) {
247  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
248  "data structure for MoFEM not yet created");
249  }
250  if (!dm_field->isSubDM) {
251  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "this is not sub-dm");
252  }
253  dm_field->rowFields.push_back(field_name);
254  dm_field->mapTypeRow.erase(field_name);
256 }

◆ DMMoFEMAddSubFieldRow() [2/2]

PetscErrorCode MoFEM::DMMoFEMAddSubFieldRow ( DM  dm,
const char  field_name[],
boost::shared_ptr< Range r_ptr 
)

Add field to sub dm problem on rows.

Parameters
dm
field_name
m
Returns
PetscErrorCode

Definition at line 262 of file DMMoFEM.cpp.

263  {
264  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
266  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
267  if (!dm->data) {
268  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
269  "data structure for MoFEM not yet created");
270  }
271  if (!dm_field->isSubDM) {
272  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "this is not sub-dm");
273  }
274  dm_field->rowFields.push_back(field_name);
275  dm_field->mapTypeRow[field_name] = r_ptr;
277 }

◆ 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.

Note
If problem exist function create DM for it. If you set bit levels, those bits are to existing bits. Thus if you do not like to change bit ref level for existing problem, set bits to zero.
Examples
cell_forces.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, EshelbianPlasticity.cpp, free_surface.cpp, lorentz_force.cpp, MagneticElement.hpp, minimal_surface_area.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, Remodeling.cpp, simple_contact.cpp, simple_contact_thermal.cpp, test_jacobian_of_simple_contact_element.cpp, and UnsaturatedFlow.hpp.

Definition at line 118 of file DMMoFEM.cpp.

121  {
123 
124  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
125  if (!dm->data) {
126  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
127  "data structure for MoFEM not yet created");
128  }
129  if (!m_field_ptr) {
130  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
131  "DM function not implemented into MoFEM");
132  }
133  dm_field->mField_ptr = m_field_ptr;
134  dm_field->problemName = problem_name;
135  if (!m_field_ptr->check_problem(dm_field->problemName)) {
136  // problem is not defined, declare problem internally set bool to
137  // destroyProblem problem with DM
138  dm_field->destroyProblem = PETSC_TRUE;
139  CHKERR dm_field->mField_ptr->add_problem(dm_field->problemName, MF_EXCL,
140  dm_field->verbosity);
141  } else {
142  dm_field->destroyProblem = PETSC_FALSE;
143  }
144  CHKERR dm_field->mField_ptr->modify_problem_ref_level_add_bit(
145  dm_field->problemName, bit_level);
146  CHKERR dm_field->mField_ptr->modify_problem_mask_ref_level_add_bit(
147  dm_field->problemName, bit_mask);
148  dm_field->kspCtx =
149  boost::shared_ptr<KspCtx>(new KspCtx(*m_field_ptr, problem_name));
150  dm_field->snesCtx =
151  boost::shared_ptr<SnesCtx>(new SnesCtx(*m_field_ptr, problem_name));
152  dm_field->tsCtx =
153  boost::shared_ptr<TsCtx>(new TsCtx(*m_field_ptr, problem_name));
154 
155  MPI_Comm comm;
156  CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
157  int result = 0;
158  MPI_Comm_compare(comm, m_field_ptr->get_comm(), &result);
159  if (result > MPI_CONGRUENT) {
160  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
161  "MoFEM and DM using different communicators");
162  }
163  MPI_Comm_size(comm, &dm_field->sIze);
164  MPI_Comm_rank(comm, &dm_field->rAnk);
165 
166  // problem structure
167  CHKERR dm_field->mField_ptr->get_problem(dm_field->problemName,
168  &dm_field->problemPtr);
169 
170  MPI_Comm_compare(comm, PETSC_COMM_SELF, &result);
171  if (result == MPI_IDENT) {
172  MOFEM_LOG("DMSELF", Sev::noisy)
173  << "MoFEM DM created for problem " << dm_field->problemName;
174  MOFEM_LOG("DMSELF", Sev::noisy) << *dm_field->problemPtr;
175  } else {
176  MOFEM_LOG("DMWORLD", Sev::noisy)
177  << "MoFEM DM created for problem " << dm_field->problemName;
178  MOFEM_LOG("DMWORLD", Sev::noisy) << *dm_field->problemPtr;
179  }
180 
182 }

◆ 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
analytical_poisson_field_split.cpp, cell_forces.cpp, dm_create_subdm.cpp, EshelbianPlasticity.cpp, free_surface.cpp, level_set.cpp, and plastic.cpp.

Definition at line 219 of file DMMoFEM.cpp.

219  {
221 
222  if (!dm->data) {
223  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
224  "data structure for MoFEM not yet created");
225  }
226  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
227 
228  CHKERR DMMoFEMCreateMoFEM(subdm, dm_field->mField_ptr, problem_name,
229  dm_field->problemPtr->getBitRefLevel(),
230  dm_field->problemPtr->getBitRefLevelMask());
231 
232  DMCtx *subdm_field = (DMCtx *)subdm->data;
233  subdm_field->isSubDM = PETSC_TRUE;
234  subdm_field->problemMainOfSubPtr = dm_field->problemPtr;
235  subdm_field->isPartitioned = dm_field->isPartitioned;
236  subdm_field->isSquareMatrix = PETSC_FALSE;
237  subdm->ops->setup = DMSubDMSetUp_MoFEM;
238 
240 }

◆ 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);

Definition at line 1496 of file DMMoFEM.cpp.

1497  {
1498  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1500  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1501  CHKERR dm_field->mField_ptr->getInterface<ISManager>()
1502  ->isCreateProblemFieldAndRank(dm_field->problemPtr->getName(), ROW,
1503  field_name, 0, 1000, is);
1505 }

◆ 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 409 of file DMMoFEM.cpp.

409  {
411  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
413  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
414  *is_comp_dm = dm_field->isCompDM;
416 }

◆ DMMoFEMGetIsPartitioned()

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

get if read mesh is partitioned

Definition at line 1138 of file DMMoFEM.cpp.

1138  {
1139  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1141  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1142  *is_partitioned = dm_field->isPartitioned;
1144 }

◆ 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 326 of file DMMoFEM.cpp.

326  {
328  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
330  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
331  *is_sub_dm = dm_field->isSubDM;
333 }

◆ DMMoFEMGetKspCtx() [1/2]

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

get MoFEM::KspCtx data structure

Definition at line 1081 of file DMMoFEM.cpp.

1081  {
1082  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1084  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1085  const_cast<boost::shared_ptr<MoFEM::KspCtx> &>(ksp_ctx) = dm_field->kspCtx;
1087 }

◆ DMMoFEMGetKspCtx() [2/2]

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

get MoFEM::KspCtx data structure

Definition at line 1072 of file DMMoFEM.cpp.

1072  {
1073  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1075  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1076  *ksp_ctx = dm_field->kspCtx.get();
1078 }

◆ DMMoFEMGetProblemFiniteElementLayout()

PetscErrorCode MoFEM::DMMoFEMGetProblemFiniteElementLayout ( DM  dm,
std::string  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 477 of file DMMoFEM.cpp.

478  {
480  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
482  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
483 
484  MPI_Comm comm;
485  CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
486  CHKERR dm_field->problemPtr->getNumberOfElementsByNameAndPart(comm, fe_name,
487  layout);
489 }

◆ DMMoFEMGetProblemPtr()

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

Get pointer to problem data structure.

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

Definition at line 430 of file DMMoFEM.cpp.

430  {
431  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
433  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
434  if (!dm->data) {
435  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
436  "data structure for MoFEM not yet created");
437  }
438  *problem_ptr = dm_field->problemPtr;
440 }

◆ DMMoFEMGetSnesCtx() [1/2]

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

get MoFEM::SnesCtx data structure

Definition at line 1107 of file DMMoFEM.cpp.

1107  {
1108  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1110  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1111  const_cast<boost::shared_ptr<MoFEM::SnesCtx> &>(snes_ctx) = dm_field->snesCtx;
1113 }

◆ DMMoFEMGetSnesCtx() [2/2]

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

get MoFEM::SnesCtx data structure

Examples
minimal_surface_area.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 1098 of file DMMoFEM.cpp.

1098  {
1099  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1101  DMCtx *dm_field = (DMCtx *)dm->data;
1102  *snes_ctx = dm_field->snesCtx.get();
1104 }

◆ 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 491 of file DMMoFEM.cpp.

491  {
494  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
496  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
497  *square_problem = dm_field->isSquareMatrix;
499 }

◆ DMMoFEMGetTsCtx() [1/2]

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

get MoFEM::TsCtx data structure

Definition at line 1154 of file DMMoFEM.cpp.

1155  {
1156  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1158  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1159  const_cast<boost::shared_ptr<MoFEM::TsCtx> &>(ts_ctx) = dm_field->tsCtx;
1161 }

◆ 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 1146 of file DMMoFEM.cpp.

1146  {
1147  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1149  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1150  *ts_ctx = dm_field->tsCtx.get();
1152 }

◆ 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, level_set.cpp, and simple_elasticity.cpp.

Definition at line 682 of file DMMoFEM.cpp.

685  {
686  return DMMoFEMKSPSetComputeOperators<const char *, MoFEM::FEMethod *,
689  dm, fe_name, method, pre_only, post_only);
690 }

◆ 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 693 of file DMMoFEM.cpp.

696  {
697  return DMMoFEMKSPSetComputeOperators<const std::string,
698  boost::shared_ptr<MoFEM::FEMethod>>(
699  dm, fe_name, method, pre_only, post_only);
700 }

◆ 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, level_set.cpp, and simple_elasticity.cpp.

Definition at line 641 of file DMMoFEM.cpp.

644  {
645  return DMMoFEMKSPSetComputeRHS<const char *, MoFEM::FEMethod *,
647  dm, fe_name, method, pre_only, post_only);
648 }

◆ 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 651 of file DMMoFEM.cpp.

654  {
655  return DMMoFEMKSPSetComputeRHS<const std::string,
656  boost::shared_ptr<MoFEM::FEMethod>,
657  boost::shared_ptr<MoFEM::BasicMethod>,
658  boost::shared_ptr<MoFEM::BasicMethod>>(
659  dm, fe_name, method, pre_only, post_only);
660 }

◆ DMMoFEMResolveSharedFiniteElements()

PetscErrorCode MoFEM::DMMoFEMResolveSharedFiniteElements ( DM  dm,
std::string  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);

Definition at line 468 of file DMMoFEM.cpp.

468  {
469  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
471  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
472  CHKERR dm_field->mField_ptr->getInterface<CommInterface>()
473  ->resolveSharedFiniteElements(dm_field->problemPtr, fe_name);
475 }

◆ DMMoFEMSetIsPartitioned()

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

sets if read mesh is partitioned

get if read mesh is partitioned

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

Definition at line 1127 of file DMMoFEM.cpp.

1127  {
1128  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1130  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1131  dm_field->isPartitioned = is_partitioned;
1133 }

◆ DMMoFEMSetKspCtx()

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

set MoFEM::KspCtx data structure

Definition at line 1089 of file DMMoFEM.cpp.

1090  {
1091  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1093  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1094  dm_field->kspCtx = ksp_ctx;
1096 }

◆ DMMoFEMSetSnesCtx()

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

Set MoFEM::SnesCtx data structure.

Definition at line 1115 of file DMMoFEM.cpp.

1116  {
1117  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1119  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1120  dm_field->snesCtx = snes_ctx;
1122 }

◆ 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
analytical_poisson_field_split.cpp, cell_forces.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, EshelbianPlasticity.cpp, free_surface.cpp, level_set.cpp, and plastic.cpp.

Definition at line 460 of file DMMoFEM.cpp.

460  {
461  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
463  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
464  dm_field->isSquareMatrix = square_problem;
466 }

◆ 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 1163 of file DMMoFEM.cpp.

1163  {
1164  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1166  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1167  dm_field->tsCtx = ts_ctx;
1169 }

◆ 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 732 of file DMMoFEM.cpp.

735  {
736  return DMMoFEMSNESSetFunction<const std::string,
737  boost::shared_ptr<MoFEM::FEMethod>,
738  boost::shared_ptr<MoFEM::BasicMethod>,
739  boost::shared_ptr<MoFEM::BasicMethod>>(
740  dm, fe_name, method, pre_only, post_only);
741 }

◆ 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 773 of file DMMoFEM.cpp.

776  {
777  return DMMoFEMSNESSetJacobian<const std::string,
778  boost::shared_ptr<MoFEM::FEMethod>,
779  boost::shared_ptr<MoFEM::BasicMethod>,
780  boost::shared_ptr<MoFEM::BasicMethod>>(
781  dm, fe_name, method, pre_only, post_only);
782 }

◆ 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 968 of file DMMoFEM.cpp.

971  {
972  return DMMoFEMTSSetI2Function<const char *, MoFEM::FEMethod *,
974  dm, fe_name, method, pre_only, post_only);
976 }

◆ 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 979 of file DMMoFEM.cpp.

982  {
983  return DMMoFEMTSSetI2Function<const std::string,
984  boost::shared_ptr<MoFEM::FEMethod>,
985  boost::shared_ptr<MoFEM::BasicMethod>,
986  boost::shared_ptr<MoFEM::BasicMethod>>(
987  dm, fe_name, method, pre_only, post_only);
989 }

◆ 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 1011 of file DMMoFEM.cpp.

1014  {
1015  return DMMoFEMTSSetI2Jacobian<const char *, FEMethod *, MoFEM::BasicMethod *,
1016  MoFEM::BasicMethod *>(dm, fe_name, method,
1017  pre_only, post_only);
1018 }

◆ 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 1021 of file DMMoFEM.cpp.

1024  {
1025  return DMMoFEMTSSetI2Jacobian<const std::string,
1026  boost::shared_ptr<MoFEM::FEMethod>,
1027  boost::shared_ptr<MoFEM::BasicMethod>,
1028  boost::shared_ptr<MoFEM::BasicMethod>>(
1029  dm, fe_name, method, pre_only, post_only);
1030 }

◆ 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
bone_adaptation.cpp, EshelbianPlasticity.cpp, NonlinearElasticElementInterface.hpp, reaction_diffusion.cpp, and UnsaturatedFlow.hpp.

Definition at line 804 of file DMMoFEM.cpp.

807  {
808  return DMMoFEMTSSetIFunction<const char *, MoFEM::FEMethod *,
810  dm, fe_name, method, pre_only, post_only);
812 }

◆ 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 815 of file DMMoFEM.cpp.

818  {
819  return DMMoFEMTSSetIFunction<const std::string,
820  boost::shared_ptr<MoFEM::FEMethod>,
821  boost::shared_ptr<MoFEM::BasicMethod>,
822  boost::shared_ptr<MoFEM::BasicMethod>>(
823  dm, fe_name, method, pre_only, post_only);
825 }

◆ 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 847 of file DMMoFEM.cpp.

850  {
851  return DMMoFEMTSSetIJacobian<const char *, FEMethod *, MoFEM::BasicMethod *,
852  MoFEM::BasicMethod *>(dm, fe_name, method,
853  pre_only, post_only);
854 }

◆ 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
bone_adaptation.cpp, EshelbianPlasticity.cpp, NonlinearElasticElementInterface.hpp, reaction_diffusion.cpp, and UnsaturatedFlow.hpp.

Definition at line 857 of file DMMoFEM.cpp.

860  {
861  return DMMoFEMTSSetIJacobian<const std::string,
862  boost::shared_ptr<MoFEM::FEMethod>,
863  boost::shared_ptr<MoFEM::BasicMethod>,
864  boost::shared_ptr<MoFEM::BasicMethod>>(
865  dm, fe_name, method, pre_only, post_only);
866 }

◆ DMMoFEMUnSetElement()

PetscErrorCode MoFEM::DMMoFEMUnSetElement ( DM  dm,
std::string  fe_name 
)

unset element from dm

Definition at line 518 of file DMMoFEM.cpp.

518  {
519  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
521  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
522  CHKERR dm_field->mField_ptr->modify_problem_unset_finite_element(
523  dm_field->problemName, fe_name);
525 }

◆ 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
adolc_plasticity.cpp, free_surface.cpp, HookeElement.cpp, mesh_smoothing.cpp, and PlasticOpsMonitor.hpp.

Definition at line 418 of file DMMoFEM.cpp.

418  {
419  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
421  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
422  if (!dm->data) {
423  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
424  "data structure for MoFEM not yet created");
425  }
426  *m_field_ptr = dm_field->mField_ptr;
428 }

◆ DMoFEMLoopDofs()

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

execute method for dofs on field in problem

Definition at line 609 of file DMMoFEM.cpp.

610  {
611  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
613  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
614  ierr =
615  dm_field->mField_ptr->loop_dofs(dm_field->problemPtr, field_name, COL,
616  *method, dm_field->rAnk, dm_field->rAnk);
617  CHKERRG(ierr);
619 }

◆ 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
adolc_plasticity.cpp, 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, dynamic_first_order_con_law.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, EshelbianPlasticity.cpp, free_surface.cpp, heat_equation.cpp, HookeElement.cpp, level_set.cpp, MagneticElement.hpp, mesh_smoothing.cpp, minimal_surface_area.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, nonlinear_elastic.cpp, NonlinearElasticElementInterface.hpp, operators_tests.cpp, photon_diffusion.cpp, PlasticOpsMonitor.hpp, reaction_diffusion.cpp, Remodeling.cpp, scalar_check_approximation.cpp, seepage.cpp, shallow_wave.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, simple_interface.cpp, tensor_divergence_operator.cpp, test_cache_on_entities.cpp, thermo_elastic.cpp, UnsaturatedFlow.hpp, and wave_equation.cpp.

Definition at line 590 of file DMMoFEM.cpp.

592  {
593  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
595  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
597  dm, fe_name, method, dm_field->rAnk, dm_field->rAnk, cache_ptr);
598  CHKERRG(ierr);
600 }

◆ 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 603 of file DMMoFEM.cpp.

605  {
606  return DMoFEMLoopFiniteElements(dm, fe_name.c_str(), method.get(), cache_ptr);
607 }

◆ 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 571 of file DMMoFEM.cpp.

573  {
575  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
576  ierr = dm_field->mField_ptr->loop_finite_elements(
577  dm_field->problemPtr, fe_name, *method, low_rank, up_rank, nullptr,
578  MF_EXIST, cache_ptr);
579  CHKERRG(ierr);
581 }

◆ 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 583 of file DMMoFEM.cpp.

585  {
586  return DMoFEMLoopFiniteElementsUpAndLowRank(dm, fe_name.c_str(), method.get(),
587  low_rank, up_rank, cache_ptr);
588 }

◆ 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 539 of file DMMoFEM.cpp.

540  {
541  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
543  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
544  ierr = dm_field->mField_ptr->getInterface<VecManager>()->setGlobalGhostVector(
545  dm_field->problemPtr, COL, g, mode, scatter_mode);
546  CHKERRG(ierr);
548 }

◆ 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
adolc_plasticity.cpp, approx_sphere.cpp, bone_adaptation.cpp, cell_forces.cpp, child_and_parent.cpp, dg_projection.cpp, dynamic_first_order_con_law.cpp, eigen_elastic.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, ep.cpp, EshelbianPlasticity.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, level_set.cpp, MagneticElement.hpp, mesh_smoothing.cpp, minimal_surface_area.cpp, mixed_poisson.cpp, mortar_contact_thermal.cpp, nonlinear_elastic.cpp, phase.cpp, photon_diffusion.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, tensor_divergence_operator.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_elastic.cpp, UnsaturatedFlow.hpp, and wave_equation.cpp.

Definition at line 527 of file DMMoFEM.cpp.

528  {
530  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
532  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
533  ierr = dm_field->mField_ptr->getInterface<VecManager>()->setLocalGhostVector(
534  dm_field->problemPtr, COL, l, mode, scatter_mode);
535  CHKERRG(ierr);
537 }

◆ 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, free_surface.cpp, scalar_check_approximation.cpp, and simple_elasticity.cpp.

Definition at line 560 of file DMMoFEM.cpp.

560  {
561  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
563  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
564  ierr = dm_field->mField_ptr->problem_basic_method_postProcess(
565  dm_field->problemPtr, *method);
566  CHKERRG(ierr);
568 }

◆ 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, free_surface.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, scalar_check_approximation.cpp, simple_contact.cpp, and simple_contact_thermal.cpp.

Definition at line 550 of file DMMoFEM.cpp.

550  {
551  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
553  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
554  ierr = dm_field->mField_ptr->problem_basic_method_preProcess(
555  dm_field->problemPtr, *method);
556  CHKERRG(ierr);
558 }

◆ 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 376 of file PCMGSetUpViaApproxOrders.cpp.

376  {
378  CHKERR DMRegister(sname, DMCreate_MGViaApproxOrders);
380 }

◆ DMRegister_MoFEM()

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

Register MoFEM problem.

Examples
adolc_plasticity.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, 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, dg_projection.cpp, dm_build_partitioned_mesh.cpp, dm_create_subdm.cpp, dm_partitioned_no_field.cpp, dynamic_first_order_con_law.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, level_set.cpp, loop_entities.cpp, lorentz_force.cpp, MagneticElement.hpp, mesh_smoothing.cpp, minimal_surface_area.cpp, mixed_poisson.cpp, mortar_contact.cpp, mortar_contact_thermal.cpp, navier_stokes.cpp, nonlinear_elastic.cpp, operators_tests.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, Remodeling.cpp, scalar_check_approximation.cpp, seepage.cpp, shallow_wave.cpp, simple_contact.cpp, simple_contact_thermal.cpp, simple_elasticity.cpp, simple_interface.cpp, simple_l2_only.cpp, tensor_divergence_operator.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_elastic.cpp, unsaturated_transport.cpp, and wave_equation.cpp.

Definition at line 47 of file DMMoFEM.cpp.

47  {
49  CHKERR DMRegister(sname, DMCreate_MoFEM);
51 }

◆ DMSetFromOptions_MoFEM()

PetscErrorCode MoFEM::DMSetFromOptions_MoFEM ( DM  dm)

Set options for MoFEM DM

Definition at line 1263 of file DMMoFEM.cpp.

1263  {
1264 #endif
1265 
1266  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1268  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1269 #if PETSC_VERSION_GE(3, 5, 3)
1270  ierr = PetscOptionsHead(PetscOptionsObject, "DMMoFEM Options");
1271  CHKERRG(ierr);
1272 #else
1273  ierr = PetscOptionsHead("DMMoFEM Options");
1274  CHKERRG(ierr);
1275 #endif
1276  ierr = PetscOptionsBool("-dm_is_partitioned",
1277  "set if mesh is partitioned (works which native MOAB "
1278  "file format, i.e. h5m",
1279  "DMSetUp", dm_field->isPartitioned,
1280  &dm_field->isPartitioned, NULL);
1281  CHKERRG(ierr);
1283 }

◆ DMSetOperators_MoFEM()

PetscErrorCode MoFEM::DMSetOperators_MoFEM ( DM  dm)

Set operators for MoFEM dm.

Parameters
dm
Returns
error code

Definition at line 53 of file DMMoFEM.cpp.

53  {
54  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
56 
57  dm->ops->createglobalvector = DMCreateGlobalVector_MoFEM;
58  dm->ops->createlocalvector = DMCreateLocalVector_MoFEM;
59  dm->ops->creatematrix = DMCreateMatrix_MoFEM;
60  dm->ops->setup = DMSetUp_MoFEM;
61  dm->ops->destroy = DMDestroy_MoFEM;
62  dm->ops->setfromoptions = DMSetFromOptions_MoFEM;
63  dm->ops->globaltolocalbegin = DMGlobalToLocalBegin_MoFEM;
64  dm->ops->globaltolocalend = DMGlobalToLocalEnd_MoFEM;
65  dm->ops->localtoglobalbegin = DMLocalToGlobalBegin_MoFEM;
66  dm->ops->localtoglobalend = DMLocalToGlobalEnd_MoFEM;
67  dm->ops->createfieldis = DMCreateFieldIS_MoFEM;
68 
69  // Default matrix type
70  CHKERR DMSetMatType(dm, MATMPIAIJ);
71 
73 }

◆ DMSetUp_MoFEM()

PetscErrorCode MoFEM::DMSetUp_MoFEM ( DM  dm)

sets up the MoFEM structures inside a DM object

Examples
mixed_poisson.cpp.

Definition at line 1285 of file DMMoFEM.cpp.

1285  {
1286  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1287  ProblemsManager *prb_mng_ptr;
1289  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1290  CHKERR dm_field->mField_ptr->getInterface(prb_mng_ptr);
1291 
1292  if (dm_field->isCompDM) {
1293  // It is composite probelm
1294  CHKERR prb_mng_ptr->buildComposedProblem(
1295  dm_field->problemName, dm_field->rowCompPrb, dm_field->colCompPrb,
1296  dm_field->isSquareMatrix == PETSC_TRUE, dm_field->verbosity);
1297  } else {
1298  if (dm_field->isPartitioned) {
1299  CHKERR prb_mng_ptr->buildProblemOnDistributedMesh(
1300  dm_field->problemName, dm_field->isSquareMatrix == PETSC_TRUE,
1301  dm_field->verbosity);
1302  } else {
1303  CHKERR prb_mng_ptr->buildProblem(dm_field->problemName,
1304  dm_field->isSquareMatrix == PETSC_TRUE,
1305  dm_field->verbosity);
1306  CHKERR prb_mng_ptr->partitionProblem(dm_field->problemName,
1307  dm_field->verbosity);
1308  }
1309  }
1310 
1311  // Partition finite elements
1312  if (dm_field->isPartitioned) {
1313  CHKERR prb_mng_ptr->partitionFiniteElements(
1314  dm_field->problemName, true, 0, dm_field->sIze, dm_field->verbosity);
1315  CHKERR prb_mng_ptr->partitionGhostDofsOnDistributedMesh(
1316  dm_field->problemName, dm_field->verbosity);
1317  } else {
1318  // partition finite elemnets
1319  CHKERR prb_mng_ptr->partitionFiniteElements(dm_field->problemName, false,
1320  -1, -1, dm_field->verbosity);
1321  // Get ghost DOFs
1322  CHKERR prb_mng_ptr->partitionGhostDofs(dm_field->problemName,
1323  dm_field->verbosity);
1324  }
1325 
1326  // Set flag that problem is build and partitioned
1327  dm_field->isProblemBuild = PETSC_TRUE;
1328 
1330 }

◆ DMSubDMSetUp_MoFEM()

PetscErrorCode MoFEM::DMSubDMSetUp_MoFEM ( DM  subdm)

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

Examples
level_set.cpp.

Definition at line 1332 of file DMMoFEM.cpp.

1332  {
1333  PetscValidHeaderSpecific(subdm, DM_CLASSID, 1);
1334  ProblemsManager *prb_mng_ptr;
1336 
1337  DMCtx *subdm_field = static_cast<DMCtx *>(subdm->data);
1338 
1339  // build sub dm problem
1340  CHKERR subdm_field->mField_ptr->getInterface(prb_mng_ptr);
1341 
1342  map<std::string, boost::shared_ptr<Range>> *entity_map_row = nullptr;
1343  map<std::string, boost::shared_ptr<Range>> *entity_map_col = nullptr;
1344 
1345  if (subdm_field->mapTypeRow.size())
1346  entity_map_row = &subdm_field->mapTypeRow;
1347  if (subdm_field->mapTypeCol.size())
1348  entity_map_col = &subdm_field->mapTypeCol;
1349 
1350  CHKERR prb_mng_ptr->buildSubProblem(
1351  subdm_field->problemName, subdm_field->rowFields, subdm_field->colFields,
1352  subdm_field->problemMainOfSubPtr->getName(),
1353  subdm_field->isSquareMatrix == PETSC_TRUE, entity_map_row, entity_map_col,
1354  subdm_field->verbosity);
1355 
1356  // partition problem
1357  subdm_field->isPartitioned = subdm_field->isPartitioned;
1358  if (subdm_field->isPartitioned) {
1359  CHKERR prb_mng_ptr->partitionFiniteElements(subdm_field->problemName, true,
1360  0, subdm_field->sIze,
1361  subdm_field->verbosity);
1362  // set ghost nodes
1363  CHKERR prb_mng_ptr->partitionGhostDofsOnDistributedMesh(
1364  subdm_field->problemName, subdm_field->verbosity);
1365  } else {
1366  // partition finite elements
1367  CHKERR prb_mng_ptr->partitionFiniteElements(subdm_field->problemName, false,
1368  -1, -1, subdm_field->verbosity);
1369  // set ghost nodes
1370  CHKERR prb_mng_ptr->partitionGhostDofs(subdm_field->problemName,
1371  subdm_field->verbosity);
1372  }
1373 
1374  subdm_field->isProblemBuild = PETSC_TRUE;
1375 
1377 }
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
MoFEM::DMSetFromOptions_MoFEM
PetscErrorCode DMSetFromOptions_MoFEM(DM dm)
Definition: DMMoFEM.cpp:1263
g
constexpr double g
Definition: shallow_wave.cpp:63
MYPCOMM_INDEX
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:215
MoFEM::DMMoFEMSNESSetJacobian
static PetscErrorCode DMMoFEMSNESSetJacobian(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMoFEM.cpp:744
MoFEM::FEMethod
structure for User Loop Methods on finite elements
Definition: LoopMethods.hpp:369
MoFEM::CoreInterface::get_comm
virtual MPI_Comm & get_comm() const =0
MoFEM::DMCreateGlobalVector_MoFEM
PetscErrorCode DMCreateGlobalVector_MoFEM(DM dm, SmartPetscObj< Vec > &g_ptr)
DMShellSetCreateGlobalVector.
Definition: DMMoFEM.cpp:1181
MoFEM::DMMoFEMTSSetI2Function
static PetscErrorCode DMMoFEMTSSetI2Function(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMoFEM.cpp:949
MoFEM::DMGlobalToLocalBegin_MoFEM
PetscErrorCode DMGlobalToLocalBegin_MoFEM(DM dm, Vec, InsertMode, Vec)
Definition: DMMoFEM.cpp:1379
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
MoFEM::DMMoFEMTSSetIJacobian
static PetscErrorCode DMMoFEMTSSetIJacobian(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMoFEM.cpp:828
MoFEM::DMSetUp_MoFEM
PetscErrorCode DMSetUp_MoFEM(DM dm)
Definition: DMMoFEM.cpp:1285
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
GET_DM_FIELD
#define GET_DM_FIELD(DM)
Definition: PCMGSetUpViaApproxOrders.cpp:170
ts_ctx
MoFEM::TsCtx * ts_ctx
Definition: level_set.cpp:1932
MoFEM::DMLocalToGlobalBegin_MoFEM
PetscErrorCode DMLocalToGlobalBegin_MoFEM(DM, Vec, InsertMode, Vec)
Definition: DMMoFEM.cpp:1416
MoFEM::DMMoFEMAddElement
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
Definition: DMMoFEM.cpp:501
MoFEM::DMMoFEMTSSetI2Jacobian
static PetscErrorCode DMMoFEMTSSetI2Jacobian(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMoFEM.cpp:992
MoFEM::CoreInterface::check_problem
virtual bool check_problem(const std::string name)=0
check if problem exist
ROW
@ ROW
Definition: definitions.h:123
DMCreate_MGViaApproxOrders
MoFEMErrorCode DMCreate_MGViaApproxOrders(DM dm)
Create DM data structure for Multi-Grid via approximation orders.
Definition: PCMGSetUpViaApproxOrders.cpp:409
MoFEM::DMCreateGlobalVector_MoFEM
PetscErrorCode DMCreateGlobalVector_MoFEM(DM dm, Vec *g)
DMShellSetCreateGlobalVector.
Definition: DMMoFEM.cpp:1171
PlasticOps::M
FTensor::Index< 'M', 3 > M
Definition: PlasticOps.hpp:117
MoFEM::DMCreateMatrix_MoFEM
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
Definition: DMMoFEM.cpp:1201
FEMethod
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEM::DMoFEMLoopFiniteElementsUpAndLowRank
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: DMMoFEM.cpp:571
a
constexpr double a
Definition: approx_sphere.cpp:30
sub_mat_mult
MoFEMErrorCode sub_mat_mult(Mat a, Vec x, Vec f)
Definition: PCMGSetUpViaApproxOrders.cpp:106
MoFEM::DMDestroy_MoFEM
PetscErrorCode DMDestroy_MoFEM(DM dm)
Destroys dm with MoFEM data structure.
Definition: DMMoFEM.cpp:83
MoFEM::DMSubDMSetUp_MoFEM
PetscErrorCode DMSubDMSetUp_MoFEM(DM subdm)
Definition: DMMoFEM.cpp:1332
convert.type
type
Definition: convert.py:64
COL
@ COL
Definition: definitions.h:123
PCMGSubMatrixCtx_private
Definition: PCMGSetUpViaApproxOrders.cpp:48
MoFEM::DMMoFEMTSSetIFunction
static PetscErrorCode DMMoFEMTSSetIFunction(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMoFEM.cpp:785
MoFEM::DMGlobalToLocalEnd_MoFEM
PetscErrorCode DMGlobalToLocalEnd_MoFEM(DM dm, Vec, InsertMode, Vec)
Definition: DMMoFEM.cpp:1387
MoFEM::BasicMethod
Data structure to exchange data between mofem and User Loop Methods.
Definition: LoopMethods.hpp:183
MoFEM::DMMoFEMCreateMoFEM
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: DMMoFEM.cpp:118
MoFEM::DMMoFEMKSPSetComputeRHS
static PetscErrorCode DMMoFEMKSPSetComputeRHS(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMoFEM.cpp:622
MoFEM::DMSetOperators_MoFEM
PetscErrorCode DMSetOperators_MoFEM(DM dm)
Set operators for MoFEM dm.
Definition: DMMoFEM.cpp:53
MoFEM::DMCreateFieldIS_MoFEM
PetscErrorCode DMCreateFieldIS_MoFEM(DM dm, PetscInt *numFields, char ***fieldNames, IS **fields)
Definition: DMMoFEM.cpp:1451
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
MoFEM::DMCreateMatrix_MoFEM
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, SmartPetscObj< Mat > &M)
Definition: DMMoFEM.cpp:1229
MoFEM::DMMoFEMResolveSharedFiniteElements
PetscErrorCode DMMoFEMResolveSharedFiniteElements(DM dm, std::string fe_name)
Resolve shared entities.
Definition: DMMoFEM.cpp:468
convert.n
n
Definition: convert.py:82
N
const int N
Definition: speed_test.cpp:3
sub_mat_mult_add
MoFEMErrorCode sub_mat_mult_add(Mat a, Vec x, Vec f)
Definition: PCMGSetUpViaApproxOrders.cpp:110
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
SnesCtx
MoFEM::DMCreate_MoFEM
PetscErrorCode DMCreate_MoFEM(DM dm)
Create dm data structure with MoFEM data structure.
Definition: DMMoFEM.cpp:75
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
MoFEM::DMMoFEMGetFieldIS
PetscErrorCode DMMoFEMGetFieldIS(DM dm, RowColData rc, const char field_name[], IS *is)
get field is in the problem
Definition: DMMoFEM.cpp:1496
HenckyOps::f
auto f
Definition: HenckyOps.hpp:15
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::getCommFromPetscObject
MPI_Comm getCommFromPetscObject(PetscObject obj)
Get the Comm From Petsc Object object.
Definition: PetscSmartObj.hpp:156
MoFEM::DMMoFEMKSPSetComputeOperators
static PetscErrorCode DMMoFEMKSPSetComputeOperators(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMoFEM.cpp:663
sub_mat_sor
MoFEMErrorCode sub_mat_sor(Mat mat, Vec b, PetscReal omega, MatSORType flag, PetscReal shift, PetscInt its, PetscInt lits, Vec x)
Definition: PCMGSetUpViaApproxOrders.cpp:114
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
MF_EXCL
@ MF_EXCL
Definition: definitions.h:99
MoFEM::DMLocalToGlobalEnd_MoFEM
PetscErrorCode DMLocalToGlobalEnd_MoFEM(DM, Vec, InsertMode, Vec)
Definition: DMMoFEM.cpp:1445
MoFEM::DMoFEMLoopFiniteElements
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition: DMMoFEM.cpp:590
MF_EXIST
@ MF_EXIST
Definition: definitions.h:100
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
MoFEM::DMCreateLocalVector_MoFEM
PetscErrorCode DMCreateLocalVector_MoFEM(DM dm, Vec *l)
DMShellSetCreateLocalVector.
Definition: DMMoFEM.cpp:1191
CHKERRG
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:483
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
MOFEM_INVALID_DATA
@ MOFEM_INVALID_DATA
Definition: definitions.h:36
MoFEM::DMMoFEMSNESSetFunction
static PetscErrorCode DMMoFEMSNESSetFunction(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMoFEM.cpp:703