Date: 2013-07-02T14:45:12+00:00

Actual source code: petsc-dmdaimpl.h
petsc-3.4.2 2013-07-02

      1: /*
      2:    Distributed arrays - communication tools for parallel, rectangular grids.
      3: */

      5: #if !defined(_DAIMPL_H)
      6: #define _DAIMPL_H

      8: #include <petscdmda.h>
      9: #include "petsc-private/dmimpl.h"

     11: typedef struct {
     12:   PetscInt              M,N,P;                 /* array dimensions */
     13:   PetscInt              m,n,p;                 /* processor layout */
     14:   PetscInt              w;                     /* degrees of freedom per node */
     15:   PetscInt              s;                     /* stencil width */
     16:   PetscInt              xs,xe,ys,ye,zs,ze;     /* range of local values */
     17:   PetscInt              Xs,Xe,Ys,Ye,Zs,Ze;     /* range including ghost values
     18:                                                    values above already scaled by w */
     19:   PetscInt              *idx,Nl;               /* local to global map */
     20:   PetscInt              base;                  /* global number of 1st local node, includes the * w term */
     21:   DMDABoundaryType      bx,by,bz;              /* indicates type of ghost nodes at boundary */
     22:   VecScatter            gtol,ltog,ltol;        /* scatters, see below for details */
     23:   DMDAStencilType       stencil_type;          /* stencil, either box or star */
     24:   PetscInt              dim;                   /* DMDA dimension (1,2, or 3) */
     25:   DMDAInterpolationType interptype;

     27:   PetscInt              nlocal,Nlocal;         /* local size of local vector and global vector, includes the * w term */

     29:   PetscInt              xol,yol,zol;           /* overlap of local subdomains */
     30:   PetscInt              xo,yo,zo;              /* offsets for the indices in x y and z */
     31:   PetscInt              Mo,No,Po;              /* the size of the problem the offset is in to */
     32:   PetscInt              Nsub;                  /* number of local subdomains to decompose into */
     33:   PetscInt              nonxs,nonys,nonzs;     /* the nonoverlapping starts in the case of a subdomain da */
     34:   PetscInt              nonxm,nonym,nonzm;     /* the nonoverlapping sizes in the case of a subdomain da */

     36:   AO                    ao;                    /* application ordering context */

     38:   char                  **fieldname;           /* names of individual components in vectors */
     39:   char                  **coordinatename;      /* names of coordinate directions, for example, x, y, z */

     41:   PetscInt              *lx,*ly,*lz;        /* number of nodes in each partition block along 3 axis */
     42:   Vec                   natural;            /* global vector for storing items in natural order */
     43:   VecScatter            gton;               /* vector scatter from global to natural */
     44:   PetscMPIInt           *neighbors;         /* ranks of all neighbors and self */

     46:   ISColoring            localcoloring;       /* set by DMCreateColoring() */
     47:   ISColoring            ghostedcoloring;

     49:   DMDAElementType       elementtype;
     50:   PetscInt              ne;                  /* number of elements */
     51:   PetscInt              *e;                  /* the elements */

     53:   PetscInt              refine_x,refine_y,refine_z;    /* ratio used in refining */
     54:   PetscInt              coarsen_x,coarsen_y,coarsen_z; /* ratio used for coarsening */

     56: #define DMDA_MAX_WORK_ARRAYS 2 /* work arrays for holding work via DMDAGetArray() */
     57:   void                  *arrayin[DMDA_MAX_WORK_ARRAYS],*arrayout[DMDA_MAX_WORK_ARRAYS];
     58:   void                  *arrayghostedin[DMDA_MAX_WORK_ARRAYS],*arrayghostedout[DMDA_MAX_WORK_ARRAYS];
     59:   void                  *startin[DMDA_MAX_WORK_ARRAYS],*startout[DMDA_MAX_WORK_ARRAYS];
     60:   void                  *startghostedin[DMDA_MAX_WORK_ARRAYS],*startghostedout[DMDA_MAX_WORK_ARRAYS];

     62:   PetscErrorCode (*lf)(DM, Vec, Vec, void *);
     63:   PetscErrorCode (*lj)(DM, Vec, Vec, void *);

     65:   /* used by DMDASetBlockFills() */
     66:   PetscInt              *ofill,*dfill;
     67:   PetscInt              *ofillcols;

     69:   /* used by DMDASetMatPreallocateOnly() */
     70:   PetscBool             prealloc_only;
     71: } DM_DA;

     73: /*
     74:   Vectors:
     75:      Global has on each processor the interior degrees of freedom and
     76:          no ghost points. This vector is what the solvers usually see.
     77:      Local has on each processor the ghost points as well. This is
     78:           what code to calculate Jacobians, etc. usually sees.
     79:   Vector scatters:
     80:      gtol - Global representation to local
     81:      ltog - Local representation to global (involves no communication)
     82:      ltol - Local representation to local representation, updates the
     83:             ghostpoint values in the second vector from (correct) interior
     84:             values in the first vector.  This is good for explicit
     85:             nearest neighbor timestepping.
     86: */

     88: PETSC_EXTERN PetscErrorCode VecView_MPI_DA(Vec,PetscViewer);
     89: PETSC_EXTERN PetscErrorCode VecLoad_Default_DA(Vec, PetscViewer);
     90: PETSC_EXTERN PetscErrorCode DMView_DA_Matlab(DM,PetscViewer);
     91: PETSC_EXTERN PetscErrorCode DMView_DA_Binary(DM,PetscViewer);
     92: PETSC_EXTERN PetscErrorCode DMView_DA_VTK(DM,PetscViewer);
     93: PETSC_EXTERN PetscErrorCode DMDAVTKWriteAll(PetscObject,PetscViewer);
     94: PETSC_EXTERN PetscErrorCode DMDASelectFields(DM,PetscInt*,PetscInt**);

     96: PETSC_EXTERN PetscLogEvent DMDA_LocalADFunction;

     98: #endif