libMesh
Functions
petscdmlibmesh.h File Reference

Go to the source code of this file.

Functions

PETSC_EXTERN PetscErrorCode DMlibMeshSetSystem (DM, libMesh::NonlinearImplicitSystem &)
 Any functional implementation of the DMlibMesh API must compose the following functions with the DM object. More...
 
PETSC_EXTERN PetscErrorCode DMlibMeshGetSystem (DM, libMesh::NonlinearImplicitSystem *&)
 
EXTERN_C_BEGIN PETSC_EXTERN PetscErrorCode DMCreate_libMesh (DM)
 

Function Documentation

EXTERN_C_BEGIN PETSC_EXTERN PetscErrorCode DMCreate_libMesh ( DM  )

Definition at line 1162 of file petscdmlibmeshimpl.C.

References DM_libMesh::blockids, DM_libMesh::blocknames, CHKERRQ(), DM_libMesh::decomposition, DM_libMesh::decomposition_type, dlm, DMCreateDomainDecomposition_libMesh(), DMCreateDomainDecompositionDM_libMesh(), DMCreateFieldDecomposition_libMesh(), DMCreateFieldDecompositionDM_libMesh(), DMCreateGlobalVector_libMesh(), DMCreateMatrix_libMesh(), DMDestroy_libMesh(), DMlibMeshGetSystem_libMesh(), DMlibMeshSetSystem_libMesh(), DMSetUp_libMesh(), DMView_libMesh(), ierr, PetscFunctionReturn(), DM_libMesh::varids, and DM_libMesh::varnames.

Referenced by libMesh::LibMeshInit::LibMeshInit().

1163 {
1164  PetscErrorCode ierr;
1165  DM_libMesh * dlm;
1166 
1167  PetscFunctionBegin;
1168  PetscValidHeaderSpecific(dm,DM_CLASSID,1);
1169 #if PETSC_RELEASE_LESS_THAN(3,5,0)
1170  ierr = PetscNewLog(dm,DM_libMesh,&dlm);CHKERRQ(ierr);
1171 #else
1172  ierr = PetscNewLog(dm,&dlm);CHKERRQ(ierr);
1173 #endif
1174  dm->data = dlm;
1175 
1176  /* DMlibMesh impl */
1177  dlm->varids = new(std::map<std::string, unsigned int>);
1178  dlm->blockids = new(std::map<std::string, unsigned int>);
1179  dlm->varnames = new(std::map<unsigned int, std::string>);
1180  dlm->blocknames = new(std::map<unsigned int, std::string>);
1181  dlm->decomposition = PETSC_NULL;
1182  dlm->decomposition_type = DMLIBMESH_NO_DECOMPOSITION;
1183 
1184  /* DM API */
1185  dm->ops->createglobalvector = DMCreateGlobalVector_libMesh;
1186  dm->ops->createlocalvector = 0; // DMCreateLocalVector_libMesh;
1187  dm->ops->getcoloring = 0; // DMGetColoring_libMesh;
1188  dm->ops->creatematrix = DMCreateMatrix_libMesh;
1189  dm->ops->createinterpolation= 0; // DMCreateInterpolation_libMesh;
1190 
1191  dm->ops->refine = 0; // DMRefine_libMesh;
1192  dm->ops->coarsen = 0; // DMCoarsen_libMesh;
1193  dm->ops->getinjection = 0; // DMGetInjection_libMesh;
1194  dm->ops->getaggregates = 0; // DMGetAggregates_libMesh;
1195 
1196 #if PETSC_RELEASE_LESS_THAN(3,3,1)
1197  dm->ops->createfielddecompositiondm = DMCreateFieldDecompositionDM_libMesh;
1198  dm->ops->createdomaindecompositiondm = DMCreateDomainDecompositionDM_libMesh;
1199 #endif
1200  dm->ops->createfielddecomposition = DMCreateFieldDecomposition_libMesh;
1201  dm->ops->createdomaindecomposition = DMCreateDomainDecomposition_libMesh;
1202 
1203  dm->ops->destroy = DMDestroy_libMesh;
1204  dm->ops->view = DMView_libMesh;
1205  dm->ops->setfromoptions = 0; // DMSetFromOptions_libMesh;
1206  dm->ops->setup = DMSetUp_libMesh;
1207 
1208  /* DMlibMesh API */
1209 #if PETSC_RELEASE_LESS_THAN(3,4,0)
1210  ierr = PetscObjectComposeFunction((PetscObject)dm,"DMlibMeshSetSystem_C",PETSC_NULL,(PetscVoidFunction)DMlibMeshSetSystem_libMesh);CHKERRQ(ierr);
1211  ierr = PetscObjectComposeFunction((PetscObject)dm,"DMlibMeshGetSystem_C",PETSC_NULL,(PetscVoidFunction)DMlibMeshGetSystem_libMesh);CHKERRQ(ierr);
1212 #else
1213  ierr = PetscObjectComposeFunction((PetscObject)dm,"DMlibMeshSetSystem_C",DMlibMeshSetSystem_libMesh);CHKERRQ(ierr);
1214  ierr = PetscObjectComposeFunction((PetscObject)dm,"DMlibMeshGetSystem_C",DMlibMeshGetSystem_libMesh);CHKERRQ(ierr);
1215 #endif
1216 
1218 }
static PetscErrorCode DMCreateDomainDecomposition_libMesh(DM dm, PetscInt *len, char ***namelist, IS **innerislist, IS **outerislist, DM **dmlist)
static PetscErrorCode DMCreateGlobalVector_libMesh(DM dm, Vec *x)
static PetscErrorCode DMCreateDomainDecompositionDM_libMesh(DM dm, const char *ddesc, DM *ddm)
std::map< std::string, unsigned int > * blockids
PetscErrorCode DMlibMeshSetSystem_libMesh(DM dm, NonlinearImplicitSystem &sys)
std::map< std::string, unsigned int > * varids
static PetscErrorCode DMCreateFieldDecomposition_libMesh(DM dm, PetscInt *len, char ***namelist, IS **islist, DM **dmlist)
std::vector< std::set< unsigned int > > * decomposition
static PetscErrorCode DMSetUp_libMesh(DM dm)
static PetscErrorCode DMCreateMatrix_libMesh(DM dm, const MatType, Mat *A) static PetscErrorCode DMCreateMatrix_libMesh(DM dm
PetscErrorCode DMlibMeshGetSystem_libMesh(DM dm, NonlinearImplicitSystem *&sys)
std::map< unsigned int, std::string > * varnames
std::map< unsigned int, std::string > * blocknames
static PetscErrorCode DMCreateFieldDecompositionDM_libMesh(DM dm, const char *ddesc, DM *ddm)
PetscErrorCode ierr
DM_libMesh * dlm
PetscFunctionReturn(0)
CHKERRQ(ierr)
static PetscErrorCode DMView_libMesh(DM dm, PetscViewer viewer)
unsigned int decomposition_type
static PetscErrorCode DMDestroy_libMesh(DM dm)
PETSC_EXTERN PetscErrorCode DMlibMeshGetSystem ( DM  ,
libMesh::NonlinearImplicitSystem *&   
)

Definition at line 53 of file petscdmlibmesh.C.

References CHKERRQ(), ierr, libmesh_nullptr, PetscFunctionReturn(), and libMesh::sys.

Referenced by DMlibMeshFunction(), DMlibMeshJacobian(), and DMVariableBounds_libMesh().

54 {
55  PetscErrorCode (*f)(DM,libMesh::NonlinearImplicitSystem *&) = libmesh_nullptr;
56  PetscErrorCode ierr;
57 
58  PetscFunctionBegin;
59  PetscValidHeaderSpecific(dm,DM_CLASSID,1);
60 #if PETSC_RELEASE_LESS_THAN(3,4,0)
61  ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshGetSystem_C",(PetscVoidFunction*)&f);CHKERRQ(ierr);
62 #else
63  ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshGetSystem_C",&f);CHKERRQ(ierr);
64 #endif
65  if (!f) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "DM has no implementation for DMlibMeshGetSystem");
66  ierr = (*f)(dm,sys);CHKERRQ(ierr);
68 }
ImplicitSystem & sys
const class libmesh_nullptr_t libmesh_nullptr
This class provides a specific system class.
PetscErrorCode ierr
PetscFunctionReturn(0)
CHKERRQ(ierr)
PETSC_EXTERN PetscErrorCode DMlibMeshSetSystem ( DM  ,
libMesh::NonlinearImplicitSystem  
)

Any functional implementation of the DMlibMesh API must compose the following functions with the DM object.

(See PETSc documentation on PetscObjectComposeFunction(), a polymorphism mechanism.) The following functions are called in PetscNonlinear Solver (others can be called by users): DMlibMeshSetSystem(), DMlibMeshGetSystem()

Any implementation needs to register its creation routine, DMCreate_libMesh, with PETSc using DMRegister().

Definition at line 34 of file petscdmlibmesh.C.

References CHKERRQ(), ierr, libmesh_nullptr, PetscFunctionReturn(), and libMesh::sys.

Referenced by libMesh::PetscNonlinearSolver< T >::init().

35 {
36  PetscErrorCode (*f)(DM,libMesh::NonlinearImplicitSystem &) = libmesh_nullptr;
37  PetscErrorCode ierr;
38 
39  PetscFunctionBegin;
40  PetscValidHeaderSpecific(dm,DM_CLASSID,1);
41 #if PETSC_RELEASE_LESS_THAN(3,4,0)
42  ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshSetSystem_C",(PetscVoidFunction*)&f);CHKERRQ(ierr);
43 #else
44  ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshSetSystem_C",&f);CHKERRQ(ierr);
45 #endif
46  if (!f) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "DM has no implementation for DMlibMeshSetSystem");
47  ierr = (*f)(dm,sys);CHKERRQ(ierr);
49 }
ImplicitSystem & sys
const class libmesh_nullptr_t libmesh_nullptr
This class provides a specific system class.
PetscErrorCode ierr
PetscFunctionReturn(0)
CHKERRQ(ierr)