Actual source code: petscdmstag.h

petsc-3.11.4 2019-09-28
Report Typos and Errors
  1: #if !defined(DMSTAG_H_)
  2: #define DMSTAG_H_

  4:  #include <petscdm.h>
  5:  #include <petscdmproduct.h>

  7: /*E
  8:   DMStagStencilLocation - enumerated type denoted a location relative to an element in a DMStag grid

 10:   The interpretation of these values is dimension-dependent.

 12:   Level: beginner

 14: .seealso: DMSTAG, DMStagStencil, DMStagGetLocationSlot()
 15: E*/
 16: typedef enum {
 17: DMSTAG_NULL_LOCATION=0,
 18: DMSTAG_BACK_DOWN_LEFT,
 19: DMSTAG_BACK_DOWN,
 20: DMSTAG_BACK_DOWN_RIGHT,
 21: DMSTAG_BACK_LEFT,
 22: DMSTAG_BACK,
 23: DMSTAG_BACK_RIGHT,
 24: DMSTAG_BACK_UP_LEFT,
 25: DMSTAG_BACK_UP,
 26: DMSTAG_BACK_UP_RIGHT,
 27: DMSTAG_DOWN_LEFT,
 28: DMSTAG_DOWN,
 29: DMSTAG_DOWN_RIGHT,
 30: DMSTAG_LEFT,
 31: DMSTAG_ELEMENT,
 32: DMSTAG_RIGHT,
 33: DMSTAG_UP_LEFT,
 34: DMSTAG_UP,
 35: DMSTAG_UP_RIGHT,
 36: DMSTAG_FRONT_DOWN_LEFT,
 37: DMSTAG_FRONT_DOWN,
 38: DMSTAG_FRONT_DOWN_RIGHT,
 39: DMSTAG_FRONT_LEFT,
 40: DMSTAG_FRONT,
 41: DMSTAG_FRONT_RIGHT,
 42: DMSTAG_FRONT_UP_LEFT,
 43: DMSTAG_FRONT_UP,
 44: DMSTAG_FRONT_UP_RIGHT
 45: } DMStagStencilLocation;
 46: PETSC_EXTERN const char *const DMStagStencilLocations[]; /* Corresponding strings (see stagstencil.c) */

 48: /*S
 49:   DMStagStencil - data structure representing a degree of freedom on a DMStag grid

 51:   Data structure (C struct), analogous to describing a degree of freedom associated with a DMStag object,
 52:   in terms of a global element index in each of up to three directions, a "location" as defined by DMStagStencilLocation,
 53:   and a component number. Primarily for use with DMStagMatSetValuesStencil() (compare with use of MatStencil with MatSetValuesStencil()).

 55:   Note:
 56:   The component (c) field must always be set, even if there is a single component at a given location (in which case c should be set to 0).

 58: Level: beginner

 60: .seealso: DMSTAG, DMStagMatSetValuesStencil(), DMStagVecSetValuesStencil(), DMStagStencilLocation, DMStagSetStencilWidth(), DMStagSetStencilType(), DMStagVecGetValuesStencil()
 61: S*/
 62: typedef struct {
 63:   DMStagStencilLocation loc;
 64:   PetscInt              i,j,k,c;
 65: } DMStagStencil;

 67: /*E
 68:   DMStagStencilType - Elementwise stencil type, determining which neighbors participate in communication

 70:   Level: beginner

 72: .seealso: DMSTAG, DMStagCreate1d(), DMStagCreate2d(), DMStagCreate3d(), DMStagStencil
 73: E*/

 75: typedef enum{DMSTAG_STENCIL_NONE=0,DMSTAG_STENCIL_STAR,DMSTAG_STENCIL_BOX} DMStagStencilType;
 76: PETSC_EXTERN const char *const DMStagStencilTypes[]; /* Corresponding strings (see stagstencil.c) */

 78: PETSC_EXTERN PetscErrorCode DMCreate_Stag(DM);
 79: PETSC_EXTERN PetscErrorCode DMStagCreate1d(MPI_Comm,DMBoundaryType,PetscInt,PetscInt,PetscInt,DMStagStencilType,PetscInt,const PetscInt[],DM*);
 80: PETSC_EXTERN PetscErrorCode DMStagCreate2d(MPI_Comm,DMBoundaryType,DMBoundaryType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,DMStagStencilType,PetscInt,const PetscInt[],const PetscInt[],DM*);
 81: PETSC_EXTERN PetscErrorCode DMStagCreate3d(MPI_Comm,DMBoundaryType,DMBoundaryType,DMBoundaryType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,DMStagStencilType,PetscInt,const PetscInt[],const PetscInt[],const PetscInt[],DM*);
 82: PETSC_EXTERN PetscErrorCode DMStagGetBoundaryTypes(DM,DMBoundaryType*,DMBoundaryType*,DMBoundaryType*);
 83: PETSC_EXTERN PetscErrorCode DMStagGet1dCoordinateArraysDOFRead(DM,void*,void*,void*);
 84: PETSC_EXTERN PetscErrorCode DMStagGet1dCoordinateLocationSlot(DM,DMStagStencilLocation,PetscInt*);
 85: PETSC_EXTERN PetscErrorCode DMStagGetCorners(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
 86: PETSC_EXTERN PetscErrorCode DMStagGetDOF(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
 87: PETSC_EXTERN PetscErrorCode DMStagGetEntriesPerElement(DM,PetscInt*);
 88: PETSC_EXTERN PetscErrorCode DMStagGetLocationDOF(DM,DMStagStencilLocation,PetscInt*);
 89: PETSC_EXTERN PetscErrorCode DMStagGetLocationSlot(DM,DMStagStencilLocation,PetscInt,PetscInt*);
 90: PETSC_EXTERN PetscErrorCode DMStagGetGhostCorners(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
 91: PETSC_EXTERN PetscErrorCode DMStagGetStencilWidth(DM,PetscInt*);
 92: PETSC_EXTERN PetscErrorCode DMStagGetGlobalSizes(DM,PetscInt*,PetscInt*,PetscInt*);
 93: PETSC_EXTERN PetscErrorCode DMStagGetIsFirstRank(DM,PetscBool*,PetscBool*,PetscBool*);
 94: PETSC_EXTERN PetscErrorCode DMStagGetIsLastRank(DM,PetscBool*,PetscBool*,PetscBool*);
 95: PETSC_EXTERN PetscErrorCode DMStagGetLocalSizes(DM,PetscInt*,PetscInt*,PetscInt*);
 96: PETSC_EXTERN PetscErrorCode DMStagGetNumRanks(DM,PetscInt*,PetscInt*,PetscInt*);
 97: PETSC_EXTERN PetscErrorCode DMStagCreateCompatibleDMStag(DM,PetscInt,PetscInt,PetscInt,PetscInt,DM*);
 98: PETSC_EXTERN PetscErrorCode DMStagMigrateVec(DM,Vec,DM,Vec);
 99: PETSC_EXTERN PetscErrorCode DMStagMatSetValuesStencil(DM,Mat,PetscInt,const DMStagStencil*,PetscInt,const DMStagStencil*,const PetscScalar*,InsertMode);
100: PETSC_EXTERN PetscErrorCode DMStagRestore1dCoordinateArraysDOFRead(DM,void*,void*,void*);
101: PETSC_EXTERN PetscErrorCode DMStagSetBoundaryTypes(DM,DMBoundaryType,DMBoundaryType,DMBoundaryType);
102: PETSC_EXTERN PetscErrorCode DMStagSetCoordinateDMType(DM,DMType);
103: PETSC_EXTERN PetscErrorCode DMStagSetDOF(DM,PetscInt,PetscInt,PetscInt,PetscInt);
104: PETSC_EXTERN PetscErrorCode DMStagSetGlobalSizes(DM,PetscInt,PetscInt,PetscInt);
105: PETSC_EXTERN PetscErrorCode DMStagSetNumRanks(DM,PetscInt,PetscInt,PetscInt);
106: PETSC_EXTERN PetscErrorCode DMStagSetOwnershipRanges(DM,PetscInt const *,PetscInt const *,PetscInt const *);
107: PETSC_EXTERN PetscErrorCode DMStagSetUniformCoordinates(DM,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal);
108: PETSC_EXTERN PetscErrorCode DMStagSetUniformCoordinatesExplicit(DM,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal);
109: PETSC_EXTERN PetscErrorCode DMStagSetUniformCoordinatesProduct(DM,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal);
110: PETSC_EXTERN PetscErrorCode DMStagVecSplitToDMDA(DM,Vec,DMStagStencilLocation,PetscInt,DM*,Vec*);
111: PETSC_EXTERN PetscErrorCode DMStagVecGetArrayDOF(DM,Vec,void*);
112: PETSC_EXTERN PetscErrorCode DMStagVecGetArrayDOFRead(DM,Vec,void*);
113: PETSC_EXTERN PetscErrorCode DMStagVecRestoreArrayDOF(DM,Vec,void*);
114: PETSC_EXTERN PetscErrorCode DMStagVecRestoreArrayDOFRead(DM,Vec,void*);
115: PETSC_EXTERN PetscErrorCode DMStagVecGetValuesStencil(DM,Vec,PetscInt,const DMStagStencil*,PetscScalar*);
116: PETSC_EXTERN PetscErrorCode DMStagVecSetValuesStencil(DM,Vec,PetscInt,const DMStagStencil*,const PetscScalar*,InsertMode);

118: #endif