Actual source code: petscdmmoab.h
petsc-3.7.1 2016-05-15
Report Typos and Errors
4: #include <petscvec.h> /*I "petscvec.h" I*/ 5: #include <petscmat.h> /*I "petscmat.h" I*/ 6: #include <petscdm.h> /*I "petscdm.h" I*/ 8: #include <string> 9: #include <moab/Core.hpp> /*I "moab/Core.hpp" I*/ 10: #include <moab/ParallelComm.hpp> /*I "moab/ParallelComm.hpp" I*/ 12: /* The MBERR macro is used to save typing. It checks a MOAB error code 13: * (rval) and calls SETERRQ if not MB_SUCCESS. A message (msg) can 14: * also be passed in. */ 15: #define MBERR(msg,rval) do{if(rval != moab::MB_SUCCESS) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_LIB,"MOAB ERROR (%i): %s",(PetscErrorCode)rval,msg);} while(0) 16: #define MBERRNM(rval) do{if(rval != moab::MB_SUCCESS) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"MOAB ERROR (%i)",rval);} while(0) 17: #define MBERRV(mbif,rval) do{if(rval != moab::MB_SUCCESS) { std::string emsg; mbif->get_last_error(emsg); SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_LIB,"MOAB ERROR (%i): %s",(PetscErrorCode)rval,emsg.c_str());} } while(0) 18: #define MBERRVM(mbif,msg,rval) do{if(rval != moab::MB_SUCCESS) { std::string emsg; mbif->get_last_error(emsg); SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_LIB,"MOAB ERROR (%i): %s :: %s",(PetscErrorCode)rval,msg,emsg.c_str());} } while(0) 21: /* define enums for options to read and write MOAB files in parallel */ 22: typedef enum {READ_PART,READ_DELETE,BCAST_DELETE} MoabReadMode; 23: static const char *const MoabReadModes[] = {"READ_PART","READ_DELETE","BCAST_DELETE","MoabReadMode","",0}; 24: typedef enum {WRITE_PART,FORMAT} MoabWriteMode; 25: static const char *const MoabWriteModes[] = {"WRITE_PART","FORMAT","MoabWriteMode","",0}; 27: PETSC_EXTERN PetscErrorCode DMMoabCreate(MPI_Comm comm, DM *moab); 28: PETSC_EXTERN PetscErrorCode DMMoabCreateMoab(MPI_Comm comm, moab::Interface *mbiface, moab::ParallelComm *pcomm, moab::Tag *ltog_tag, moab::Range *range, DM *moab); 29: PETSC_EXTERN PetscErrorCode DMMoabOutput(DM,const char*,const char*); 31: PETSC_EXTERN PetscErrorCode DMMoabSetParallelComm(DM dm,moab::ParallelComm *pcomm); 32: PETSC_EXTERN PetscErrorCode DMMoabGetParallelComm(DM dm,moab::ParallelComm **pcomm); 33: PETSC_EXTERN PetscErrorCode DMMoabSetInterface(DM dm,moab::Interface *iface); 34: PETSC_EXTERN PetscErrorCode DMMoabGetInterface(DM dm,moab::Interface **iface); 35: PETSC_EXTERN PetscErrorCode DMMoabSetLocalVertices(DM dm,moab::Range *range); 36: PETSC_EXTERN PetscErrorCode DMMoabGetAllVertices(DM dm,moab::Range *local); 37: PETSC_EXTERN PetscErrorCode DMMoabGetLocalVertices(DM dm,const moab::Range **owned,const moab::Range **ghost); 38: PETSC_EXTERN PetscErrorCode DMMoabSetLocalElements(DM dm,moab::Range *range); 39: PETSC_EXTERN PetscErrorCode DMMoabGetLocalElements(DM dm,const moab::Range **range); 40: PETSC_EXTERN PetscErrorCode DMMoabSetLocalToGlobalTag(DM dm,moab::Tag ltogtag); 41: PETSC_EXTERN PetscErrorCode DMMoabGetLocalToGlobalTag(DM dm,moab::Tag *ltog_tag); 42: PETSC_EXTERN PetscErrorCode DMMoabSetBlockSize(DM dm,PetscInt bs); 43: PETSC_EXTERN PetscErrorCode DMMoabGetBlockSize(DM dm,PetscInt *bs); 44: PETSC_EXTERN PetscErrorCode DMMoabGetDimension(DM dm,PetscInt *dim); 45: PETSC_EXTERN PetscErrorCode DMMoabGetBoundaryEntities(DM dm,moab::Range *bdvtx,moab::Range* bdfaces,moab::Range* bdelems); 46: PETSC_EXTERN PetscErrorCode DMMoabGetMaterialBlock(DM dm,const moab::EntityHandle ehandle, PetscInt *mat); 48: PETSC_EXTERN PetscErrorCode DMMoabGetSize(DM dm,PetscInt*,PetscInt*); 49: PETSC_EXTERN PetscErrorCode DMMoabGetLocalSize(DM dm,PetscInt*,PetscInt*,PetscInt*,PetscInt*); 50: PETSC_EXTERN PetscErrorCode DMMoabGetOffset(DM dm,PetscInt*); 52: PETSC_EXTERN PetscErrorCode DMMoabVecGetArrayRead(DM,Vec,void*); 53: PETSC_EXTERN PetscErrorCode DMMoabVecRestoreArrayRead(DM,Vec,void*); 54: PETSC_EXTERN PetscErrorCode DMMoabVecGetArray(DM,Vec,void*); 55: PETSC_EXTERN PetscErrorCode DMMoabVecRestoreArray(DM,Vec,void*); 57: PETSC_EXTERN PetscErrorCode DMMoabCreateVector(DM dm, moab::Tag tag,const moab::Range *range,PetscBool serial, PetscBool destroy_tag,Vec *X); 58: PETSC_EXTERN PetscErrorCode DMMoabGetVecTag(Vec vec,moab::Tag *tag); 59: PETSC_EXTERN PetscErrorCode DMMoabGetVecRange(Vec vec,moab::Range *range); 61: PETSC_EXTERN PetscErrorCode DMMoabSetFieldVector(DM, PetscInt, Vec); 62: PETSC_EXTERN PetscErrorCode DMMoabSetGlobalFieldVector(DM, Vec); 64: PETSC_EXTERN PetscErrorCode DMMoabGetFieldName(DM dm, PetscInt field, const char **fieldName); 65: PETSC_EXTERN PetscErrorCode DMMoabSetFieldName(DM dm, PetscInt field, const char *fieldName); 66: PETSC_EXTERN PetscErrorCode DMMoabSetFieldNames(DM dm,PetscInt nfields,const char* fields[]); 67: PETSC_EXTERN PetscErrorCode DMMoabGetFieldDof(DM dm,moab::EntityHandle point, PetscInt field,PetscInt* dof); 68: PETSC_EXTERN PetscErrorCode DMMoabGetFieldDofs(DM dm,PetscInt npoints,const moab::EntityHandle* points, PetscInt field,PetscInt* dof); 69: PETSC_EXTERN PetscErrorCode DMMoabGetFieldDofsLocal(DM dm,PetscInt npoints,const moab::EntityHandle* points, PetscInt field,PetscInt* dof); 70: PETSC_EXTERN PetscErrorCode DMMoabGetDofs(DM dm,PetscInt npoints,const moab::EntityHandle* points,PetscInt* dof); 71: PETSC_EXTERN PetscErrorCode DMMoabGetDofsLocal(DM dm,PetscInt npoints,const moab::EntityHandle* points,PetscInt* dof); 72: PETSC_EXTERN PetscErrorCode DMMoabGetDofsBlocked(DM dm,PetscInt npoints,const moab::EntityHandle* points,PetscInt* dof); 73: PETSC_EXTERN PetscErrorCode DMMoabGetDofsBlockedLocal(DM dm,PetscInt npoints,const moab::EntityHandle* points,PetscInt* dof); 75: PETSC_EXTERN PetscErrorCode DMMoabGetVertexDofsBlocked(DM dm,PetscInt** dof); 76: PETSC_EXTERN PetscErrorCode DMMoabGetVertexDofsBlockedLocal(DM dm,PetscInt** dof); 78: /* discretization and assembly specific DMMoab interface functions */ 79: PETSC_EXTERN PetscErrorCode DMMoabGetElementConnectivity(DM dm,moab::EntityHandle ehandle,PetscInt* nconn,const moab::EntityHandle **conn); 80: PETSC_EXTERN PetscErrorCode DMMoabGetVertexConnectivity(DM dm,moab::EntityHandle ehandle,PetscInt* nconn, moab::EntityHandle **conn); 81: PETSC_EXTERN PetscErrorCode DMMoabRestoreVertexConnectivity(DM dm,moab::EntityHandle ehandle,PetscInt* nconn, moab::EntityHandle **conn); 82: PETSC_EXTERN PetscErrorCode DMMoabGetVertexCoordinates(DM dm,PetscInt nconn,const moab::EntityHandle *conn,PetscReal *vpos); 83: PETSC_EXTERN PetscErrorCode DMMoabIsEntityOnBoundary(DM dm,const moab::EntityHandle ent,PetscBool* ent_on_boundary); 84: PETSC_EXTERN PetscErrorCode DMMoabCheckBoundaryVertices(DM dm,PetscInt nconn,const moab::EntityHandle *cnt,PetscBool* isbdvtx); 85: PETSC_EXTERN PetscErrorCode DMMoabGetBoundaryMarkers(DM dm,const moab::Range **bdvtx,const moab::Range** bdelems,const moab::Range** bdfaces); 87: /* DM utility creation interface */ 88: PETSC_EXTERN PetscErrorCode DMMoabCreateBoxMesh(MPI_Comm,PetscInt,PetscBool,const PetscReal*,PetscInt,PetscInt,DM*); 89: PETSC_EXTERN PetscErrorCode DMMoabLoadFromFile(MPI_Comm,PetscInt,const char*,const char*,DM*); 91: #endif