v0.8.16
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 problemIt if true is assumed that matrix has the same indexing on rows and columns. This reduces interprocessor communication. More...
 
PetscErrorCode MoFEM::DMMoFEMGetSquareProblem (DM dm, PetscBool *square_problem)
 get squared problemIt if true is assumed that matrix has the same indexing on rows and columns. This reduces interprocessor communication. More...
 
PetscErrorCode MoFEM::DMMoFEMResolveSharedEntities (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)
 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)
 Executes FEMethod for finite elements in DM. More...
 
PetscErrorCode MoFEM::DMoFEMLoopFiniteElements (DM dm, const char fe_name[], MoFEM::FEMethod *method)
 Executes FEMethod for finite elements in DM. More...
 
PetscErrorCode MoFEM::DMoFEMLoopFiniteElements (DM dm, const std::string &fe_name, boost::shared_ptr< MoFEM::FEMethod > method)
 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 compute operator for KSP solver via sub-matrix and IS. 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::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 structureIt take over pointer, do not delete it, DM will destroy pointer when is destroyed. 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)
 DMShellSetCreateGlobalVectorsets the routine to create a global vector associated with the shell DM. More...
 
PetscErrorCode MoFEM::DMCreateLocalVector_MoFEM (DM dm, Vec *l)
 DMShellSetCreateLocalVectorsets the routine to create a local vector associated with the shell DM. More...
 
PetscErrorCode MoFEM::DMCreateMatrix_MoFEM (DM dm, 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::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 rowThis create block on row with DOFs from problem of given name. More...
 
PetscErrorCode MoFEM::DMMoFEMAddColCompositeProblem (DM dm, const char prb_name[])
 Add problem to composite DM on colThis create block on col with DOFs from problem of given name. 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...
 
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 477 of file PCMGSetUpViaApproxOrders.cpp.

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

◆ DMCreate_MoFEM()

PetscErrorCode MoFEM::DMCreate_MoFEM ( DM  dm)

Create dm data structure with MoFEM data structure.

Definition at line 119 of file DMMMoFEM.cpp.

119  {
120  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
122  dm->data = new DMCtx();
125 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
PetscErrorCode DMSetOperators_MoFEM(DM dm)
Set operators for MoFEM dm.
Definition: DMMMoFEM.cpp:97
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ 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 1123 of file DMMMoFEM.cpp.

1124  {
1125  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1127 
1128  if (numFields) {
1129  *numFields = 0;
1130  }
1131  if (fieldNames) {
1132  *fieldNames = NULL;
1133  }
1134  if (fields) {
1135  *fields = NULL;
1136  }
1137 
1138  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1139  const Field_multiIndex *fields_ptr;
1140  CHKERR dm_field->mField_ptr->get_fields(&fields_ptr);
1141  Field_multiIndex::iterator fit, hi_fit;
1142  fit = fields_ptr->begin();
1143  hi_fit = fields_ptr->end();
1144  *numFields = std::distance(fit, hi_fit);
1145 
1146  if (fieldNames) {
1147  CHKERR PetscMalloc1(*numFields, fieldNames);
1148  }
1149  if (fields) {
1150  CHKERR PetscMalloc1(*numFields, fields);
1151  }
1152 
1153  for (int f = 0; fit != hi_fit; fit++, f++) {
1154  if (fieldNames) {
1155  CHKERR PetscStrallocpy(fit->get()->getName().c_str(),
1156  (char **)&(*fieldNames)[f]);
1157  }
1158  if (fields) {
1159  CHKERR dm_field->mField_ptr->getInterface<ISManager>()
1160  ->isCreateProblemFieldAndRank(
1161  dm_field->problemPtr->getName(), ROW, fit->get()->getName(), 0,
1162  fit->get()->getNbOfCoeffs(), &(*fields)[f]);
1163  }
1164  }
1165 
1167 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
multi_index_container< boost::shared_ptr< Field >, indexed_by< hashed_unique< tag< BitFieldId_mi_tag >, const_mem_fun< Field, const BitFieldId &, &Field::getId >, HashBit< BitFieldId >, EqBit< BitFieldId > >, ordered_unique< tag< Meshset_mi_tag >, member< Field, EntityHandle, &Field::meshSet > >, ordered_unique< tag< FieldName_mi_tag >, const_mem_fun< Field, boost::string_ref, &Field::getNameRef > >, ordered_non_unique< tag< BitFieldId_space_mi_tag >, const_mem_fun< Field, FieldSpace, &Field::getSpace > > > > Field_multiIndex
Field_multiIndex for Field.
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ DMCreateGlobalVector_MoFEM()

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

DMShellSetCreateGlobalVectorsets the routine to create a global vector associated with the shell DM.

Definition at line 889 of file DMMMoFEM.cpp.

889  {
890  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
892  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
893  CHKERR dm_field->mField_ptr->getInterface<VecManager>()->vecCreateGhost(
894  dm_field->problemName, COL, g);
896 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
#define CHKERR
Inline error check.
Definition: definitions.h:578

◆ DMCreateLocalVector_MoFEM()

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

DMShellSetCreateLocalVectorsets the routine to create a local vector associated with the shell DM.

Definition at line 898 of file DMMMoFEM.cpp.

898  {
899  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
901  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
902  CHKERR dm_field->mField_ptr->getInterface<VecManager>()->vecCreateSeq(
903  dm_field->problemName, COL, l);
905 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

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

446  {
447 
448  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
450  GET_DM_FIELD(dm);
451 
452  int leveldown = dm->leveldown;
453 
454  if (dm_field->kspOperators.empty()) {
456  } else {
457  MPI_Comm comm;
458  CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
459  if (dm_field->kspOperators.empty()) {
460  SETERRQ(comm, MOFEM_DATA_INCONSISTENCY,
461  "data inconsistency, operator can not be set");
462  }
463  if (static_cast<int>(dm_field->kspOperators.size()) < leveldown) {
464  SETERRQ(comm, MOFEM_DATA_INCONSISTENCY,
465  "data inconsistency, no IS for that level");
466  }
467  *M = dm_field->kspOperators[dm_field->kspOperators.size() - 1 - leveldown];
468  CHKERR PetscObjectReference((PetscObject)*M);
469  }
470 
471  PetscInfo1(dm, "Create Matrix DMMGViaApproxOrders leveldown = %d\n",
472  leveldown);
473 
475 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
Definition: DMMMoFEM.cpp:907
#define GET_DM_FIELD(DM)
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ DMCreateMatrix_MoFEM()

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

DMShellSetCreateMatrix

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

Definition at line 907 of file DMMMoFEM.cpp.

907  {
908  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
910  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
911  if (strcmp(dm->mattype, MATMPIAIJ) == 0) {
912  CHKERR dm_field->mField_ptr->MatCreateMPIAIJWithArrays(
913  dm_field->problemName, M);
914  } else if (strcmp(dm->mattype, MATAIJ) == 0) {
915  PetscInt *i;
916  PetscInt *j;
917  PetscScalar *v;
918 #if PETSC_VERSION_GE(3, 7, 0)
919  CHKERR dm_field->mField_ptr->MatCreateSeqAIJWithArrays(
920  dm_field->problemName, M, &i, &j, &v);
921  CHKERR MatConvert(*M, MATAIJ, MAT_INPLACE_MATRIX, M);
922 #else
923  Mat N;
924  CHKERR dm_field->mField_ptr->MatCreateSeqAIJWithArrays(
925  dm_field->problemName, &N, &i, &j, &v);
926  CHKERR MatConvert(N, MATAIJ, MAT_INITIAL_MATRIX, M);
927  CHKERR MatDestroy(&N);
928 #endif
929  CHKERR PetscFree(i);
930  CHKERR PetscFree(j);
931  CHKERR PetscFree(v);
932  } else {
933  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
934  "Matrix type not implemented");
935  }
937 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403
const int N
Definition: speed_test.cpp:3

◆ DMDestroy_MoFEM()

PetscErrorCode MoFEM::DMDestroy_MoFEM ( DM  dm)

Destroys dm with MoFEM data structure.

destroy the MoFEM structure

Definition at line 127 of file DMMMoFEM.cpp.

127  {
128  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
129  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
131  if (((DMCtx *)dm->data)->referenceNumber == 0) {
132  if (dm_field->destroyProblem) {
133  if (dm_field->mField_ptr->check_problem(dm_field->problemName)) {
134  dm_field->mField_ptr->delete_problem(dm_field->problemName);
135  } // else problem has to be deleted by the user
136  }
137  // cerr << "Destroy " << dm_field->problemName << endl;
138  delete ((DMCtx *)dm->data);
139  } else {
140  // cerr << "Dereference " << dm_field->problemName << " " <<
141  // ((DMCtx*)dm->data)->referenceNumber << endl;
142  (((DMCtx *)dm->data)->referenceNumber)--;
143  }
145 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ 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 1051 of file DMMMoFEM.cpp.

1052  {
1053  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1055  CHKERR VecGhostUpdateBegin(g, INSERT_VALUES, SCATTER_FORWARD);
1057 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ 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 1059 of file DMMMoFEM.cpp.

1059  {
1061  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1063 
1064  CHKERR VecGhostUpdateEnd(g, INSERT_VALUES, SCATTER_FORWARD);
1065 
1066  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1067  int nb_dofs = dm_field->problemPtr->getNbLocalDofsRow();
1068  int nb_ghost = dm_field->problemPtr->getNbGhostDofsRow();
1069 
1070  double *array_loc, *array_glob;
1071  CHKERR VecGetArray(l, &array_loc);
1072  CHKERR VecGetArray(g, &array_glob);
1073  switch (mode) {
1074  case INSERT_VALUES:
1075  cblas_dcopy(nb_dofs + nb_ghost, array_glob, 1, array_loc, 1);
1076  break;
1077  case ADD_VALUES:
1078  cblas_daxpy(nb_dofs + nb_ghost, 1, array_glob, 1, array_loc, 1);
1079  break;
1080  default:
1081  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1082  }
1083  CHKERR VecRestoreArray(l, &array_loc);
1084  CHKERR VecRestoreArray(g, &array_glob);
1086 }
void cblas_daxpy(const int N, const double alpha, const double *X, const int incX, double *Y, const int incY)
Definition: cblas_daxpy.c:11
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
void cblas_dcopy(const int N, const double *X, const int incX, double *Y, const int incY)
Definition: cblas_dcopy.c:11
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ 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 1088 of file DMMMoFEM.cpp.

1089  {
1090 
1091  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1093 
1094  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1095  int nb_dofs = dm_field->problemPtr->getNbLocalDofsRow();
1096  int nb_ghost = dm_field->problemPtr->getNbGhostDofsRow();
1097 
1098  double *array_loc, *array_glob;
1099  CHKERR VecGetArray(l, &array_loc);
1100  CHKERR VecGetArray(g, &array_glob);
1101  switch (mode) {
1102  case INSERT_VALUES:
1103  cblas_dcopy(nb_dofs + nb_ghost, array_loc, 1, array_glob, 1);
1104  break;
1105  case ADD_VALUES:
1106  cblas_daxpy(nb_dofs + nb_ghost, 1, array_loc, 1, array_glob, 1);
1107  break;
1108  default:
1109  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
1110  }
1111  CHKERR VecRestoreArray(l, &array_loc);
1112  CHKERR VecRestoreArray(g, &array_glob);
1113 
1115 }
void cblas_daxpy(const int N, const double alpha, const double *X, const int incX, double *Y, const int incY)
Definition: cblas_daxpy.c:11
void cblas_dcopy(const int N, const double *X, const int incX, double *Y, const int incY)
Definition: cblas_dcopy.c:11
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ 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 1117 of file DMMMoFEM.cpp.

1117  {
1118  //
1121 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMGViaApproxOrdersClearCoarseningIS()

MoFEMErrorCode DMMGViaApproxOrdersClearCoarseningIS ( DM  )

Clear approximation orders.

Parameters
DMdm
Returns
Error code

Definition at line 296 of file PCMGSetUpViaApproxOrders.cpp.

296  {
297  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
299  GET_DM_FIELD(dm);
300  CHKERR dm_field->destroyCoarseningIS();
301  PetscInfo(dm, "Clear DMs data structures\n");
303 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define GET_DM_FIELD(DM)
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ DMMGViaApproxOrdersPopBackCoarseningIS()

MoFEMErrorCode DMMGViaApproxOrdersPopBackCoarseningIS ( DM  )

Pop is form MG via approximation orders.

Parameters
DMdm
ispop back IS
Returns
error code

Definition at line 280 of file PCMGSetUpViaApproxOrders.cpp.

280  {
281  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
283  GET_DM_FIELD(dm);
284  if (dm_field->coarseningIS.back()) {
285  CHKERR ISDestroy(&dm_field->coarseningIS.back());
286  dm_field->coarseningIS.pop_back();
287  }
288  if (dm_field->kspOperators.back()) {
289  CHKERR MatDestroy(&dm_field->kspOperators.back());
290  }
291  dm_field->kspOperators.pop_back();
292  PetscInfo(dm, "Pop back IS to DMMGViaApproxOrders\n");
294 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define GET_DM_FIELD(DM)
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

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

233  {
234  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
236  GET_DM_FIELD(dm);
237  dm_field->coarseningIS.push_back(is);
238  dm_field->shellMatrixCtxPtr.push_back(new PCMGSubMatrixCtx_private(A, is));
239  if (is) {
240  CHKERR PetscObjectReference((PetscObject)is);
241  }
242  if (is) {
243  IS is2 = is;
244  if (dm_field->aO) {
245  CHKERR ISDuplicate(is, &is2);
246  CHKERR ISCopy(is, is2);
247  CHKERR AOApplicationToPetscIS(dm_field->aO, is2);
248  }
249  if (create_sub_matrix) {
250  if (shell_sub_a) {
251  int n, N;
252  CHKERR ISGetSize(is, &N);
253  CHKERR ISGetLocalSize(is, &n);
254  MPI_Comm comm;
255  CHKERR PetscObjectGetComm((PetscObject)A, &comm);
256  CHKERR MatCreateShell(comm, n, n, N, N,
257  &(dm_field->shellMatrixCtxPtr.back()), subA);
258  CHKERR MatShellSetOperation(*subA, MATOP_MULT,
259  (void (*)(void))sub_mat_mult);
260  CHKERR MatShellSetOperation(*subA, MATOP_MULT_ADD,
261  (void (*)(void))sub_mat_mult_add);
262  CHKERR MatShellSetOperation(*subA, MATOP_SOR,
263  (void (*)(void))sub_mat_sor);
264  } else {
265  CHKERR MatGetSubMatrix(A, is2, is2, MAT_INITIAL_MATRIX, subA);
266  }
267  }
268  if (dm_field->aO) {
269  CHKERR ISDestroy(&is2);
270  }
271  dm_field->kspOperators.push_back(*subA);
272  CHKERR PetscObjectReference((PetscObject)(*subA));
273  } else {
274  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
275  }
276  PetscInfo(dm, "Push back IS to DMMGViaApproxOrders\n");
278 }
MoFEMErrorCode sub_mat_mult_add(Mat a, Vec x, Vec f)
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
MoFEMErrorCode sub_mat_sor(Mat mat, Vec b, PetscReal omega, MatSORType flag, PetscReal shift, PetscInt its, PetscInt lits, Vec x)
#define GET_DM_FIELD(DM)
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403
MoFEMErrorCode sub_mat_mult(Mat a, Vec x, Vec f)
const int N
Definition: speed_test.cpp:3

◆ DMMoFEMAddColCompositeProblem()

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

Add problem to composite DM on colThis 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 318 of file DMMMoFEM.cpp.

318  {
319  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
321  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
322  if (!dm->data) {
323  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
324  "data structure for MoFEM not yet created");
325  }
326  if (!dm_field->isCompDM) {
327  dm_field->isCompDM = PETSC_TRUE;
328  }
329  if (dm_field->isSquareMatrix) {
330  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
331  "No need to add problem on column when problem block structurally "
332  "symmetric");
333  }
334  dm_field->colCompPrb.push_back(prb_name);
336 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ 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:
analytical_poisson_field_split.cpp, cell_forces.cpp, elasticity.cpp, MagneticElement.hpp, minimal_surface_area.cpp, simple_elasticity.cpp, and UnsaturatedFlow.hpp.

Definition at line 432 of file DMMMoFEM.cpp.

432  {
433  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
435  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
436  ierr = dm_field->mField_ptr->modify_problem_add_finite_element(
437  dm_field->problemName, fe_name);
438  CHKERRG(ierr);
440 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMAddRowCompositeProblem()

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

Add problem to composite DM on rowThis 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 300 of file DMMMoFEM.cpp.

300  {
301  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
303  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
304  if (!dm->data) {
305  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
306  "data structure for MoFEM not yet created");
307  }
308  if (!dm_field->isCompDM) {
309  dm_field->isCompDM = PETSC_TRUE;
310  }
311  dm_field->rowCompPrb.push_back(prb_name);
312  if (dm_field->isSquareMatrix) {
313  dm_field->colCompPrb.push_back(prb_name);
314  }
316 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ DMMoFEMAddSubFieldCol()

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

Add field to sub dm problem on columns

Examples:
analytical_poisson_field_split.cpp, and cell_forces.cpp.

Definition at line 240 of file DMMMoFEM.cpp.

240  {
241  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
243  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
244  if (!dm->data) {
245  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
246  "data structure for MoFEM not yet created");
247  }
248  if (!dm_field->isSubDM) {
249  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "this is not sub-dm");
250  }
251  dm_field->colFields.push_back(field_name);
253 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMAddSubFieldRow()

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

Add field to sub dm problem on rows

Examples:
analytical_poisson_field_split.cpp, and cell_forces.cpp.

Definition at line 225 of file DMMMoFEM.cpp.

225  {
226  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
228  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
229  if (!dm->data) {
230  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
231  "data structure for MoFEM not yet created");
232  }
233  if (!dm_field->isSubDM) {
234  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "this is not sub-dm");
235  }
236  dm_field->rowFields.push_back(field_name);
238 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ 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:
cell_forces.cpp, elasticity.cpp, MagneticElement.hpp, minimal_surface_area.cpp, and UnsaturatedFlow.hpp.

Definition at line 147 of file DMMMoFEM.cpp.

150  {
152 
153  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
154  if (!dm->data) {
155  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
156  "data structure for MoFEM not yet created");
157  }
158  if (!m_field_ptr) {
159  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
160  "DM function not implemented into MoFEM");
161  }
162  dm_field->mField_ptr = m_field_ptr;
163  dm_field->problemName = problem_name;
164  if (!m_field_ptr->check_problem(dm_field->problemName)) {
165  // problem is not defined, declare problem internally set bool to
166  // destroyProblem problem with DM
167  dm_field->destroyProblem = PETSC_TRUE;
168  CHKERR dm_field->mField_ptr->add_problem(dm_field->problemName, MF_EXCL,
169  dm_field->verbosity);
170  } else {
171  dm_field->destroyProblem = PETSC_FALSE;
172  }
173  CHKERR dm_field->mField_ptr->modify_problem_ref_level_add_bit(
174  dm_field->problemName, bit_level);
175  CHKERR dm_field->mField_ptr->modify_problem_mask_ref_level_add_bit(
176  dm_field->problemName, bit_mask);
177  dm_field->kspCtx =
178  boost::shared_ptr<KspCtx>(new KspCtx(*m_field_ptr, problem_name));
179  dm_field->snesCtx =
180  boost::shared_ptr<SnesCtx>(new SnesCtx(*m_field_ptr, problem_name));
181  dm_field->tsCtx =
182  boost::shared_ptr<TsCtx>(new TsCtx(*m_field_ptr, problem_name));
183 
184  MPI_Comm comm;
185  CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
186  int result = 0;
187  MPI_Comm_compare(comm, m_field_ptr->get_comm(), &result);
188  // std::cerr << result << " " << MPI_IDENT << " " << MPI_CONGRUENT << " " <<
189  // MPI_SIMILAR << " " << MPI_UNEQUAL << std::endl;
190  if (result > MPI_CONGRUENT) {
191  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
192  "MoFEM and DM using different communicators");
193  }
194  MPI_Comm_size(comm, &dm_field->sIze);
195  MPI_Comm_rank(comm, &dm_field->rAnk);
196 
197  // problem structure
198  CHKERR dm_field->mField_ptr->get_problem(dm_field->problemName,
199  &dm_field->problemPtr);
200 
202 }
virtual bool check_problem(const std::string name)=0
check if problem exist
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403
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:
analytical_poisson_field_split.cpp, and cell_forces.cpp.

Definition at line 204 of file DMMMoFEM.cpp.

204  {
206 
207  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
208  if (!dm->data) {
209  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
210  "data structure for MoFEM not yet created");
211  }
212  CHKERR DMMoFEMCreateMoFEM(subdm, dm_field->mField_ptr, problem_name,
213  dm_field->problemPtr->getBitRefLevel());
214 
215  DMCtx *subdm_field = (DMCtx *)subdm->data;
216  subdm_field->isSubDM = PETSC_TRUE;
217  subdm_field->problemMainOfSubPtr = dm_field->problemPtr;
218  subdm_field->isPartitioned = dm_field->isPartitioned;
219  subdm_field->isSquareMatrix = PETSC_FALSE;
220  subdm->ops->setup = DMSubDMSetUp_MoFEM;
221 
223 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
PetscErrorCode DMSubDMSetUp_MoFEM(DM subdm)
Definition: DMMMoFEM.cpp:1014
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:147
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ 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 1169 of file DMMMoFEM.cpp.

1170  {
1171  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1173  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
1174  CHKERR dm_field->mField_ptr->getInterface<ISManager>()
1175  ->isCreateProblemFieldAndRank(dm_field->problemPtr->getName(), ROW,
1176  field_name, 0, 1000, is);
1178 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ 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 338 of file DMMMoFEM.cpp.

338  {
340  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
342  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
343  *is_comp_dm = dm_field->isCompDM;
345 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMGetIsPartitioned()

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

get if read mesh is partitioned

Definition at line 856 of file DMMMoFEM.cpp.

856  {
857  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
859  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
860  *is_partitioned = dm_field->isPartitioned;
862 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ 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 255 of file DMMMoFEM.cpp.

255  {
257  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
259  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
260  *is_sub_dm = dm_field->isSubDM;
262 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMGetKspCtx() [1/2]

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

get MoFEM::KspCtx data structure

Definition at line 790 of file DMMMoFEM.cpp.

790  {
791  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
793  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
794  *ksp_ctx = dm_field->kspCtx.get();
796 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMGetKspCtx() [2/2]

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

get MoFEM::KspCtx data structure

Definition at line 799 of file DMMMoFEM.cpp.

799  {
800  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
802  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
803  const_cast<boost::shared_ptr<MoFEM::KspCtx> &>(ksp_ctx) = dm_field->kspCtx;
805 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ 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 408 of file DMMMoFEM.cpp.

409  {
411  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
413  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
414 
415  MPI_Comm comm;
416  CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
417  CHKERR dm_field->problemPtr->getNumberOfElementsByNameAndPart(comm, fe_name,
418  layout);
420 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ DMMoFEMGetProblemPtr()

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

Get pointer to problem data structure.

Examples:
MagneticElement.hpp.

Definition at line 359 of file DMMMoFEM.cpp.

359  {
360  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
362  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
363  if (!dm->data) {
364  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
365  "data structure for MoFEM not yet created");
366  }
367  *problem_ptr = dm_field->problemPtr;
369 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMGetSnesCtx() [1/2]

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

get MoFEM::SnesCtx data structure

Examples:
minimal_surface_area.cpp, and testing_jacobian_of_hook_element.cpp.

Definition at line 816 of file DMMMoFEM.cpp.

816  {
817  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
819  DMCtx *dm_field = (DMCtx *)dm->data;
820  *snes_ctx = dm_field->snesCtx.get();
822 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMGetSnesCtx() [2/2]

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

get MoFEM::SnesCtx data structure

Definition at line 825 of file DMMMoFEM.cpp.

825  {
826  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
828  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
829  const_cast<boost::shared_ptr<MoFEM::SnesCtx> &>(snes_ctx) = dm_field->snesCtx;
831 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMGetSquareProblem()

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

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

Definition at line 422 of file DMMMoFEM.cpp.

422  {
425  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
427  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
428  *square_problem = dm_field->isSquareMatrix;
430 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMGetTsCtx() [1/2]

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

get MoFEM::TsCtx data structure

Examples:
UnsaturatedFlow.hpp.

Definition at line 864 of file DMMMoFEM.cpp.

864  {
865  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
867  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
868  *ts_ctx = dm_field->tsCtx.get();
870 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMGetTsCtx() [2/2]

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

get MoFEM::TsCtx data structure

Definition at line 872 of file DMMMoFEM.cpp.

873  {
874  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
876  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
877  const_cast<boost::shared_ptr<MoFEM::TsCtx> &>(ts_ctx) = dm_field->tsCtx;
879 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

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

Definition at line 604 of file DMMMoFEM.cpp.

607  {
608  return DMMoFEMKSPSetComputeOperators<const char *, MoFEM::FEMethod *,
611  dm, fe_name, method, pre_only, post_only);
612 }
structure for User Loop Methods on finite elementsIt can be used to calculate stiffness matrices...
static PetscErrorCode DMMoFEMKSPSetComputeOperators(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:585
Data structure to exchange data between mofem and User Loop Methods.It allows to exchange data betwee...

◆ 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 615 of file DMMMoFEM.cpp.

618  {
619  return DMMoFEMKSPSetComputeOperators<const std::string &,
620  boost::shared_ptr<MoFEM::FEMethod> >(
621  dm, fe_name, method, pre_only, post_only);
622 }
static PetscErrorCode DMMoFEMKSPSetComputeOperators(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:585

◆ DMMoFEMKSPSetComputeRHS() [1/2]

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

Set compute operator for KSP solver via sub-matrix and IS.

Parameters
dmDM
Returns
error code set KSP right hand side evaluation function
Examples:
analytical_poisson.cpp, and simple_elasticity.cpp.

Definition at line 563 of file DMMMoFEM.cpp.

566  {
567  return DMMoFEMKSPSetComputeRHS<const char *, MoFEM::FEMethod *,
569  dm, fe_name, method, pre_only, post_only);
570 }
structure for User Loop Methods on finite elementsIt can be used to calculate stiffness matrices...
static PetscErrorCode DMMoFEMKSPSetComputeRHS(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:544
Data structure to exchange data between mofem and User Loop Methods.It allows to exchange data betwee...

◆ 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 573 of file DMMMoFEM.cpp.

576  {
577  return DMMoFEMKSPSetComputeRHS<const std::string &,
578  boost::shared_ptr<MoFEM::FEMethod>,
579  boost::shared_ptr<MoFEM::BasicMethod>,
580  boost::shared_ptr<MoFEM::BasicMethod>>(
581  dm, fe_name, method, pre_only, post_only);
582 }
static PetscErrorCode DMMoFEMKSPSetComputeRHS(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:544

◆ DMMoFEMResolveSharedEntities()

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

Resolve shared entities.

Parameters
dmdm
fe_namefinite element for which shared entities are resolved
Returns
error code

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

ierr = DMMoFEMGetSquareProblem(dm,"SHELL_ELEMENT"); CHKERRG(ierr);
Tag th;
rval = mField.get_moab().tag_get_handle("ADAPT_ORDER",th); CHKERRQ_MOAB(rval);
ParallelComm* pcomm =
ParallelComm::get_pcomm(&mField.get_moab(),MYPCOMM_INDEX);
// rval = pcomm->reduce_tags(th,MPI_SUM,prisms);
rval = pcomm->exchange_tags(th,prisms);

Definition at line 398 of file DMMMoFEM.cpp.

398  {
400  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
402  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
403  CHKERR dm_field->mField_ptr->resolve_shared_ents(dm_field->problemPtr,
404  fe_name);
406 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ 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, elasticity.cpp, simple_elasticity.cpp, and UnsaturatedFlow.hpp.

Definition at line 845 of file DMMMoFEM.cpp.

845  {
846  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
848  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
849  dm_field->isPartitioned = is_partitioned;
851 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMSetKspCtx()

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

set MoFEM::KspCtx data structure

Definition at line 807 of file DMMMoFEM.cpp.

808  {
809  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
811  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
812  dm_field->kspCtx = ksp_ctx;
814 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMSetSnesCtx()

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

Set MoFEM::SnesCtx data structure.

Definition at line 833 of file DMMMoFEM.cpp.

834  {
835  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
837  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
838  dm_field->snesCtx = snes_ctx;
840 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMSetSquareProblem()

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

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

Examples:
analytical_poisson_field_split.cpp, and cell_forces.cpp.

Definition at line 389 of file DMMMoFEM.cpp.

389  {
391  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
393  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
394  dm_field->isSquareMatrix = square_problem;
396 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMSetTsCtx()

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

Set MoFEM::TsCtx data structureIt take over pointer, do not delete it, DM will destroy pointer when is destroyed.

Definition at line 881 of file DMMMoFEM.cpp.

881  {
882  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
884  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
885  dm_field->tsCtx = ts_ctx;
887 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMMoFEMSNESSetFunction() [1/2]

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

Examples:
analytical_nonlinear_poisson.cpp, mesh_smoothing.cpp, minimal_surface_area.cpp, and testing_jacobian_of_hook_element.cpp.

Definition at line 644 of file DMMMoFEM.cpp.

647  {
648  return DMMoFEMSNESSetFunction<const char *, MoFEM::FEMethod *,
650  dm, fe_name, method, pre_only, post_only);
651 }
structure for User Loop Methods on finite elementsIt can be used to calculate stiffness matrices...
static PetscErrorCode DMMoFEMSNESSetFunction(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:625
Data structure to exchange data between mofem and User Loop Methods.It allows to exchange data betwee...

◆ 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 654 of file DMMMoFEM.cpp.

657  {
658  return DMMoFEMSNESSetFunction<const std::string &,
659  boost::shared_ptr<MoFEM::FEMethod>,
660  boost::shared_ptr<MoFEM::BasicMethod>,
661  boost::shared_ptr<MoFEM::BasicMethod>>(
662  dm, fe_name, method, pre_only, post_only);
663 }
static PetscErrorCode DMMoFEMSNESSetFunction(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:625

◆ DMMoFEMSNESSetJacobian() [1/2]

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

Examples:
analytical_nonlinear_poisson.cpp, mesh_smoothing.cpp, minimal_surface_area.cpp, and testing_jacobian_of_hook_element.cpp.

Definition at line 685 of file DMMMoFEM.cpp.

688  {
689  return DMMoFEMSNESSetJacobian<const char *, MoFEM::FEMethod *,
691  dm, fe_name, method, pre_only, post_only);
692 }
structure for User Loop Methods on finite elementsIt can be used to calculate stiffness matrices...
static PetscErrorCode DMMoFEMSNESSetJacobian(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:666
Data structure to exchange data between mofem and User Loop Methods.It allows to exchange data betwee...

◆ 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 695 of file DMMMoFEM.cpp.

698  {
699  return DMMoFEMSNESSetJacobian<const std::string &,
700  boost::shared_ptr<MoFEM::FEMethod>,
701  boost::shared_ptr<MoFEM::BasicMethod>,
702  boost::shared_ptr<MoFEM::BasicMethod>>(
703  dm, fe_name, method, pre_only, post_only);
704 }
static PetscErrorCode DMMoFEMSNESSetJacobian(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:666

◆ 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:
UnsaturatedFlow.hpp.

Definition at line 726 of file DMMMoFEM.cpp.

729  {
730  return DMMoFEMTSSetIFunction<const char *, MoFEM::FEMethod *,
732  dm, fe_name, method, pre_only, post_only);
734 }
structure for User Loop Methods on finite elementsIt can be used to calculate stiffness matrices...
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
static PetscErrorCode DMMoFEMTSSetIFunction(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:707
Data structure to exchange data between mofem and User Loop Methods.It allows to exchange data betwee...

◆ 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 737 of file DMMMoFEM.cpp.

740  {
741  return DMMoFEMTSSetIFunction<const std::string,
742  boost::shared_ptr<MoFEM::FEMethod>,
743  boost::shared_ptr<MoFEM::BasicMethod>,
744  boost::shared_ptr<MoFEM::BasicMethod>>(
745  dm, fe_name, method, pre_only, post_only);
747 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
static PetscErrorCode DMMoFEMTSSetIFunction(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:707

◆ DMMoFEMTSSetIJacobian() [1/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:
UnsaturatedFlow.hpp.

Definition at line 779 of file DMMMoFEM.cpp.

782  {
783  return DMMoFEMTSSetIJacobian<const std::string &,
784  boost::shared_ptr<MoFEM::FEMethod>,
785  boost::shared_ptr<MoFEM::BasicMethod>,
786  boost::shared_ptr<MoFEM::BasicMethod>>(
787  dm, fe_name, method, pre_only, post_only);
788 }
static PetscErrorCode DMMoFEMTSSetIJacobian(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:750

◆ DMMoFEMTSSetIJacobian() [2/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 769 of file DMMMoFEM.cpp.

772  {
773  return DMMoFEMTSSetIJacobian<const char *, FEMethod *, MoFEM::BasicMethod *,
774  MoFEM::BasicMethod *>(dm, fe_name, method,
775  pre_only, post_only);
776 }
static PetscErrorCode DMMoFEMTSSetIJacobian(DM dm, S fe_name, T0 method, T1 pre_only, T2 post_only)
Definition: DMMMoFEM.cpp:750
Data structure to exchange data between mofem and User Loop Methods.It allows to exchange data betwee...

◆ DMMoFEMUnSetElement()

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

unset element from dm

Definition at line 442 of file DMMMoFEM.cpp.

442  {
443  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
445  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
446  ierr = dm_field->mField_ptr->modify_problem_unset_finite_element(
447  dm_field->problemName, fe_name);
448  CHKERRG(ierr);
450 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ 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 347 of file DMMMoFEM.cpp.

347  {
348  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
350  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
351  if (!dm->data) {
352  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
353  "data structure for MoFEM not yet created");
354  }
355  *m_field_ptr = dm_field->mField_ptr;
357 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMoFEMLoopDofs()

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

execute method for dofs on field in problem

Definition at line 531 of file DMMMoFEM.cpp.

532  {
533  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
535  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
536  ierr =
537  dm_field->mField_ptr->loop_dofs(dm_field->problemPtr, field_name, COL,
538  *method, dm_field->rAnk, dm_field->rAnk);
539  CHKERRG(ierr);
541 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMoFEMLoopFiniteElements() [1/2]

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

Executes FEMethod for finite elements in DM.

Parameters
dmMoFEM discrete manager
fe_namename of element
methodpointer to MOFEM::FEMethod
Returns
Error code
Examples:
analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, cell_forces.cpp, elasticity.cpp, hello_world.cpp, HookeElement.cpp, MagneticElement.hpp, mesh_smoothing.cpp, minimal_surface_area.cpp, simple_elasticity.cpp, simple_interface.cpp, and UnsaturatedFlow.hpp.

Definition at line 514 of file DMMMoFEM.cpp.

515  {
516  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
518  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
519  ierr = DMoFEMLoopFiniteElementsUpAndLowRank(dm, fe_name, method,
520  dm_field->rAnk, dm_field->rAnk);
521  CHKERRG(ierr);
523 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
PetscErrorCode DMoFEMLoopFiniteElementsUpAndLowRank(DM dm, const char fe_name[], MoFEM::FEMethod *method, int low_rank, int up_rank)
Executes FEMethod for finite elements in DM.
Definition: DMMMoFEM.cpp:495

◆ DMoFEMLoopFiniteElements() [2/2]

PetscErrorCode MoFEM::DMoFEMLoopFiniteElements ( DM  dm,
const std::string &  fe_name,
boost::shared_ptr< MoFEM::FEMethod method 
)

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 526 of file DMMMoFEM.cpp.

527  {
528  return DMoFEMLoopFiniteElements(dm, fe_name.c_str(), method.get());
529 }
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method)
Executes FEMethod for finite elements in DM.
Definition: DMMMoFEM.cpp:514

◆ DMoFEMLoopFiniteElementsUpAndLowRank() [1/2]

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

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 495 of file DMMMoFEM.cpp.

497  {
499  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
500  ierr = dm_field->mField_ptr->loop_finite_elements(
501  dm_field->problemPtr, fe_name, *method, low_rank, up_rank);
502  CHKERRG(ierr);
504 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

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

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 507 of file DMMMoFEM.cpp.

509  {
510  return DMoFEMLoopFiniteElementsUpAndLowRank(dm, fe_name.c_str(), method.get(),
511  low_rank, up_rank);
512 }
PetscErrorCode DMoFEMLoopFiniteElementsUpAndLowRank(DM dm, const char fe_name[], MoFEM::FEMethod *method, int low_rank, int up_rank)
Executes FEMethod for finite elements in DM.
Definition: DMMMoFEM.cpp:495

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

Definition at line 464 of file DMMMoFEM.cpp.

465  {
466  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
468  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
469  ierr = dm_field->mField_ptr->getInterface<VecManager>()->setGlobalGhostVector(
470  dm_field->problemPtr, COL, g, mode, scatter_mode);
471  CHKERRG(ierr);
473 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ 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:
cell_forces.cpp, elasticity.cpp, MagneticElement.hpp, mesh_smoothing.cpp, minimal_surface_area.cpp, testing_jacobian_of_hook_element.cpp, and UnsaturatedFlow.hpp.

Definition at line 452 of file DMMMoFEM.cpp.

453  {
455  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
457  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
458  ierr = dm_field->mField_ptr->getInterface<VecManager>()->setLocalGhostVector(
459  dm_field->problemPtr, COL, l, mode, scatter_mode);
460  CHKERRG(ierr);
462 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

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

Definition at line 485 of file DMMMoFEM.cpp.

485  {
486  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
488  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
489  ierr = dm_field->mField_ptr->problem_basic_method_postProcess(
490  dm_field->problemPtr, *method);
491  CHKERRG(ierr);
493 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMoFEMPreProcessFiniteElements()

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

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

Examples:
cell_forces.cpp, and elasticity.cpp.

Definition at line 475 of file DMMMoFEM.cpp.

475  {
476  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
478  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
479  ierr = dm_field->mField_ptr->problem_basic_method_preProcess(
480  dm_field->problemPtr, *method);
481  CHKERRG(ierr);
483 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

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

392  {
394  CHKERR DMRegister(sname, DMCreate_MGViaApproxOrders);
396 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
MoFEMErrorCode DMCreate_MGViaApproxOrders(DM dm)
Create DM data structure for Multi-Grid via approximation orders.
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ DMRegister_MoFEM()

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

Register MoFEM problem.

Examples:
analytical_nonlinear_poisson.cpp, analytical_poisson.cpp, analytical_poisson_field_split.cpp, cell_forces.cpp, hello_world.cpp, MagneticElement.hpp, mesh_smoothing.cpp, minimal_surface_area.cpp, simple_elasticity.cpp, simple_interface.cpp, testing_jacobian_of_hook_element.cpp, and unsaturated_transport.cpp.

Definition at line 91 of file DMMMoFEM.cpp.

91  {
93  CHKERR DMRegister(sname, DMCreate_MoFEM);
95 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
PetscErrorCode DMCreate_MoFEM(DM dm)
Create dm data structure with MoFEM data structure.
Definition: DMMMoFEM.cpp:119
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ DMSetFromOptions_MoFEM()

PetscErrorCode MoFEM::DMSetFromOptions_MoFEM ( DM  dm)

Set options for MoFEM DM

Definition at line 945 of file DMMMoFEM.cpp.

945  {
946 #endif
947 
948  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
950  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
951 #if PETSC_VERSION_GE(3, 5, 3)
952  ierr = PetscOptionsHead(PetscOptionsObject, "DMMoFEM Options");
953  CHKERRG(ierr);
954 #else
955  ierr = PetscOptionsHead("DMMoFEM Options");
956  CHKERRG(ierr);
957 #endif
958  ierr = PetscOptionsBool("-dm_is_partitioned",
959  "set if mesh is partitioned (works which native MOAB "
960  "file format, i.e. h5m",
961  "DMSetUp", dm_field->isPartitioned,
962  &dm_field->isPartitioned, NULL);
963  CHKERRG(ierr);
965 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ DMSetOperators_MoFEM()

PetscErrorCode MoFEM::DMSetOperators_MoFEM ( DM  dm)

Set operators for MoFEM dm.

Parameters
dm
Returns
error code

Definition at line 97 of file DMMMoFEM.cpp.

97  {
98  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
100 
101  dm->ops->createglobalvector = DMCreateGlobalVector_MoFEM;
102  dm->ops->createlocalvector = DMCreateLocalVector_MoFEM;
103  dm->ops->creatematrix = DMCreateMatrix_MoFEM;
104  dm->ops->setup = DMSetUp_MoFEM;
105  dm->ops->destroy = DMDestroy_MoFEM;
106  dm->ops->setfromoptions = DMSetFromOptions_MoFEM;
107  dm->ops->globaltolocalbegin = DMGlobalToLocalBegin_MoFEM;
108  dm->ops->globaltolocalend = DMGlobalToLocalEnd_MoFEM;
109  dm->ops->localtoglobalbegin = DMLocalToGlobalBegin_MoFEM;
110  dm->ops->localtoglobalend = DMLocalToGlobalEnd_MoFEM;
111  dm->ops->createfieldis = DMCreateFieldIS_MoFEM;
112 
113  // Default matrix type
114  CHKERR DMSetMatType(dm, MATMPIAIJ);
115 
117 }
PetscErrorCode DMGlobalToLocalBegin_MoFEM(DM dm, Vec, InsertMode, Vec)
Definition: DMMMoFEM.cpp:1051
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
PetscErrorCode DMSetUp_MoFEM(DM dm)
Definition: DMMMoFEM.cpp:967
PetscErrorCode DMLocalToGlobalBegin_MoFEM(DM, Vec, InsertMode, Vec)
Definition: DMMMoFEM.cpp:1088
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
Definition: DMMMoFEM.cpp:907
PetscErrorCode DMDestroy_MoFEM(DM dm)
Destroys dm with MoFEM data structure.
Definition: DMMMoFEM.cpp:127
PetscErrorCode DMCreateGlobalVector_MoFEM(DM dm, Vec *g)
DMShellSetCreateGlobalVectorsets the routine to create a global vector associated with the shell DM...
Definition: DMMMoFEM.cpp:889
PetscErrorCode DMGlobalToLocalEnd_MoFEM(DM dm, Vec, InsertMode, Vec)
Definition: DMMMoFEM.cpp:1059
#define CHKERR
Inline error check.
Definition: definitions.h:578
PetscErrorCode DMCreateFieldIS_MoFEM(DM dm, PetscInt *numFields, char ***fieldNames, IS **fields)
Definition: DMMMoFEM.cpp:1123
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403
PetscErrorCode DMLocalToGlobalEnd_MoFEM(DM, Vec, InsertMode, Vec)
Definition: DMMMoFEM.cpp:1117
PetscErrorCode DMSetFromOptions_MoFEM(DM dm)
Definition: DMMMoFEM.cpp:945
PetscErrorCode DMCreateLocalVector_MoFEM(DM dm, Vec *l)
DMShellSetCreateLocalVectorsets the routine to create a local vector associated with the shell DM...
Definition: DMMMoFEM.cpp:898

◆ DMSetUp_MoFEM()

PetscErrorCode MoFEM::DMSetUp_MoFEM ( DM  dm)

sets up the MoFEM structures inside a DM object

Definition at line 967 of file DMMMoFEM.cpp.

967  {
968  PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
969  ProblemsManager *prb_mng_ptr;
971  DMCtx *dm_field = static_cast<DMCtx *>(dm->data);
972  CHKERR dm_field->mField_ptr->getInterface(prb_mng_ptr);
973 
974  if (dm_field->isCompDM) {
975  // It is composite probelm
976  CHKERR prb_mng_ptr->buildCompsedProblem(
977  dm_field->problemName, dm_field->rowCompPrb, dm_field->colCompPrb,
978  dm_field->isSquareMatrix == PETSC_TRUE, dm_field->verbosity);
979  } else {
980  if (dm_field->isPartitioned) {
981  CHKERR prb_mng_ptr->buildProblemOnDistributedMesh(
982  dm_field->problemName, dm_field->isSquareMatrix == PETSC_TRUE,
983  dm_field->verbosity);
984  } else {
985  CHKERR prb_mng_ptr->buildProblem(dm_field->problemName,
986  dm_field->isSquareMatrix == PETSC_TRUE,
987  dm_field->verbosity);
988  CHKERR prb_mng_ptr->partitionProblem(dm_field->problemName,
989  dm_field->verbosity);
990  }
991  }
992 
993  // Partition finite elements
994  if (dm_field->isPartitioned) {
995  CHKERR prb_mng_ptr->partitionFiniteElements(
996  dm_field->problemName, true, 0, dm_field->sIze, dm_field->verbosity);
997  CHKERR prb_mng_ptr->partitionGhostDofsOnDistributedMesh(
998  dm_field->problemName, dm_field->verbosity);
999  } else {
1000  // partition finite elemnets
1001  CHKERR prb_mng_ptr->partitionFiniteElements(dm_field->problemName, false,
1002  -1, -1, dm_field->verbosity);
1003  // Get ghost DOFs
1004  CHKERR prb_mng_ptr->partitionGhostDofs(dm_field->problemName,
1005  dm_field->verbosity);
1006  }
1007 
1008  // Set flag that problem is build and partitioned
1009  dm_field->isProblemBuild = PETSC_TRUE;
1010 
1012 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ DMSubDMSetUp_MoFEM()

PetscErrorCode MoFEM::DMSubDMSetUp_MoFEM ( DM  subdm)

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

Definition at line 1014 of file DMMMoFEM.cpp.

1014  {
1015  PetscValidHeaderSpecific(subdm, DM_CLASSID, 1);
1016  ProblemsManager *prb_mng_ptr;
1018 
1019  DMCtx *subdm_field = static_cast<DMCtx *>(subdm->data);
1020 
1021  // build sub dm problem
1022  CHKERR subdm_field->mField_ptr->getInterface(prb_mng_ptr);
1023  CHKERR prb_mng_ptr->buildSubProblem(
1024  subdm_field->problemName, subdm_field->rowFields, subdm_field->colFields,
1025  subdm_field->problemMainOfSubPtr->getName(),
1026  subdm_field->isSquareMatrix == PETSC_TRUE, subdm_field->verbosity);
1027 
1028  // partition problem
1029  subdm_field->isPartitioned = subdm_field->isPartitioned;
1030  if (subdm_field->isPartitioned) {
1031  CHKERR prb_mng_ptr->partitionFiniteElements(subdm_field->problemName, true,
1032  0, subdm_field->sIze,
1033  subdm_field->verbosity);
1034  // set ghost nodes
1035  CHKERR prb_mng_ptr->partitionGhostDofsOnDistributedMesh(
1036  subdm_field->problemName, subdm_field->verbosity);
1037  } else {
1038  // partition finite elements
1039  CHKERR prb_mng_ptr->partitionFiniteElements(subdm_field->problemName, false,
1040  -1, -1, subdm_field->verbosity);
1041  // set ghost nodes
1042  CHKERR prb_mng_ptr->partitionGhostDofs(subdm_field->problemName,
1043  subdm_field->verbosity);
1044  }
1045 
1046  subdm_field->isProblemBuild = PETSC_TRUE;
1047 
1049 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403