[petsc-dev] DMDABoundaryType

Ethan Coon ecoon at lanl.gov
Fri Mar 11 17:35:36 CST 2011


Ok, here's a patch that makes the below change, and changes the APIs of
DMDACreate*D(), DMDAGetInfo(), and DMDASetBoundaryType().

Nearly every tutorial/test example is touched, and everyone's DA code is
broken.  Up to you if you want it :)

This should deal with Lisandro's c++ issue with int/enum bitwise or (or
we could change the enum to a typedef if that works or int otherwise, or
some other hack for c++?).

Ethan

On Thu, 2011-03-10 at 21:50 -0600, Barry Smith wrote:
> Sounds good to me.
> 
>   Barry
> 
> On Mar 10, 2011, at 8:53 PM, Lisandro Dalcin wrote:
> 
> > While updating petsc4py for the latest DMDA chages, and alto taking
> > into account some new in NumPy C API related to neighborhood
> > iterators,  I've got new idea. What about the API below?:
> > 
> > enum DMDABoundaryType:
> >    DMDA_BOUNDARY_NONE = 0
> >    DMDA_BOUNDARY_GHOSTED = 1
> >    DMDA_BOUNDARY_MIRROR = 2
> >    DMDA_BOUNDARY_PERIODIC = 4
> > 
> > PetscErrorCode DMDASetBoundaryType(DM dm, DMDABoundaryType bx,
> > DMDABoundaryType by, DMDABoundaryType bz)
> > 
> > Changes for GHOSTED and PERIODIC should be easy
> > (http://lkml.org/lkml/2000/8/25/132) ;-).
> > 
> > The new MIRROR boundary type could be implemented later.
> > 
> > 
> > 
> > -- 
> > Lisandro Dalcin
> > ---------------
> > CIMEC (INTEC/CONICET-UNL)
> > Predio CONICET-Santa Fe
> > Colectora RN 168 Km 472, Paraje El Pozo
> > 3000 Santa Fe, Argentina
> > Tel: +54-342-4511594 (ext 1011)
> > Tel/Fax: +54-342-4511169
> 

-- 
------------------------------------
Ethan Coon
Post-Doctoral Researcher
Applied Mathematics - T-5
Los Alamos National Laboratory
505-665-8289

http://www.ldeo.columbia.edu/~ecoon/
------------------------------------
-------------- next part --------------
changed DMDA API to take multiple DMDABoundaryType (one per dimension) in the creation/setup of a DMDA

diff -r 23e7928e179a include/finclude/petscdm.h
--- a/include/finclude/petscdm.h	Thu Mar 10 22:14:51 2011 -0600
+++ b/include/finclude/petscdm.h	Fri Mar 11 16:29:15 2011 -0700
@@ -15,33 +15,15 @@
 !
 !  Types of periodicity
 !
-      PetscEnum DMDA_NONPERIODIC
-      PetscEnum DMDA_NONGHOSTED
-      PetscEnum DMDA_XPERIODIC
-      PetscEnum DMDA_YPERIODIC
-      PetscEnum DMDA_XYPERIODIC
-      PetscEnum DMDA_XYZPERIODIC
-      PetscEnum DMDA_XZPERIODIC
-      PetscEnum DMDA_YZPERIODIC
-      PetscEnum DMDA_ZPERIODIC
-      PetscEnum DMDA_XGHOSTED
-      PetscEnum DMDA_YGHOSTED
-      PetscEnum DMDA_ZGHOSTED
-      PetscEnum DMDA_XYZGHOSTED
+      PetscEnum DMDA_BOUNDARY_NONE
+      PetscEnum DMDA_BOUNDARY_GHOSTED
+      PetscEnum DMDA_BOUNDARY_MIRROR
+      PetscEnum DMDA_BOUNDARY_PERIODIC
 
-      parameter (DMDA_NONPERIODIC = Z'0')
-      parameter (DMDA_NONGHOSTED = Z'0')
-      parameter (DMDA_XPERIODIC = Z'3')
-      parameter (DMDA_YPERIODIC = Z'C')
-      parameter (DMDA_XYPERIODIC = Z'F')
-      parameter (DMDA_XYZPERIODIC = Z'3F')
-      parameter (DMDA_XZPERIODIC = Z'33')
-      parameter (DMDA_YZPERIODIC = Z'3C')
-      parameter (DMDA_ZPERIODIC = Z'30')
-      parameter (DMDA_XGHOSTED = Z'1')
-      parameter (DMDA_YGHOSTED = Z'4')
-      parameter (DMDA_ZGHOSTED = Z'10')
-      parameter (DMDA_XYZGHOSTED = Z'15')
+      parameter (DMDA_BOUNDARY_NONE = 0)
+      parameter (DMDA_BOUNDARY_GHOSTED = 0)
+      parameter (DMDA_BOUNDARY_MIRROR = 0)
+      parameter (DMDA_BOUNDARY_PERIODIC = 0)
 
 !
 ! DMDAInterpolationType
diff -r 23e7928e179a include/petscdm.h
--- a/include/petscdm.h	Thu Mar 10 22:14:51 2011 -0600
+++ b/include/petscdm.h	Fri Mar 11 16:29:15 2011 -0700
@@ -54,32 +54,17 @@
 M*/
 
 /*E
-    DMDABoundaryType - Is the domain periodic or ghosted in one or more directions
+    DMDABoundaryType - Describes the choice for fill of ghost cells on domain boundaries.
 
    Level: beginner
 
-   Each dimension may be non-periodic, ghosted (meaning ghost nodes are added outside
-   of the boundary, but not filled by DMDAGlobalToLocal()), or periodic.  Dimensions 
-   may be composed using the bitwise or operator, i.e.:
+   A boundary may be of type DMDA_BOUNDARY_NONE (no ghost nodes), DMDA_BOUNDARY_GHOST (ghost nodes 
+   exist but aren't filled), DMDA_BOUNDARY_MIRROR (not yet implemented), or DMDA_BOUNDARY_PERIODIC
+   (ghost nodes filled by the opposite edge of the domain).
 
-   DMDA_XYPERIODIC = DMDA_XPERIODIC | DMDA_YPERIODIC
-
-.seealso: DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDACreate()
+.seealso: DMDASetBoundaryType(), DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDACreate()
 E*/
-typedef enum {
-  DMDA_NONGHOSTED = 0x0,
-  DMDA_NONPERIODIC = 0x0, /* kept for backwards compatiblity, though it's not precise */
-  DMDA_XGHOSTED = 0x1,
-  DMDA_XPERIODIC = 0x3,
-  DMDA_YGHOSTED = 0x4,
-  DMDA_YPERIODIC = 0xc,
-  DMDA_ZGHOSTED = 0x10,
-  DMDA_ZPERIODIC = 0x30,
-  DMDA_XYPERIODIC = 0xf,
-  DMDA_XZPERIODIC = 0x33,
-  DMDA_YZPERIODIC = 0x3c,
-  DMDA_XYZPERIODIC = 0x3f,
-  DMDA_XYZGHOSTED = 0x15} DMDABoundaryType;
+typedef enum { DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_GHOSTED, DMDA_BOUNDARY_MIRROR, DMDA_BOUNDARY_PERIODIC } DMDABoundaryType;
 
 extern const char *DMDABoundaryTypes[];
 
@@ -109,13 +94,6 @@
 extern PetscErrorCode   DMDASetElementType(DM,DMDAElementType);
 extern PetscErrorCode   DMDAGetElementType(DM,DMDAElementType*);
 
-#define DMDAXPeriodic(pt) ((pt) & (DMDA_XPERIODIC ^ DMDA_XGHOSTED))
-#define DMDAYPeriodic(pt) ((pt) & (DMDA_YPERIODIC ^ DMDA_YGHOSTED))
-#define DMDAZPeriodic(pt) ((pt) & (DMDA_ZPERIODIC ^ DMDA_ZGHOSTED))
-#define DMDAXGhosted(pt) ((pt) & DMDA_XGHOSTED)
-#define DMDAYGhosted(pt) ((pt) & DMDA_YGHOSTED)
-#define DMDAZGhosted(pt) ((pt) & DMDA_ZGHOSTED)
-
 typedef enum { DMDA_X,DMDA_Y,DMDA_Z } DMDADirection;
 
 extern PetscClassId  DM_CLASSID;
@@ -126,8 +104,8 @@
 extern PetscErrorCode  DMDASetDim(DM,PetscInt);
 extern PetscErrorCode  DMDASetSizes(DM,PetscInt,PetscInt,PetscInt);
 extern PetscErrorCode     DMDACreate1d(MPI_Comm,DMDABoundaryType,PetscInt,PetscInt,PetscInt,const PetscInt[],DM *);
-extern PetscErrorCode     DMDACreate2d(MPI_Comm,DMDABoundaryType,DMDAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],DM*);
-extern PetscErrorCode     DMDACreate3d(MPI_Comm,DMDABoundaryType,DMDAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscInt[],DM*);
+extern PetscErrorCode     DMDACreate2d(MPI_Comm,DMDABoundaryType,DMDABoundaryType,DMDAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],DM*);
+extern PetscErrorCode     DMDACreate3d(MPI_Comm,DMDABoundaryType,DMDABoundaryType,DMDABoundaryType,DMDAStencilType,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscInt[],DM*);
 extern PetscErrorCode  DMSetOptionsPrefix(DM,const char []);
 extern PetscErrorCode  DMSetVecType(DM,const VecType);
 
@@ -142,7 +120,7 @@
 extern PetscErrorCode     DMDALoad(PetscViewer,PetscInt,PetscInt,PetscInt,DM *);
 extern PetscErrorCode     DMDAGetCorners(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
 extern PetscErrorCode     DMDAGetGhostCorners(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
-extern PetscErrorCode     DMDAGetInfo(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,DMDABoundaryType*,DMDAStencilType*);
+extern PetscErrorCode     DMDAGetInfo(DM,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,DMDABoundaryType*,DMDABoundaryType*,DMDABoundaryType*,DMDAStencilType*);
 extern PetscErrorCode     DMDAGetProcessorSubset(DM,DMDADirection,PetscInt,MPI_Comm*);
 extern PetscErrorCode     DMDAGetProcessorSubsets(DM,DMDADirection,MPI_Comm*);
 
@@ -166,7 +144,7 @@
 extern PetscErrorCode     DMDASetFieldName(DM,PetscInt,const char[]);
 extern PetscErrorCode     DMDAGetFieldName(DM,PetscInt,const char**);
 
-extern PetscErrorCode  DMDASetBoundaryType(DM, DMDABoundaryType);
+extern PetscErrorCode  DMDASetBoundaryType(DM,DMDABoundaryType,DMDABoundaryType,DMDABoundaryType);
 extern PetscErrorCode  DMDASetDof(DM, int);
 extern PetscErrorCode  DMDASetStencilWidth(DM, PetscInt);
 extern PetscErrorCode  DMDASetOwnershipRanges(DM,const PetscInt[],const PetscInt[],const PetscInt[]);
@@ -279,7 +257,7 @@
   PetscInt       xm,ym,zm;    /* number of grid points on this processor, excluding ghosts */
   PetscInt       gxs,gys,gzs;    /* starting point of this processor including ghosts */
   PetscInt       gxm,gym,gzm;    /* number of grid points on this processor including ghosts */
-  DMDABoundaryType pt;
+  DMDABoundaryType bx,by,bz; /* type of ghost nodes at boundary */
   DMDAStencilType  st;
   DM             da;
 } DMDALocalInfo;
diff -r 23e7928e179a include/private/daimpl.h
--- a/include/private/daimpl.h	Thu Mar 10 22:14:51 2011 -0600
+++ b/include/private/daimpl.h	Fri Mar 11 16:29:15 2011 -0700
@@ -17,7 +17,7 @@
                                                    values above already scaled by w */
   PetscInt            *idx,Nl;               /* local to global map */
   PetscInt            base;                  /* global number of 1st local node */
-  DMDABoundaryType      wrap;                  /* indicates type of periodic boundaries */
+  DMDABoundaryType    bx,by,bz;              /* indicates type of ghost nodes at boundary */
   VecScatter          gtol,ltog,ltol;        /* scatters, see below for details */
   DMDAStencilType       stencil_type;          /* stencil, either box or star */
   PetscInt            dim;                   /* DMDA dimension (1,2, or 3) */
diff -r 23e7928e179a src/characteristic/examples/tutorials/ex1.c
--- a/src/characteristic/examples/tutorials/ex1.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/characteristic/examples/tutorials/ex1.c	Fri Mar 11 16:29:15 2011 -0700
@@ -104,7 +104,7 @@
   ierr = DMDACreate2d(comm,grid.periodic,grid.stencil,grid.ni,grid.nj,PETSC_DECIDE,PETSC_DECIDE,grid.dof,grid.stencil_width,0,0,&da);CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,&(param->pi),&(param->pj),PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,&(param->pi),&(param->pj),PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
   REG_INTG(user->bag,&param->pi,param->pi ,"procs_x","<DO NOT SET> Processors in the x-direction");
   REG_INTG(user->bag,&param->pj,param->pj ,"procs_y","<DO NOT SET> Processors in the y-direction");
 
diff -r 23e7928e179a src/characteristic/examples/tutorials/ex2.c
--- a/src/characteristic/examples/tutorials/ex2.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/characteristic/examples/tutorials/ex2.c	Fri Mar 11 16:29:15 2011 -0700
@@ -104,7 +104,7 @@
   ierr = DMDACreate2d(comm,user->grid.periodic,user->grid.stencil,user->grid.ni,user->grid.nj,PETSC_DECIDE,PETSC_DECIDE,user->grid.dof,user->grid.stencil_width,0,0,&da);CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,&(param->pi),&(param->pj),PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,&(param->pi),&(param->pj),PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
   REG_INTG(user->bag,&param->pi,param->pi ,"procs_x","<DO NOT SET> Processors in the x-direction");
   REG_INTG(user->bag,&param->pj,param->pj ,"procs_y","<DO NOT SET> Processors in the y-direction");
 
diff -r 23e7928e179a src/characteristic/examples/tutorials/ex4.c
--- a/src/characteristic/examples/tutorials/ex4.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/characteristic/examples/tutorials/ex4.c	Fri Mar 11 16:29:15 2011 -0700
@@ -127,7 +127,7 @@
   ierr = DMDestroy(da);CHKERRQ(ierr);
   ierr = DMMGSetSNESLocal(user->dmmg,FormNewTimeFunctionLocal,PETSC_NULL,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
   ierr = DMMGSetFromOptions(user->dmmg);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(DMMGGetDM(user->dmmg),PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,&(param->pi),&(param->pj),PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(DMMGGetDM(user->dmmg),PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,&(param->pi),&(param->pj),PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
   REG_INTG(user->bag,&param->pi,param->pi ,"procs_x","<DO NOT SET> Processors in the x-direction");
   REG_INTG(user->bag,&param->pj,param->pj ,"procs_y","<DO NOT SET> Processors in the y-direction");
 
diff -r 23e7928e179a src/characteristic/impls/da/slda.c
--- a/src/characteristic/impls/da/slda.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/characteristic/impls/da/slda.c	Fri Mar 11 16:29:15 2011 -0700
@@ -44,7 +44,7 @@
   PetscInt       dim, numValues;
   PetscErrorCode ierr;
 
-  ierr = DMDAGetInfo(c->velocityDA, &dim, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(c->velocityDA, &dim, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0,0);CHKERRQ(ierr);
   if (c->structured) {
     c->numIds = dim;
   } else {
@@ -110,25 +110,20 @@
    ----------------------------------------------------------------------------------------*/
 PetscErrorCode DMDAMapCoordsToPeriodicDomain(DM da, PetscScalar *x, PetscScalar *y)
 {
-  DMDABoundaryType periodic_type;
+  DMDABoundaryType bx, by;
   PetscInt       dim, gx, gy;
   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da, &dim, &gx, &gy, 0, 0, 0, 0, 0, 0, &periodic_type, 0);
+  ierr = DMDAGetInfo(da, &dim, &gx, &gy, 0, 0, 0, 0, 0, 0, &bx, &by, 0, 0);
 
-  if ( periodic_type == DMDA_NONPERIODIC ) {
-    ierr = 0;
-  } else {
-    if (DMDAXPeriodic(periodic_type)) {
+  if (bx == DMDA_BOUNDARY_PERIODIC) {
       while (*x >= ( PetscScalar ) gx ) { *x -= ( PetscScalar ) gx; }
       while (*x < 0.0 )                 { *x += ( PetscScalar ) gx; }
     }
-    if (DMDAYPeriodic(periodic_type)) {
+    if (by == DMDA_BOUNDARY_PERIODIC) {
       while (*y >= ( PetscScalar ) gy ) { *y -= ( PetscScalar ) gy; }
       while (*y < 0.0 )                 { *y += ( PetscScalar ) gy; }
     }
-  }
-    
   PetscFunctionReturn(ierr);
 }
diff -r 23e7928e179a src/characteristic/interface/characteristic.c
--- a/src/characteristic/interface/characteristic.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/characteristic/interface/characteristic.c	Fri Mar 11 16:29:15 2011 -0700
@@ -320,8 +320,7 @@
   DM                      da = c->velocityDA;
   Vec                     velocityLocal, velocityLocalOld;
   Vec                     fieldLocal;
-  DMDALocalInfo             info;
-  DMDABoundaryType          periodic_type;
+  DMDALocalInfo           info;
   PetscScalar             **solArray;
   void                    *velocityArray;
   void                    *velocityArrayOld;
@@ -345,7 +344,7 @@
   ierr = CharacteristicSetNeighbors(c, 9, neighbors);CHKERRQ(ierr);
   ierr = CharacteristicSetUp(c);CHKERRQ(ierr);
   /* global and local grid info */
-  ierr = DMDAGetInfo(da, &dim, &gx, &gy, 0, 0, 0, 0, 0, 0, &periodic_type, 0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, &dim, &gx, &gy, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);CHKERRQ(ierr);
   ierr = DMDAGetLocalInfo(da, &info);CHKERRQ(ierr);
   ni   = info.mx;          nj   = info.my;
   is   = info.xs;          ie   = info.xs+info.xm; 
@@ -559,7 +558,7 @@
 
   /* Return field of characteristics at t_n-1 */
   ierr = PetscLogEventBegin(CHARACTERISTIC_DAUpdate,0,0,0,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(c->fieldDA, 0, 0, 0, 0, 0, 0, 0, &dof, 0, 0, 0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(c->fieldDA,0,0,0,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(c->fieldDA, solution, &solArray);CHKERRQ(ierr);
   for(n = 0; n < c->queueSize; n++) {
     Qi = c->queue[n];
@@ -788,7 +787,7 @@
 /* [center, left, top-left, top, top-right, right, bottom-right, bottom, bottom-left] */
 PetscErrorCode DMDAGetNeighborsRank(DM da, PetscMPIInt neighbors[])
 {
-  DMDABoundaryType periodic_type;
+  DMDABoundaryType bx, by;
   PetscBool      IPeriodic = PETSC_FALSE, JPeriodic = PETSC_FALSE;
   MPI_Comm       comm;
   PetscMPIInt    rank;
@@ -798,12 +797,12 @@
   PetscFunctionBegin;
   ierr = PetscObjectGetComm((PetscObject) da, &comm);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da, 0, 0, 0, 0, &PI,&PJ, 0, 0, 0, &periodic_type, 0);
+  ierr = DMDAGetInfo(da, 0, 0, 0, 0, &PI,&PJ, 0, 0, 0, &bx, &by,0, 0);
 
-  if (DMDAXPeriodic(periodic_type)) {
+  if (bx == DMDA_BOUNDARY_PERIODIC) {
     IPeriodic = PETSC_TRUE;
   }
-  if (DMDAYPeriodic(periodic_type)) {
+  if (by == DMDA_BOUNDARY_PERIODIC) {
     JPeriodic = PETSC_TRUE;
   }
 
diff -r 23e7928e179a src/contrib/blopex/driver/driver.c
--- a/src/contrib/blopex/driver/driver.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/contrib/blopex/driver/driver.c	Fri Mar 11 16:29:15 2011 -0700
@@ -179,21 +179,25 @@
   if (PreLoadIt==0)
   {
       /* small problem */
-      ierr=DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,10,10,10,
-            1,PETSC_DECIDE,1,1,1,0,0,0,&da); CHKERRQ(ierr);
+      ierr=DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,
+                        DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,10,10,10,
+                        1,PETSC_DECIDE,1,1,1,0,0,0,&da); CHKERRQ(ierr);
   }
   else
   {
      /* actual problem */
       if (freepart)     /* petsc determines partitioning */
       {
-        ierr=DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-10,-10,-10,
-            PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da); CHKERRQ(ierr);
+        ierr=DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,
+                          DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-10,-10,-10,
+                          PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,
+                          1,1,0,0,0,&da); CHKERRQ(ierr);
       }
       else             /* (1,NP,1) partitioning */
       {
-        ierr=DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-10,-10,-10,
-            1,PETSC_DECIDE,1,1,1,0,0,0,&da); CHKERRQ(ierr);
+        ierr=DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUDNARY_NONE,DMDA_BOUDNARY_NONE,
+                          DMDA_BOUDNARY_NONE,DMDA_STENCIL_STAR,-10,-10,-10,
+                          1,PETSC_DECIDE,1,1,1,0,0,0,&da); CHKERRQ(ierr);
       }
 
       /* now we print what partitioning is chosen */
diff -r 23e7928e179a src/contrib/helmholtz_2/ex12.c
--- a/src/contrib/helmholtz_2/ex12.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/contrib/helmholtz_2/ex12.c	Fri Mar 11 16:29:15 2011 -0700
@@ -240,7 +240,7 @@
      mapping is needed when we determine the global column numbers for
      grid points on a processor edge.
   */
-  ierr = DMDACreate2d(user.comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,user.m_eta,
+  ierr = DMDACreate2d(user.comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,user.m_eta,
                     user.m_xi,N_eta,N_xi,1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRA(ierr);
   ierr = DMCreateGlobalVector(user.da,&user.phi);CHKERRA(ierr);
   ierr = VecGetLocalSize(user.phi,&user.m_ldim);CHKERRA(ierr);
diff -r 23e7928e179a src/contrib/keyes/ex15.c
--- a/src/contrib/keyes/ex15.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/contrib/keyes/ex15.c	Fri Mar 11 16:29:15 2011 -0700
@@ -128,7 +128,7 @@
 
   /* Set up distributed array for  each level */
   for (i=0; i<user.nlevels; i++) {
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,user.grid[i].mx,
+    ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,user.grid[i].mx,
                       user.grid[i].my,Nx,Ny,1,1,PETSC_NULL,PETSC_NULL,&user.grid[i].da);CHKERRA(ierr);
     ierr = DMCreateGlobalVector(user.grid[i].da,&user.grid[i].x);CHKERRA(ierr);
     ierr = VecDuplicate(user.grid[i].x,&user.grid[i].r);CHKERRA(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex1.c
--- a/src/dm/examples/tests/ex1.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex1.c	Fri Mar 11 16:29:15 2011 -0700
@@ -25,7 +25,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-n",&n,PETSC_NULL);CHKERRQ(ierr);
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,
                     M,N,m,n,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex11.c
--- a/src/dm/examples/tests/ex11.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex11.c	Fri Mar 11 16:29:15 2011 -0700
@@ -1,5 +1,5 @@
 
-static char help[] = "Tests various 1-dimensional DM routines.\n\n";
+static char help[] = "Tests various 2-dimensional DM routines.\n\n";
 
 #include "petscdm.h"
 
@@ -7,7 +7,7 @@
 #define __FUNCT__ "main"
 int main(int argc,char **argv)
 {
-  PetscInt       M = 5,N = 4,dof=1,s=1,wrap=0,i,n,j,k,m,cnt;
+  PetscInt       M = 5,N = 4,dof=1,s=1,bx=0,by=0,i,n,j,k,m,cnt;
   PetscErrorCode ierr;
   DM             da;
   PetscViewer    viewer;
@@ -28,10 +28,11 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-N",&N,PETSC_NULL);CHKERRQ(ierr);
   ierr = PetscOptionsGetInt(PETSC_NULL,"-dof",&dof,PETSC_NULL);CHKERRQ(ierr); 
   ierr = PetscOptionsGetInt(PETSC_NULL,"-s",&s,PETSC_NULL);CHKERRQ(ierr); 
-  ierr = PetscOptionsGetInt(PETSC_NULL,"-periodic",&wrap,PETSC_NULL);CHKERRQ(ierr); 
+  ierr = PetscOptionsGetInt(PETSC_NULL,"-periodic_x",&wrap,PETSC_NULL);CHKERRQ(ierr); 
+  ierr = PetscOptionsGetInt(PETSC_NULL,"-periodic_y",&wrap,PETSC_NULL);CHKERRQ(ierr); 
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,(DMDABoundaryType)wrap,DMDA_STENCIL_BOX,M,N,PETSC_DECIDE,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,(DMDABoundaryType)bx,(DMDABoundaryType)by,DMDA_STENCIL_BOX,M,N,PETSC_DECIDE,
                     PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMDASetUniformCoordinates(da,0.0,1.0,0.0,1.0,0.0,0.0);CHKERRQ(ierr);
   for (i=0; i<dof; i++) {
diff -r 23e7928e179a src/dm/examples/tests/ex12.c
--- a/src/dm/examples/tests/ex12.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex12.c	Fri Mar 11 16:29:15 2011 -0700
@@ -26,7 +26,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-time",&time_steps,PETSC_NULL);CHKERRQ(ierr);
     
   /* Set up the array */ 
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,M,w,s,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,M,w,s,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(PETSC_COMM_WORLD,&rank);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex14.c
--- a/src/dm/examples/tests/ex14.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex14.c	Fri Mar 11 16:29:15 2011 -0700
@@ -25,7 +25,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-dof",&dof,PETSC_NULL);CHKERRQ(ierr);
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,
                     M,N,m,n,dof,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex15.c
--- a/src/dm/examples/tests/ex15.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex15.c	Fri Mar 11 16:29:15 2011 -0700
@@ -13,7 +13,8 @@
   Vec            v_c,v_f;
   Mat            I;
   PetscScalar    one = 1.0;
-  DMDABoundaryType pt = DMDA_NONPERIODIC;
+  PetscBool pt;
+  DMDABoundaryType bx = DMDA_BOUNDARY_NONE,by = DMDA_BOUNDARY_NONE;
  
   ierr = PetscInitialize(&argc,&argv,(char*)0,help);CHKERRQ(ierr); 
 
@@ -24,12 +25,12 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-dof",&dof,PETSC_NULL);CHKERRQ(ierr);
   ierr = PetscOptionsGetBool(PETSC_NULL,"-periodic",(PetscBool*)&pt,PETSC_NULL);CHKERRQ(ierr);
 
-  if (pt != DMDA_NONPERIODIC) {
-    if (dim == 1) pt = DMDA_XPERIODIC;
-    if (dim == 2) pt = DMDA_XYPERIODIC;
-    if (dim == 3) pt = DMDA_XYZPERIODIC;
+  if (pt) {
+    if (dim > 0) bx = DMDA_BOUNDARY_PERIODIC;
+    if (dim > 1) by = DMDA_BOUNDARY_PERIODIC;
+    if (dim > 2) bz = DMDA_BOUNDARY_PERIODIC;
   }
-  if (pt == DMDA_NONPERIODIC) {
+  if (bx == DMDA_BOUNDARY_NONE) {
     M2   = ratio*(M1-1) + 1;
   } else {
     M2 = ratio*M1;
@@ -37,14 +38,14 @@
 
   /* Set up the array */ 
   if (dim == 1) {
-    ierr = DMDACreate1d(PETSC_COMM_WORLD,pt,M1,dof,s,PETSC_NULL,&da_c);CHKERRQ(ierr);
-    ierr = DMDACreate1d(PETSC_COMM_WORLD,pt,M2,dof,s,PETSC_NULL,&da_f);CHKERRQ(ierr);
+    ierr = DMDACreate1d(PETSC_COMM_WORLD,bx,M1,dof,s,PETSC_NULL,&da_c);CHKERRQ(ierr);
+    ierr = DMDACreate1d(PETSC_COMM_WORLD,bx,M2,dof,s,PETSC_NULL,&da_f);CHKERRQ(ierr);
   } else if (dim == 2) {
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,pt,DMDA_STENCIL_BOX,M1,M1,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,&da_c);CHKERRQ(ierr);
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,pt,DMDA_STENCIL_BOX,M2,M2,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,&da_f);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD,bx,by,DMDA_STENCIL_BOX,M1,M1,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,&da_c);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD,bx,by,DMDA_STENCIL_BOX,M2,M2,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,&da_f);CHKERRQ(ierr);
   } else if (dim == 3) {
-    ierr = DMDACreate3d(PETSC_COMM_WORLD,pt,DMDA_STENCIL_BOX,M1,M1,M1,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,PETSC_NULL,&da_c);CHKERRQ(ierr);
-    ierr = DMDACreate3d(PETSC_COMM_WORLD,pt,DMDA_STENCIL_BOX,M2,M2,M2,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,PETSC_NULL,&da_f);CHKERRQ(ierr);
+    ierr = DMDACreate3d(PETSC_COMM_WORLD,bx,by,bz,DMDA_STENCIL_BOX,M1,M1,M1,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,PETSC_NULL,&da_c);CHKERRQ(ierr);
+    ierr = DMDACreate3d(PETSC_COMM_WORLD,bx,by,bz,DMDA_STENCIL_BOX,M2,M2,M2,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,PETSC_NULL,&da_f);CHKERRQ(ierr);
   }
 
   ierr = DMCreateGlobalVector(da_c,&v_c);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex16.c
--- a/src/dm/examples/tests/ex16.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex16.c	Fri Mar 11 16:29:15 2011 -0700
@@ -31,14 +31,14 @@
   ierr = PetscMalloc(nredundant1*sizeof(PetscScalar),&redundant1);CHKERRQ(ierr);
   ierr = DMCompositeAddArray(packer,0,nredundant1);CHKERRQ(ierr);
 
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,8,1,1,PETSC_NULL,&da1);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,8,1,1,PETSC_NULL,&da1);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da1,&local1);CHKERRQ(ierr);
   ierr = DMCompositeAddDM(packer,(DM)da1);CHKERRQ(ierr);
 
   ierr = PetscMalloc(nredundant2*sizeof(PetscScalar),&redundant2);CHKERRQ(ierr);
   ierr = DMCompositeAddArray(packer,1%size,nredundant2);CHKERRQ(ierr);
 
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,6,1,1,PETSC_NULL,&da2);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,6,1,1,PETSC_NULL,&da2);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da2,&local2);CHKERRQ(ierr);
   ierr = DMCompositeAddDM(packer,(DM)da2);CHKERRQ(ierr);
 
diff -r 23e7928e179a src/dm/examples/tests/ex17.c
--- a/src/dm/examples/tests/ex17.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex17.c	Fri Mar 11 16:29:15 2011 -0700
@@ -28,9 +28,9 @@
     
   /* Set up the array */ 
   if (dim == 2) {
-    ierr = DMDACreate2d(comm_c,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,M,M,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,&da_c);CHKERRQ(ierr);
+    ierr = DMDACreate2d(comm_c,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,M,M,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,&da_c);CHKERRQ(ierr);
     M    = ratio*(M-1) + 1;
-    ierr = DMDACreate2d(comm_f,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,M,M,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,&da_f);CHKERRQ(ierr);
+    ierr = DMDACreate2d(comm_f,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,M,M,PETSC_DECIDE,PETSC_DECIDE,dof,s,PETSC_NULL,PETSC_NULL,&da_f);CHKERRQ(ierr);
   } else if (dim == 3) {
     ;
   }
diff -r 23e7928e179a src/dm/examples/tests/ex18.c
--- a/src/dm/examples/tests/ex18.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex18.c	Fri Mar 11 16:29:15 2011 -0700
@@ -25,7 +25,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-n",&n,PETSC_NULL);CHKERRQ(ierr);
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,
                     M,N,m,n,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex19.c
--- a/src/dm/examples/tests/ex19.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex19.c	Fri Mar 11 16:29:15 2011 -0700
@@ -12,7 +12,7 @@
   PetscErrorCode ierr;
   PetscInt       i,j,k,M,N,dof;
 
-  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
   {
     struct {PetscScalar inside[dof];} **mystruct;
     ierr = DMDAVecGetArray(da,global,(void*) &mystruct);
@@ -42,7 +42,7 @@
 
   ierr = PetscOptionsGetInt(0,"-dof",&dof,0);CHKERRQ(ierr);
   /* Create distributed array and get vectors */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,
                     M,N,m,n,dof,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex2.c
--- a/src/dm/examples/tests/ex2.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex2.c	Fri Mar 11 16:29:15 2011 -0700
@@ -9,7 +9,7 @@
 {
   PetscMPIInt    rank;
   PetscInt       M = 13,s=1,dof=1;
-  DMDABoundaryType wrap = DMDA_XPERIODIC;
+  DMDABoundaryType bx = DMDA_BOUNDARY_PERIODIC;
   PetscErrorCode ierr;
   DM             da;
   PetscViewer    viewer;
@@ -27,12 +27,12 @@
 
   /* Readoptions */
   ierr = PetscOptionsGetInt(PETSC_NULL,"-M",&M,PETSC_NULL);CHKERRQ(ierr);
-  ierr = PetscOptionsGetEnum(PETSC_NULL,"-wrap",DMDABoundaryTypes,(PetscEnum*)&wrap,PETSC_NULL);CHKERRQ(ierr);
+  ierr = PetscOptionsGetEnum(PETSC_NULL,"-wrap",DMDABoundaryTypes,(PetscEnum*)&bx,PETSC_NULL);CHKERRQ(ierr);
   ierr = PetscOptionsGetInt(PETSC_NULL,"-dof",&dof,PETSC_NULL);CHKERRQ(ierr); 
   ierr = PetscOptionsGetInt(PETSC_NULL,"-s",&s,PETSC_NULL);CHKERRQ(ierr); 
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,wrap,M,dof,s,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,bx,M,dof,s,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMView(da,viewer);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex21.c
--- a/src/dm/examples/tests/ex21.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex21.c	Fri Mar 11 16:29:15 2011 -0700
@@ -13,22 +13,23 @@
   PetscViewer vv;
   Vec ac,af;
   PetscInt periodicity;
-  DMDABoundaryType pt;
+  DMDABoundaryType bx,by,bz;
 
   PetscFunctionBegin;
+  bx = DMDA_BOUNDARY_NONE;
+  by = DMDA_BOUNDARY_NONE;
+  bz = DMDA_BOUNDARY_NONE;
   periodicity = 0;
   ierr = PetscOptionsGetInt(PETSC_NULL,"-periodic", &periodicity, PETSC_NULL);CHKERRQ(ierr);
   if (periodicity==1) {
-    pt = DMDA_XPERIODIC;
+    bx = DMDA_BOUNDARY_PERIODIC;
   } else if (periodicity==2) {
-    pt = DMDA_YPERIODIC;
+    by = DMDA_BOUNDARY_PERIODIC;
   } else if (periodicity==3) {
-    pt = DMDA_ZPERIODIC;
-  } else {
-    pt = DMDA_NONPERIODIC;
+    bz = DMDA_BOUNDARY_PERIODIC;
   }
 
-  ierr = DMDACreate3d(PETSC_COMM_WORLD, pt, DMDA_STENCIL_BOX,
+  ierr = DMDACreate3d(PETSC_COMM_WORLD, bx,by,bz, DMDA_STENCIL_BOX,
                       mx+1, my+1,mz+1,
                       PETSC_DECIDE, PETSC_DECIDE,PETSC_DECIDE,
                       1, /* 1 dof */
@@ -68,7 +69,7 @@
     ierr = VecAXPY(coordsf2,-1.0,coordsf);CHKERRQ(ierr);
     ierr = VecNorm(coordsf2,NORM_MAX,&norm);CHKERRQ(ierr);
     /* The fine coordinates are only reproduced in certain cases */
-    if (pt == DMDA_NONPERIODIC && norm > 1.e-10) {ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm %A\n",norm);CHKERRQ(ierr);}
+    if (!bx && !by && !bz && norm > 1.e-10) {ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm %A\n",norm);CHKERRQ(ierr);}
     ierr = VecDestroy(coordsf2);CHKERRQ(ierr);
     ierr = MatDestroy(interp);CHKERRQ(ierr);
   }
diff -r 23e7928e179a src/dm/examples/tests/ex22.c
--- a/src/dm/examples/tests/ex22.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex22.c	Fri Mar 11 16:29:15 2011 -0700
@@ -32,7 +32,7 @@
   if (flg) stencil_type =  DMDA_STENCIL_STAR;
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,stencil_type,M,N,P,m,n,p,w,s,
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,stencil_type,M,N,P,m,n,p,w,s,
                     0,0,0,&da);CHKERRQ(ierr);
 
   ierr = DMGetMatrix(da,MATMPIBAIJ,&mat);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex23.c
--- a/src/dm/examples/tests/ex23.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex23.c	Fri Mar 11 16:29:15 2011 -0700
@@ -11,7 +11,7 @@
   PetscInt       N = 6,m=PETSC_DECIDE,n=PETSC_DECIDE,p=PETSC_DECIDE,M=8,dof=1,stencil_width=1,P=5,pt = 0,st = 0;
   PetscErrorCode ierr;
   PetscBool      flg2,flg3;
-  DMDABoundaryType periodic = DMDA_NONPERIODIC;
+  DMDABoundaryType bx = DMDA_BOUNDARY_NONE,by = DMDA_BOUNDARY_NONE,bz = DMDA_BOUNDARY_NONE;
   DMDAStencilType  stencil_type = DMDA_STENCIL_STAR;
   DM             da;
   Vec            global1,global2,global3,global4;
@@ -28,7 +28,11 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-dof",&dof,PETSC_NULL);CHKERRQ(ierr); 
   ierr = PetscOptionsGetInt(PETSC_NULL,"-stencil_width",&stencil_width,PETSC_NULL);CHKERRQ(ierr); 
   ierr = PetscOptionsGetInt(PETSC_NULL,"-periodic",&pt,PETSC_NULL);CHKERRQ(ierr); 
-  periodic = (DMDABoundaryType) pt;
+  if (pt == 1) bx = DMDA_BOUNDARY_PERIODIC;
+  if (pt == 2) by = DMDA_BOUNDARY_PERIODIC;
+  if (pt == 3) {bx = DMDA_BOUNDARY_PERIODIC; by = DMDA_BOUNDARY_PERIODIC;}
+  if (pt == 4) bz = DMDA_BOUNDARY_PERIODIC;
+
   ierr = PetscOptionsGetInt(PETSC_NULL,"-stencil_type",&st,PETSC_NULL);CHKERRQ(ierr); 
   stencil_type = (DMDAStencilType) st;
 
@@ -36,12 +40,12 @@
   ierr = PetscOptionsHasName(PETSC_NULL,"-2d",&flg2);CHKERRQ(ierr);
   ierr = PetscOptionsHasName(PETSC_NULL,"-3d",&flg3);CHKERRQ(ierr);
   if (flg2) {
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,periodic,stencil_type,M,N,m,n,dof,stencil_width,0,0,&da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD,bx,by,stencil_type,M,N,m,n,dof,stencil_width,0,0,&da);CHKERRQ(ierr);
   } else if (flg3) {
-    ierr = DMDACreate3d(PETSC_COMM_WORLD,periodic,stencil_type,M,N,P,m,n,p,dof,stencil_width,0,0,0,&da);CHKERRQ(ierr);
+    ierr = DMDACreate3d(PETSC_COMM_WORLD,bx,by,bz,stencil_type,M,N,P,m,n,p,dof,stencil_width,0,0,0,&da);CHKERRQ(ierr);
   }
   else {
-    ierr = DMDACreate1d(PETSC_COMM_WORLD,periodic,M,dof,stencil_width,PETSC_NULL,&da);CHKERRQ(ierr);
+    ierr = DMDACreate1d(PETSC_COMM_WORLD,bx,M,dof,stencil_width,PETSC_NULL,&da);CHKERRQ(ierr);
   }
 
   ierr = DMCreateGlobalVector(da,&global1);CHKERRQ(ierr);
@@ -70,7 +74,7 @@
     ierr = PetscPrintf(PETSC_COMM_WORLD,"ex23: Norm of difference %G should be zero\n",norm);CHKERRQ(ierr);
     ierr = PetscPrintf(PETSC_COMM_WORLD,"  Number of processors %d\n",size);CHKERRQ(ierr);
     ierr = PetscPrintf(PETSC_COMM_WORLD,"  M,N,P,dof %D %D %D %D\n",M,N,P,dof);CHKERRQ(ierr);
-    ierr = PetscPrintf(PETSC_COMM_WORLD,"  stencil_width %D stencil_type %d periodic %d\n",stencil_width,(int)stencil_type,(int)periodic);CHKERRQ(ierr);
+    ierr = PetscPrintf(PETSC_COMM_WORLD,"  stencil_width %D stencil_type %d periodic %d\n",stencil_width,(int)stencil_type,(int)bx);CHKERRQ(ierr);
     ierr = PetscPrintf(PETSC_COMM_WORLD,"  dimension %d\n",1 + (int) flg2 + (int) flg3);CHKERRQ(ierr);
   }
   ierr = VecAXPY(global4,mone,global3);CHKERRQ(ierr);
@@ -80,7 +84,7 @@
     ierr = PetscPrintf(PETSC_COMM_WORLD,"ex23: Norm of difference %G should be zero\n",norm);CHKERRQ(ierr);
     ierr = PetscPrintf(PETSC_COMM_WORLD,"  Number of processors %d\n",size);CHKERRQ(ierr);
     ierr = PetscPrintf(PETSC_COMM_WORLD,"  M,N,P,dof %D %D %D %D\n",M,N,P,dof);CHKERRQ(ierr);
-    ierr = PetscPrintf(PETSC_COMM_WORLD,"  stencil_width %D stencil_type %d periodic %d\n",stencil_width,(int)stencil_type,(int)periodic);CHKERRQ(ierr);
+    ierr = PetscPrintf(PETSC_COMM_WORLD,"  stencil_width %D stencil_type %d periodic %d\n",stencil_width,(int)stencil_type,(int)bx);CHKERRQ(ierr);
     ierr = PetscPrintf(PETSC_COMM_WORLD,"  dimension %d\n",1 + (int) flg2 + (int) flg3);CHKERRQ(ierr);
   }
 
diff -r 23e7928e179a src/dm/examples/tests/ex24.c
--- a/src/dm/examples/tests/ex24.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex24.c	Fri Mar 11 16:29:15 2011 -0700
@@ -16,7 +16,7 @@
   ierr = PetscInitialize(&argc,&argv,(char*)0,help);CHKERRQ(ierr); 
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,M,N,m,n,3,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,M,N,m,n,3,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
 
diff -r 23e7928e179a src/dm/examples/tests/ex25.c
--- a/src/dm/examples/tests/ex25.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex25.c	Fri Mar 11 16:29:15 2011 -0700
@@ -16,7 +16,7 @@
   ierr = PetscInitialize(&argc,&argv,(char*)0,help);CHKERRQ(ierr); 
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,M,N,P,m,n,p,2,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,M,N,P,m,n,p,2,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
 
diff -r 23e7928e179a src/dm/examples/tests/ex26.c
--- a/src/dm/examples/tests/ex26.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex26.c	Fri Mar 11 16:29:15 2011 -0700
@@ -19,7 +19,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_XPERIODIC,DMDA_STENCIL_BOX,-5,-5,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_PERIODIC, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,-5,-5,
                     PETSC_DECIDE,PETSC_DECIDE,1,2,0,0,&da);CHKERRQ(ierr);
   ierr = DMGetMatrix(da,MATAIJ,&J);CHKERRQ(ierr);
   ierr = DMGetColoring(da,IS_COLORING_GHOSTED,MATAIJ,&iscoloring);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex27.c
--- a/src/dm/examples/tests/ex27.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex27.c	Fri Mar 11 16:29:15 2011 -0700
@@ -47,7 +47,7 @@
 
   
 
-  ierr = DMDACreate3d(PETSC_COMM_SELF,DMDA_NONPERIODIC,DMDA_STENCIL_STAR, 
+  ierr = DMDACreate3d(PETSC_COMM_SELF,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR, 
                     dim[0], dim[1], dim[2], 
                     PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE, 
                     dof, stencil,
diff -r 23e7928e179a src/dm/examples/tests/ex28.c
--- a/src/dm/examples/tests/ex28.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex28.c	Fri Mar 11 16:29:15 2011 -0700
@@ -49,7 +49,7 @@
   ierr = PetscOptionsGetIntArray(PETSC_NULL,"-dim",dim,&ndim,PETSC_NULL);CHKERRQ(ierr); 
 
   // DMDA with the correct fiber dimension
-  ierr = DMDACreate3d(PETSC_COMM_SELF,DMDA_NONPERIODIC,DMDA_STENCIL_STAR, 
+  ierr = DMDACreate3d(PETSC_COMM_SELF,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR, 
                     dim[0], dim[1], dim[2], 
                     PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE, 
                     dof, stencil,
@@ -57,7 +57,7 @@
                     &da); 
  CHKERRQ(ierr);
   // DMDA with fiber dimension 1 for split fields
-  ierr = DMDACreate3d(PETSC_COMM_SELF,DMDA_NONPERIODIC,DMDA_STENCIL_STAR, 
+  ierr = DMDACreate3d(PETSC_COMM_SELF,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR, 
                     dim[0], dim[1], dim[2], 
                     PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE, 
                     1, stencil,
diff -r 23e7928e179a src/dm/examples/tests/ex3.c
--- a/src/dm/examples/tests/ex3.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex3.c	Fri Mar 11 16:29:15 2011 -0700
@@ -35,7 +35,7 @@
   }
     
   /* Set up the array */ 
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_XPERIODIC,M,1,1,localnodes,&da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_PERIODIC,M,1,1,localnodes,&da);CHKERRQ(ierr);
   ierr = PetscFree(localnodes);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex31.c
--- a/src/dm/examples/tests/ex31.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex31.c	Fri Mar 11 16:29:15 2011 -0700
@@ -12,7 +12,7 @@
   DM             da,daf;
 
   ierr = PetscInitialize(&argc,&argv,0,help);CHKERRQ(ierr);
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,4,5,PETSC_DECIDE,PETSC_DECIDE,41,1,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,4,5,PETSC_DECIDE,PETSC_DECIDE,41,1,0,0,&da);CHKERRQ(ierr);
   ierr = DMRefine(da,PETSC_COMM_WORLD,&daf);CHKERRQ(ierr);
   ierr = DMGetInterpolation(da,daf,&M,PETSC_NULL);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&x);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex32.c
--- a/src/dm/examples/tests/ex32.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex32.c	Fri Mar 11 16:29:15 2011 -0700
@@ -30,10 +30,10 @@
   mx=7;
   my=11;
   mz=13;
-  ierr=DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,mx,my,mz,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,3,2,0,0,0,&Q2_da);CHKERRQ(ierr);
+  ierr=DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,mx,my,mz,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,3,2,0,0,0,&Q2_da);CHKERRQ(ierr);
   ierr = DMDASetUniformCoordinates(Q2_da,-1.0,1.0,-2.0,2.0,-3.0,3.0);CHKERRQ(ierr);
   ierr = DMDAGetCoordinates(Q2_da,&coords);CHKERRQ(ierr);
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,mx,my,mz,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,3,1,0,0,0,&Q1_da);CHKERRQ(ierr);
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,mx,my,mz,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,3,1,0,0,0,&Q1_da);CHKERRQ(ierr);
   ierr = DMDASetCoordinates(Q1_da,coords);CHKERRQ(ierr);
 
   /* Get ghost coordinates one way */
diff -r 23e7928e179a src/dm/examples/tests/ex33.c
--- a/src/dm/examples/tests/ex33.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex33.c	Fri Mar 11 16:29:15 2011 -0700
@@ -12,7 +12,7 @@
   PetscInt       stencil_width=1,pt=0,st=0;
   PetscErrorCode ierr;
   PetscBool      flg2,flg3,isbinary,mpiio;
-  DMDABoundaryType periodic = DMDA_NONPERIODIC;
+  DMDABoundaryType bx = DMDA_BOUNDARY_NONE,by = DMDA_BOUNDARY_NONE,bz = DMDA_BOUNDARY_NONE;
   DMDAStencilType  stencil_type = DMDA_STENCIL_STAR;
   DM             da,da2;
   Vec            global1,global2;
@@ -34,7 +34,10 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-dof",&dof,PETSC_NULL);CHKERRQ(ierr); 
   ierr = PetscOptionsGetInt(PETSC_NULL,"-stencil_width",&stencil_width,PETSC_NULL);CHKERRQ(ierr); 
   ierr = PetscOptionsGetInt(PETSC_NULL,"-periodic",&pt,PETSC_NULL);CHKERRQ(ierr); 
-  periodic = (DMDABoundaryType) pt;
+  if (pt == 1) bx = DMDA_BOUNDARY_PERIODIC;
+  if (pt == 2) by = DMDA_BOUNDARY_PERIODIC;
+  if (pt == 4) bx = DMDA_BOUNDARY_PERIODIC; by = DMDA_BOUNDARY_PERIODIC
+
   ierr = PetscOptionsGetInt(PETSC_NULL,"-stencil_type",&st,PETSC_NULL);CHKERRQ(ierr); 
   stencil_type = (DMDAStencilType) st;
 
@@ -48,12 +51,12 @@
 #endif
   ierr = PetscOptionsHasName(PETSC_NULL,"-mpiio",&mpiio);CHKERRQ(ierr);
   if (flg2) {
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,periodic,stencil_type,M,N,PETSC_DECIDE,PETSC_DECIDE,dof,stencil_width,0,0,&da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD,bx,by,stencil_type,M,N,PETSC_DECIDE,PETSC_DECIDE,dof,stencil_width,0,0,&da);CHKERRQ(ierr);
   } else if (flg3) {
-    ierr = DMDACreate3d(PETSC_COMM_WORLD,periodic,stencil_type,M,N,P,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,dof,stencil_width,0,0,0,&da);CHKERRQ(ierr);
+    ierr = DMDACreate3d(PETSC_COMM_WORLD,bx,by,bz,stencil_type,M,N,P,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,dof,stencil_width,0,0,0,&da);CHKERRQ(ierr);
   }
   else {
-    ierr = DMDACreate1d(PETSC_COMM_WORLD,periodic,M,dof,stencil_width,PETSC_NULL,&da);CHKERRQ(ierr);
+    ierr = DMDACreate1d(PETSC_COMM_WORLD,bx,M,dof,stencil_width,PETSC_NULL,&da);CHKERRQ(ierr);
   }
 
   ierr = DMCreateGlobalVector(da,&global1);CHKERRQ(ierr);
@@ -80,12 +83,12 @@
   ierr = VecView(global1,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
 
   if (flg2) {
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,periodic,stencil_type,M,N,PETSC_DECIDE,PETSC_DECIDE,dof,stencil_width,0,0,&da2);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD,bx,by,stencil_type,M,N,PETSC_DECIDE,PETSC_DECIDE,dof,stencil_width,0,0,&da2);CHKERRQ(ierr);
   } else if (flg3) {
-    ierr = DMDACreate3d(PETSC_COMM_WORLD,periodic,stencil_type,M,N,P,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,dof,stencil_width,0,0,0,&da2);CHKERRQ(ierr);
+    ierr = DMDACreate3d(PETSC_COMM_WORLD,bx,by,bz,stencil_type,M,N,P,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,dof,stencil_width,0,0,0,&da2);CHKERRQ(ierr);
   }
   else {
-    ierr = DMDACreate1d(PETSC_COMM_WORLD,periodic,M,dof,stencil_width,PETSC_NULL,&da2);CHKERRQ(ierr);
+    ierr = DMDACreate1d(PETSC_COMM_WORLD,bx,M,dof,stencil_width,PETSC_NULL,&da2);CHKERRQ(ierr);
   }
 
   if (isbinary) {
diff -r 23e7928e179a src/dm/examples/tests/ex35.c
--- a/src/dm/examples/tests/ex35.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex35.c	Fri Mar 11 16:29:15 2011 -0700
@@ -26,7 +26,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-Z",&Z,PETSC_NULL);CHKERRQ(ierr);
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,
                     X,Y,Z,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMGetMatrix(da,MATMPIAIJ,&A);CHKERRQ(ierr);
   ierr = MatShift(A,X);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex36.c
--- a/src/dm/examples/tests/ex36.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex36.c	Fri Mar 11 16:29:15 2011 -0700
@@ -85,7 +85,7 @@
   
   ierr = VecGetArray(Gcoords,&XX);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da,&sx,&sy,&sz,&nx,&ny,&nz);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da, &dim, 0,0,0, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, &dim, 0,0,0, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = VecGetLocalSize(Gcoords,&n);CHKERRQ(ierr);
   n = n / dim;
   
@@ -345,7 +345,7 @@
   PetscBool output = PETSC_FALSE;
   
   PetscFunctionBegin;
-  ierr = DMDACreate1d( PETSC_COMM_WORLD, DMDA_NONPERIODIC,
+  ierr = DMDACreate1d( PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE,
                       mx+1,
                       1, /* 1 dof */
                       1, /* stencil = 1 */
@@ -354,7 +354,7 @@
   ierr = DMSetFromOptions(dac);CHKERRQ(ierr);
   
   ierr = DMRefine(dac,PETSC_NULL,&daf);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,0,&Mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,0,&Mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   Mx--;
   
   ierr = DMDASetUniformCoordinates(dac, -1.0,1.0, PETSC_DECIDE,PETSC_DECIDE, PETSC_DECIDE,PETSC_DECIDE );CHKERRQ(ierr); 
@@ -440,7 +440,7 @@
   PetscBool output = PETSC_FALSE;
   
   PetscFunctionBegin;
-  ierr = DMDACreate2d( PETSC_COMM_WORLD, DMDA_NONPERIODIC, DMDA_STENCIL_BOX,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE, DMDA_STENCIL_BOX,
                       mx+1, my+1,
                       PETSC_DECIDE, PETSC_DECIDE,
                       1, /* 1 dof */
@@ -450,7 +450,7 @@
   ierr = DMSetFromOptions(dac);CHKERRQ(ierr);
   
   ierr = DMRefine(dac,PETSC_NULL,&daf);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,0,&Mx,&My,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,0,&Mx,&My,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   Mx--; My--;
   
   ierr = DMDASetUniformCoordinates(dac, -1.0,1.0, -1.0,1.0, PETSC_DECIDE,PETSC_DECIDE );CHKERRQ(ierr); 
@@ -544,7 +544,7 @@
   PetscBool output = PETSC_FALSE;
   
   PetscFunctionBegin;
-  ierr = DMDACreate3d( PETSC_COMM_WORLD, DMDA_NONPERIODIC, DMDA_STENCIL_BOX,
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,
                       mx+1, my+1,mz+1,
                       PETSC_DECIDE, PETSC_DECIDE,PETSC_DECIDE,
                       1, /* 1 dof */
@@ -554,7 +554,7 @@
   ierr = DMSetFromOptions(dac);CHKERRQ(ierr);
   
   ierr = DMRefine(dac,PETSC_NULL,&daf);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,0,&Mx,&My,&Mz,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,0,&Mx,&My,&Mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   Mx--; My--; Mz--;
   
   ierr = DMDASetUniformCoordinates(dac, -1.0,1.0, -1.0,1.0, -1.0,1.0 );CHKERRQ(ierr); 
diff -r 23e7928e179a src/dm/examples/tests/ex4.c
--- a/src/dm/examples/tests/ex4.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex4.c	Fri Mar 11 16:29:15 2011 -0700
@@ -14,7 +14,7 @@
   PetscInt       Xs,Xm,Ys,Ym,iloc,*iglobal,*ltog;
   PetscInt       *lx = PETSC_NULL,*ly = PETSC_NULL;
   PetscBool      testorder = PETSC_FALSE,flg;
-  DMDABoundaryType wrap = DMDA_NONPERIODIC;
+  DMDABoundaryType bx = DMDA_BOUNDARY_NONE,by= DMDA_BOUNDARY_NONE;
   DM             da;
   PetscViewer    viewer;
   Vec            local,global;
@@ -32,15 +32,15 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-n",&n,PETSC_NULL);CHKERRQ(ierr);
   ierr = PetscOptionsGetInt(PETSC_NULL,"-s",&s,PETSC_NULL);CHKERRQ(ierr);
   ierr = PetscOptionsGetInt(PETSC_NULL,"-w",&w,PETSC_NULL);CHKERRQ(ierr);
-  wrap = 0x0;
+
   flg  = PETSC_FALSE;
-  ierr = PetscOptionsGetBool(PETSC_NULL,"-xperiodic",&flg,PETSC_NULL);CHKERRQ(ierr); if (flg) wrap = wrap | DMDA_XPERIODIC;
+  ierr = PetscOptionsGetBool(PETSC_NULL,"-xperiodic",&flg,PETSC_NULL);CHKERRQ(ierr); if (flg) bx = DMDA_BOUNDARY_PERIODIC;
   flg  = PETSC_FALSE;
-  ierr = PetscOptionsGetBool(PETSC_NULL,"-yperiodic",&flg,PETSC_NULL);CHKERRQ(ierr); if (flg) wrap = wrap | DMDA_YPERIODIC;
+  ierr = PetscOptionsGetBool(PETSC_NULL,"-yperiodic",&flg,PETSC_NULL);CHKERRQ(ierr); if (flg) by = DMDA_BOUNDARY_PERIODIC;
   flg  = PETSC_FALSE;
-  ierr = PetscOptionsGetBool(PETSC_NULL,"-xghosted",&flg,PETSC_NULL);CHKERRQ(ierr); if (flg) wrap = wrap | DMDA_XGHOSTED;
+  ierr = PetscOptionsGetBool(PETSC_NULL,"-xghosted",&flg,PETSC_NULL);CHKERRQ(ierr); if (flg) bx = DMDA_BOUNDARY_GHOSTED;
   flg  = PETSC_FALSE;
-  ierr = PetscOptionsGetBool(PETSC_NULL,"-yghosted",&flg,PETSC_NULL);CHKERRQ(ierr); if (flg) wrap = wrap | DMDA_YGHOSTED;
+  ierr = PetscOptionsGetBool(PETSC_NULL,"-yghosted",&flg,PETSC_NULL);CHKERRQ(ierr); if (flg) by = DMDA_BOUNDARY_GHOSTED;
   flg  = PETSC_FALSE;
   ierr = PetscOptionsGetBool(PETSC_NULL,"-star",&flg,PETSC_NULL);CHKERRQ(ierr); if (flg) st = DMDA_STENCIL_STAR;
   flg  = PETSC_FALSE;
@@ -66,7 +66,7 @@
 
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,wrap,st,M,N,m,n,w,s,lx,ly,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,bx,by,st,M,N,m,n,w,s,lx,ly,&da);CHKERRQ(ierr);
   ierr = PetscFree(lx);CHKERRQ(ierr);
   ierr = PetscFree(ly);CHKERRQ(ierr);
 
diff -r 23e7928e179a src/dm/examples/tests/ex5.c
--- a/src/dm/examples/tests/ex5.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex5.c	Fri Mar 11 16:29:15 2011 -0700
@@ -25,7 +25,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-time",&time_steps,PETSC_NULL);CHKERRQ(ierr);
     
   /* Set up the array */ 
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,M,w,s,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,M,w,s,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(PETSC_COMM_WORLD,&rank);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex6.c
--- a/src/dm/examples/tests/ex6.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex6.c	Fri Mar 11 16:29:15 2011 -0700
@@ -17,7 +17,7 @@
   PetscViewer    viewer;
   Vec            local,global;
   PetscScalar    value;
-  DMDABoundaryType wrap = DMDA_NONPERIODIC;
+  DMDABoundaryType bx = DMDA_BOUNDARY_NONE,by = DMDA_BOUNDARY_NONE,bz = DMDA_BOUNDARY_NONE;
   DMDAStencilType  stencil_type = DMDA_STENCIL_BOX;
   AO             ao;
   PetscBool      flg = PETSC_FALSE;
@@ -43,28 +43,28 @@
 
   flg = PETSC_FALSE;
   ierr = PetscOptionsGetBool(PETSC_NULL,"-xperiodic",&flg,PETSC_NULL);CHKERRQ(ierr); 
-  if (flg) wrap = wrap | DMDA_XPERIODIC;
+  if (flg) bx = DMDA_BOUNDARY_PERIODIC;
   flg = PETSC_FALSE;
   ierr = PetscOptionsGetBool(PETSC_NULL,"-xghosted",&flg,PETSC_NULL);CHKERRQ(ierr); 
-  if (flg) wrap = wrap | DMDA_XPERIODIC;
+  if (flg) bx = DMDA_BOUNDARY_GHOSTED;
   flg = PETSC_FALSE;
   ierr = PetscOptionsGetBool(PETSC_NULL,"-xnonghosted",&flg,PETSC_NULL);CHKERRQ(ierr); 
 
   flg = PETSC_FALSE;
   ierr = PetscOptionsGetBool(PETSC_NULL,"-yperiodic",&flg,PETSC_NULL);CHKERRQ(ierr); 
-  if (flg) wrap = wrap | DMDA_YPERIODIC;
+  if (flg) by = DMDA_BOUNDARY_PERIODIC;
   flg = PETSC_FALSE;
   ierr = PetscOptionsGetBool(PETSC_NULL,"-yghosted",&flg,PETSC_NULL);CHKERRQ(ierr); 
-  if (flg) wrap = wrap | DMDA_YPERIODIC;
+  if (flg) by = DMDA_BOUNDARY_GHOSTED;
   flg = PETSC_FALSE;
   ierr = PetscOptionsGetBool(PETSC_NULL,"-ynonghosted",&flg,PETSC_NULL);CHKERRQ(ierr); 
 
   flg = PETSC_FALSE;
   ierr = PetscOptionsGetBool(PETSC_NULL,"-zperiodic",&flg,PETSC_NULL);CHKERRQ(ierr); 
-  if (flg) wrap = wrap | DMDA_ZPERIODIC;
+  if (flg) bz = DMDA_BOUNDARY_PERIODIC;
   flg = PETSC_FALSE;
   ierr = PetscOptionsGetBool(PETSC_NULL,"-zghosted",&flg,PETSC_NULL);CHKERRQ(ierr); 
-  if (flg) wrap = wrap | DMDA_ZPERIODIC;
+  if (flg) bz = DMDA_BOUNDARY_GHOSTED;
   flg = PETSC_FALSE;
   ierr = PetscOptionsGetBool(PETSC_NULL,"-znonghosted",&flg,PETSC_NULL);CHKERRQ(ierr); 
 
@@ -88,7 +88,7 @@
   }
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,wrap,stencil_type,M,N,P,m,n,p,w,s,lx,ly,lz,&da);CHKERRQ(ierr);
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,bx,by,bz,stencil_type,M,N,P,m,n,p,w,s,lx,ly,lz,&da);CHKERRQ(ierr);
   ierr = PetscFree(lx);CHKERRQ(ierr);
   ierr = PetscFree(ly);CHKERRQ(ierr);
   ierr = PetscFree(lz);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tests/ex8.c
--- a/src/dm/examples/tests/ex8.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex8.c	Fri Mar 11 16:29:15 2011 -0700
@@ -29,7 +29,7 @@
   ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr);
 
   ierr = DMDAGetAO(da,&ao);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&M,&N,&P,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&M,&N,&P,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
 
   /* 
      nslice is number of degrees of freedom in this processors slice
diff -r 23e7928e179a src/dm/examples/tests/ex9.c
--- a/src/dm/examples/tests/ex9.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tests/ex9.c	Fri Mar 11 16:29:15 2011 -0700
@@ -51,7 +51,7 @@
   }
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,stencil_type,M,N,P,m,n,p,w,s,lx,ly,lz,&da);CHKERRQ(ierr);
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,stencil_type,M,N,P,m,n,p,w,s,lx,ly,lz,&da);CHKERRQ(ierr);
   ierr = PetscFree(lx);CHKERRQ(ierr);
   ierr = PetscFree(ly);CHKERRQ(ierr);
   ierr = PetscFree(lz);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tutorials/ex1.c
--- a/src/dm/examples/tutorials/ex1.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex1.c	Fri Mar 11 16:29:15 2011 -0700
@@ -44,7 +44,7 @@
   PetscViewer    viewer;
   Vec            local,global;
   PetscScalar    value;
-  DMDABoundaryType ptype = DMDA_NONPERIODIC;
+  DMDABoundaryType bx = DMDA_BOUNDARY_NONE,by = DMDA_BOUNDARY_NONE;
   DMDAStencilType  stype = DMDA_STENCIL_BOX;
 #if defined(PETSC_HAVE_MATLAB_ENGINE)
   PetscViewer    mviewer;
@@ -60,7 +60,7 @@
   if (flg) stype = DMDA_STENCIL_STAR;
       
   /* Create distributed array and get vectors */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,ptype,stype,M,N,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,bx,by,stype,M,N,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
 
diff -r 23e7928e179a src/dm/examples/tutorials/ex10.c
--- a/src/dm/examples/tutorials/ex10.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex10.c	Fri Mar 11 16:29:15 2011 -0700
@@ -35,7 +35,7 @@
   ierr = PetscInitialize(&argc,&argv,(char*)0,help);CHKERRQ(ierr);
   
   // Build of the DMDA
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,Nx,Ny,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da2D);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,Nx,Ny,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da2D);CHKERRQ(ierr);
   
   // Set the coordinates
   DMDASetUniformCoordinates(da2D, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0);
diff -r 23e7928e179a src/dm/examples/tutorials/ex11f90.F
--- a/src/dm/examples/tutorials/ex11f90.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex11f90.F	Fri Mar 11 16:29:15 2011 -0700
@@ -41,7 +41,7 @@
       s = 1
       dof = 1
       CALL PetscInitialize(PETSC_NULL_CHARACTER,ierr)
-      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,m,dof,1,             &
+      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,m,dof,1,             &
      &                PETSC_NULL_INTEGER,ada,ierr)
       call DMGetGlobalVector(ada,g,ierr)
       call DMDAGetCorners(ada,xs,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,       &
@@ -57,7 +57,8 @@
       call DMRestoreGlobalVector(ada,g,ierr)
       call DMDestroy(ada,ierr)
 
-      call DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,                      &
+      call DMDACreate2d(PETSC_COMM_WORLD,                                   &
+     &      DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,                      &
      &      DMDA_STENCIL_BOX,m,n,PETSC_DECIDE,PETSC_DECIDE,dof,s,                 &
      &                PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,ada,ierr)
       call DMGetGlobalVector(ada,g,ierr)
@@ -76,7 +77,8 @@
       call DMRestoreGlobalVector(ada,g,ierr)
       call DMDestroy(ada,ierr)
 
-      call DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,                       &
+      call DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,                       &
+     &     DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,                               &
      &     DMDA_STENCIL_BOX, m,n,p,PETSC_DECIDE,PETSC_DECIDE,                     &
      &                PETSC_DECIDE,dof,s,                                  &
      &                PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,               &
@@ -104,7 +106,7 @@
 !
       dof = 2
       CALL PetscInitialize(PETSC_NULL_CHARACTER,ierr)
-      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,m,dof,1,             &
+      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,m,dof,1,             &
      &                PETSC_NULL_INTEGER,ada,ierr)
       call DMGetGlobalVector(ada,g,ierr)
       call DMDAGetCorners(ada,xs,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,       &
@@ -122,7 +124,8 @@
       call DMDestroy(ada,ierr)
 
       dof = 2
-      call DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,                      &
+      call DMDACreate2d(PETSC_COMM_WORLD,                               &
+     &     DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,                      &
      &     DMDA_STENCIL_BOX,m,n,PETSC_DECIDE,PETSC_DECIDE,dof,s,                 &
      &                PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,ada,ierr)
       call DMGetGlobalVector(ada,g,ierr)
@@ -143,7 +146,8 @@
       call DMDestroy(ada,ierr)
 
       dof = 3
-      call DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,                  &
+      call DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,
+     &     DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,                            &
      &         DMDA_STENCIL_BOX,m,n,p,PETSC_DECIDE,PETSC_DECIDE,                     &
      &                PETSC_DECIDE,dof,s,                                  &
      &                PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,               &
diff -r 23e7928e179a src/dm/examples/tutorials/ex12.c
--- a/src/dm/examples/tutorials/ex12.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex12.c	Fri Mar 11 16:29:15 2011 -0700
@@ -20,7 +20,7 @@
   PetscBool      flg = PETSC_FALSE;
   DM             da;
   Vec            global1,global2,global3;
-  DMDABoundaryType ptype = DMDA_NONPERIODIC;
+  DMDABoundaryType bx = DMDA_BOUNDARY_NONE,by = DMDA_BOUNDARY_NONE;
   DMDAStencilType  stype = DMDA_STENCIL_BOX;
 
   ierr = PetscInitialize(&argc,&argv,(char*)0,help);CHKERRQ(ierr); 
@@ -28,7 +28,7 @@
   if (flg) stype = DMDA_STENCIL_STAR;
       
   /* Create distributed array and get vectors */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,ptype,stype,M,N,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,bx,by,stype,M,N,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMGetGlobalVector(da,&global1);CHKERRQ(ierr);
   ierr = DMGetGlobalVector(da,&global2);CHKERRQ(ierr);
   ierr = DMRestoreGlobalVector(da,&global1);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tutorials/ex2.c
--- a/src/dm/examples/tutorials/ex2.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex2.c	Fri Mar 11 16:29:15 2011 -0700
@@ -15,7 +15,7 @@
   PetscViewer    viewer;
   Vec            localall,global;
   PetscScalar    value,*vlocal;
-  DMDABoundaryType ptype = DMDA_NONPERIODIC;
+  DMDABoundaryType bx = DMDA_BOUNDARY_NONE,by = DMDA_BOUNDARY_NONE;
   DMDAStencilType  stype = DMDA_STENCIL_BOX;
   VecScatter     tolocalall,fromlocalall;
   PetscInt       start,end;
@@ -33,7 +33,7 @@
   if (flg) stype = DMDA_STENCIL_STAR;
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,ptype,stype,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,bx,by,stype,
                     M,N,m,n,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = VecCreateSeq(PETSC_COMM_SELF,M*N,&localall);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tutorials/ex3.c
--- a/src/dm/examples/tutorials/ex3.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex3.c	Fri Mar 11 16:29:15 2011 -0700
@@ -109,7 +109,7 @@
   PetscInt       M = 5,N = 4,P = 3, m = PETSC_DECIDE,n = PETSC_DECIDE,p = PETSC_DECIDE,dim = 1;
   PetscErrorCode ierr;
   DM             dac,daf;
-  DMDABoundaryType ptype = DMDA_NONPERIODIC;
+  DMDABoundaryType bx=DMDA_BOUNDARY_NONE,by=DMDA_BOUNDARY_NONE,bz=DMDA_BOUNDARY_NONE;
   DMDAStencilType  stype = DMDA_STENCIL_BOX;
   Mat            A;
 
@@ -126,11 +126,11 @@
 
   /* Create distributed array and get vectors */
   if (dim == 1) {
-    ierr = DMDACreate1d(PETSC_COMM_WORLD,ptype,M,1,1,PETSC_NULL,&dac);CHKERRQ(ierr);
+    ierr = DMDACreate1d(PETSC_COMM_WORLD,bx,M,1,1,PETSC_NULL,&dac);CHKERRQ(ierr);
   } else if (dim == 2) {
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,ptype,stype,M,N,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&dac);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD,bx,by,stype,M,N,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&dac);CHKERRQ(ierr);
   } else if (dim == 3) {
-    ierr = DMDACreate3d(PETSC_COMM_WORLD,ptype,stype,M,N,P,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,&dac);CHKERRQ(ierr);
+    ierr = DMDACreate3d(PETSC_COMM_WORLD,bx,by,bz,stype,M,N,P,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,&dac);CHKERRQ(ierr);
   }
 
   ierr = DMRefine(dac,PETSC_COMM_WORLD,&daf);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tutorials/ex4.c
--- a/src/dm/examples/tutorials/ex4.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex4.c	Fri Mar 11 16:29:15 2011 -0700
@@ -42,7 +42,7 @@
 
   ierr = PetscInitialize(&argc,&argv,(char*)0,help);CHKERRQ(ierr); 
  
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,m,n,PETSC_DECIDE,PETSC_DECIDE,dof,1,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,m,n,PETSC_DECIDE,PETSC_DECIDE,dof,1,0,0,&da);CHKERRQ(ierr);
   ierr = DMDASetUniformCoordinates(da,0.0,1.0,0.0,1.0,0.0,1.0);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&u);CHKERRQ(ierr);
   ierr = DMDAGetCoordinates(da,&xy);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tutorials/ex5.c
--- a/src/dm/examples/tutorials/ex5.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex5.c	Fri Mar 11 16:29:15 2011 -0700
@@ -15,7 +15,7 @@
   PetscViewer    viewer;
   Vec            local,global;
   PetscScalar    value;
-  DMDABoundaryType ptype = DMDA_NONPERIODIC;
+  DMDABoundaryType bx = DMDA_BOUNDARY_NONE,by = DMDA_BOUNDARY_NONE;
   DMDAStencilType  stype = DMDA_STENCIL_BOX;
   PetscScalar    *lv;
 
@@ -31,7 +31,7 @@
   if (flg) stype = DMDA_STENCIL_STAR;
 
   /* Create distributed array and get vectors */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,ptype,stype,M,N,m,n,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,bx,by,stype,M,N,m,n,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
 
diff -r 23e7928e179a src/dm/examples/tutorials/ex6.c
--- a/src/dm/examples/tutorials/ex6.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex6.c	Fri Mar 11 16:29:15 2011 -0700
@@ -227,17 +227,17 @@
   if (!((fa->p2 - fa->p1) % 2)) SETERRQ(PETSC_COMM_SELF,1,"width of region 3 must NOT be divisible by 2");
 
   if (fa->comm[1]) {
-    ierr = DMDACreate2d(fa->comm[1],DMDA_XPERIODIC,DMDA_STENCIL_BOX,fa->p2,fa->r2g,PETSC_DECIDE,PETSC_DECIDE,1,fa->sw,PETSC_NULL,PETSC_NULL,&da2);CHKERRQ(ierr);
+    ierr = DMDACreate2d(fa->comm[1],DMDA_BOUNDARY_PERIODIC,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,fa->p2,fa->r2g,PETSC_DECIDE,PETSC_DECIDE,1,fa->sw,PETSC_NULL,PETSC_NULL,&da2);CHKERRQ(ierr);
     ierr = DMGetLocalVector(da2,&vl2);CHKERRQ(ierr);
     ierr = DMGetGlobalVector(da2,&vg2);CHKERRQ(ierr);
   }
   if (fa->comm[2]) {
-    ierr = DMDACreate2d(fa->comm[2],DMDA_NONPERIODIC,DMDA_STENCIL_BOX,fa->p1-fa->p2,fa->r2g,PETSC_DECIDE,PETSC_DECIDE,1,fa->sw,PETSC_NULL,PETSC_NULL,&da3);CHKERRQ(ierr);
+    ierr = DMDACreate2d(fa->comm[2],DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,fa->p1-fa->p2,fa->r2g,PETSC_DECIDE,PETSC_DECIDE,1,fa->sw,PETSC_NULL,PETSC_NULL,&da3);CHKERRQ(ierr);
     ierr = DMGetLocalVector(da3,&vl3);CHKERRQ(ierr);
     ierr = DMGetGlobalVector(da3,&vg3);CHKERRQ(ierr);
   }
   if (fa->comm[0]) {
-    ierr = DMDACreate2d(fa->comm[0],DMDA_NONPERIODIC,DMDA_STENCIL_BOX,fa->p1,fa->r1g,PETSC_DECIDE,PETSC_DECIDE,1,fa->sw,PETSC_NULL,PETSC_NULL,&da1);CHKERRQ(ierr);
+    ierr = DMDACreate2d(fa->comm[0],DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,fa->p1,fa->r1g,PETSC_DECIDE,PETSC_DECIDE,1,fa->sw,PETSC_NULL,PETSC_NULL,&da1);CHKERRQ(ierr);
     ierr = DMGetLocalVector(da1,&vl1);CHKERRQ(ierr);
     ierr = DMGetGlobalVector(da1,&vg1);CHKERRQ(ierr);
   }
diff -r 23e7928e179a src/dm/examples/tutorials/ex6f90.F
--- a/src/dm/examples/tutorials/ex6f90.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex6f90.F	Fri Mar 11 16:29:15 2011 -0700
@@ -219,21 +219,24 @@
 !     set up distributed arrays.
 !-----------------------------------------------------------------------
       IF(fa%comm(1) /= 0)THEN
-         CALL DMDACreate2d(fa%comm(1),DMDA_XPERIODIC,DMDA_STENCIL_BOX,             &
+         CALL DMDACreate2d(fa%comm(1),DMDA_BOUNDARY_PERIODIC,                   &
+     &        DMDA_BOUNDARY_NONE, DMDA_STENCIL_BOX,                          &
      &        fa%p2,fa%r2g,PETSC_DECIDE,PETSC_DECIDE,1,fa%sw,                &
      &        PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,da2,ierr)
          CALL DMGetLocalVector(da2,vl2,ierr)
          CALL DMGetGlobalVector(da2,vg2,ierr)
       ENDIF
       IF(fa%comm(2) /= 0)THEN
-         CALL DMDACreate2d(fa%comm(2),DMDA_NONPERIODIC,DMDA_STENCIL_BOX,           &
+         CALL DMDACreate2d(fa%comm(2),DMDA_BOUNDARY_NONE,                       &
+     &        DMDA_BOUNDARY_NONE, DMDA_STENCIL_BOX,                        &
      &        fa%p1-fa%p2,fa%r2g,PETSC_DECIDE,PETSC_DECIDE,1,fa%sw,          &
      &        PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,da3,ierr)
          CALL DMGetLocalVector(da3,vl3,ierr)
          CALL DMGetGlobalVector(da3,vg3,ierr)
       ENDIF
       IF(fa%comm(0) /= 0)THEN
-         CALL DMDACreate2d(fa%comm(0),DMDA_NONPERIODIC,DMDA_STENCIL_BOX,           &
+         CALL DMDACreate2d(fa%comm(0),DMDA_BOUNDARY_NONE,                       &
+     &        DMDA_BOUNDARY_NONE, DMDA_STENCIL_BOX,                        &
      &        fa%p1,fa%r1g,PETSC_DECIDE,PETSC_DECIDE,1,fa%sw,                &
      &        PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,da1,ierr)
          CALL DMGetLocalVector(da1,vl1,ierr)
diff -r 23e7928e179a src/dm/examples/tutorials/ex7.c
--- a/src/dm/examples/tutorials/ex7.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex7.c	Fri Mar 11 16:29:15 2011 -0700
@@ -39,7 +39,7 @@
   ierr = PetscInitialize(&argc,&argv,(char *)0,help);CHKERRQ(ierr);
 
   /* Create a DMDA and an associated vector */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,10,10,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,10,10,
 		    PETSC_DECIDE,PETSC_DECIDE,2,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/examples/tutorials/ex8.c
--- a/src/dm/examples/tutorials/ex8.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex8.c	Fri Mar 11 16:29:15 2011 -0700
@@ -13,8 +13,8 @@
   PetscErrorCode ierr;
 
   ierr = PetscNew(Load,&load);CHKERRQ(ierr);
-  ierr = DMDACreate1d(PETSC_COMM_SELF,DMDA_NONPERIODIC,n1,1,1,PETSC_NULL,(DM*)&load->L1);CHKERRQ(ierr);
-  ierr = DMDACreate1d(PETSC_COMM_SELF,DMDA_NONPERIODIC,n1,1,1,PETSC_NULL,(DM*)&load->L2);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_SELF,DMDA_BOUNDARY_NONE,n1,1,1,PETSC_NULL,(DM*)&load->L1);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_SELF,DMDA_BOUNDARY_NONE,n1,1,1,PETSC_NULL,(DM*)&load->L2);CHKERRQ(ierr);
   ierr = DMCompositeCreate(PETSC_COMM_SELF,(DMComposite*)&load->load);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
diff -r 23e7928e179a src/dm/examples/tutorials/ex9.c
--- a/src/dm/examples/tutorials/ex9.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/examples/tutorials/ex9.c	Fri Mar 11 16:29:15 2011 -0700
@@ -31,7 +31,7 @@
   ierr = PetscInitialize(&argc,&argv,(char *)0,help);CHKERRQ(ierr);
 
   /* Create a DMDA and an associated vector */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,100,90,PETSC_DECIDE,PETSC_DECIDE,2,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,100,90,PETSC_DECIDE,PETSC_DECIDE,2,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&global);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(da,&local);CHKERRQ(ierr);
   ierr = VecSet(global,-1.0);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/impls/da/da.c
--- a/src/dm/impls/da/da.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/da.c	Fri Mar 11 16:29:15 2011 -0700
@@ -96,26 +96,31 @@
 #undef __FUNCT__  
 #define __FUNCT__ "DMDASetBoundaryType"
 /*@
-  DMDASetBoundaryType - Sets the type of periodicity
+  DMDASetBoundaryType - Sets the type of ghost nodes on domain boundaries.
 
   Not collective
 
   Input Parameter:
 + da    - The DMDA
-- ptype - One of DMDA_NONPERIODIC, DMDA_XPERIODIC, DMDA_YPERIODIC, DMDA_ZPERIODIC, DMDA_XYPERIODIC, DMDA_XZPERIODIC, DMDA_YZPERIODIC, or DMDA_XYZPERIODIC
+- bx,by,bz - One of DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_GHOSTED, DMDA_BOUNDARY_PERIODIC
 
   Level: intermediate
 
 .keywords:  distributed array, periodicity
 .seealso: DMDACreate(), DMDestroy(), DMDA, DMDABoundaryType
 @*/
-PetscErrorCode  DMDASetBoundaryType(DM da, DMDABoundaryType ptype)
+PetscErrorCode  DMDASetBoundaryType(DM da,DMDABoundaryType bx,DMDABoundaryType by,DMDABoundaryType bz)
 {
   DM_DA *dd = (DM_DA*)da->data;
 
   PetscFunctionBegin;
   PetscValidHeaderSpecific(da,DM_CLASSID,1);
-  dd->wrap = ptype;
+  PetscValidLogicalCollectiveInt(da,bx,2);
+  PetscValidLogicalCollectiveInt(da,by,3);
+  PetscValidLogicalCollectiveInt(da,bz,4);
+  dd->bx = bx;
+  dd->by = by;
+  dd->bz = bz;
   PetscFunctionReturn(0);
 }
 
@@ -733,17 +738,17 @@
   PetscValidHeaderSpecific(da,DM_CLASSID,1);
   PetscValidPointer(daref,3);
 
-  if (DMDAXPeriodic(dd->wrap) || dd->interptype == DMDA_Q0){
+  if (dd->bx == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0){
     M = dd->refine_x*dd->M;
   } else {
     M = 1 + dd->refine_x*(dd->M - 1);
   }
-  if (DMDAYPeriodic(dd->wrap) || dd->interptype == DMDA_Q0){
+  if (dd->by == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0){
     N = dd->refine_y*dd->N;
   } else {
     N = 1 + dd->refine_y*(dd->N - 1);
   }
-  if (DMDAZPeriodic(dd->wrap) || dd->interptype == DMDA_Q0){
+  if (dd->bz == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0){
     P = dd->refine_z*dd->P;
   } else {
     P = 1 + dd->refine_z*(dd->P - 1);
@@ -752,23 +757,23 @@
   if (dd->dim == 3) {
     PetscInt *lx,*ly,*lz;
     ierr = PetscMalloc3(dd->m,PetscInt,&lx,dd->n,PetscInt,&ly,dd->p,PetscInt,&lz);CHKERRQ(ierr);
-    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(DMDAXPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
-    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(DMDAYPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_y,dd->n,dd->ly,ly);CHKERRQ(ierr);
-    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(DMDAZPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_z,dd->p,dd->lz,lz);CHKERRQ(ierr);
-    ierr = DMDACreate3d(((PetscObject)da)->comm,dd->wrap,dd->stencil_type,M,N,P,dd->m,dd->n,dd->p,dd->w,dd->s,lx,ly,lz,&da2);CHKERRQ(ierr);
+    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(dd->bx == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
+    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(dd->by == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_y,dd->n,dd->ly,ly);CHKERRQ(ierr);
+    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(dd->bz == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_z,dd->p,dd->lz,lz);CHKERRQ(ierr);
+    ierr = DMDACreate3d(((PetscObject)da)->comm,dd->bx,dd->by,dd->bz,dd->stencil_type,M,N,P,dd->m,dd->n,dd->p,dd->w,dd->s,lx,ly,lz,&da2);CHKERRQ(ierr);
     ierr = PetscFree3(lx,ly,lz);CHKERRQ(ierr);
   } else if (dd->dim == 2) {
     PetscInt *lx,*ly;
     ierr = PetscMalloc2(dd->m,PetscInt,&lx,dd->n,PetscInt,&ly);CHKERRQ(ierr);
-    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(DMDAXPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
-    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(DMDAYPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_y,dd->n,dd->ly,ly);CHKERRQ(ierr);
-    ierr = DMDACreate2d(((PetscObject)da)->comm,dd->wrap,dd->stencil_type,M,N,dd->m,dd->n,dd->w,dd->s,lx,ly,&da2);CHKERRQ(ierr);
+    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(dd->bx == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
+    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(dd->by == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_y,dd->n,dd->ly,ly);CHKERRQ(ierr);
+    ierr = DMDACreate2d(((PetscObject)da)->comm,dd->bx,dd->by,dd->stencil_type,M,N,dd->m,dd->n,dd->w,dd->s,lx,ly,&da2);CHKERRQ(ierr);
     ierr = PetscFree2(lx,ly);CHKERRQ(ierr);
   } else if (dd->dim == 1) {
     PetscInt *lx;
     ierr = PetscMalloc(dd->m*sizeof(PetscInt),&lx);CHKERRQ(ierr);
-    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(DMDAXPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
-    ierr = DMDACreate1d(((PetscObject)da)->comm,dd->wrap,M,dd->w,dd->s,lx,&da2);CHKERRQ(ierr);
+    ierr = DMDARefineOwnershipRanges(da,(PetscBool)(dd->bx == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
+    ierr = DMDACreate1d(((PetscObject)da)->comm,dd->bx,M,dd->w,dd->s,lx,&da2);CHKERRQ(ierr);
     ierr = PetscFree(lx);CHKERRQ(ierr);
   }
   dd2 = (DM_DA*)da2->data;
@@ -830,17 +835,17 @@
   PetscValidHeaderSpecific(da,DM_CLASSID,1);
   PetscValidPointer(daref,3);
 
-  if (DMDAXPeriodic(dd->wrap) || dd->interptype == DMDA_Q0){
+  if (dd->bx == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0){
     M = dd->M / dd->refine_x;
   } else {
     M = 1 + (dd->M - 1) / dd->refine_x;
   }
-  if (DMDAYPeriodic(dd->wrap) || dd->interptype == DMDA_Q0){
+  if (dd->by == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0){
     N = dd->N / dd->refine_y;
   } else {
     N = 1 + (dd->N - 1) / dd->refine_y;
   }
-  if (DMDAZPeriodic(dd->wrap) || dd->interptype == DMDA_Q0){
+  if (dd->bz == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0){
     P = dd->P / dd->refine_z;
   } else {
     P = 1 + (dd->P - 1) / dd->refine_z;
@@ -849,23 +854,23 @@
   if (dd->dim == 3) {
     PetscInt *lx,*ly,*lz;
     ierr = PetscMalloc3(dd->m,PetscInt,&lx,dd->n,PetscInt,&ly,dd->p,PetscInt,&lz);CHKERRQ(ierr);
-    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(DMDAXPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
-    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(DMDAYPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_y,dd->n,dd->ly,ly);CHKERRQ(ierr);
-    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(DMDAZPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_z,dd->p,dd->lz,lz);CHKERRQ(ierr);
-    ierr = DMDACreate3d(((PetscObject)da)->comm,dd->wrap,dd->stencil_type,M,N,P,dd->m,dd->n,dd->p,dd->w,dd->s,lx,ly,lz,&da2);CHKERRQ(ierr);
+    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(dd->bx == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
+    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(dd->by == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_y,dd->n,dd->ly,ly);CHKERRQ(ierr);
+    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(dd->bz == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_z,dd->p,dd->lz,lz);CHKERRQ(ierr);
+    ierr = DMDACreate3d(((PetscObject)da)->comm,dd->bx,dd->by,dd->bz,dd->stencil_type,M,N,P,dd->m,dd->n,dd->p,dd->w,dd->s,lx,ly,lz,&da2);CHKERRQ(ierr);
     ierr = PetscFree3(lx,ly,lz);CHKERRQ(ierr);
   } else if (dd->dim == 2) {
     PetscInt *lx,*ly;
     ierr = PetscMalloc2(dd->m,PetscInt,&lx,dd->n,PetscInt,&ly);CHKERRQ(ierr);
-    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(DMDAXPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
-    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(DMDAYPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_y,dd->n,dd->ly,ly);CHKERRQ(ierr);
-    ierr = DMDACreate2d(((PetscObject)da)->comm,dd->wrap,dd->stencil_type,M,N,dd->m,dd->n,dd->w,dd->s,lx,ly,&da2);CHKERRQ(ierr);
+    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(dd->bx == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
+    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(dd->by == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_y,dd->n,dd->ly,ly);CHKERRQ(ierr);
+    ierr = DMDACreate2d(((PetscObject)da)->comm,dd->bx,dd->by,dd->stencil_type,M,N,dd->m,dd->n,dd->w,dd->s,lx,ly,&da2);CHKERRQ(ierr);
     ierr = PetscFree2(lx,ly);CHKERRQ(ierr);
   } else if (dd->dim == 1) {
     PetscInt *lx;
     ierr = PetscMalloc(dd->m*sizeof(PetscInt),&lx);CHKERRQ(ierr);
-    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(DMDAXPeriodic(dd->wrap) || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
-    ierr = DMDACreate1d(((PetscObject)da)->comm,dd->wrap,M,dd->w,dd->s,lx,&da2);CHKERRQ(ierr);
+    ierr = DMDACoarsenOwnershipRanges(da,(PetscBool)(dd->bx == DMDA_BOUNDARY_PERIODIC || dd->interptype == DMDA_Q0),dd->s,dd->refine_x,dd->m,dd->lx,lx);CHKERRQ(ierr);
+    ierr = DMDACreate1d(((PetscObject)da)->comm,dd->bx,M,dd->w,dd->s,lx,&da2);CHKERRQ(ierr);
     ierr = PetscFree(lx);CHKERRQ(ierr);
   }
   dd2 = (DM_DA*)da2->data;
diff -r 23e7928e179a src/dm/impls/da/da1.c
--- a/src/dm/impls/da/da1.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/da1.c	Fri Mar 11 16:29:15 2011 -0700
@@ -6,9 +6,7 @@
 
 #include "private/daimpl.h"     /*I  "petscdm.h"   I*/
 
-const char *DMDABoundaryTypes[] = {"NONPERIODIC","XPERIODIC","YPERIODIC","XYPERIODIC",
-                                   "XYZPERIODIC","XZPERIODIC","YZPERIODIC","ZPERIODIC",
-                                   "XYZGHOSTED","DMDABoundaryType","DMDA_",0};
+const char *DMDABoundaryTypes[] = {"BOUNDARY_NONE","BOUNDARY_GHOSTED","BOUNDARY_PERIODIC","DMDA_",0};
 
 #undef __FUNCT__  
 #define __FUNCT__ "DMView_DA_1d"
@@ -137,7 +135,7 @@
   const PetscInt         s     = dd->s;
   const PetscInt         sDist = s*dof;  /* absolute stencil distance */
   const PetscInt         *lx    = dd->lx;
-  const DMDABoundaryType wrap  = dd->wrap;
+  const DMDABoundaryType bx  = dd->bx;
   MPI_Comm               comm;
   Vec                    local, global;
   VecScatter             ltog, gtol;
@@ -207,7 +205,7 @@
   xe  = xs + x;
 
   /* determine ghost region */
-  if (DMDAXGhosted(wrap)) {
+  if (bx) {
     Xs = xs - sDist;
     Xe = xe + sDist;
   } else {
@@ -215,7 +213,7 @@
     if ((xe+sDist) <= M*dof) Xe = xe+sDist;  else Xe = M*dof;
   }
 
-  if (DMDAXPeriodic(wrap)) {
+  if (bx == DMDA_BOUNDARY_PERIODIC) {
     IXs = xs - sDist;
     IXe = xe + sDist;
   } else {
@@ -251,7 +249,7 @@
   for (i=0; i<IXs-Xs; i++) {idx[i] = -1; } /* prepend with -1s if needed for ghosted case*/
 
   nn = IXs-Xs;
-  if DMDAXPeriodic(wrap) { /* Handle all cases with wrap first */
+  if (bx == DMDA_BOUNDARY_PERIODIC) { /* Handle all cases with wrap first */
     for (i=0; i<sDist; i++) {  /* Left ghost points */
       if ((xs-sDist+i)>=0) { idx[nn++] = xs-sDist+i;}
       else                 { idx[nn++] = M*dof+(xs-sDist+i);}
@@ -318,8 +316,8 @@
 
    Input Parameters:
 +  comm - MPI communicator
-.  wrap - type of ghost cells at the boundary the array should have, if any. Use 
-          DMDA_NONGHOSTED, DMDA_XGHOSTED, or DMDA_XPERIODIC.
+.  bx - type of ghost cells at the boundary the array should have, if any. Use 
+          DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_GHOSTED, or DMDA_BOUNDARY_PERIODIC.
 .  M - global dimension of the array (use -M to indicate that it may be set to a different value 
             from the command line with -da_grid_x <M>)
 .  dof - number of degrees of freedom per node
@@ -350,7 +348,7 @@
           DMDAGetInfo(), DMCreateGlobalVector(), DMCreateLocalVector(), DMDACreateNaturalVector(), DMDALoad(), DMDAGetOwnershipRanges()
 
 @*/
-PetscErrorCode  DMDACreate1d(MPI_Comm comm, DMDABoundaryType wrap, PetscInt M, PetscInt dof, PetscInt s, const PetscInt lx[], DM *da)
+PetscErrorCode  DMDACreate1d(MPI_Comm comm, DMDABoundaryType bx, PetscInt M, PetscInt dof, PetscInt s, const PetscInt lx[], DM *da)
 {
   PetscErrorCode ierr;
   PetscMPIInt    size;
@@ -361,7 +359,7 @@
   ierr = DMDASetSizes(*da, M, 1, 1);CHKERRQ(ierr);
   ierr = MPI_Comm_size(comm, &size);CHKERRQ(ierr);
   ierr = DMDASetNumProcs(*da, size, PETSC_DECIDE, PETSC_DECIDE);CHKERRQ(ierr);
-  ierr = DMDASetBoundaryType(*da, wrap);CHKERRQ(ierr);
+  ierr = DMDASetBoundaryType(*da, bx, PETSC_NULL, PETSC_NULL);CHKERRQ(ierr);
   ierr = DMDASetDof(*da, dof);CHKERRQ(ierr);
   ierr = DMDASetStencilWidth(*da, s);CHKERRQ(ierr);
   ierr = DMDASetOwnershipRanges(*da, lx, PETSC_NULL, PETSC_NULL);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/impls/da/da2.c
--- a/src/dm/impls/da/da2.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/da2.c	Fri Mar 11 16:29:15 2011 -0700
@@ -1236,7 +1236,8 @@
   PetscInt               n            = dd->n;
   const PetscInt         dof          = dd->w;
   const PetscInt         s            = dd->s;
-  const DMDABoundaryType wrap         = dd->wrap;
+  const DMDABoundaryType bx         = dd->bx;
+  const DMDABoundaryType by         = dd->by;
   const DMDAStencilType  stencil_type = dd->stencil_type;
   PetscInt               *lx           = dd->lx;
   PetscInt               *ly           = dd->ly;
@@ -1358,10 +1359,10 @@
   if (ye+s <= N) { Ye = ye + s; IYe = ye + s; } else { Ye = N; IYe = N; }
 
   /* fix for periodicity/ghosted */
-  if (DMDAXGhosted(wrap)) { Xs = xs - s; Xe = xe + s; }
-  if (DMDAXPeriodic(wrap)) { IXs = xs - s; IXe = xe + s; }
-  if (DMDAYGhosted(wrap)) { Ys = ys - s; Ye = ye + s; }
-  if (DMDAYPeriodic(wrap)) { IYs = ys - s; IYe = ye + s; }
+  if (bx) { Xs = xs - s; Xe = xe + s; }
+  if (bx == DMDA_BOUNDARY_PERIODIC) { IXs = xs - s; IXe = xe + s; }
+  if (by) { Ys = ys - s; Ye = ye + s; }
+  if (by == DMDA_BOUNDARY_PERIODIC) { IYs = ys - s; IYe = ye + s; }
 
   /* Resize all X parameters to reflect w */
   s_x = s;
@@ -1492,7 +1493,7 @@
   }
   n7 = rank + m; if (n7 >= m*n) n7 = -1;
 
-  if (DMDAXPeriodic(wrap) && DMDAYPeriodic(wrap)) {
+  if (bx == DMDA_BOUNDARY_PERIODIC && by == DMDA_BOUNDARY_PERIODIC) {
   /* Modify for Periodic Cases */
     /* Handle all four corners */
     if ((n6 < 0) && (n7 < 0) && (n3 < 0)) n6 = m-1;
@@ -1515,14 +1516,14 @@
     if ((n1 >= 0) && (n2 < 0)) n2 = rank-2*m+1;
     if ((n7 >= 0) && (n6 < 0)) n6 = rank+2*m-1;
     if ((n7 >= 0) && (n8 < 0)) n8 = rank+1;
-  } else if (DMDAYPeriodic(wrap)) {  /* Handle Top and Bottom Sides */
+  } else if (by == DMDA_BOUNDARY_PERIODIC) {  /* Handle Top and Bottom Sides */
     if (n1 < 0) n1 = rank + m * (n-1);
     if (n7 < 0) n7 = rank - m * (n-1);
     if ((n3 >= 0) && (n0 < 0)) n0 = size - m + rank - 1;
     if ((n3 >= 0) && (n6 < 0)) n6 = (rank%m)-1;
     if ((n5 >= 0) && (n2 < 0)) n2 = size - m + rank + 1;
     if ((n5 >= 0) && (n8 < 0)) n8 = (rank%m)+1;
-  } else if (DMDAXPeriodic(wrap)) { /* Handle Left and Right Sides */
+  } else if (bx == DMDA_BOUNDARY_PERIODIC) { /* Handle Left and Right Sides */
     if (n3 < 0) n3 = rank + (m-1);
     if (n5 < 0) n5 = rank - (m-1);
     if ((n1 >= 0) && (n0 < 0)) n0 = rank-1;
@@ -1624,8 +1625,8 @@
   }
 
   if ((stencil_type == DMDA_STENCIL_STAR) ||
-      (!DMDAXPeriodic(wrap) && DMDAXGhosted(wrap)) ||
-      (!DMDAYPeriodic(wrap) && DMDAYGhosted(wrap))) {
+      (bx && bx != DMDA_BOUNDARY_PERIODIC) ||
+      (by && by != DMDA_BOUNDARY_PERIODIC)) {
     /*
         Recompute the local to global mappings, this time keeping the 
       information about the cross corner processor numbers and any ghosted
@@ -1756,8 +1757,8 @@
 
    Input Parameters:
 +  comm - MPI communicator
-.  wrap - type of periodicity should the array have. 
-         Use one of DMDA_NONPERIODIC, DMDA_XPERIODIC, DMDA_YPERIODIC, or DMDA_XYPERIODIC.
+.  bx,by - type of ghost nodes the array have. 
+         Use one of DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_GHOSTED, DMDA_BOUNDARY_PERIODIC.
 .  stencil_type - stencil type.  Use either DMDA_STENCIL_BOX or DMDA_STENCIL_STAR.
 .  M,N - global dimension in each direction of the array (use -M and or -N to indicate that it may be set to a different value 
             from the command line with -da_grid_x <M> -da_grid_y <N>)
@@ -1801,7 +1802,7 @@
           DMDAGetInfo(), DMCreateGlobalVector(), DMCreateLocalVector(), DMDACreateNaturalVector(), DMDALoad(), DMDAGetOwnershipRanges()
 
 @*/
-PetscErrorCode  DMDACreate2d(MPI_Comm comm,DMDABoundaryType wrap,DMDAStencilType stencil_type,
+PetscErrorCode  DMDACreate2d(MPI_Comm comm,DMDABoundaryType bx,DMDABoundaryType by,DMDAStencilType stencil_type,
                           PetscInt M,PetscInt N,PetscInt m,PetscInt n,PetscInt dof,PetscInt s,const PetscInt lx[],const PetscInt ly[],DM *da)
 {
   PetscErrorCode ierr;
@@ -1811,7 +1812,7 @@
   ierr = DMDASetDim(*da, 2);CHKERRQ(ierr);
   ierr = DMDASetSizes(*da, M, N, 1);CHKERRQ(ierr);
   ierr = DMDASetNumProcs(*da, m, n, PETSC_DECIDE);CHKERRQ(ierr);
-  ierr = DMDASetBoundaryType(*da, wrap);CHKERRQ(ierr);
+  ierr = DMDASetBoundaryType(*da, bx, by, PETSC_NULL);CHKERRQ(ierr);
   ierr = DMDASetDof(*da, dof);CHKERRQ(ierr);
   ierr = DMDASetStencilType(*da, stencil_type);CHKERRQ(ierr);
   ierr = DMDASetStencilWidth(*da, s);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/impls/da/da3.c
--- a/src/dm/impls/da/da3.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/da3.c	Fri Mar 11 16:29:15 2011 -0700
@@ -173,7 +173,9 @@
   PetscInt               p            = dd->p;
   const PetscInt         dof          = dd->w;
   const PetscInt         s            = dd->s;
-  const DMDABoundaryType wrap         = dd->wrap;
+  const DMDABoundaryType bx         = dd->bx;
+  const DMDABoundaryType by         = dd->by;
+  const DMDABoundaryType bz         = dd->bz;
   const DMDAStencilType  stencil_type = dd->stencil_type;
   PetscInt               *lx           = dd->lx;
   PetscInt               *ly           = dd->ly;
@@ -339,12 +341,12 @@
   if (ze+s <= P) { Ze = ze + s; IZe = ze + s; } else { Ze = P; IZe = P; }
 
   /* fix for periodicity/ghosted */
-  if (DMDAXGhosted(wrap)) { Xs = xs - s; Xe = xe + s; }
-  if (DMDAXPeriodic(wrap)) { IXs = xs - s; IXe = xe + s; }
-  if (DMDAYGhosted(wrap)) { Ys = ys - s; Ye = ye + s; }
-  if (DMDAYPeriodic(wrap)) { IYs = ys - s; IYe = ye + s; }
-  if (DMDAZGhosted(wrap)) { Zs = zs - s; Ze = ze + s; }
-  if (DMDAZPeriodic(wrap)) { IZs = zs - s; IZe = ze + s; }
+  if (bx) { Xs = xs - s; Xe = xe + s; }
+  if (bx == DMDA_BOUNDARY_PERIODIC) { IXs = xs - s; IXe = xe + s; }
+  if (by) { Ys = ys - s; Ye = ye + s; }
+  if (by == DMDA_BOUNDARY_PERIODIC) { IYs = ys - s; IYe = ye + s; }
+  if (bz) { Zs = zs - s; Ze = ze + s; }
+  if (bz == DMDA_BOUNDARY_PERIODIC) { IZs = zs - s; IZe = ze + s; }
 
   /* Resize all X parameters to reflect w */
   s_x = s;
@@ -658,19 +660,19 @@
   /* Check for when not X,Y, and Z Periodic */
 
   /* If not X periodic */
-  if (!DMDAXPeriodic(wrap)) {
+  if (bx != DMDA_BOUNDARY_PERIODIC) {
     if (xs==0)   {n0  = n3  = n6  = n9  = n12 = n15 = n18 = n21 = n24 = -2;}
     if (xe==M) {n2  = n5  = n8  = n11 = n14 = n17 = n20 = n23 = n26 = -2;}
   }
 
   /* If not Y periodic */
-  if (!DMDAYPeriodic(wrap)) {
+  if (by != DMDA_BOUNDARY_PERIODIC) {
     if (ys==0)   {n0  = n1  = n2  = n9  = n10 = n11 = n18 = n19 = n20 = -2;}
     if (ye==N)   {n6  = n7  = n8  = n15 = n16 = n17 = n24 = n25 = n26 = -2;}
   }
 
   /* If not Z periodic */
-  if (!DMDAZPeriodic(wrap)) {
+  if (bz != DMDA_BOUNDARY_PERIODIC) {
     if (zs==0)   {n0  = n1  = n2  = n3  = n4  = n5  = n6  = n7  = n8  = -2;}
     if (ze==P)   {n18 = n19 = n20 = n21 = n22 = n23 = n24 = n25 = n26 = -2;}
   }
@@ -961,9 +963,9 @@
   }
 
   if ((stencil_type == DMDA_STENCIL_STAR) ||
-      (!DMDAXPeriodic(wrap) && DMDAXGhosted(wrap)) ||
-      (!DMDAYPeriodic(wrap) && DMDAYGhosted(wrap)) ||
-      (!DMDAZPeriodic(wrap) && DMDAZGhosted(wrap))) {
+      (bx != DMDA_BOUNDARY_PERIODIC && bx) ||
+      (by != DMDA_BOUNDARY_PERIODIC && by) ||
+      (bz != DMDA_BOUNDARY_PERIODIC && bz)) {
     /*
         Recompute the local to global mappings, this time keeping the 
       information about the cross corner processor numbers.
@@ -1296,8 +1298,8 @@
 
    Input Parameters:
 +  comm - MPI communicator
-.  wrap - type of periodicity the array should have, if any.  Use one
-          of DMDA_NONPERIODIC, DMDA_XPERIODIC, DMDA_YPERIODIC, DMDA_ZPERIODIC, DMDA_XYPERIODIC, DMDA_XZPERIODIC, DMDA_YZPERIODIC, DMDA_XYZPERIODIC, or DMDA_XYZGHOSTED.
+.  bx,by,bz - type of ghost nodes the array have. 
+         Use one of DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_GHOSTED, DMDA_BOUNDARY_PERIODIC.
 .  stencil_type - Type of stencil (DMDA_STENCIL_STAR or DMDA_STENCIL_BOX)
 .  M,N,P - global dimension in each direction of the array (use -M, -N, and or -P to indicate that it may be set to a different value 
             from the command line with -da_grid_x <M> -da_grid_y <N> -da_grid_z <P>)
@@ -1344,7 +1346,7 @@
           DMDAGetInfo(), DMCreateGlobalVector(), DMCreateLocalVector(), DMDACreateNaturalVector(), DMDALoad(), DMDAGetOwnershipRanges()
 
 @*/
-PetscErrorCode  DMDACreate3d(MPI_Comm comm,DMDABoundaryType wrap,DMDAStencilType stencil_type,PetscInt M,
+PetscErrorCode  DMDACreate3d(MPI_Comm comm,DMDABoundaryType bx,DMDABoundaryType by,DMDABoundaryType bz,DMDAStencilType stencil_type,PetscInt M,
                PetscInt N,PetscInt P,PetscInt m,PetscInt n,PetscInt p,PetscInt dof,PetscInt s,const PetscInt lx[],const PetscInt ly[],const PetscInt lz[],DM *da)
 {
   PetscErrorCode ierr;
@@ -1354,7 +1356,7 @@
   ierr = DMDASetDim(*da, 3);CHKERRQ(ierr);
   ierr = DMDASetSizes(*da, M, N, P);CHKERRQ(ierr);
   ierr = DMDASetNumProcs(*da, m, n, p);CHKERRQ(ierr);
-  ierr = DMDASetBoundaryType(*da, wrap);CHKERRQ(ierr);
+  ierr = DMDASetBoundaryType(*da, bx, by, bz);CHKERRQ(ierr);
   ierr = DMDASetDof(*da, dof);CHKERRQ(ierr);
   ierr = DMDASetStencilType(*da, stencil_type);CHKERRQ(ierr);
   ierr = DMDASetStencilWidth(*da, s);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/impls/da/dacorn.c
--- a/src/dm/impls/da/dacorn.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/dacorn.c	Fri Mar 11 16:29:15 2011 -0700
@@ -152,17 +152,17 @@
     ierr = MPI_Comm_size(((PetscObject)da)->comm,&size);CHKERRQ(ierr);
     if (dd->dim == 1) {
       PetscInt            s,m,*lc,l;
-      DMDABoundaryType pt;
-      ierr = DMDAGetInfo(da,0,&m,0,0,0,0,0,0,&s,&pt,0);CHKERRQ(ierr);
+      DMDABoundaryType bx;
+      ierr = DMDAGetInfo(da,0,&m,0,0,0,0,0,0,&s,&bx,0,0,0);CHKERRQ(ierr);
       ierr = DMDAGetCorners(da,0,0,0,&l,0,0);CHKERRQ(ierr);
       ierr = PetscMalloc(size*sizeof(PetscInt),&lc);CHKERRQ(ierr);
       ierr = MPI_Allgather(&l,1,MPIU_INT,lc,1,MPIU_INT,((PetscObject)da)->comm);CHKERRQ(ierr);
-      ierr = DMDACreate1d(((PetscObject)da)->comm,pt,m,1,s,lc,&dd->da_coordinates);CHKERRQ(ierr);
+      ierr = DMDACreate1d(((PetscObject)da)->comm,bx,m,1,s,lc,&dd->da_coordinates);CHKERRQ(ierr);
       ierr = PetscFree(lc);CHKERRQ(ierr);
     } else if (dd->dim == 2) {
       PetscInt            i,s,m,*lc,*ld,l,k,n,M,N;
-      DMDABoundaryType pt;
-      ierr = DMDAGetInfo(da,0,&m,&n,0,&M,&N,0,0,&s,&pt,0);CHKERRQ(ierr);
+      DMDABoundaryType bx,by;
+      ierr = DMDAGetInfo(da,0,&m,&n,0,&M,&N,0,0,&s,&bx,&by,0,0);CHKERRQ(ierr);
       ierr = DMDAGetCorners(da,0,0,0,&l,&k,0);CHKERRQ(ierr);
       ierr = PetscMalloc2(size,PetscInt,&lc,size,PetscInt,&ld);CHKERRQ(ierr);
       /* only first M values in lc matter */
@@ -172,12 +172,12 @@
       for ( i=0; i<N; i++) {
         ld[i] = ld[M*i];
       }
-      ierr = DMDACreate2d(((PetscObject)da)->comm,pt,DMDA_STENCIL_BOX,m,n,M,N,2,s,lc,ld,&dd->da_coordinates);CHKERRQ(ierr);
+      ierr = DMDACreate2d(((PetscObject)da)->comm,bx,by,DMDA_STENCIL_BOX,m,n,M,N,2,s,lc,ld,&dd->da_coordinates);CHKERRQ(ierr);
       ierr = PetscFree2(lc,ld);CHKERRQ(ierr);
     } else if (dd->dim == 3) {
       PetscInt            i,s,m,*lc,*ld,*le,l,k,q,n,M,N,P,p;
-      DMDABoundaryType pt;
-      ierr = DMDAGetInfo(da,0,&m,&n,&p,&M,&N,&P,0,&s,&pt,0);CHKERRQ(ierr);
+      DMDABoundaryType bx,by,bz;
+      ierr = DMDAGetInfo(da,0,&m,&n,&p,&M,&N,&P,0,&s,&bx,&by,&bz,0);CHKERRQ(ierr);
       ierr = DMDAGetCorners(da,0,0,0,&l,&k,&q);CHKERRQ(ierr);
       ierr = PetscMalloc3(size,PetscInt,&lc,size,PetscInt,&ld,size,PetscInt,&le);CHKERRQ(ierr);
       /* only first M values in lc matter */
@@ -191,7 +191,7 @@
       for ( i=0; i<P; i++) {
         le[i] = le[M*N*i];
       }
-      ierr = DMDACreate3d(((PetscObject)da)->comm,pt,DMDA_STENCIL_BOX,m,n,p,M,N,P,3,s,lc,ld,le,&dd->da_coordinates);CHKERRQ(ierr);
+      ierr = DMDACreate3d(((PetscObject)da)->comm,bx,by,bz,DMDA_STENCIL_BOX,m,n,p,M,N,P,3,s,lc,ld,le,&dd->da_coordinates);CHKERRQ(ierr);
       ierr = PetscFree3(lc,ld,le);CHKERRQ(ierr);
     }
   }
diff -r 23e7928e179a src/dm/impls/da/dacreate.c
--- a/src/dm/impls/da/dacreate.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/dacreate.c	Fri Mar 11 16:29:15 2011 -0700
@@ -109,7 +109,9 @@
   dd->ltol         = PETSC_NULL;
   dd->ao           = PETSC_NULL;
   dd->base         = -1;
-  dd->wrap         = DMDA_NONPERIODIC;
+  dd->bx         = DMDA_BOUNDARY_NONE;
+  dd->by         = DMDA_BOUNDARY_NONE;
+  dd->bz         = DMDA_BOUNDARY_NONE;
   dd->stencil_type = DMDA_STENCIL_BOX;
   dd->interptype   = DMDA_Q1;
   dd->idx          = PETSC_NULL;
diff -r 23e7928e179a src/dm/impls/da/dagetarray.c
--- a/src/dm/impls/da/dagetarray.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/dagetarray.c	Fri Mar 11 16:29:15 2011 -0700
@@ -51,7 +51,7 @@
   PetscFunctionBegin;
   ierr = DMDAGetCorners(da,&xs,&ys,&zs,&xm,&ym,&zm);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(da,&gxs,&gys,&gzs,&gxm,&gym,&gzm);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,&dim,0,0,0,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,0,0,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
 
   /* Handle case where user passes in global vector as opposed to local */
   ierr = VecGetLocalSize(vec,&N);CHKERRQ(ierr);
@@ -108,7 +108,7 @@
   PetscFunctionBegin;
   ierr = DMDAGetCorners(da,&xs,&ys,&zs,&xm,&ym,&zm);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(da,&gxs,&gys,&gzs,&gxm,&gym,&gzm);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,&dim,0,0,0,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,0,0,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
 
   /* Handle case where user passes in global vector as opposed to local */
   ierr = VecGetLocalSize(vec,&N);CHKERRQ(ierr);
@@ -170,7 +170,7 @@
   PetscFunctionBegin;
   ierr = DMDAGetCorners(da,&xs,&ys,&zs,&xm,&ym,&zm);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(da,&gxs,&gys,&gzs,&gxm,&gym,&gzm);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,&dim,0,0,0,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,0,0,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
 
   /* Handle case where user passes in global vector as opposed to local */
   ierr = VecGetLocalSize(vec,&N);CHKERRQ(ierr);
@@ -224,7 +224,7 @@
   PetscFunctionBegin;
   ierr = DMDAGetCorners(da,&xs,&ys,&zs,&xm,&ym,&zm);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(da,&gxs,&gys,&gzs,&gxm,&gym,&gzm);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,&dim,0,0,0,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,0,0,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
 
   /* Handle case where user passes in global vector as opposed to local */
   ierr = VecGetLocalSize(vec,&N);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/impls/da/dainterp.c
--- a/src/dm/impls/da/dainterp.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/dainterp.c	Fri Mar 11 16:29:15 2011 -0700
@@ -53,14 +53,14 @@
   PetscInt         i_c,i_start_c,i_start_ghost_c,cols[2],dof;
   PetscScalar      v[2],x,*coors = 0,*ccoors;
   Mat              mat;
-  DMDABoundaryType pt;
+  DMDABoundaryType bx;
   Vec              vcoors,cvcoors;
   DM_DA            *ddc = (DM_DA*)dac->data, *ddf = (DM_DA*)daf->data;
   
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(dac,0,&Mx,0,0,0,0,0,0,0,&pt,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,0,&mx,0,0,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
-  if DMDAXPeriodic(pt) {
+  ierr = DMDAGetInfo(dac,0,&Mx,0,0,0,0,0,0,0,&bx,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,0,&mx,0,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
+  if (bx == DMDA_BOUNDARY_PERIODIC){
     ratio = mx/Mx;
     if (ratio*Mx != mx) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: mx/Mx  must be integer: mx %D Mx %D",mx,Mx);
   } else {
@@ -191,12 +191,12 @@
   PetscInt         i_c,i_start_c,i_start_ghost_c,cols[2],dof;
   PetscScalar      v[2],x;
   Mat              mat;
-  DMDABoundaryType pt;
+  DMDABoundaryType bx;
   
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(dac,0,&Mx,0,0,0,0,0,0,0,&pt,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,0,&mx,0,0,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
-  if DMDAXPeriodic(pt) {
+  ierr = DMDAGetInfo(dac,0,&Mx,0,0,0,0,0,0,0,&bx,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,0,&mx,0,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
+  if (bx == DMDA_BOUNDARY_PERIODIC){
     ratio = mx/Mx;
     if (ratio*Mx != mx) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: mx/Mx  must be integer: mx %D Mx %D",mx,Mx);
   } else {
@@ -264,22 +264,22 @@
   PetscMPIInt      size_c,size_f,rank_f;
   PetscScalar      v[4],x,y;
   Mat              mat;
-  DMDABoundaryType pt;
+  DMDABoundaryType bx,by;
   DMDACoor2d       **coors = 0,**ccoors;
   Vec              vcoors,cvcoors;
   DM_DA            *ddc = (DM_DA*)dac->data, *ddf = (DM_DA*)daf->data;
   
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(dac,0,&Mx,&My,0,0,0,0,0,0,&pt,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,0,&mx,&my,0,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
-  if (DMDAXPeriodic(pt)){
+  ierr = DMDAGetInfo(dac,0,&Mx,&My,0,0,0,0,0,0,&bx,&by,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,0,&mx,&my,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
+  if (bx == DMDA_BOUNDARY_PERIODIC){
     ratioi = mx/Mx;
     if (ratioi*Mx != mx) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: mx/Mx  must be integer: mx %D Mx %D",mx,Mx);
   } else {
     ratioi = (mx-1)/(Mx-1);
     if (ratioi*(Mx-1) != mx-1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: (mx - 1)/(Mx - 1) must be integer: mx %D Mx %D",mx,Mx);
   }
-  if (DMDAYPeriodic(pt)){
+  if (by == DMDA_BOUNDARY_PERIODIC){
     ratioj = my/My;
     if (ratioj*My != my) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: my/My  must be integer: my %D My %D",my,My);
   } else {
@@ -504,13 +504,13 @@
   PetscMPIInt      size_c,size_f,rank_f;
   PetscScalar      v[4];
   Mat              mat;
-  DMDABoundaryType pt;
+  DMDABoundaryType bx,by;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(dac,0,&Mx,&My,0,0,0,0,0,0,&pt,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,0,&mx,&my,0,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
-  if (DMDAXPeriodic(pt)) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_WRONG,"Cannot handle periodic grid in x");
-  if (DMDAYPeriodic(pt)) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_WRONG,"Cannot handle periodic grid in y");
+  ierr = DMDAGetInfo(dac,0,&Mx,&My,0,0,0,0,0,0,&bx,&by,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,0,&mx,&my,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
+  if (bx == DMDA_BOUNDARY_PERIODIC) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_WRONG,"Cannot handle periodic grid in x");
+  if (by == DMDA_BOUNDARY_PERIODIC) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_WRONG,"Cannot handle periodic grid in y");
   ratioi = mx/Mx;
   ratioj = my/My;
   if (ratioi*Mx != mx) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_WRONG,"Fine grid points must be multiple of coarse grid points in x");
@@ -615,14 +615,14 @@
   PetscMPIInt      size_c,size_f,rank_f;
   PetscScalar      v[8];
   Mat              mat;
-  DMDABoundaryType pt;
+  DMDABoundaryType bx,by,bz;
   
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(dac,0,&Mx,&My,&Mz,0,0,0,0,0,&pt,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,0,&mx,&my,&mz,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
-  if (DMDAXPeriodic(pt)) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_WRONG,"Cannot handle periodic grid in x");
-  if (DMDAYPeriodic(pt)) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_WRONG,"Cannot handle periodic grid in y");
-  if (DMDAZPeriodic(pt)) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_WRONG,"Cannot handle periodic grid in z");
+  ierr = DMDAGetInfo(dac,0,&Mx,&My,&Mz,0,0,0,0,0,&bx,&by,&bz,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,0,&mx,&my,&mz,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
+  if (bx == DMDA_BOUNDARY_PERIODIC) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_WRONG,"Cannot handle periodic grid in x");
+  if (by == DMDA_BOUNDARY_PERIODIC) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_WRONG,"Cannot handle periodic grid in y");
+  if (bz == DMDA_BOUNDARY_PERIODIC) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_WRONG,"Cannot handle periodic grid in z");
   ratioi = mx/Mx;
   ratioj = my/My;
   ratiol = mz/Mz;
@@ -735,17 +735,17 @@
   PetscInt         l_start_ghost_c,p_ghost_c,l_c,*dnz,*onz;
   PetscScalar      v[8],x,y,z;
   Mat              mat;
-  DMDABoundaryType pt;
+  DMDABoundaryType bx,by,bz;
   DMDACoor3d       ***coors = 0,***ccoors;
   Vec              vcoors,cvcoors;
   DM_DA            *ddc = (DM_DA*)dac->data, *ddf = (DM_DA*)daf->data;
   
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(dac,0,&Mx,&My,&Mz,0,0,0,0,0,&pt,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,0,&mx,&my,&mz,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dac,0,&Mx,&My,&Mz,0,0,0,0,0,&bx,&by,&bz,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,0,&mx,&my,&mz,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
   if (mx == Mx) {
     ratioi = 1;
-  } else if (DMDAXPeriodic(pt)){
+  } else if (bx == DMDA_BOUNDARY_PERIODIC) {
     ratioi = mx/Mx;
     if (ratioi*Mx != mx) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: mx/Mx  must be integer: mx %D Mx %D",mx,Mx);
   } else {
@@ -754,7 +754,7 @@
   }
   if (my == My) {
     ratioj = 1;
-  } else if (DMDAYPeriodic(pt)){
+  } else if (by == DMDA_BOUNDARY_PERIODIC) {
     ratioj = my/My;
     if (ratioj*My != my) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: my/My  must be integer: my %D My %D",my,My);
   } else {
@@ -763,7 +763,7 @@
   }
   if (mz == Mz) {
     ratiok = 1;
-  } else if (DMDAZPeriodic(pt)){
+  } else if (bz == DMDA_BOUNDARY_PERIODIC) {
     ratiok = mz/Mz;
     if (ratiok*Mz != mz) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: mz/Mz  must be integer: mz %D Mz %D",mz,Mz);
   } else {
@@ -1023,7 +1023,7 @@
 {
   PetscErrorCode   ierr;
   PetscInt         dimc,Mc,Nc,Pc,mc,nc,pc,dofc,sc,dimf,Mf,Nf,Pf,mf,nf,pf,doff,sf;
-  DMDABoundaryType wrapc,wrapf;
+  DMDABoundaryType bxc,byc,bzc,bxf,byf,bzf;
   DMDAStencilType  stc,stf;
   DM_DA            *ddc = (DM_DA*)dac->data;
 
@@ -1033,12 +1033,12 @@
   PetscValidPointer(A,3);
   if (scale) PetscValidPointer(scale,4);
 
-  ierr = DMDAGetInfo(dac,&dimc,&Mc,&Nc,&Pc,&mc,&nc,&pc,&dofc,&sc,&wrapc,&stc);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,&dimf,&Mf,&Nf,&Pf,&mf,&nf,&pf,&doff,&sf,&wrapf,&stf);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dac,&dimc,&Mc,&Nc,&Pc,&mc,&nc,&pc,&dofc,&sc,&bxc,&byc,&bzc,&stc);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,&dimf,&Mf,&Nf,&Pf,&mf,&nf,&pf,&doff,&sf,&bxf,&byf,&bzf,&stf);CHKERRQ(ierr);
   if (dimc != dimf) SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Dimensions of DMDA do not match %D %D",dimc,dimf);CHKERRQ(ierr);
   if (dofc != doff) SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"DOF of DMDA do not match %D %D",dofc,doff);CHKERRQ(ierr);
   if (sc != sf) SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Stencil width of DMDA do not match %D %D",sc,sf);CHKERRQ(ierr);
-  if (wrapc != wrapf) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Periodic type different in two DMDAs");CHKERRQ(ierr);
+  if (bxc != bxf || byc != byf || bzc != bzf) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Boundary type different in two DMDAs");CHKERRQ(ierr);
   if (stc != stf) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Stencil type different in two DMDAs");CHKERRQ(ierr);
   if (Mc < 2 && Mf > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Coarse grid requires at least 2 points in x direction");
   if (dimc > 1 && Nc < 2 && Nf > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Coarse grid requires at least 2 points in y direction");
@@ -1081,21 +1081,21 @@
   PetscInt         row,i_start_ghost,j_start_ghost,mx,m_c,my,nc,ratioi,ratioj;
   PetscInt         i_start_c,j_start_c,n_c,i_start_ghost_c,j_start_ghost_c;
   PetscInt         *cols;
-  DMDABoundaryType pt;
+  DMDABoundaryType bx,by;
   Vec              vecf,vecc;
   IS               isf;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(dac,0,&Mx,&My,0,0,0,0,0,0,&pt,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,0,&mx,&my,0,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
-  if (DMDAXPeriodic(pt)){
+  ierr = DMDAGetInfo(dac,0,&Mx,&My,0,0,0,0,0,0,&bx,&by,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,0,&mx,&my,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
+  if (bx == DMDA_BOUNDARY_PERIODIC) {
     ratioi = mx/Mx;
     if (ratioi*Mx != mx) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: mx/Mx  must be integer: mx %D Mx %D",mx,Mx);
   } else {
     ratioi = (mx-1)/(Mx-1);
     if (ratioi*(Mx-1) != mx-1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: (mx - 1)/(Mx - 1) must be integer: mx %D Mx %D",mx,Mx);
   }
-  if (DMDAYPeriodic(pt)){
+  if (by == DMDA_BOUNDARY_PERIODIC) {
     ratioj = my/My;
     if (ratioj*My != my) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: my/My  must be integer: my %D My %D",my,My);
   } else {
@@ -1152,29 +1152,29 @@
   PetscInt         row,nc,dof;
   PetscInt         *idx_c,*idx_f;
   PetscInt         *cols;
-  DMDABoundaryType pt;
+  DMDABoundaryType bx,by,bz;
   Vec              vecf,vecc;
   IS               isf;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(dac,0,&Mx,&My,&Mz,0,0,0,0,0,&pt,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,0,&mx,&my,&mz,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dac,0,&Mx,&My,&Mz,0,0,0,0,0,&bx,&by,&bz,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,0,&mx,&my,&mz,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
 
-  if (DMDAXPeriodic(pt)){
+  if (bx == DMDA_BOUNDARY_PERIODIC){
     ratioi = mx/Mx;
     if (ratioi*Mx != mx) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: mx/Mx  must be integer: mx %D Mx %D",mx,Mx);
   } else {
     ratioi = (mx-1)/(Mx-1);
     if (ratioi*(Mx-1) != mx-1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: (mx - 1)/(Mx - 1) must be integer: mx %D Mx %D",mx,Mx);
   }
-  if (DMDAYPeriodic(pt)){
+  if (by == DMDA_BOUNDARY_PERIODIC){
     ratioj = my/My;
     if (ratioj*My != my) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: my/My  must be integer: my %D My %D",my,My);
   } else {
     ratioj = (my-1)/(My-1);
     if (ratioj*(My-1) != my-1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: (my - 1)/(My - 1) must be integer: my %D My %D",my,My);
   }
-  if (DMDAZPeriodic(pt)){
+  if (bz == DMDA_BOUNDARY_PERIODIC){
     ratiok = mz/Mz;
     if (ratiok*Mz != mz) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Ratio between levels: mz/Mz  must be integer: mz %D My %D",mz,Mz);
   } else {
@@ -1226,7 +1226,7 @@
 {
   PetscErrorCode   ierr;
   PetscInt         dimc,Mc,Nc,Pc,mc,nc,pc,dofc,sc,dimf,Mf,Nf,Pf,mf,nf,pf,doff,sf;
-  DMDABoundaryType wrapc,wrapf;
+  DMDABoundaryType bxc,byc,bzc,bxf,byf,bzf;
   DMDAStencilType  stc,stf;
 
   PetscFunctionBegin;
@@ -1234,12 +1234,12 @@
   PetscValidHeaderSpecific(daf,DM_CLASSID,2);
   PetscValidPointer(inject,3);
 
-  ierr = DMDAGetInfo(dac,&dimc,&Mc,&Nc,&Pc,&mc,&nc,&pc,&dofc,&sc,&wrapc,&stc);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,&dimf,&Mf,&Nf,&Pf,&mf,&nf,&pf,&doff,&sf,&wrapf,&stf);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dac,&dimc,&Mc,&Nc,&Pc,&mc,&nc,&pc,&dofc,&sc,&bxc,&byc,&bzc,&stc);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,&dimf,&Mf,&Nf,&Pf,&mf,&nf,&pf,&doff,&sf,&bxf,&byf,&bzf,&stf);CHKERRQ(ierr);
   if (dimc != dimf) SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Dimensions of DMDA do not match %D %D",dimc,dimf);CHKERRQ(ierr);
   if (dofc != doff) SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"DOF of DMDA do not match %D %D",dofc,doff);CHKERRQ(ierr);
   if (sc != sf) SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Stencil width of DMDA do not match %D %D",sc,sf);CHKERRQ(ierr);
-  if (wrapc != wrapf) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Periodic type different in two DMDAs");CHKERRQ(ierr);
+  if (bxc != bxf || byc != byf || bzc != bzf) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Boundary type different in two DMDAs");CHKERRQ(ierr);
   if (stc != stf) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Stencil type different in two DMDAs");CHKERRQ(ierr);
   if (Mc < 2) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Coarse grid requires at least 2 points in x direction");
   if (dimc > 1 && Nc < 2) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Coarse grid requires at least 2 points in y direction");
@@ -1262,7 +1262,7 @@
   PetscErrorCode   ierr;
   PetscInt         dimc,Mc,Nc,Pc,mc,nc,pc,dofc,sc;
   PetscInt         dimf,Mf,Nf,Pf,mf,nf,pf,doff,sf;
-  DMDABoundaryType wrapc,wrapf;
+  DMDABoundaryType bxc,byc,bzc,bxf,byf,bzf;
   DMDAStencilType  stc,stf;
   PetscInt         i,j,l;
   PetscInt         i_start,j_start,l_start, m_f,n_f,p_f;
@@ -1284,12 +1284,12 @@
   PetscValidHeaderSpecific(daf,DM_CLASSID,2);
   PetscValidPointer(rest,3);
 
-  ierr = DMDAGetInfo(dac,&dimc,&Mc,&Nc,&Pc,&mc,&nc,&pc,&dofc,&sc,&wrapc,&stc);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(daf,&dimf,&Mf,&Nf,&Pf,&mf,&nf,&pf,&doff,&sf,&wrapf,&stf);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dac,&dimc,&Mc,&Nc,&Pc,&mc,&nc,&pc,&dofc,&sc,&bxc,&byc,&bzc,&stc);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,&dimf,&Mf,&Nf,&Pf,&mf,&nf,&pf,&doff,&sf,&bxf,&byf,&bzf,&stf);CHKERRQ(ierr);
   if (dimc != dimf) SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Dimensions of DMDA do not match %D %D",dimc,dimf);CHKERRQ(ierr);
   if (dofc != doff) SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"DOF of DMDA do not match %D %D",dofc,doff);CHKERRQ(ierr);
   if (sc != sf) SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Stencil width of DMDA do not match %D %D",sc,sf);CHKERRQ(ierr);
-  if (wrapc != wrapf) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Periodic type different in two DMDAs");CHKERRQ(ierr);
+  if (bxc != bxf || byc != byf || bzc != bzf) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Boundary type different in two DMDAs");CHKERRQ(ierr);
   if (stc != stf) SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Stencil type different in two DMDAs");CHKERRQ(ierr);
 
   if( Mf < Mc ) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Coarse grid has more points than fine grid, Mc %D, Mf %D", Mc, Mf);
diff -r 23e7928e179a src/dm/impls/da/daload.c
--- a/src/dm/impls/da/daload.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/daload.c	Fri Mar 11 16:29:15 2011 -0700
@@ -27,7 +27,7 @@
 PetscErrorCode  DMDALoad(PetscViewer viewer,PetscInt M,PetscInt N,PetscInt P,DM *da)
 {
   PetscErrorCode ierr;
-  PetscInt       info[8],nmax = 8,i;
+  PetscInt       info[10],nmax = 10,i;
   MPI_Comm       comm;
   char           fieldnametag[32],fieldname[64];
   PetscBool      isbinary,flag;
@@ -42,14 +42,14 @@
 
   ierr = PetscOptionsGetIntArray(PETSC_NULL,"-daload_info",info,&nmax,&flag);CHKERRQ(ierr);
   if (!flag) SETERRQ(((PetscObject)viewer)->comm,PETSC_ERR_FILE_UNEXPECTED,"No DMDA information in file");
-  if (nmax != 8) SETERRQ1(((PetscObject)viewer)->comm,PETSC_ERR_FILE_UNEXPECTED,"Wrong number of items in DMDA information in file: %D",nmax);
+  if (nmax != 10) SETERRQ1(((PetscObject)viewer)->comm,PETSC_ERR_FILE_UNEXPECTED,"Wrong number of items in DMDA information in file: %D",nmax);
 
   if (info[0] == 1) {
     ierr = DMDACreate1d(comm,(DMDABoundaryType) info[7],info[1],info[4],info[5],0,da);CHKERRQ(ierr);
   } else if (info[0] == 2) {
-    ierr = DMDACreate2d(comm,(DMDABoundaryType) info[7],(DMDAStencilType) info[6],info[1],info[2],M,N,info[4],info[5],0,0,da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(comm,(DMDABoundaryType) info[7],(DMDABoundaryType) info[8],(DMDAStencilType) info[6],info[1],info[2],M,N,info[4],info[5],0,0,da);CHKERRQ(ierr);
   } else if (info[0] == 3) {
-    ierr = DMDACreate3d(comm,(DMDABoundaryType) info[7],(DMDAStencilType) info[6],info[1],info[2],info[3],M,N,P,info[4],info[5],0,0,0,da);CHKERRQ(ierr);
+    ierr = DMDACreate3d(comm,(DMDABoundaryType) info[7],(DMDABoundaryType) info[8],(DMDABoundaryType) info[9],(DMDAStencilType) info[6],info[1],info[2],info[3],M,N,P,info[4],info[5],0,0,0,da);CHKERRQ(ierr);
   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"Dimension in info file is not 1, 2, or 3 it is %D",info[0]);
 
   for (i=0; i<info[4]; i++) {
@@ -71,11 +71,11 @@
     PetscInt mlocal;
 
     if (info[0] == 1) {
-      ierr = DMDACreate1d(comm,DMDA_NONPERIODIC,info[1],1,0,0,&dac);CHKERRQ(ierr);
+      ierr = DMDACreate1d(comm,DMDA_BOUNDARY_NONE,info[1],1,0,0,&dac);CHKERRQ(ierr);
     } else if (info[0] == 2) {
-      ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,info[1],info[2],M,N,2,0,0,0,&dac);CHKERRQ(ierr);
+      ierr = DMDACreate2d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,info[1],info[2],M,N,2,0,0,0,&dac);CHKERRQ(ierr);
     } else if (info[0] == 3) {
-      ierr = DMDACreate3d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,info[1],info[2],info[3],M,N,P,3,0,0,0,0,&dac);CHKERRQ(ierr);
+      ierr = DMDACreate3d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,info[1],info[2],info[3],M,N,P,3,0,0,0,0,&dac);CHKERRQ(ierr);
     }
 
     /* this nonsense is so that the vector set to DMDASetCoordinates() does NOT have a DMDA */
diff -r 23e7928e179a src/dm/impls/da/daview.c
--- a/src/dm/impls/da/daview.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/daview.c	Fri Mar 11 16:29:15 2011 -0700
@@ -17,14 +17,14 @@
   PetscMPIInt      rank;
   PetscInt         dim,m,n,p,dof,swidth;
   DMDAStencilType  stencil;
-  DMDABoundaryType periodic;
+  DMDABoundaryType bx,by,bz;
   mxArray          *mx;
-  const char       *fnames[] = {"dimension","m","n","p","dof","stencil_width","periodicity","stencil_type"};
+  const char       *fnames[] = {"dimension","m","n","p","dof","stencil_width","bx","by","bz","stencil_type"};
 
   PetscFunctionBegin;
   ierr = MPI_Comm_rank(((PetscObject)da)->comm,&rank);CHKERRQ(ierr);
   if (!rank) {
-    ierr = DMDAGetInfo(da,&dim,&m,&n,&p,0,0,0,&dof,&swidth,&periodic,&stencil);CHKERRQ(ierr);
+    ierr = DMDAGetInfo(da,&dim,&m,&n,&p,0,0,0,&dof,&swidth,&bx,&by,&bz,&stencil);CHKERRQ(ierr);
     mx = mxCreateStructMatrix(1,1,8,(const char **)fnames);
     if (!mx) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_LIB,"Unable to generate MATLAB struct array to hold DMDA informations");
     mxSetFieldByNumber(mx,0,0,mxCreateDoubleScalar((double)dim));
@@ -33,8 +33,10 @@
     mxSetFieldByNumber(mx,0,3,mxCreateDoubleScalar((double)p));
     mxSetFieldByNumber(mx,0,4,mxCreateDoubleScalar((double)dof));
     mxSetFieldByNumber(mx,0,5,mxCreateDoubleScalar((double)swidth));
-    mxSetFieldByNumber(mx,0,6,mxCreateDoubleScalar((double)periodic));
-    mxSetFieldByNumber(mx,0,7,mxCreateDoubleScalar((double)stencil));
+    mxSetFieldByNumber(mx,0,6,mxCreateDoubleScalar((double)bx));
+    mxSetFieldByNumber(mx,0,7,mxCreateDoubleScalar((double)by));
+    mxSetFieldByNumber(mx,0,8,mxCreateDoubleScalar((double)bz));
+    mxSetFieldByNumber(mx,0,9,mxCreateDoubleScalar((double)stencil));
     ierr = PetscObjectName((PetscObject)da);CHKERRQ(ierr);
     ierr = PetscViewerMatlabPutVariable(viewer,((PetscObject)da)->name,mx);CHKERRQ(ierr);
   }
@@ -51,14 +53,14 @@
   PetscInt         i,dim,m,n,p,dof,swidth,M,N,P;
   size_t           j,len;
   DMDAStencilType  stencil;
-  DMDABoundaryType periodic;
+  DMDABoundaryType bx,by,bz;
   MPI_Comm         comm;
   DM_DA            *dd = (DM_DA*)da->data;
 
   PetscFunctionBegin;
   ierr = PetscObjectGetComm((PetscObject)da,&comm);CHKERRQ(ierr);
 
-  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,&M,&N,&P,&dof,&swidth,&periodic,&stencil);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,&M,&N,&P,&dof,&swidth,&bx,&by,&bz,&stencil);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr);
   if (!rank) {
     FILE *file;
@@ -67,7 +69,7 @@
     if (file) {
       char fieldname[PETSC_MAX_PATH_LEN];
 
-      ierr = PetscFPrintf(PETSC_COMM_SELF,file,"-daload_info %D,%D,%D,%D,%D,%D,%D,%D\n",dim,m,n,p,dof,swidth,stencil,periodic);CHKERRQ(ierr);
+      ierr = PetscFPrintf(PETSC_COMM_SELF,file,"-daload_info %D,%D,%D,%D,%D,%D,%D,%D,%D,%D\n",dim,m,n,p,dof,swidth,stencil,bx,by,bz);CHKERRQ(ierr);
       for (i=0; i<dof; i++) {
         if (dd->fieldname[i]) {
           ierr = PetscStrncpy(fieldname,dd->fieldname[i],PETSC_MAX_PATH_LEN);CHKERRQ(ierr);
@@ -94,11 +96,11 @@
     /* create the appropriate DMDA to map to natural ordering */
     ierr = DMDAGetOwnershipRanges(da,&lx,&ly,&lz);CHKERRQ(ierr);
     if (dim == 1) {
-      ierr = DMDACreate1d(comm,DMDA_NONPERIODIC,m,dim,0,lx,&dac);CHKERRQ(ierr); 
+      ierr = DMDACreate1d(comm,DMDA_BOUNDARY_NONE,m,dim,0,lx,&dac);CHKERRQ(ierr); 
     } else if (dim == 2) {
-      ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,m,n,M,N,dim,0,lx,ly,&dac);CHKERRQ(ierr); 
+      ierr = DMDACreate2d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,m,n,M,N,dim,0,lx,ly,&dac);CHKERRQ(ierr); 
     } else if (dim == 3) {
-      ierr = DMDACreate3d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,m,n,p,M,N,P,dim,0,lx,ly,lz,&dac);CHKERRQ(ierr); 
+      ierr = DMDACreate3d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,m,n,p,M,N,P,dim,0,lx,ly,lz,&dac);CHKERRQ(ierr); 
     } else SETERRQ1(comm,PETSC_ERR_ARG_CORRUPT,"Dimension is not 1 2 or 3: %D\n",dim);
     ierr = DMDACreateNaturalVector(dac,&natural);CHKERRQ(ierr);
     ierr = PetscObjectSetOptionsPrefix((PetscObject)natural,"coor_");CHKERRQ(ierr);
@@ -120,7 +122,7 @@
   DM_DA          *dd = (DM_DA*)da->data;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da, &dim, &M, &N, &P, PETSC_NULL, PETSC_NULL, PETSC_NULL, &dof, PETSC_NULL, PETSC_NULL, PETSC_NULL);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, &dim, &M, &N, &P, PETSC_NULL, PETSC_NULL, PETSC_NULL, &dof, PETSC_NULL, PETSC_NULL, PETSC_NULL, PETSC_NULL, PETSC_NULL);CHKERRQ(ierr);
   /* if (dim != 3) {SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "VTK output only works for three dimensional DMDAs.");} */
   if (!dd->coordinates) SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP, "VTK output requires DMDA coordinates.");
   /* Write Header */
@@ -158,14 +160,14 @@
 .  da - the distributed array
 
    Output Parameters:
-+  dim     - dimension of the distributed array (1, 2, or 3)
-.  M, N, P - global dimension in each direction of the array
-.  m, n, p - corresponding number of procs in each dimension
-.  dof     - number of degrees of freedom per node
-.  s       - stencil width
-.  wrap    - type of periodicity, one of DMDA_NONPERIODIC, DMDA_XPERIODIC, DMDA_YPERIODIC, 
-             DMDA_XYPERIODIC, DMDA_XYZPERIODIC, DMDA_XZPERIODIC, DMDA_YZPERIODIC,DMDA_ZPERIODIC
--  st      - stencil type, either DMDA_STENCIL_STAR or DMDA_STENCIL_BOX
++  dim      - dimension of the distributed array (1, 2, or 3)
+.  M, N, P  - global dimension in each direction of the array
+.  m, n, p  - corresponding number of procs in each dimension
+.  dof      - number of degrees of freedom per node
+.  s        - stencil width
+.  bx,by,bz - type of ghost nodes at boundary, one of DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_GHOSTED, 
+              DMDA_BOUNDARY_MIRROR, DMDA_BOUNDARY_PERIODIC
+-  st       - stencil type, either DMDA_STENCIL_STAR or DMDA_STENCIL_BOX
 
    Level: beginner
   
@@ -176,7 +178,7 @@
 
 .seealso: DMView(), DMDAGetCorners(), DMDAGetLocalInfo()
 @*/
-PetscErrorCode  DMDAGetInfo(DM da,PetscInt *dim,PetscInt *M,PetscInt *N,PetscInt *P,PetscInt *m,PetscInt *n,PetscInt *p,PetscInt *dof,PetscInt *s,DMDABoundaryType *wrap,DMDAStencilType *st)
+PetscErrorCode  DMDAGetInfo(DM da,PetscInt *dim,PetscInt *M,PetscInt *N,PetscInt *P,PetscInt *m,PetscInt *n,PetscInt *p,PetscInt *dof,PetscInt *s,DMDABoundaryType *bx,DMDABoundaryType *by,DMDABoundaryType *bz,DMDAStencilType *st)
 {
   DM_DA *dd = (DM_DA*)da->data;
 
@@ -191,7 +193,9 @@
   if (p)    *p    = dd->p;
   if (dof)  *dof  = dd->w;
   if (s)    *s    = dd->s;
-  if (wrap) *wrap = dd->wrap;
+  if (bx) *bx = dd->bx;
+  if (by) *by = dd->by;
+  if (bz) *bz = dd->bz;
   if (st)   *st   = dd->stencil_type;
   PetscFunctionReturn(0);
 }  
@@ -230,7 +234,9 @@
   info->mz   = dd->P;
   info->dof  = dd->w;
   info->sw   = dd->s;
-  info->pt   = dd->wrap;
+  info->bx   = dd->bx;
+  info->by   = dd->by;
+  info->bz   = dd->bz;
   info->st   = dd->stencil_type;
 
   /* since the xs, xe ... have all been multiplied by the number of degrees 
diff -r 23e7928e179a src/dm/impls/da/f90-custom/zda1f90.c
--- a/src/dm/impls/da/f90-custom/zda1f90.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/f90-custom/zda1f90.c	Fri Mar 11 16:29:15 2011 -0700
@@ -34,7 +34,7 @@
 
   *ierr = DMDAGetCorners(*da,&xs,&ys,&zs,&xm,&ym,&zm);if (*ierr) return;
   *ierr = DMDAGetGhostCorners(*da,&gxs,&gys,&gzs,&gxm,&gym,&gzm);if (*ierr) return;
-  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,&dof,0,0,0);if (*ierr) return;
+  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,&dof,0,0,0,0,0);if (*ierr) return;
 
   /* Handle case where user passes in global vector as opposed to local */
   *ierr = VecGetLocalSize(*v,&N);if (*ierr) return;
@@ -65,7 +65,7 @@
 
   *ierr = DMDAGetCorners(*da,&xs,&ys,&zs,&xm,&ym,&zm);if (*ierr) return;
   *ierr = DMDAGetGhostCorners(*da,&gxs,&gys,&gzs,&gxm,&gym,&gzm);if (*ierr) return;
-  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,&dof,0,0,0);if (*ierr) return;
+  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,&dof,0,0,0,0,0);if (*ierr) return;
 
   /* Handle case where user passes in global vector as opposed to local */
   *ierr = VecGetLocalSize(*v,&N);if (*ierr) return;
@@ -102,7 +102,7 @@
 
   *ierr = DMDAGetCorners(*da,&xs,&ys,&zs,&xm,&ym,&zm);if (*ierr) return;
   *ierr = DMDAGetGhostCorners(*da,&gxs,&gys,&gzs,&gxm,&gym,&gzm);if (*ierr) return;
-  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,&dof,0,0,0);if (*ierr) return;
+  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,&dof,0,0,0,0,0);if (*ierr) return;
 
   /* Handle case where user passes in global vector as opposed to local */
   *ierr = VecGetLocalSize(*v,&N);if (*ierr) return;
@@ -141,7 +141,7 @@
 
   *ierr = DMDAGetCorners(*da,&xs,&ys,&zs,&xm,&ym,&zm);if (*ierr) return;
   *ierr = DMDAGetGhostCorners(*da,&gxs,&gys,&gzs,&gxm,&gym,&gzm);if (*ierr) return;
-  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,&dof,0,0,0);if (*ierr) return;
+  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,&dof,0,0,0,0,0);if (*ierr) return;
 
   /* Handle case where user passes in global vector as opposed to local */
   *ierr = VecGetLocalSize(*v,&N);if (*ierr) return;
diff -r 23e7928e179a src/dm/impls/da/fdda.c
--- a/src/dm/impls/da/fdda.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/fdda.c	Fri Mar 11 16:29:15 2011 -0700
@@ -131,7 +131,7 @@
 {
   PetscErrorCode   ierr;
   PetscInt         dim,m,n,p,nc;
-  DMDABoundaryType wrap;
+  DMDABoundaryType bx,by,bz;
   MPI_Comm         comm;
   PetscMPIInt      size;
   PetscBool        isBAIJ;
@@ -160,7 +160,7 @@
          col - number of colors needed in one direction for single component problem
   
   */  
-  ierr = DMDAGetInfo(da,&dim,0,0,0,&m,&n,&p,&nc,0,&wrap,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,0,0,0,&m,&n,&p,&nc,0,&bx,&by,&bz,0);CHKERRQ(ierr);
 
   ierr = PetscObjectGetComm((PetscObject)da,&comm);CHKERRQ(ierr);
   ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr);
@@ -168,7 +168,7 @@
     if (size == 1) {
       ctype = IS_COLORING_GLOBAL;
     } else if (dim > 1){
-      if ((m==1 && DMDAXPeriodic(wrap)) || (n==1 && DMDAYPeriodic(wrap)) || (p==1 && DMDAZPeriodic(wrap))){
+      if ((m==1 && bx == DMDA_BOUNDARY_PERIODIC) || (n==1 && by == DMDA_BOUNDARY_PERIODIC) || (p==1 && bz == DMDA_BOUNDARY_PERIODIC)){
         SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"IS_COLORING_GHOSTED cannot be used for periodic boundary condition having both ends of the domain  on the same process");
       }
     }
@@ -221,7 +221,7 @@
   PetscInt               xs,ys,nx,ny,i,j,ii,gxs,gys,gnx,gny,m,n,M,N,dim,s,k,nc,col;
   PetscInt               ncolors;
   MPI_Comm               comm;
-  DMDABoundaryType       wrap;
+  DMDABoundaryType       bx,by;
   DMDAStencilType        st;
   ISColoringValue        *colors;
   DM_DA                  *dd = (DM_DA*)da->data;
@@ -232,7 +232,7 @@
          col - number of colors needed in one direction for single component problem
   
   */
-  ierr = DMDAGetInfo(da,&dim,&m,&n,0,&M,&N,0,&nc,&s,&wrap,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,&n,0,&M,&N,0,&nc,&s,&bx,&by,0,&st);CHKERRQ(ierr);
   col    = 2*s + 1;
   ierr = DMDAGetCorners(da,&xs,&ys,0,&nx,&ny,0);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(da,&gxs,&gys,0,&gnx,&gny,0);CHKERRQ(ierr);
@@ -243,11 +243,11 @@
     ierr = DMGetColoring_DA_2d_5pt_MPIAIJ(da,ctype,coloring);CHKERRQ(ierr);
   } else {
 
-    if (DMDAXPeriodic(wrap) && (m % col)){ 
+    if (bx == DMDA_BOUNDARY_PERIODIC && (m % col)){ 
       SETERRQ2(((PetscObject)da)->comm,PETSC_ERR_SUP,"For coloring efficiency ensure number of grid points in X (%d) is divisible\n\
                  by 2*stencil_width + 1 (%d)\n", m, col);
     }
-    if (DMDAYPeriodic(wrap) && (n % col)){ 
+    if (by == DMDA_BOUNDARY_PERIODIC && (n % col)){ 
       SETERRQ2(((PetscObject)da)->comm,PETSC_ERR_SUP,"For coloring efficiency ensure number of grid points in Y (%d) is divisible\n\
                  by 2*stencil_width + 1 (%d)\n", n, col);
     }
@@ -301,7 +301,7 @@
   PetscInt          xs,ys,nx,ny,i,j,gxs,gys,gnx,gny,m,n,p,dim,s,k,nc,col,zs,gzs,ii,l,nz,gnz,M,N,P;
   PetscInt          ncolors;
   MPI_Comm          comm;
-  DMDABoundaryType  wrap;
+  DMDABoundaryType  bx,by,bz;
   DMDAStencilType   st;
   ISColoringValue   *colors;
   DM_DA             *dd = (DM_DA*)da->data;
@@ -312,17 +312,17 @@
          col - number of colors needed in one direction for single component problem
   
   */
-  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,&M,&N,&P,&nc,&s,&wrap,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,&M,&N,&P,&nc,&s,&bx,&by,&bz,&st);CHKERRQ(ierr);
   col    = 2*s + 1;
-  if (DMDAXPeriodic(wrap) && (m % col)){ 
+  if (bx == DMDA_BOUNDARY_PERIODIC && (m % col)){ 
     SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"For coloring efficiency ensure number of grid points in X is divisible\n\
                  by 2*stencil_width + 1\n");
   }
-  if (DMDAYPeriodic(wrap) && (n % col)){ 
+  if (by == DMDA_BOUNDARY_PERIODIC && (n % col)){ 
     SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"For coloring efficiency ensure number of grid points in Y is divisible\n\
                  by 2*stencil_width + 1\n");
   }
-  if (DMDAZPeriodic(wrap) && (p % col)){ 
+  if (bz == DMDA_BOUNDARY_PERIODIC && (p % col)){ 
     SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"For coloring efficiency ensure number of grid points in Z is divisible\n\
                  by 2*stencil_width + 1\n");
   }
@@ -383,7 +383,7 @@
   PetscInt          xs,nx,i,i1,gxs,gnx,l,m,M,dim,s,nc,col;
   PetscInt          ncolors;
   MPI_Comm          comm;
-  DMDABoundaryType  wrap;
+  DMDABoundaryType  bx;
   ISColoringValue   *colors;
   DM_DA             *dd = (DM_DA*)da->data;
 
@@ -393,10 +393,10 @@
          col - number of colors needed in one direction for single component problem
   
   */
-  ierr = DMDAGetInfo(da,&dim,&m,0,0,&M,0,0,&nc,&s,&wrap,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,0,0,&M,0,0,&nc,&s,&bx,0,0,0);CHKERRQ(ierr);
   col    = 2*s + 1;
 
-  if (DMDAXPeriodic(wrap) && (m % col)) {
+  if (bx == DMDA_BOUNDARY_PERIODIC && (m % col)) {
     SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"For coloring efficiency ensure number of grid points is divisible\n\
                  by 2*stencil_width + 1\n");
   }
@@ -447,7 +447,7 @@
   PetscInt          xs,ys,nx,ny,i,j,ii,gxs,gys,gnx,gny,m,n,dim,s,k,nc;
   PetscInt          ncolors;
   MPI_Comm          comm;
-  DMDABoundaryType  wrap;
+  DMDABoundaryType  bx,by;
   ISColoringValue   *colors;
   DM_DA             *dd = (DM_DA*)da->data;
 
@@ -457,16 +457,16 @@
          col - number of colors needed in one direction for single component problem
   
   */
-  ierr   = DMDAGetInfo(da,&dim,&m,&n,0,0,0,0,&nc,&s,&wrap,0);CHKERRQ(ierr);
+  ierr   = DMDAGetInfo(da,&dim,&m,&n,0,0,0,0,&nc,&s,&bx,&by,0,0);CHKERRQ(ierr);
   ierr   = DMDAGetCorners(da,&xs,&ys,0,&nx,&ny,0);CHKERRQ(ierr);
   ierr   = DMDAGetGhostCorners(da,&gxs,&gys,0,&gnx,&gny,0);CHKERRQ(ierr);
   ierr   = PetscObjectGetComm((PetscObject)da,&comm);CHKERRQ(ierr);
 
-  if (DMDAXPeriodic(wrap) && (m % 5)){ 
+  if (bx == DMDA_BOUNDARY_PERIODIC && (m % 5)){ 
     SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"For coloring efficiency ensure number of grid points in X is divisible\n\
                  by 5\n");
   }
-  if (DMDAYPeriodic(wrap) && (n % 5)){ 
+  if (by == DMDA_BOUNDARY_PERIODIC && (n % 5)){ 
     SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"For coloring efficiency ensure number of grid points in Y is divisible\n\
                  by 5\n");
   }
@@ -669,7 +669,7 @@
          col - number of colors needed in one direction for single component problem
   
   */
-  ierr = DMDAGetInfo(da,&dim,&M,&N,&P,0,0,0,&dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&M,&N,&P,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da,0,0,0,&nx,&ny,&nz);CHKERRQ(ierr);
   ierr = PetscObjectGetComm((PetscObject)da,&comm);CHKERRQ(ierr);
   ierr = MatCreate(comm,&A);CHKERRQ(ierr);
@@ -762,7 +762,7 @@
   PetscInt               lstart,lend,pstart,pend,*dnz,*onz;
   MPI_Comm               comm;
   PetscScalar            *values;
-  DMDABoundaryType       wrap;
+  DMDABoundaryType       bx,by;
   ISLocalToGlobalMapping ltog,ltogb;
   DMDAStencilType        st;
   DM_DA                  *dd = (DM_DA*)da->data;
@@ -773,7 +773,7 @@
          col - number of colors needed in one direction for single component problem
   
   */
-  ierr = DMDAGetInfo(da,&dim,&m,&n,0,0,0,0,&nc,&s,&wrap,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,&n,0,0,0,0,&nc,&s,&bx,&by,0,&st);CHKERRQ(ierr);
   col = 2*s + 1;
   ierr = DMDAGetCorners(da,&xs,&ys,0,&nx,&ny,0);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(da,&gxs,&gys,0,&gnx,&gny,0);CHKERRQ(ierr);
@@ -787,14 +787,14 @@
   ierr = MatPreallocateInitialize(comm,nc*nx*ny,nc*nx*ny,dnz,onz);CHKERRQ(ierr);
   for (i=xs; i<xs+nx; i++) {
 
-    pstart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-    pend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+    pstart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+    pend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
 
     for (j=ys; j<ys+ny; j++) {
       slot = i - gxs + gnx*(j - gys);
 
-      lstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-      lend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+      lstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+      lend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
 
       cnt  = 0;
       for (k=0; k<nc; k++) {
@@ -828,14 +828,14 @@
     ierr = PetscMemzero(values,col*col*nc*nc*sizeof(PetscScalar));CHKERRQ(ierr);
     for (i=xs; i<xs+nx; i++) {
     
-      pstart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-      pend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+      pstart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+      pend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
       
       for (j=ys; j<ys+ny; j++) {
 	slot = i - gxs + gnx*(j - gys);
       
-	lstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-	lend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1)); 
+	lstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+	lend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1)); 
 
 	cnt  = 0;
 	for (k=0; k<nc; k++) {
@@ -871,7 +871,7 @@
   PetscInt               ifill_col,*ofill = dd->ofill, *dfill = dd->dfill;
   MPI_Comm               comm;
   PetscScalar            *values;
-  DMDABoundaryType       wrap;
+  DMDABoundaryType       bx,by;
   ISLocalToGlobalMapping ltog,ltogb;
   DMDAStencilType        st;
 
@@ -881,7 +881,7 @@
          col - number of colors needed in one direction for single component problem
   
   */
-  ierr = DMDAGetInfo(da,&dim,&m,&n,0,0,0,0,&nc,&s,&wrap,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,&n,0,0,0,0,&nc,&s,&bx,&by,0,&st);CHKERRQ(ierr);
   col = 2*s + 1;
   ierr = DMDAGetCorners(da,&xs,&ys,0,&nx,&ny,0);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(da,&gxs,&gys,0,&gnx,&gny,0);CHKERRQ(ierr);
@@ -895,14 +895,14 @@
   ierr = MatPreallocateInitialize(comm,nc*nx*ny,nc*nx*ny,dnz,onz);CHKERRQ(ierr);
   for (i=xs; i<xs+nx; i++) {
 
-    pstart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-    pend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+    pstart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+    pend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
 
     for (j=ys; j<ys+ny; j++) {
       slot = i - gxs + gnx*(j - gys);
 
-      lstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-      lend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+      lstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+      lend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
 
       for (k=0; k<nc; k++) {
         cnt  = 0;
@@ -945,14 +945,14 @@
     ierr = PetscMemzero(values,col*col*nc*nc*sizeof(PetscScalar));CHKERRQ(ierr);
     for (i=xs; i<xs+nx; i++) {
     
-      pstart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-      pend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+      pstart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+      pend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
       
       for (j=ys; j<ys+ny; j++) {
 	slot = i - gxs + gnx*(j - gys);
       
-	lstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-	lend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1)); 
+	lstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+	lend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1)); 
 
 	for (k=0; k<nc; k++) {
 	  cnt  = 0;
@@ -999,7 +999,7 @@
   PetscInt               istart,iend,jstart,jend,kstart,kend,zs,nz,gzs,gnz,ii,jj,kk;
   MPI_Comm               comm;
   PetscScalar            *values;
-  DMDABoundaryType       wrap;
+  DMDABoundaryType       bx,by,bz;
   ISLocalToGlobalMapping ltog,ltogb;
   DMDAStencilType        st;
   DM_DA                  *dd = (DM_DA*)da->data;
@@ -1010,7 +1010,7 @@
          col - number of colors needed in one direction for single component problem
   
   */
-  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,0,0,0,&nc,&s,&wrap,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,0,0,0,&nc,&s,&bx,&by,&bz,&st);CHKERRQ(ierr);
   col    = 2*s + 1;
 
   ierr = DMDAGetCorners(da,&xs,&ys,&zs,&nx,&ny,&nz);CHKERRQ(ierr);
@@ -1024,14 +1024,14 @@
   /* determine the matrix preallocation information */
   ierr = MatPreallocateInitialize(comm,nc*nx*ny*nz,nc*nx*ny*nz,dnz,onz);CHKERRQ(ierr);
   for (i=xs; i<xs+nx; i++) {
-    istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-    iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+    istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+    iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
     for (j=ys; j<ys+ny; j++) {
-      jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-      jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+      jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+      jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
       for (k=zs; k<zs+nz; k++) {
-	kstart = DMDAZPeriodic(wrap) ? -s : (PetscMax(-s,-k)); 
-	kend   = DMDAZPeriodic(wrap) ?  s : (PetscMin(s,p-k-1));
+	kstart = (bz == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-k)); 
+	kend   = (bz == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,p-k-1));
 	
 	slot = i - gxs + gnx*(j - gys) + gnx*gny*(k - gzs);
 	
@@ -1068,14 +1068,14 @@
     ierr = PetscMalloc(col*col*col*nc*nc*nc*sizeof(PetscScalar),&values);CHKERRQ(ierr);
     ierr = PetscMemzero(values,col*col*col*nc*nc*nc*sizeof(PetscScalar));CHKERRQ(ierr);
     for (i=xs; i<xs+nx; i++) {
-      istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-      iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+      istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+      iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
       for (j=ys; j<ys+ny; j++) {
-	jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-	jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+	jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+	jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
 	for (k=zs; k<zs+nz; k++) {
-	  kstart = DMDAZPeriodic(wrap) ? -s : (PetscMax(-s,-k)); 
-	  kend   = DMDAZPeriodic(wrap) ?  s : (PetscMin(s,p-k-1));
+	  kstart = (bz == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-k)); 
+	  kend   = (bz == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,p-k-1));
 	
 	  slot = i - gxs + gnx*(j - gys) + gnx*gny*(k - gzs);
 	
@@ -1115,7 +1115,7 @@
   PetscInt               m,dim,s,*cols = PETSC_NULL,nc,*rows = PETSC_NULL,col,cnt,l;
   PetscInt               istart,iend;
   PetscScalar            *values;
-  DMDABoundaryType       wrap;
+  DMDABoundaryType       bx;
   ISLocalToGlobalMapping ltog,ltogb;
   DM_DA                  *dd = (DM_DA*)da->data;
 
@@ -1125,7 +1125,7 @@
          col - number of colors needed in one direction for single component problem
   
   */
-  ierr = DMDAGetInfo(da,&dim,&m,0,0,0,0,0,&nc,&s,&wrap,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,0,0,0,0,0,&nc,&s,&bx,0,0,0);CHKERRQ(ierr);
   col    = 2*s + 1;
 
   ierr = DMDAGetCorners(da,&xs,0,0,&nx,0,0);CHKERRQ(ierr);
@@ -1181,7 +1181,7 @@
   PetscInt               istart,iend,jstart,jend,ii,jj;
   MPI_Comm               comm;
   PetscScalar            *values;
-  DMDABoundaryType       wrap;
+  DMDABoundaryType       bx,by;
   DMDAStencilType        st;
   ISLocalToGlobalMapping ltog,ltogb;
   DM_DA                  *dd = (DM_DA*)da->data;
@@ -1191,7 +1191,7 @@
      nc - number of components per grid point 
      col - number of colors needed in one direction for single component problem
   */
-  ierr = DMDAGetInfo(da,&dim,&m,&n,0,0,0,0,&nc,&s,&wrap,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,&n,0,0,0,0,&nc,&s,&bx,&by,0,&st);CHKERRQ(ierr);
   col = 2*s + 1;
 
   ierr = DMDAGetCorners(da,&xs,&ys,0,&nx,&ny,0);CHKERRQ(ierr);
@@ -1206,11 +1206,11 @@
   /* determine the matrix preallocation information */
   ierr = MatPreallocateInitialize(comm,nx*ny,nx*ny,dnz,onz);CHKERRQ(ierr);
   for (i=xs; i<xs+nx; i++) {
-    istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-    iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+    istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+    iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
     for (j=ys; j<ys+ny; j++) {
-      jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-      jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+      jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+      jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
       slot = i - gxs + gnx*(j - gys); 
 
       /* Find block columns in block row */
@@ -1241,11 +1241,11 @@
     ierr = PetscMalloc(col*col*nc*nc*sizeof(PetscScalar),&values);CHKERRQ(ierr);
     ierr = PetscMemzero(values,col*col*nc*nc*sizeof(PetscScalar));CHKERRQ(ierr);
     for (i=xs; i<xs+nx; i++) {
-      istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-      iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+      istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+      iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
       for (j=ys; j<ys+ny; j++) {
-	jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-	jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+	jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+	jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
 	slot = i - gxs + gnx*(j - gys); 
 	cnt  = 0;
         for (ii=istart; ii<iend+1; ii++) {
@@ -1276,7 +1276,7 @@
   PetscInt               istart,iend,jstart,jend,kstart,kend,zs,nz,gzs,gnz,ii,jj,kk;
   MPI_Comm               comm;
   PetscScalar            *values;
-  DMDABoundaryType       wrap;
+  DMDABoundaryType       bx,by,bz;
   DMDAStencilType        st;
   ISLocalToGlobalMapping ltog,ltogb;
   DM_DA                  *dd = (DM_DA*)da->data;
@@ -1287,7 +1287,7 @@
          col - number of colors needed in one direction for single component problem
   
   */
-  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,0,0,0,&nc,&s,&wrap,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,0,0,0,&nc,&s,&bx,&by,&bz,&st);CHKERRQ(ierr);
   col    = 2*s + 1;
 
   ierr = DMDAGetCorners(da,&xs,&ys,&zs,&nx,&ny,&nz);CHKERRQ(ierr);
@@ -1302,14 +1302,14 @@
   /* determine the matrix preallocation information */
   ierr = MatPreallocateInitialize(comm,nx*ny*nz,nx*ny*nz,dnz,onz);CHKERRQ(ierr);
   for (i=xs; i<xs+nx; i++) {
-    istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-    iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+    istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+    iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
     for (j=ys; j<ys+ny; j++) {
-      jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-      jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+      jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+      jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
       for (k=zs; k<zs+nz; k++) {
-	kstart = DMDAZPeriodic(wrap) ? -s : (PetscMax(-s,-k)); 
-	kend   = DMDAZPeriodic(wrap) ?  s : (PetscMin(s,p-k-1));
+	kstart = (bz == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-k)); 
+	kend   = (bz == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,p-k-1));
 
 	slot = i - gxs + gnx*(j - gys) + gnx*gny*(k - gzs);
 
@@ -1344,14 +1344,14 @@
     ierr  = PetscMalloc(col*col*col*nc*nc*sizeof(PetscScalar),&values);CHKERRQ(ierr);
     ierr  = PetscMemzero(values,col*col*col*nc*nc*sizeof(PetscScalar));CHKERRQ(ierr);
     for (i=xs; i<xs+nx; i++) {
-      istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-      iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+      istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+      iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
       for (j=ys; j<ys+ny; j++) {
-	jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-	jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+	jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+	jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
 	for (k=zs; k<zs+nz; k++) {
-	  kstart = DMDAZPeriodic(wrap) ? -s : (PetscMax(-s,-k)); 
-	  kend   = DMDAZPeriodic(wrap) ?  s : (PetscMin(s,p-k-1));
+	  kstart = (bz == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-k)); 
+	  kend   = (bz == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,p-k-1));
 	
 	  slot = i - gxs + gnx*(j - gys) + gnx*gny*(k - gzs);
 	
@@ -1408,7 +1408,7 @@
   PetscInt               istart,iend,jstart,jend,ii,jj;
   MPI_Comm               comm;
   PetscScalar            *values;
-  DMDABoundaryType       wrap;
+  DMDABoundaryType       bx,by;
   DMDAStencilType        st;
   ISLocalToGlobalMapping ltog,ltogb;
   DM_DA                  *dd = (DM_DA*)da->data;
@@ -1418,7 +1418,7 @@
      nc - number of components per grid point 
      col - number of colors needed in one direction for single component problem
   */
-  ierr = DMDAGetInfo(da,&dim,&m,&n,0,0,0,0,&nc,&s,&wrap,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,&n,0,0,0,0,&nc,&s,&bx,&by,0,&st);CHKERRQ(ierr);
   col = 2*s + 1;
 
   ierr = DMDAGetCorners(da,&xs,&ys,0,&nx,&ny,0);CHKERRQ(ierr);
@@ -1433,11 +1433,11 @@
   /* determine the matrix preallocation information */
   ierr = MatPreallocateSymmetricInitialize(comm,nx*ny,nx*ny,dnz,onz);CHKERRQ(ierr);
   for (i=xs; i<xs+nx; i++) {
-    istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-    iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+    istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+    iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
     for (j=ys; j<ys+ny; j++) {
-      jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j));
-      jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+      jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j));
+      jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
       slot = i - gxs + gnx*(j - gys);
 
       /* Find block columns in block row */
@@ -1469,11 +1469,11 @@
     ierr = PetscMalloc(col*col*nc*nc*sizeof(PetscScalar),&values);CHKERRQ(ierr);
     ierr = PetscMemzero(values,col*col*nc*nc*sizeof(PetscScalar));CHKERRQ(ierr);
     for (i=xs; i<xs+nx; i++) {
-      istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-      iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+      istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+      iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
       for (j=ys; j<ys+ny; j++) {
-        jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j));
-        jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+        jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j));
+        jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
         slot = i - gxs + gnx*(j - gys);
 
         /* Find block columns in block row */
@@ -1507,7 +1507,7 @@
   PetscInt               istart,iend,jstart,jend,kstart,kend,zs,nz,gzs,gnz,ii,jj,kk;
   MPI_Comm               comm;
   PetscScalar            *values;
-  DMDABoundaryType       wrap;
+  DMDABoundaryType       bx,by,bz;
   DMDAStencilType        st;
   ISLocalToGlobalMapping ltog,ltogb;
   DM_DA                  *dd = (DM_DA*)da->data;
@@ -1517,7 +1517,7 @@
      nc - number of components per grid point 
      col - number of colors needed in one direction for single component problem 
   */
-  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,0,0,0,&nc,&s,&wrap,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,0,0,0,&nc,&s,&bx,&by,&bz,&st);CHKERRQ(ierr);
   col = 2*s + 1;
 
   ierr = DMDAGetCorners(da,&xs,&ys,&zs,&nx,&ny,&nz);CHKERRQ(ierr);
@@ -1533,14 +1533,14 @@
   /* determine the matrix preallocation information */
   ierr = MatPreallocateSymmetricInitialize(comm,nx*ny*nz,nx*ny*nz,dnz,onz);CHKERRQ(ierr);
   for (i=xs; i<xs+nx; i++) {
-    istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-    iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+    istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+    iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
     for (j=ys; j<ys+ny; j++) {
-      jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j));
-      jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+      jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j));
+      jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
       for (k=zs; k<zs+nz; k++) {
-        kstart = DMDAZPeriodic(wrap) ? -s : (PetscMax(-s,-k));
-	kend   = DMDAZPeriodic(wrap) ?  s : (PetscMin(s,p-k-1));
+        kstart = (bz == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-k));
+	kend   = (bz == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,p-k-1));
 
 	slot = i - gxs + gnx*(j - gys) + gnx*gny*(k - gzs);
 
@@ -1576,14 +1576,14 @@
     ierr = PetscMalloc(col*col*col*nc*nc*sizeof(PetscScalar),&values);CHKERRQ(ierr);
     ierr = PetscMemzero(values,col*col*col*nc*nc*sizeof(PetscScalar));CHKERRQ(ierr);
     for (i=xs; i<xs+nx; i++) {
-      istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-      iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+      istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+      iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
       for (j=ys; j<ys+ny; j++) {
-        jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j));
-	jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+        jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j));
+	jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
 	for (k=zs; k<zs+nz; k++) {
-          kstart = DMDAZPeriodic(wrap) ? -s : (PetscMax(-s,-k));
-	  kend   = DMDAZPeriodic(wrap) ?  s : (PetscMin(s,p-k-1));
+          kstart = (bz == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-k));
+	  kend   = (bz == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,p-k-1));
 	  
 	  slot = i - gxs + gnx*(j - gys) + gnx*gny*(k - gzs);
 	  
@@ -1624,7 +1624,7 @@
   PetscInt               ifill_col,*dfill = dd->dfill,*ofill = dd->ofill;
   MPI_Comm               comm;
   PetscScalar            *values;
-  DMDABoundaryType       wrap;
+  DMDABoundaryType       bx,by,bz;
   ISLocalToGlobalMapping ltog,ltogb;
   DMDAStencilType        st;
 
@@ -1634,17 +1634,17 @@
          col - number of colors needed in one direction for single component problem
   
   */
-  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,0,0,0,&nc,&s,&wrap,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&m,&n,&p,0,0,0,&nc,&s,&bx,&by,&bz,&st);CHKERRQ(ierr);
   col    = 2*s + 1;
-  if (DMDAXPeriodic(wrap) && (m % col)){ 
+  if (bx == DMDA_BOUNDARY_PERIODIC && (m % col)){ 
     SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"For coloring efficiency ensure number of grid points in X is divisible\n\
                  by 2*stencil_width + 1\n");
   }
-  if (DMDAYPeriodic(wrap) && (n % col)){ 
+  if (by == DMDA_BOUNDARY_PERIODIC && (n % col)){ 
     SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"For coloring efficiency ensure number of grid points in Y is divisible\n\
                  by 2*stencil_width + 1\n");
   }
-  if (DMDAZPeriodic(wrap) && (p % col)){ 
+  if (bz == DMDA_BOUNDARY_PERIODIC && (p % col)){ 
     SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"For coloring efficiency ensure number of grid points in Z is divisible\n\
                  by 2*stencil_width + 1\n");
   }
@@ -1662,14 +1662,14 @@
 
 
   for (i=xs; i<xs+nx; i++) {
-    istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-    iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+    istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+    iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
     for (j=ys; j<ys+ny; j++) {
-      jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-      jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+      jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+      jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
       for (k=zs; k<zs+nz; k++) {
-        kstart = DMDAZPeriodic(wrap) ? -s : (PetscMax(-s,-k)); 
-        kend   = DMDAZPeriodic(wrap) ?  s : (PetscMin(s,p-k-1));
+        kstart = (bz == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-k)); 
+        kend   = (bz == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,p-k-1));
 	
         slot = i - gxs + gnx*(j - gys) + gnx*gny*(k - gzs);
 	
@@ -1716,14 +1716,14 @@
     ierr = PetscMalloc(col*col*col*nc*nc*nc*sizeof(PetscScalar),&values);CHKERRQ(ierr);
     ierr = PetscMemzero(values,col*col*col*nc*nc*nc*sizeof(PetscScalar));CHKERRQ(ierr);
     for (i=xs; i<xs+nx; i++) {
-      istart = DMDAXPeriodic(wrap) ? -s : (PetscMax(-s,-i));
-      iend   = DMDAXPeriodic(wrap) ?  s : (PetscMin(s,m-i-1));
+      istart = (bx == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-i));
+      iend   = (bx == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,m-i-1));
       for (j=ys; j<ys+ny; j++) {
-	jstart = DMDAYPeriodic(wrap) ? -s : (PetscMax(-s,-j)); 
-	jend   = DMDAYPeriodic(wrap) ?  s : (PetscMin(s,n-j-1));
+	jstart = (by == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-j)); 
+	jend   = (by == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,n-j-1));
 	for (k=zs; k<zs+nz; k++) {
-	  kstart = DMDAZPeriodic(wrap) ? -s : (PetscMax(-s,-k)); 
-	  kend   = DMDAZPeriodic(wrap) ?  s : (PetscMin(s,p-k-1));
+	  kstart = (bz == DMDA_BOUNDARY_PERIODIC) ? -s : (PetscMax(-s,-k)); 
+	  kend   = (bz == DMDA_BOUNDARY_PERIODIC) ?  s : (PetscMin(s,p-k-1));
 	  
 	  slot = i - gxs + gnx*(j - gys) + gnx*gny*(k - gzs);
 	  
diff -r 23e7928e179a src/dm/impls/da/ftn-custom/zda1f.c
--- a/src/dm/impls/da/ftn-custom/zda1f.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/ftn-custom/zda1f.c	Fri Mar 11 16:29:15 2011 -0700
@@ -10,11 +10,11 @@
 
 EXTERN_C_BEGIN
 
-void PETSC_STDCALL dmdacreate1d_(MPI_Comm *comm,DMDABoundaryType *wrap,PetscInt *M,PetscInt *w,PetscInt *s,
+void PETSC_STDCALL dmdacreate1d_(MPI_Comm *comm,DMDABoundaryType *bx,PetscInt *M,PetscInt *w,PetscInt *s,
                  PetscInt *lc,DM *inra,PetscErrorCode *ierr)
 {
  CHKFORTRANNULLINTEGER(lc);
-  *ierr = DMDACreate1d(MPI_Comm_f2c(*(MPI_Fint *)&*comm),*wrap,*M,*w,*s,lc,inra);
+  *ierr = DMDACreate1d(MPI_Comm_f2c(*(MPI_Fint *)&*comm),*bx,*M,*w,*s,lc,inra);
 }
 EXTERN_C_END
 
diff -r 23e7928e179a src/dm/impls/da/ftn-custom/zda2f.c
--- a/src/dm/impls/da/ftn-custom/zda2f.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/ftn-custom/zda2f.c	Fri Mar 11 16:29:15 2011 -0700
@@ -56,7 +56,7 @@
   PetscInt dim;
 
   PetscObjectAllocateFortranPointers(*da,6);
-  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,0,0,0,0); if (*ierr) return;
+  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,0,0,0,0,0,0); if (*ierr) return;
   if (dim == 2) {
     ((PetscObject)*da)->fortran_func_pointers[1] = (PetscVoidFunction)jac;
     *ierr = DMDASetLocalJacobian(*da,(DMDALocalFunction1)ourlj2d);
@@ -97,7 +97,7 @@
   PetscInt dim;
 
   PetscObjectAllocateFortranPointers(*da,6);
-  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,0,0,0,0); if (*ierr) return;
+  *ierr = DMDAGetInfo(*da,&dim,0,0,0,0,0,0,0,0,0,0,0,0); if (*ierr) return;
   if (dim == 2) {
     ((PetscObject)*da)->fortran_func_pointers[4] = (PetscVoidFunction)func;
     *ierr = DMDASetLocalFunction(*da,(DMDALocalFunction1)ourlf2d);
@@ -112,13 +112,13 @@
 
 /************************************************/
 
-void PETSC_STDCALL dmdacreate2d_(MPI_Comm *comm,DMDABoundaryType *wrap,DMDAStencilType
+void PETSC_STDCALL dmdacreate2d_(MPI_Comm *comm,DMDABoundaryType *bx,DMDABoundaryType *by,DMDAStencilType
                   *stencil_type,PetscInt *M,PetscInt *N,PetscInt *m,PetscInt *n,PetscInt *w,
                   PetscInt *s,PetscInt *lx,PetscInt *ly,DM *inra,PetscErrorCode *ierr)
 {
   CHKFORTRANNULLINTEGER(lx);
   CHKFORTRANNULLINTEGER(ly);
-  *ierr = DMDACreate2d(MPI_Comm_f2c(*(MPI_Fint *)&*comm),*wrap,*stencil_type,*M,*N,*m,*n,*w,*s,lx,ly,inra);
+  *ierr = DMDACreate2d(MPI_Comm_f2c(*(MPI_Fint *)&*comm),*bx,*by,*stencil_type,*M,*N,*m,*n,*w,*s,lx,ly,inra);
 }
 
 void PETSC_STDCALL dmdagetownershipranges_(DM *da,PetscInt lx[],PetscInt ly[],PetscInt lz[],PetscErrorCode *ierr)
@@ -129,7 +129,7 @@
   CHKFORTRANNULLINTEGER(lx);
   CHKFORTRANNULLINTEGER(ly);
   CHKFORTRANNULLINTEGER(lz);
-  *ierr = DMDAGetInfo(*da,0,0,0,0,&M,&N,&P,0,0,0,0);if (*ierr) return;
+  *ierr = DMDAGetInfo(*da,0,0,0,0,&M,&N,&P,0,0,0,0,0,0);if (*ierr) return;
   *ierr = DMDAGetOwnershipRanges(*da,&gx,&gy,&gz);if (*ierr) return;
   if (lx) {for (i=0; i<M; i++) {lx[i] = gx[i];}}
   if (ly) {for (i=0; i<N; i++) {ly[i] = gy[i];}}
diff -r 23e7928e179a src/dm/impls/da/ftn-custom/zda3f.c
--- a/src/dm/impls/da/ftn-custom/zda3f.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/ftn-custom/zda3f.c	Fri Mar 11 16:29:15 2011 -0700
@@ -10,14 +10,14 @@
 
 EXTERN_C_BEGIN
 
-void PETSC_STDCALL dmdacreate3d_(MPI_Comm *comm,DMDABoundaryType *wrap,DMDAStencilType 
+void PETSC_STDCALL dmdacreate3d_(MPI_Comm *comm,DMDABoundaryType *bx,DMDABoundaryType *by,DMDABoundaryType *bz,DMDAStencilType 
                  *stencil_type,PetscInt *M,PetscInt *N,PetscInt *P,PetscInt *m,PetscInt *n,PetscInt *p,
                  PetscInt *w,PetscInt *s,PetscInt *lx,PetscInt *ly,PetscInt *lz,DM *inra,PetscErrorCode *ierr)
 {
   CHKFORTRANNULLINTEGER(lx);
   CHKFORTRANNULLINTEGER(ly);
   CHKFORTRANNULLINTEGER(lz);
-  *ierr = DMDACreate3d(MPI_Comm_f2c(*(MPI_Fint *)&*comm),*wrap,*stencil_type,
+  *ierr = DMDACreate3d(MPI_Comm_f2c(*(MPI_Fint *)&*comm),*bx,*by,*bz,*stencil_type,
                         *M,*N,*P,*m,*n,*p,*w,*s,lx,ly,lz,inra);
 }
 
diff -r 23e7928e179a src/dm/impls/da/gr1.c
--- a/src/dm/impls/da/gr1.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/gr1.c	Fri Mar 11 16:29:15 2011 -0700
@@ -28,7 +28,7 @@
 {
   MPI_Comm         comm;
   DM               cda;
-  DMDABoundaryType periodic;
+  DMDABoundaryType bx,by,bz;
   Vec              xcoor;
   PetscScalar      *coors;
   PetscReal        hx,hy,hz_;
@@ -39,12 +39,12 @@
   if (xmax <= xmin) SETERRQ2(((PetscObject)da)->comm,PETSC_ERR_ARG_INCOMP,"xmax must be larger than xmin %G %G",xmin,xmax);
 
   ierr = PetscObjectGetComm((PetscObject)da,&comm);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,&dim,&M,&N,&P,0,0,0,0,0,&periodic,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,&M,&N,&P,0,0,0,0,0,&bx,&by,&bz,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da,&istart,&jstart,&kstart,&isize,&jsize,&ksize);CHKERRQ(ierr);
   ierr = DMDAGetCoordinateDA(da, &cda);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(cda, &xcoor);CHKERRQ(ierr);
   if (dim == 1) {
-    if (DMDAXPeriodic(periodic)) hx = (xmax-xmin)/M;
+    if (bx == DMDA_BOUNDARY_PERIODIC) hx = (xmax-xmin)/M;
     else                         hx = (xmax-xmin)/(M-1);
     ierr = VecGetArray(xcoor,&coors);CHKERRQ(ierr);
     for (i=0; i<isize; i++) {
@@ -53,9 +53,9 @@
     ierr = VecRestoreArray(xcoor,&coors);CHKERRQ(ierr);
   } else if (dim == 2) {
     if (ymax <= ymin) SETERRQ2(((PetscObject)da)->comm,PETSC_ERR_ARG_INCOMP,"ymax must be larger than ymin %G %G",ymin,ymax);
-    if (DMDAXPeriodic(periodic)) hx = (xmax-xmin)/(M);
+    if (bx == DMDA_BOUNDARY_PERIODIC) hx = (xmax-xmin)/(M);
     else                       hx = (xmax-xmin)/(M-1);
-    if (DMDAYPeriodic(periodic)) hy = (ymax-ymin)/(N);
+    if (by == DMDA_BOUNDARY_PERIODIC) hy = (ymax-ymin)/(N);
     else                       hy = (ymax-ymin)/(N-1);
     ierr = VecGetArray(xcoor,&coors);CHKERRQ(ierr);
     cnt  = 0;
@@ -69,11 +69,11 @@
   } else if (dim == 3) {
     if (ymax <= ymin) SETERRQ2(((PetscObject)da)->comm,PETSC_ERR_ARG_INCOMP,"ymax must be larger than ymin %G %G",ymin,ymax);
     if (zmax <= zmin) SETERRQ2(((PetscObject)da)->comm,PETSC_ERR_ARG_INCOMP,"zmax must be larger than zmin %G %G",zmin,zmax);
-    if (DMDAXPeriodic(periodic)) hx = (xmax-xmin)/(M);
+    if (bx == DMDA_BOUNDARY_PERIODIC) hx = (xmax-xmin)/(M);
     else                       hx = (xmax-xmin)/(M-1);
-    if (DMDAYPeriodic(periodic)) hy = (ymax-ymin)/(N);
+    if (by == DMDA_BOUNDARY_PERIODIC) hy = (ymax-ymin)/(N);
     else                       hy = (ymax-ymin)/(N-1);
-    if (DMDAZPeriodic(periodic)) hz_ = (zmax-zmin)/(P);
+    if (bz == DMDA_BOUNDARY_PERIODIC) hz_ = (zmax-zmin)/(P);
     else                       hz_ = (zmax-zmin)/(P-1);
     ierr = VecGetArray(xcoor,&coors);CHKERRQ(ierr);
     cnt  = 0;
@@ -112,7 +112,7 @@
   MPI_Comm          comm;
   PetscDrawAxis     axis;
   Vec               xcoor;
-  DMDABoundaryType  periodic;
+  DMDABoundaryType  bx;
 
   PetscFunctionBegin;
   ierr = PetscViewerDrawGetDraw(v,0,&draw);CHKERRQ(ierr);
@@ -123,7 +123,7 @@
 
   ierr = PetscOptionsGetBool(PETSC_NULL,"-draw_vec_mark_points",&showpoints,PETSC_NULL);CHKERRQ(ierr);
 
-  ierr = DMDAGetInfo(da,0,&N,0,0,0,0,0,&step,0,&periodic,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&N,0,0,0,0,0,&step,0,&bx,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da,&istart,0,0,&isize,0,0);CHKERRQ(ierr);
   ierr = VecGetArrayRead(xin,&array);CHKERRQ(ierr);
   ierr = VecGetLocalSize(xin,&n);CHKERRQ(ierr);
@@ -201,7 +201,7 @@
       ierr = MPI_Send((void*)&array[j+(n-1)*step],1,MPIU_REAL,rank+1,tag1,comm);CHKERRQ(ierr);
       ierr = MPI_Send((void*)&xg[n-1],1,MPIU_REAL,rank+1,tag1,comm);CHKERRQ(ierr);
     }
-    if (!rank && DMDAXPeriodic(periodic) && size > 1) { /* first processor sends first value to last */
+    if (!rank && bx == DMDA_BOUNDARY_PERIODIC && size > 1) { /* first processor sends first value to last */
       ierr = MPI_Send((void*)&array[j],1,MPIU_REAL,size-1,tag2,comm);CHKERRQ(ierr);
     }
 
@@ -227,7 +227,7 @@
         ierr = PetscDrawPoint(draw,xgtmp,tmp,PETSC_DRAW_BLACK);CHKERRQ(ierr);
       }
     }
-    if (rank == size-1 && DMDAXPeriodic(periodic) && size > 1) {
+    if (rank == size-1 && bx == DMDA_BOUNDARY_PERIODIC && size > 1) {
       ierr = MPI_Recv(&tmp,1,MPIU_REAL,0,tag2,comm,&status);CHKERRQ(ierr);
 #if !defined(PETSC_USE_COMPLEX)
       ierr = PetscDrawLine(draw,xg[n-2],array[j+step*(n-1)],xg[n-1],tmp,PETSC_DRAW_RED);CHKERRQ(ierr);
diff -r 23e7928e179a src/dm/impls/da/gr2.c
--- a/src/dm/impls/da/gr2.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/dm/impls/da/gr2.c	Fri Mar 11 16:29:15 2011 -0700
@@ -83,7 +83,7 @@
   PetscBool          isnull,useports = PETSC_FALSE;
   MPI_Comm           comm;
   Vec                xlocal,xcoor,xcoorl;
-  DMDABoundaryType   periodic;
+  DMDABoundaryType   bx,by;
   DMDAStencilType    st;
   ZoomCtx            zctx;
   PetscDrawViewPorts *ports;
@@ -100,7 +100,7 @@
   ierr = PetscObjectGetComm((PetscObject)xin,&comm);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr);
 
-  ierr = DMDAGetInfo(da,0,&M,&N,0,&zctx.m,&zctx.n,0,&w,&s,&periodic,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&M,&N,0,&zctx.m,&zctx.n,0,&w,&s,&bx,&by,0,&st);CHKERRQ(ierr);
   ierr = DMDAGetOwnershipRanges(da,&lx,&ly,PETSC_NULL);CHKERRQ(ierr);
 
   /* 
@@ -110,12 +110,12 @@
   */
   ierr = PetscObjectQuery((PetscObject)da,"GraphicsGhosted",(PetscObject*)&xlocal);CHKERRQ(ierr);
   if (!xlocal) {
-    if (!periodic || s != 1 || st != DMDA_STENCIL_BOX) {
+    if (!bx || !by || s != 1 || st != DMDA_STENCIL_BOX) {
       /* 
          if original da is not of stencil width one, or periodic or not a box stencil then
          create a special DMDA to handle one level of ghost points for graphics
       */
-      ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,M,N,zctx.m,zctx.n,w,1,lx,ly,&dac);CHKERRQ(ierr); 
+      ierr = DMDACreate2d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,M,N,zctx.m,zctx.n,w,1,lx,ly,&dac);CHKERRQ(ierr); 
       ierr = PetscInfo(da,"Creating auxilary DMDA for managing graphics ghost points\n");CHKERRQ(ierr);
     } else {
       /* otherwise we can use the da we already have */
@@ -135,7 +135,7 @@
     ierr = PetscObjectCompose((PetscObject)da,"GraphicsGhosted",(PetscObject)xlocal);CHKERRQ(ierr);
     ierr = PetscObjectDereference((PetscObject)xlocal);CHKERRQ(ierr);
   } else {
-    if (!periodic && s == 1 && st == DMDA_STENCIL_BOX) {
+    if (!bx && !by && s == 1 && st == DMDA_STENCIL_BOX) {
       dac = da;
     } else {
       ierr = PetscObjectQuery((PetscObject)xlocal,"DMDA",(PetscObject*)&dac);CHKERRQ(ierr);
@@ -173,7 +173,7 @@
   ierr = PetscObjectQuery((PetscObject)da,"GraphicsCoordinateGhosted",(PetscObject*)&xcoorl);CHKERRQ(ierr);
   if (!xcoorl) {
     /* create DMDA to get local version of graphics */
-    ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,M,N,zctx.m,zctx.n,2,1,lx,ly,&dag);CHKERRQ(ierr); 
+    ierr = DMDACreate2d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,M,N,zctx.m,zctx.n,2,1,lx,ly,&dag);CHKERRQ(ierr); 
     ierr = PetscInfo(dag,"Creating auxilary DMDA for managing graphics coordinates ghost points\n");CHKERRQ(ierr);
     ierr = DMCreateLocalVector(dag,&xcoorl);CHKERRQ(ierr);
     ierr = PetscObjectCompose((PetscObject)da,"GraphicsCoordinateGhosted",(PetscObject)xcoorl);CHKERRQ(ierr);
@@ -189,7 +189,7 @@
   /*
         Get information about size of area each processor must do graphics for
   */
-  ierr = DMDAGetInfo(dac,0,&M,&N,0,0,0,0,&zctx.step,0,&periodic,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dac,0,&M,&N,0,0,0,0,&zctx.step,0,&bx,&by,0,0);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(dac,&igstart,&jgstart,0,&zctx.m,&zctx.n,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(dac,&istart,0,0,&isize,0,0);CHKERRQ(ierr);
 
@@ -428,7 +428,7 @@
   ierr = PetscTypeCompare((PetscObject)viewer,PETSCVIEWERHDF5,&ishdf5);CHKERRQ(ierr);
 #endif
   if (isdraw) {
-    ierr = DMDAGetInfo(da,&dim,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+    ierr = DMDAGetInfo(da,&dim,0,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
     if (dim == 1) {
       ierr = VecView_MPI_Draw_DA1d(xin,viewer);CHKERRQ(ierr);
     } else if (dim == 2) {
diff -r 23e7928e179a src/docs/website/documentation/changes/dev.html
--- a/src/docs/website/documentation/changes/dev.html	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/docs/website/documentation/changes/dev.html	Fri Mar 11 16:29:15 2011 -0700
@@ -299,13 +299,16 @@
 and DMGetLocalToGlobalMappingBlock() and are collective since they may
 be constructed lazily.</li>
         <li>DMGetBlockSize() is added.</li>
-	<li>Changed DMDAPeriodicType to DMDABoundaryType, and enabled
-ghost cells to be included in DM_DAs on domain boundaries even for
-non-periodic dimensions through the use of DMDA_{XYZ}GHOSTED.
-DMDABoundaryType is assigned through bitwise-or composition,
-i.e. DMDA_XPERIODIC | DMDA_YGHOSTED.</li>
-        <li>DMDASetPeriodicity() is now DMDASetBoundaryType()</li>
-	<li>DMDASetGhostedCoordinates() is added.</li>
+	<li>Changed DMDAPeriodicType to DMDABoundaryType, and changed
+this enum to only specify one boundary (one for each dimension).  This
+enum is now one of DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_GHOSTED, or
+DMDA_BOUNDARY_PERIODIC.  See DMDABoundaryType man page for more.</li>
+        <li>DMDASetPeriodicity() is now DMDASetBoundaryType(), and API
+is changed to take three DMDABoundaryType arguments.</li>
+        <li>Changed API for DMDACreate*D(), DMDAGetInfo() to take the
+correct number of DMDABoundaryType enums for the dimension.</li>
+	<li>DMDASetGhostedCoordinates() is added to set coordinates of
+non-periodic ghost cells.</li>
       </ul>
       <p><u><b>DMMG:</b></u></p>
       <ul>
diff -r 23e7928e179a src/ksp/ksp/examples/tests/ex14.c
--- a/src/ksp/ksp/examples/tests/ex14.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tests/ex14.c	Fri Mar 11 16:29:15 2011 -0700
@@ -143,7 +143,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-Ny",&Ny,PETSC_NULL);CHKERRQ(ierr);
   if (Nx*Ny != size && (Nx != PETSC_DECIDE || Ny != PETSC_DECIDE))
     SETERRQ(PETSC_COMM_WORLD,1,"Incompatible number of processors:  Nx * Ny != size");
-  ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,user.mx,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,user.mx,
                     user.my,Nx,Ny,1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(ierr);
 
   /*
diff -r 23e7928e179a src/ksp/ksp/examples/tests/ex19.c
--- a/src/ksp/ksp/examples/tests/ex19.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tests/ex19.c	Fri Mar 11 16:29:15 2011 -0700
@@ -81,7 +81,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-Ny",&Ny,PETSC_NULL);CHKERRQ(ierr);
 
   /* Set up distributed array for fine grid */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,user.fine.mx,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,user.fine.mx,
                     user.fine.my,Nx,Ny,1,1,PETSC_NULL,PETSC_NULL,&user.fine.da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(user.fine.da,&user.fine.x);CHKERRQ(ierr);
   ierr = VecDuplicate(user.fine.x,&user.fine.r);CHKERRQ(ierr);
@@ -92,7 +92,7 @@
   ierr = MatCreateMPIAIJ(PETSC_COMM_WORLD,nlocal,nlocal,n,n,5,PETSC_NULL,3,PETSC_NULL,&user.fine.J);CHKERRQ(ierr);
 
   /* Set up distributed array for coarse grid */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,user.coarse.mx,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,user.coarse.mx,
                     user.coarse.my,Nx,Ny,1,1,PETSC_NULL,PETSC_NULL,&user.coarse.da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(user.coarse.da,&user.coarse.x);CHKERRQ(ierr);
   ierr = VecDuplicate(user.coarse.x,&user.coarse.b);CHKERRQ(ierr);
diff -r 23e7928e179a src/ksp/ksp/examples/tests/ex26.c
--- a/src/ksp/ksp/examples/tests/ex26.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tests/ex26.c	Fri Mar 11 16:29:15 2011 -0700
@@ -69,7 +69,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-Ny",&Ny,PETSC_NULL);CHKERRQ(ierr);
 
   /* Set up distributed array for fine grid */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,fine_ctx.mx,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,fine_ctx.mx,
                     fine_ctx.my,Nx,Ny,1,1,PETSC_NULL,PETSC_NULL,&fine_ctx.da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(fine_ctx.da,&fine_ctx.x);CHKERRQ(ierr);
   ierr = VecDuplicate(fine_ctx.x,&fine_ctx.b);CHKERRQ(ierr);
diff -r 23e7928e179a src/ksp/ksp/examples/tests/ex29.c
--- a/src/ksp/ksp/examples/tests/ex29.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tests/ex29.c	Fri Mar 11 16:29:15 2011 -0700
@@ -69,7 +69,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-Nx",&Nx,PETSC_NULL);CHKERRQ(ierr);
   ierr = PetscOptionsGetInt(PETSC_NULL,"-Ny",&Ny,PETSC_NULL);CHKERRQ(ierr);
 
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,fine_ctx.mx,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,fine_ctx.mx,
                     fine_ctx.my,Nx,Ny,1,1,PETSC_NULL,PETSC_NULL,&fine_ctx.da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(fine_ctx.da,&fine_ctx.x);CHKERRQ(ierr);
   ierr = VecDuplicate(fine_ctx.x,&fine_ctx.b);CHKERRQ(ierr);
diff -r 23e7928e179a src/ksp/ksp/examples/tests/ex32.c
--- a/src/ksp/ksp/examples/tests/ex32.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tests/ex32.c	Fri Mar 11 16:29:15 2011 -0700
@@ -37,7 +37,7 @@
 
   ierr = DMDACreate(PETSC_COMM_WORLD,&da);CHKERRQ(ierr);
   ierr = DMDASetDim(da,3);CHKERRQ(ierr);
-  ierr = DMDASetBoundaryType(da,DMDA_NONPERIODIC);CHKERRQ(ierr);
+  ierr = DMDASetBoundaryType(da,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE);CHKERRQ(ierr);
   ierr = DMDASetStencilType(da,DMDA_STENCIL_STAR);CHKERRQ(ierr);
   ierr = DMDASetSizes(da,M,M,M);CHKERRQ(ierr);
   ierr = DMDASetNumProcs(da,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE);CHKERRQ(ierr);
@@ -115,7 +115,7 @@
   PetscScalar    h;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   h    = 1.0/((mx-1)*(my-1)*(mz-1));
   ierr = VecSet(b,h);CHKERRQ(ierr);
   PetscFunctionReturn(0);
@@ -131,7 +131,7 @@
   MatStencil     row,col;
  
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,&dof,0,0,0);CHKERRQ(ierr); 
+  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr); 
   /* For simplicity, this example only works on mx=my=mz */
   if ( mx != my || mx != mz) SETERRQ3(PETSC_COMM_SELF,1,"This example only works with mx %d = my %d = mz %d\n",mx,my,mz);
 
diff -r 23e7928e179a src/ksp/ksp/examples/tests/ex35.c
--- a/src/ksp/ksp/examples/tests/ex35.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tests/ex35.c	Fri Mar 11 16:29:15 2011 -0700
@@ -31,7 +31,7 @@
 
   ierr = DMDACreate(PETSC_COMM_WORLD,&da);CHKERRQ(ierr);
   ierr = DMDASetDim(da,3);CHKERRQ(ierr);
-  ierr = DMDASetBoundaryType(da,DMDA_NONPERIODIC);CHKERRQ(ierr);
+  ierr = DMDASetBoundaryType(da,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE);CHKERRQ(ierr);
   ierr = DMDASetStencilType(da,DMDA_STENCIL_STAR);CHKERRQ(ierr);
   ierr = DMDASetSizes(da,3,3,3);CHKERRQ(ierr);
   ierr = DMDASetNumProcs(da,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE);CHKERRQ(ierr);
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex14f.F
--- a/src/ksp/ksp/examples/tutorials/ex14f.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex14f.F	Fri Mar 11 16:29:15 2011 -0700
@@ -129,9 +129,9 @@
       Ny = PETSC_DECIDE
       call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-Nx',Nx,flg,ierr)
       call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-Ny',Ny,flg,ierr)
-      call DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,mx,           &
-     &     my,Nx,Ny,one,one,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,       &
-     &     da,ierr)
+      call DMDACreate2d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,      &
+     &     DMDA_STENCIL_STAR,mx,my,Nx,Ny,one,one,                        &
+     &     PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,da,ierr)
 
 !  
 !  Extract global and local vectors from DMDA then duplicate for remaining
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex22.c
--- a/src/ksp/ksp/examples/tutorials/ex22.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex22.c	Fri Mar 11 16:29:15 2011 -0700
@@ -34,7 +34,7 @@
   PetscInitialize(&argc,&argv,(char *)0,help);
   ierr = PetscOptionsGetInt(PETSC_NULL,"-nlevels",&nlevels,PETSC_NULL);CHKERRQ(ierr);
   ierr = DMMGCreate(PETSC_COMM_WORLD,nlevels,PETSC_NULL,&dmmg);CHKERRQ(ierr);
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);  
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);  
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
 
@@ -62,7 +62,7 @@
   PetscScalar    h;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(dmmg->dm,0,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dmmg->dm,0,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   h    = 1.0/((mx-1)*(my-1)*(mz-1));
   ierr = VecSet(b,h);CHKERRQ(ierr);
   PetscFunctionReturn(0);
@@ -78,7 +78,7 @@
   PetscScalar    v[7],Hx,Hy,Hz,HxHydHz,HyHzdHx,HxHzdHy;
   MatStencil     row,col[7];
 
-  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);  
+  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
   Hx = 1.0 / (PetscReal)(mx-1); Hy = 1.0 / (PetscReal)(my-1); Hz = 1.0 / (PetscReal)(mz-1);
   HxHydHz = Hx*Hy/Hz; HxHzdHy = Hx*Hz/Hy; HyHzdHx = Hy*Hz/Hx;
   ierr = DMDAGetCorners(da,&xs,&ys,&zs,&xm,&ym,&zm);CHKERRQ(ierr);
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex22f.F
--- a/src/ksp/ksp/examples/tutorials/ex22f.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex22f.F	Fri Mar 11 16:29:15 2011 -0700
@@ -38,7 +38,8 @@
       i3 = 3
       i1 = 1
       call DMMGCreate(PETSC_COMM_WORLD,i3,PETSC_NULL_INTEGER,dmmg,ierr)
-      call DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,                               &
+      call DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,            &
+     &    DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,                               &
      &    DMDA_STENCIL_STAR,i3,i3,i3,PETSC_DECIDE,PETSC_DECIDE,                        &
      &    PETSC_DECIDE,i1,i1,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,                        &
      &                PETSC_NULL_INTEGER,da,ierr)  
@@ -77,6 +78,7 @@
      &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,                 &
      &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,                 &
      &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,                 &
+     &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,                 &
      &               PETSC_NULL_INTEGER,ierr)
       h    = 1.d0/((mx-1)*(my-1)*(mz-1))
 
@@ -112,6 +114,7 @@
      &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,                &
      &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,                &
      &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,                &
+     &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,                &
      &               PETSC_NULL_INTEGER,ierr)
 
       Hx = 1.d0 / (mx-1)
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex25.c
--- a/src/ksp/ksp/examples/tutorials/ex25.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex25.c	Fri Mar 11 16:29:15 2011 -0700
@@ -45,7 +45,7 @@
   ierr = PetscOptionsGetScalar(0,"-e",&user.e,0);CHKERRQ(ierr);
 
   ierr = DMMGCreate(PETSC_COMM_WORLD,3,&user,&dmmg);CHKERRQ(ierr);
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,-3,1,1,0,&da);CHKERRQ(ierr);  
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,-3,1,1,0,&da);CHKERRQ(ierr);  
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
 
@@ -73,7 +73,7 @@
   PetscScalar    h,v[2];
 
   PetscFunctionBegin;
-  ierr   = DMDAGetInfo(dmmg->dm,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr   = DMDAGetInfo(dmmg->dm,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   h      = 1.0/((mx-1));
   ierr   = VecSet(b,h);CHKERRQ(ierr);
   idx[0] = 0; idx[1] = mx -1;
@@ -95,7 +95,7 @@
   MatStencil     row,col[3];
   AppCtx         *user = (AppCtx*)dmmg->user;
 
-  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
+  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
   ierr = DMDAGetCorners(da,&xs,0,0,&xm,0,0);CHKERRQ(ierr);
   h    = 1.0/(mx-1);
 
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex28.c
--- a/src/ksp/ksp/examples/tutorials/ex28.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex28.c	Fri Mar 11 16:29:15 2011 -0700
@@ -23,7 +23,7 @@
   PetscInitialize(&argc,&argv,(char *)0,help);
 
   ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr);
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_XPERIODIC,-3,2,1,0,&da);CHKERRQ(ierr);  
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_PERIODIC,-3,2,1,0,&da);CHKERRQ(ierr);  
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
 
@@ -57,7 +57,7 @@
   Vec            x = DMMGGetx(dmmg);
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   Hx = 2.0*PETSC_PI / (PetscReal)(mx);
   ierr = DMDAGetCorners(DMMGGetDM(dmmg),&xs,0,0,&xm,0,0);CHKERRQ(ierr);
   
@@ -80,7 +80,7 @@
   PetscScalar    h;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(dmmg->dm,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dmmg->dm,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   h    = 2.0*PETSC_PI/((mx));
   ierr = VecCopy(dmmg->x,b);CHKERRQ(ierr);
   ierr = VecScale(b,h);CHKERRQ(ierr);
@@ -99,7 +99,7 @@
   PetscScalar    lambda;
 
   ierr = PetscMemzero(col,7*sizeof(MatStencil));CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
+  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
   Hx = 2.0*PETSC_PI / (PetscReal)(mx);
   ierr = DMDAGetCorners(da,&xs,0,0,&xm,0,0);CHKERRQ(ierr);
   lambda = 2.0*Hx;
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex29.c
--- a/src/ksp/ksp/examples/tutorials/ex29.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex29.c	Fri Mar 11 16:29:15 2011 -0700
@@ -58,7 +58,7 @@
   PetscInitialize(&argc,&argv,(char *)0,help);
 
   ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr);
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-3,-3,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da);CHKERRQ(ierr);  
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-3,-3,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da);CHKERRQ(ierr);  
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
   for (l = 0; l < DMMGGetLevels(dmmg); l++) {
@@ -109,7 +109,7 @@
   PetscScalar    **array;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   Hx   = 1.0 / (PetscReal)(mx-1);
   Hy   = 1.0 / (PetscReal)(my-1);
   ierr = DMDAGetCorners(da,&xs,&ys,0,&xm,&ym,0);CHKERRQ(ierr);
@@ -161,7 +161,7 @@
   MatStencil     row, col[5];
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,0,&mx,&my,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
+  ierr = DMDAGetInfo(da,0,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
   Hx    = 1.0 / (PetscReal)(mx-1);
   Hy    = 1.0 / (PetscReal)(my-1);
   HxdHy = Hx/Hy;
@@ -236,7 +236,7 @@
   ierr = PetscObjectQuery((PetscObject) x, "DMDA", (PetscObject *) &da);CHKERRQ(ierr);
   if (!da) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_ARG_WRONG,"Vector not generated from a DMDA");
 
-  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0, &dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0, &dof,0,0,0,0,0);CHKERRQ(ierr);
 
   ierr = PetscViewerASCIIPrintf(viewer, "# vtk DataFile Version 2.0\n");CHKERRQ(ierr);
   ierr = PetscViewerASCIIPrintf(viewer, "Inhomogeneous Poisson Equation with %s boundary conditions\n", bcName);CHKERRQ(ierr);
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex31.c
--- a/src/ksp/ksp/examples/tutorials/ex31.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex31.c	Fri Mar 11 16:29:15 2011 -0700
@@ -81,7 +81,7 @@
   PetscInitialize(&argc,&argv,(char *)0,help);
 
   ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr);
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,3,3,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da);CHKERRQ(ierr);  
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,3,3,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da);CHKERRQ(ierr);  
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
   for (l = 0; l < DMMGGetLevels(dmmg); l++) {
@@ -256,7 +256,7 @@
   PetscErrorCode  ierr;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   hx   = 1.0 / (PetscReal)(mx-1);
   hy   = 1.0 / (PetscReal)(my-1);
   ierr = VecSet(user->sol_phi.rho,0.0);CHKERRQ(ierr);
@@ -364,7 +364,7 @@
   ierr = KSPCreate(comm, &ksp);CHKERRQ(ierr);
   ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr);
 
-  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   hx   = 1.0 / (PetscReal)(mx-1);
   hy   = 1.0 / (PetscReal)(my-1);
   area = 0.5*hx*hy;
@@ -493,7 +493,7 @@
   ierr = KSPCreate(comm, &ksp);CHKERRQ(ierr);
   ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr);
 
-  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   hx   = 1.0 / (PetscReal)(mx-1);
   hy   = 1.0 / (PetscReal)(my-1);
   area = 0.5*hx*hy;
@@ -743,7 +743,7 @@
   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da,&xs,&ys,0,&xm,&ym,0);CHKERRQ(ierr);
   hx   = 1.0 / (mx-1);
   hy   = 1.0 / (my-1);
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex32.c
--- a/src/ksp/ksp/examples/tutorials/ex32.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex32.c	Fri Mar 11 16:29:15 2011 -0700
@@ -62,7 +62,7 @@
   PetscInitialize(&argc,&argv,(char *)0,help);
   
   ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr);
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,3,3,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da);CHKERRQ(ierr);  
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,3,3,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da);CHKERRQ(ierr);  
   ierr = DMDASetInterpolationType(da, DMDA_Q0);CHKERRQ(ierr);  
   
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
@@ -108,7 +108,7 @@
   PetscScalar    **array;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &mx, &my, 0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   Hx   = 1.0 / (PetscReal)(mx);
   Hy   = 1.0 / (PetscReal)(my);
   ierr = DMDAGetCorners(da,&xs,&ys,0,&xm,&ym,0);CHKERRQ(ierr);
@@ -147,7 +147,7 @@
   MatStencil     row, col[5];
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,0,&mx,&my,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
+  ierr = DMDAGetInfo(da,0,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
   Hx    = 1.0 / (PetscReal)(mx);
   Hy    = 1.0 / (PetscReal)(my);
   HxdHy = Hx/Hy;
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex34.c
--- a/src/ksp/ksp/examples/tutorials/ex34.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex34.c	Fri Mar 11 16:29:15 2011 -0700
@@ -56,7 +56,7 @@
   PetscInitialize(&argc,&argv,(char *)0,help);
   
   ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr);
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);  
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);  
   ierr = DMDASetInterpolationType(da, DMDA_Q0);CHKERRQ(ierr);  
 
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
@@ -83,7 +83,7 @@
   ierr = VecNorm(DMMGGetr(dmmg),NORM_2,&norm);CHKERRQ(ierr);
   ierr = PetscPrintf(PETSC_COMM_WORLD,"Residual norm %G\n",norm);CHKERRQ(ierr); 
   
-  ierr = DMDAGetInfo(DMMGGetDM(dmmg), 0, &mx, &my, &mz, 0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(DMMGGetDM(dmmg), 0, &mx, &my, &mz, 0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   Hx   = 1.0 / (PetscReal)(mx);
   Hy   = 1.0 / (PetscReal)(my);
   Hz   = 1.0 / (PetscReal)(mz);
@@ -128,7 +128,7 @@
   PetscScalar    ***array;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da, 0, &mx, &my, &mz, 0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &mx, &my, &mz, 0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   Hx   = 1.0 / (PetscReal)(mx);
   Hy   = 1.0 / (PetscReal)(my);
   Hz   = 1.0 / (PetscReal)(mz);
@@ -175,7 +175,7 @@
   MatStencil     row, col[7];
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);  
+  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
   Hx    = 1.0 / (PetscReal)(mx);
   Hy    = 1.0 / (PetscReal)(my);
   Hz    = 1.0 / (PetscReal)(mz);
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex38.c
--- a/src/ksp/ksp/examples/tutorials/ex38.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex38.c	Fri Mar 11 16:29:15 2011 -0700
@@ -42,7 +42,7 @@
 
   ierr = KSPSetOperators(kspmg,cmat,cmat,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
 
-  ierr = DMDACreate1d(PETSC_COMM_WORLD, DMDA_NONPERIODIC, n, 1, 1, 0, &da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, n, 1, 1, 0, &da);CHKERRQ(ierr);
   ierr = DMDASetRefinementFactor(da, 3, 3, 3);CHKERRQ(ierr);
   ierr = PCASASetDM(pcmg, (DM) da);CHKERRQ(ierr);
 
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex43.c
--- a/src/ksp/ksp/examples/tutorials/ex43.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex43.c	Fri Mar 11 16:29:15 2011 -0700
@@ -169,7 +169,7 @@
   PetscInt ml,nl,pl;
 
   PetscFunctionBegin;
-  DMDAGetInfo(da,0,&M,&N,&P,0,0,0,0,0,0,0);
+  DMDAGetInfo(da,0,&M,&N,&P,0,0,0,0,0,0,0,0,0);
   DMDAGetCorners(da,&sx,&sy,&sz,&m,&n,&p);
 
   ml = nl = pl = 0;
@@ -288,7 +288,7 @@
   PetscFunctionBegin;
   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
 
-  DMDAGetInfo(da,0,0,0,0,&cpu_x,&cpu_y,0,0,0,0,0);
+  DMDAGetInfo(da,0,0,0,0,&cpu_x,&cpu_y,0,0,0,0,0,0,0);
 
   proc_J = rank/cpu_x;
   proc_I = rank-cpu_x*proc_J;
@@ -407,7 +407,7 @@
   if (!fp) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Cannot open file");
 
   ierr = PetscFPrintf(PETSC_COMM_SELF,fp,"### %s (processor %1.4d) ### \n",comment,rank);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,0,0,0,0,0,0,&n_dofs,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,0,0,0,0,0,0,&n_dofs,0,0,0,0,0);CHKERRQ(ierr);
   ierr = PetscFPrintf(PETSC_COMM_SELF,fp,"### x y ");CHKERRQ(ierr);
   for (d = 0; d < n_dofs; d++) {
     const char *field_name;
@@ -474,7 +474,7 @@
   if (!fp) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Cannot open file");
 
   ierr = PetscFPrintf(PETSC_COMM_SELF,fp,"### %s (processor %1.4d) ### \n",comment,rank);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,0,0,0,0,0,0,&n_dofs,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,0,0,0,0,0,0,&n_dofs,0,0,0,0,0);CHKERRQ(ierr);
   ierr = PetscFPrintf(PETSC_COMM_SELF,fp,"### x y ");CHKERRQ(ierr);
   for (d = 0; d < n_dofs; d++) {
     const char *field_name;
@@ -1015,7 +1015,7 @@
   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,
                     mx+1,my+1,PETSC_DECIDE,PETSC_DECIDE,3,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da,0,"anlytic_Vx");CHKERRQ(ierr);
   ierr = DMDASetFieldName(da,1,"anlytic_Vy");CHKERRQ(ierr);
@@ -1121,7 +1121,7 @@
   ierr = DMGlobalToLocalEnd(stokes_da,X,INSERT_VALUES,X_local);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(stokes_da,X_local,&stokes);CHKERRQ(ierr);
 
-  ierr = DMDAGetInfo(stokes_da,0,&M,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(stokes_da,0,&M,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetBoundingBox(stokes_da,xymin,xymax);CHKERRQ(ierr);
 
   h = (xymax[0]-xymin[0])/((double)M);
@@ -1222,7 +1222,7 @@
   p_dof         = P_DOFS; /* p - pressure */
   dof           = u_dof+p_dof;
   stencil_width = 1;
-  ierr          = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,
+  ierr          = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,
                              mx+1,my+1,PETSC_DECIDE,PETSC_DECIDE,dof,stencil_width,PETSC_NULL,PETSC_NULL,&da_Stokes);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da_Stokes,0,"Vx");CHKERRQ(ierr);
   ierr = DMDASetFieldName(da_Stokes,1,"Vy");CHKERRQ(ierr);
@@ -1237,18 +1237,18 @@
   ierr = DMDAGetLocalElementSize(da_Stokes,&mxl,&myl,PETSC_NULL);CHKERRQ(ierr);
 
   /* !!! IN PARALLEL WE MUST MAKE SURE THE TWO DMDA's ALIGN !!! // */
-  ierr = DMDAGetInfo(da_Stokes,0,0,0,0,&cpu_x,&cpu_y,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da_Stokes,0,0,0,0,&cpu_x,&cpu_y,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetElementOwnershipRanges2d(da_Stokes,&lx,&ly);CHKERRQ(ierr);
 
   prop_dof           = (int)(sizeof(GaussPointCoefficients)/sizeof(PetscScalar)); /* gauss point setup */
   prop_stencil_width = 0;
-  ierr               = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,
+  ierr               = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,
                                   mx,my,cpu_x,cpu_y,prop_dof,prop_stencil_width,lx,ly,&da_prop);CHKERRQ(ierr);
   ierr = PetscFree(lx);CHKERRQ(ierr);
   ierr = PetscFree(ly);CHKERRQ(ierr);
 
   /* define centroid positions */
-  ierr = DMDAGetInfo(da_prop,0,&M,&N,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da_prop,0,&M,&N,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   dx   = 1.0/((PetscReal)(M));
   dy   = 1.0/((PetscReal)(N));
 
@@ -1589,7 +1589,7 @@
   ierr = DMDAGetGhostedCoordinates(da,&coords);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(cda,coords,&_coords);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(cda,&si,&sj,0,&nx,&ny,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0,0,0);CHKERRQ(ierr);
 
   /* /// */
 
@@ -1661,7 +1661,7 @@
   ierr = DMDAGetGhostedCoordinates(da,&coords);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(cda,coords,&_coords);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(cda,&si,&sj,0,&nx,&ny,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0,0,0);CHKERRQ(ierr);
 
   /* /// */
 
@@ -1733,7 +1733,7 @@
   ierr = DMDAGetGhostedCoordinates(da,&coords);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(cda,coords,&_coords);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(cda,&si,&sj,0,&nx,&ny,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0,0,0);CHKERRQ(ierr);
 
   /* /// */
 
@@ -1805,7 +1805,7 @@
   ierr = DMDAGetGhostedCoordinates(da,&coords);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(cda,coords,&_coords);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(cda,&si,&sj,0,&nx,&ny,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0,0,0);CHKERRQ(ierr);
 
   /* /// */
 
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex44f.F90
--- a/src/ksp/ksp/examples/tutorials/ex44f.F90	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex44f.F90	Fri Mar 11 16:29:15 2011 -0700
@@ -4,7 +4,7 @@
       Vec x,f; Mat J; DM da; KSP ksp; PetscErrorCode ierr
       call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
 
-      call DMDACreate1d(MPI_COMM_WORLD,DMDA_NONPERIODIC,8,1,1,PETSC_NULL_INTEGER,da,ierr)
+      call DMDACreate1d(MPI_COMM_WORLD,DMDA_BOUNDARY_NONE,8,1,1,PETSC_NULL_INTEGER,da,ierr)
       call DMCreateGlobalVector(da,x,ierr); call VecDuplicate(x,f,ierr)
       call DMGetMatrix(da,MATAIJ,J,ierr)
 
@@ -24,7 +24,7 @@
 #include "finclude/petscdef.h"
       use petscdm
       DM da; Vec x; PetscErrorCode ierr; PetscInt xs,xm,i,mx; PetscScalar hx; PetscScalar, pointer :: xx(:)
-      call DMDAGetInfo(da,PETSC_NULL_INTEGER,mx,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,ierr)
+      call DMDAGetInfo(da,PETSC_NULL_INTEGER,mx,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,ierr)
       call DMDAGetCorners(da,xs,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,xm,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,ierr)
       hx     = 1.d0/(mx-1)
       call VecGetArrayF90(x,xx,ierr)
@@ -38,7 +38,7 @@
 #include "finclude/petscdef.h"
       use petscdm
       Mat J; DM da; PetscErrorCode ierr; PetscInt xs,xm,i,mx; PetscScalar hx
-      call DMDAGetInfo(da,PETSC_NULL_INTEGER,mx,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,ierr)
+      call DMDAGetInfo(da,PETSC_NULL_INTEGER,mx,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,ierr)
       call DMDAGetCorners(da,xs,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,xm,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,ierr)
       hx     = 1.d0/(mx-1)
       do i=xs,xs+xm-1
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex45.c
--- a/src/ksp/ksp/examples/tutorials/ex45.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex45.c	Fri Mar 11 16:29:15 2011 -0700
@@ -41,7 +41,7 @@
   PetscInitialize(&argc,&argv,(char *)0,help);
 
   ierr = KSPCreate(PETSC_COMM_WORLD,&ksp);CHKERRQ(ierr);
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-7,-7,-7,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);  
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-7,-7,-7,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);  
   ierr = DMSetInitialGuess((DM)da,ComputeInitialGuess);CHKERRQ(ierr);
   ierr = DMSetFunction((DM)da,ComputeRHS);CHKERRQ(ierr);
   ierr = DMSetJacobian((DM)da,ComputeMatrix);CHKERRQ(ierr);
@@ -77,7 +77,7 @@
   PetscScalar    h;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(dm,0,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dm,0,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   h    = 1.0/((mx-1)*(my-1)*(mz-1));
   ierr = VecSet(b,h);CHKERRQ(ierr);
 
@@ -89,7 +89,7 @@
   PetscInt       i,j,k,mx,my,mz,xm,ym,zm,xs,ys,zs;
   PetscScalar    Hx,Hy,Hz,HxHydHz,HyHzdHx,HxHzdHy;
 
-  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);  
+  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
   Hx = 1.0 / (PetscReal)(mx-1); Hy = 1.0 / (PetscReal)(my-1); Hz = 1.0 / (PetscReal)(mz-1);
   HxHydHz = Hx*Hy/Hz; HxHzdHy = Hx*Hz/Hy; HyHzdHx = Hy*Hz/Hx;
   ierr = DMDAGetCorners(da,&xs,&ys,&zs,&xm,&ym,&zm);CHKERRQ(ierr);
@@ -131,7 +131,7 @@
   PetscScalar    v[7],Hx,Hy,Hz,HxHydHz,HyHzdHx,HxHzdHy;
   MatStencil     row,col[7];
 
-  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);  
+  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
   Hx = 1.0 / (PetscReal)(mx-1); Hy = 1.0 / (PetscReal)(my-1); Hz = 1.0 / (PetscReal)(mz-1);
   HxHydHz = Hx*Hy/Hz; HxHzdHy = Hx*Hz/Hy; HyHzdHx = Hy*Hz/Hx;
   ierr = DMDAGetCorners(da,&xs,&ys,&zs,&xm,&ym,&zm);CHKERRQ(ierr);
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex46.c
--- a/src/ksp/ksp/examples/tutorials/ex46.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex46.c	Fri Mar 11 16:29:15 2011 -0700
@@ -47,7 +47,7 @@
      The problem size will default to 8 by 7, but this can be
      changed using -da_grid_x M -da_grid_y N
   */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-8,-7,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-8,-7,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
 
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          Compute the matrix and right-hand-side vector that define
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex47.c
--- a/src/ksp/ksp/examples/tutorials/ex47.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex47.c	Fri Mar 11 16:29:15 2011 -0700
@@ -39,7 +39,7 @@
   ierr = PetscInitialize(&argc,&argv,(char *)0,help);CHKERRQ(ierr);
 
   ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr);
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_XYZPERIODIC,DMDA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);  
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_PERIODIC,DMDA_BOUNDARY_PERIODIC,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);  
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
 
@@ -134,7 +134,7 @@
   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da,&xs,&ys,&zs,&xm,&ym,&zm);CHKERRQ(ierr);
   sc   = 1.0/((mx-1)*(my-1)*(mz-1));
   //wallPos = (mz-1)/20;
@@ -171,7 +171,7 @@
   PetscScalar    v[7],Hx,Hy,Hz,HxHydHz,HyHzdHx,HxHzdHy;
   MatStencil     row,col[7];
 
-  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);  
+  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);  
   Hx = 1.0 / (PetscReal)(mx-1); Hy = 1.0 / (PetscReal)(my-1); Hz = 1.0 / (PetscReal)(mz-1);
   //Hx = L[0] / (PetscReal)(mx-1); Hy = L[1] / (PetscReal)(my-1); Hz = L[2] / (PetscReal)(mz-1);
   //HxHydHz = Hx*Hy/Hz; HxHzdHy = Hx*Hz/Hy; HyHzdHx = Hy*Hz/Hx;
@@ -220,8 +220,8 @@
   PetscErrorCode ierr;
 	
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da, 0, &M, &N, &P, 0, 0, 0, 0, 0, 0, 0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da, 0, &dim[2], &dim[1], &dim[0], 0, 0, 0, 0, 0, 0, 0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &M, &N, &P, 0, 0, 0, 0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &dim[2], &dim[1], &dim[0], 0, 0, 0, 0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = MatCreateSeqFFTW(PETSC_COMM_WORLD, 3, dim, &F);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da, &xs, &ys, &zs, &xm, &ym, &zm);CHKERRQ(ierr);
   h[0] = L[0]/(M - 1);
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex49.c
--- a/src/ksp/ksp/examples/tutorials/ex49.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex49.c	Fri Mar 11 16:29:15 2011 -0700
@@ -202,7 +202,7 @@
   PetscInt ml,nl,pl;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,0,&M,&N,&P,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&M,&N,&P,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da,&sx,&sy,&sz,&m,&n,&p);CHKERRQ(ierr);
 
   ml = nl = pl = 0;
@@ -289,7 +289,7 @@
   PetscFunctionBegin;
   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
 
-  DMDAGetInfo(da,0,0,0,0,&cpu_x,&cpu_y,0,0,0,0,0);
+  DMDAGetInfo(da,0,0,0,0,&cpu_x,&cpu_y,0,0,0,0,0,0,0);
 
   proc_J = rank/cpu_x;
   proc_I = rank-cpu_x*proc_J;
@@ -411,7 +411,7 @@
   }
 
   ierr = PetscFPrintf(PETSC_COMM_SELF,fp,"### %s (processor %1.4d) ### \n",comment,rank);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,0,0,0,0,0,0,&n_dofs,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,0,0,0,0,0,0,&n_dofs,0,0,0,0,0);CHKERRQ(ierr);
   ierr = PetscFPrintf(PETSC_COMM_SELF,fp,"### x y ");CHKERRQ(ierr);
   for (d = 0; d < n_dofs; d++) {
     ierr = DMDAGetFieldName(da,d,&field_name);CHKERRQ(ierr);
@@ -477,7 +477,7 @@
   if (!fp) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Cannot open file");
 
   ierr = PetscFPrintf(PETSC_COMM_SELF,fp,"### %s (processor %1.4d) ### \n",comment,rank);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,0,0,0,0,0,0,&n_dofs,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,0,0,0,0,0,0,&n_dofs,0,0,0,0,0);CHKERRQ(ierr);
   ierr = PetscFPrintf(PETSC_COMM_SELF,fp,"### x y ");CHKERRQ(ierr);
   for (d = 0; d < n_dofs; d++) {
     ierr = DMDAGetFieldName(da,d,&field_name);CHKERRQ(ierr);
@@ -834,7 +834,7 @@
   u_dof         = U_DOFS; /* Vx, Vy - velocities */
   dof           = u_dof;
   stencil_width = 1;
-  ierr          = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,
+  ierr          = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,
                              mx+1,my+1,PETSC_DECIDE,PETSC_DECIDE,dof,stencil_width,PETSC_NULL,PETSC_NULL,&elas_da);CHKERRQ(ierr);
   ierr = DMDASetFieldName(elas_da,0,"Ux");CHKERRQ(ierr);
   ierr = DMDASetFieldName(elas_da,1,"Uy");CHKERRQ(ierr);
@@ -848,18 +848,18 @@
   ierr = DMDAGetLocalElementSize(elas_da,&mxl,&myl,PETSC_NULL);CHKERRQ(ierr);
 
   /* !!! IN PARALLEL WE MUST MAKE SURE THE TWO DMDA's ALIGN !!! // */
-  ierr = DMDAGetInfo(elas_da,0,0,0,0,&cpu_x,&cpu_y,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(elas_da,0,0,0,0,&cpu_x,&cpu_y,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetElementOwnershipRanges2d(elas_da,&lx,&ly);CHKERRQ(ierr);
 
   prop_dof           = (PetscInt)(sizeof(GaussPointCoefficients)/sizeof(PetscScalar)); /* gauss point setup */
   prop_stencil_width = 0;
-  ierr               = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,
+  ierr               = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,
                                   mx,my,cpu_x,cpu_y,prop_dof,prop_stencil_width,lx,ly,&da_prop);CHKERRQ(ierr);
   ierr = PetscFree(lx);CHKERRQ(ierr);
   ierr = PetscFree(ly);CHKERRQ(ierr);
 
   /* define centroid positions */
-  ierr = DMDAGetInfo(da_prop,0,&M,&N,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da_prop,0,&M,&N,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   dx   = 1.0/((PetscReal)(M));
   dy   = 1.0/((PetscReal)(N));
 
@@ -1170,7 +1170,7 @@
   ierr = DMDAGetGhostedCoordinates(da,&coords);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(cda,coords,&_coords);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(cda,&si,&sj,0,&nx,&ny,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0,0,0);CHKERRQ(ierr);
 
   /* /// */
 
@@ -1241,7 +1241,7 @@
   ierr = DMDAGetGhostedCoordinates(da,&coords);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(cda,coords,&_coords);CHKERRQ(ierr);
   ierr = DMDAGetGhostCorners(cda,&si,&sj,0,&nx,&ny,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,&n_dofs,0,0,0,0,0);CHKERRQ(ierr);
 
   /* /// */
 
diff -r 23e7928e179a src/ksp/ksp/examples/tutorials/ex50.c
--- a/src/ksp/ksp/examples/tutorials/ex50.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/ksp/examples/tutorials/ex50.c	Fri Mar 11 16:29:15 2011 -0700
@@ -69,7 +69,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-N",&N,PETSC_NULL);  CHKERRQ(ierr);
   
   ierr = DMMGCreate(PETSC_COMM_WORLD,mglevels,PETSC_NULL,&dmmg); CHKERRQ(ierr);
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,M,N,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da); CHKERRQ(ierr);  
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,M,N,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da); CHKERRQ(ierr);  
   ierr = DMMGSetDM(dmmg,(DM)da);
   ierr = DMDestroy(da); CHKERRQ(ierr);
   
@@ -127,7 +127,7 @@
   PetscScalar    **array;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da, 0, &M, &N, 0,0,0,0,0,0,0,0); CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &M, &N, 0,0,0,0,0,0,0,0,0,0); CHKERRQ(ierr);
   uu = user->uu; tt = user->tt;
   pi = 4*atan(1.0); 
   Hx   = 1.0/(PetscReal)(M);
@@ -168,7 +168,7 @@
   MatStencil     row, col[5];
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,0,0,0,0); CHKERRQ(ierr);  
+  ierr = DMDAGetInfo(da,0,&M,&N,0,0,0,0,0,0,0,0,0,0); CHKERRQ(ierr);  
   Hx    = 1.0 / (PetscReal)(M);
   Hy    = 1.0 / (PetscReal)(N);
   HxdHy = Hx/Hy;
@@ -231,7 +231,7 @@
   PetscScalar    *array;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da, 0, &M, &N, 0,0,0,0,0,0,0,0); CHKERRQ(ierr); /* level_0 ! */
+  ierr = DMDAGetInfo(da, 0, &M, &N, 0,0,0,0,0,0,0,0,0,0); CHKERRQ(ierr); /* level_0 ! */
   //printf("ComputeTrueSolution - M N: %d %d;\n",M,N);
 
   uu = user->uu; tt = user->tt;
@@ -277,7 +277,7 @@
   ierr = PetscObjectQuery((PetscObject) x, "DMDA", (PetscObject *) &da); CHKERRQ(ierr);
   if (!da) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Vector not generated from a DMDA");
 
-  ierr = DMDAGetInfo(da, 0, &M, &N, 0,0,0,0,&dof,0,0,0); CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da, 0, &M, &N, 0,0,0,0,&dof,0,0,0,0,0); CHKERRQ(ierr);
 
   ierr = PetscViewerASCIIPrintf(viewer, "# vtk DataFile Version 2.0\n"); CHKERRQ(ierr);
   ierr = PetscViewerASCIIPrintf(viewer, "Inhomogeneous Poisson Equation with %s boundary conditions\n", bcName); CHKERRQ(ierr);
diff -r 23e7928e179a src/ksp/pc/impls/wb/wb.c
--- a/src/ksp/pc/impls/wb/wb.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ksp/pc/impls/wb/wb.c	Fri Mar 11 16:29:15 2011 -0700
@@ -40,7 +40,7 @@
   PetscTable             ht;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,&dim,0,0,0,&mp,&np,&pp,&dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,0,0,0,&mp,&np,&pp,&dof,0,0,0,0,0);CHKERRQ(ierr);
   if (dof != 1) SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"Only for single field problems");
   if (dim != 3) SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"Only coded for 3d problems");
   ierr = DMDAGetCorners(da,0,0,0,&m,&n,&p);CHKERRQ(ierr);
@@ -318,7 +318,7 @@
   PetscTable             ht;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,&dim,0,0,0,&mp,&np,&pp,&dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim,0,0,0,&mp,&np,&pp,&dof,0,0,0,0,0);CHKERRQ(ierr);
   if (dof != 1) SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"Only for single field problems");
   if (dim != 3) SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"Only coded for 3d problems");
   ierr = DMDAGetCorners(da,0,0,0,&m,&n,&p);CHKERRQ(ierr);
diff -r 23e7928e179a src/mat/examples/tests/ex129.c
--- a/src/mat/examples/tests/ex129.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/mat/examples/tests/ex129.c	Fri Mar 11 16:29:15 2011 -0700
@@ -43,7 +43,7 @@
 
   ierr = DMDACreate(PETSC_COMM_WORLD,&da);CHKERRQ(ierr);
   ierr = DMDASetDim(da,3);CHKERRQ(ierr);
-  ierr = DMDASetBoundaryType(da,DMDA_NONPERIODIC);CHKERRQ(ierr);
+  ierr = DMDASetBoundaryType(da,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE);CHKERRQ(ierr);
   ierr = DMDASetStencilType(da,DMDA_STENCIL_STAR);CHKERRQ(ierr);
   ierr = DMDASetSizes(da,M,M,M);CHKERRQ(ierr);
   ierr = DMDASetNumProcs(da,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE);CHKERRQ(ierr);
@@ -166,7 +166,7 @@
   PetscScalar    h;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   h    = 1.0/((mx-1)*(my-1)*(mz-1));
   ierr = VecSet(b,h);CHKERRQ(ierr);
   PetscFunctionReturn(0);
@@ -227,7 +227,7 @@
   ierr = PetscRandomSetInterval(rand,-.001,.001);CHKERRQ(ierr);
   ierr = PetscRandomSetFromOptions(rand);CHKERRQ(ierr);
 
-  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,&dof,0,0,0);CHKERRQ(ierr); 
+  ierr = DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr); 
   /* For simplicity, this example only works on mx=my=mz */
   if ( mx != my || mx != mz) SETERRQ3(PETSC_COMM_SELF,1,"This example only works with mx %d = my %d = mz %d\n",mx,my,mz);
 
diff -r 23e7928e179a src/mat/examples/tests/ex96.c
--- a/src/mat/examples/tests/ex96.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/mat/examples/tests/ex96.c	Fri Mar 11 16:29:15 2011 -0700
@@ -80,10 +80,10 @@
 
   /* Set up distributed array for fine grid */
   if (!Test_3D){
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,user.fine.mx,
+    ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,user.fine.mx,
                     user.fine.my,Npx,Npy,1,1,PETSC_NULL,PETSC_NULL,&user.fine.da);CHKERRQ(ierr);
   } else {
-    ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,
+    ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,
                     user.fine.mx,user.fine.my,user.fine.mz,Npx,Npy,Npz,
                     1,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,&user.fine.da);CHKERRQ(ierr);
   }
@@ -127,10 +127,10 @@
 
   /* Set up distributed array for coarse grid */
   if (!Test_3D){
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,user.coarse.mx,
+    ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,user.coarse.mx,
                     user.coarse.my,Npx,Npy,1,1,PETSC_NULL,PETSC_NULL,&user.coarse.da);CHKERRQ(ierr);
   } else {
-    ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,
+    ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,
                     user.coarse.mx,user.coarse.my,user.coarse.mz,Npx,Npy,Npz,
                     1,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,&user.coarse.da);CHKERRQ(ierr);
   }
diff -r 23e7928e179a src/mat/interface/matrix.c
--- a/src/mat/interface/matrix.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/mat/interface/matrix.c	Fri Mar 11 16:29:15 2011 -0700
@@ -1283,8 +1283,8 @@
  
    For periodic boundary conditions use negative indices for values to the left (below 0; that are to be 
    obtained by wrapping values from right edge). For values to the right of the last entry using that index plus one
-   etc to obtain values that obtained by wrapping the values from the left edge. This does not work for the DMDA_NONPERIODIC
-   wrap.
+   etc to obtain values that obtained by wrapping the values from the left edge. This does not work for anything but the
+   DMDA_BOUNDARY_PERIODIC boundary type.
 
    For indices that don't mean anything for your case (like the k index when working in 2d) or the c index when you have
    a single value per point) you can skip filling those indices.
@@ -5445,8 +5445,8 @@
 
    For periodic boundary conditions use negative indices for values to the left (below 0; that are to be 
    obtained by wrapping values from right edge). For values to the right of the last entry using that index plus one
-   etc to obtain values that obtained by wrapping the values from the left edge. This does not work for the DMDA_NONPERIODIC
-   wrap.
+   etc to obtain values that obtained by wrapping the values from the left edge. This does not work for anything but the
+   DMDA_BOUNDARY_PERIODIC boundary type.
 
    For indices that don't mean anything for your case (like the k index when working in 2d) or the c index when you have
    a single value per point) you can skip filling those indices.
diff -r 23e7928e179a src/snes/examples/tests/ex11.c
--- a/src/snes/examples/tests/ex11.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tests/ex11.c	Fri Mar 11 16:29:15 2011 -0700
@@ -117,7 +117,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-Ny",&Ny,PETSC_NULL);CHKERRQ(ierr);
 
   /* Set up distributed array for fine grid */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,user.fine.mx,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,user.fine.mx,
                     user.fine.my,Nx,Ny,1,1,PETSC_NULL,PETSC_NULL,&user.fine.da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(user.fine.da,&user.fine.x);CHKERRQ(ierr);
   ierr = VecDuplicate(user.fine.x,&user.fine.r);CHKERRQ(ierr);
@@ -128,7 +128,7 @@
   ierr = MatCreateMPIAIJ(PETSC_COMM_WORLD,nlocal,nlocal,n,n,5,PETSC_NULL,3,PETSC_NULL,&user.fine.J);CHKERRQ(ierr);
 
   /* Set up distributed array for coarse grid */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,user.coarse.mx,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,user.coarse.mx,
                     user.coarse.my,Nx,Ny,1,1,PETSC_NULL,PETSC_NULL,&user.coarse.da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(user.coarse.da,&user.coarse.x);CHKERRQ(ierr);
   ierr = VecDuplicate(user.coarse.x,&user.coarse.b);CHKERRQ(ierr);
diff -r 23e7928e179a src/snes/examples/tests/ex12f.F
--- a/src/snes/examples/tests/ex12f.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tests/ex12f.F	Fri Mar 11 16:29:15 2011 -0700
@@ -59,7 +59,7 @@
       ctx(5) = size
 
 ! Set up data structures
-      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,N,i1,i1,            &
+      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,N,i1,i1,            &
      &     PETSC_NULL_INTEGER,ctx(1),ierr)
 
       call DMCreateGlobalVector(ctx(1),x,ierr)
diff -r 23e7928e179a src/snes/examples/tests/ex13.c
--- a/src/snes/examples/tests/ex13.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tests/ex13.c	Fri Mar 11 16:29:15 2011 -0700
@@ -81,7 +81,7 @@
     if (Nx*Ny != size && (Nx != PETSC_DECIDE || Ny != PETSC_DECIDE)) SETERRQ(PETSC_COMM_SELF,1,"Incompatible number of processors:  Nx * Ny != size");
     
     /* Set up distributed array */
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,user.mx,user.my,Nx,Ny,1,1,
+    ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,user.mx,user.my,Nx,Ny,1,1,
                       PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(ierr);
     ierr = DMCreateGlobalVector(user.da,&x);CHKERRQ(ierr);
     ierr = VecDuplicate(x,&r);CHKERRQ(ierr);
diff -r 23e7928e179a src/snes/examples/tests/ex14f.F
--- a/src/snes/examples/tests/ex14f.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tests/ex14f.F	Fri Mar 11 16:29:15 2011 -0700
@@ -125,7 +125,7 @@
       ctx(5) = size
 
 ! Set up data structures
-      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,N,i1,i1,            &
+      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,N,i1,i1,            &
      &     PETSC_NULL_INTEGER,ctx(1),ierr)
 
       call DMCreateGlobalVector(ctx(1),x,ierr)
diff -r 23e7928e179a src/snes/examples/tests/ex15.c
--- a/src/snes/examples/tests/ex15.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tests/ex15.c	Fri Mar 11 16:29:15 2011 -0700
@@ -62,7 +62,7 @@
      which derives from an elliptic PDE on two dimensional domain.  From
      the distributed array, Create the vectors.
   */
-  info = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-50,-50,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(info);
+  info = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-50,-50,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(info);
   info = DMDAGetInfo(user.da,PETSC_IGNORE,&user.nx,&user.ny,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(info);
 
   PetscPrintf(PETSC_COMM_WORLD,"\n---- Journal Bearing Problem -----\n");
diff -r 23e7928e179a src/snes/examples/tests/ex16.c
--- a/src/snes/examples/tests/ex16.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tests/ex16.c	Fri Mar 11 16:29:15 2011 -0700
@@ -60,7 +60,7 @@
 #endif
 
   /* Create distributed array to manage the 2d grid */
-  info = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,-10,-10,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(info);
+  info = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,-10,-10,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(info);
   info = DMDAGetInfo(user.da,PETSC_IGNORE,&user.mx,&user.my,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(info);
 
   user.bheight=0.1;
diff -r 23e7928e179a src/snes/examples/tests/ex5.c
--- a/src/snes/examples/tests/ex5.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tests/ex5.c	Fri Mar 11 16:29:15 2011 -0700
@@ -122,7 +122,7 @@
   ierr = PetscOptionsGetInt(PETSC_NULL,"-Nx",&Nx,PETSC_NULL);CHKERRQ(ierr);
   ierr = PetscOptionsGetInt(PETSC_NULL,"-Ny",&Ny,PETSC_NULL);CHKERRQ(ierr);
   if (Nx*Ny != size && (Nx != PETSC_DECIDE || Ny != PETSC_DECIDE)) SETERRQ(PETSC_COMM_SELF,1,"Incompatible number of processors:  Nx * Ny != size");
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,user.mx,user.my,Nx,Ny,1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,user.mx,user.my,Nx,Ny,1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(ierr);
 
   /*
      Visualize the distribution of the array across the processors
diff -r 23e7928e179a src/snes/examples/tests/ex8.c
--- a/src/snes/examples/tests/ex8.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tests/ex8.c	Fri Mar 11 16:29:15 2011 -0700
@@ -69,7 +69,7 @@
   info = PetscOptionsGetScalar(PETSC_NULL, "-ub", &ub, &flg_u);CHKERRQ(info);
 
   /* Create distributed array to manage the 2d grid */
-  info = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,-4,-4,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(info);
+  info = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,-4,-4,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(info);
   info = DMDAGetInfo(user.da,PETSC_IGNORE,&user.mx,&user.my,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(info);
   /* Extract global vectors from DMDA; */
   info = DMCreateGlobalVector(user.da,&x);CHKERRQ(info);
diff -r 23e7928e179a src/snes/examples/tests/ex9.c
--- a/src/snes/examples/tests/ex9.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tests/ex9.c	Fri Mar 11 16:29:15 2011 -0700
@@ -70,7 +70,7 @@
   if (user.param >= bratu_lambda_max || user.param <= bratu_lambda_min) SETERRQ(PETSC_COMM_SELF,1,"Lambda is out of range");
   
   /* Set up distributed array */
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,stencil,user.mx,user.my,user.mz,
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,stencil,user.mx,user.my,user.mz,
                     Nx,Ny,Nz,1,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(user.da,&x);CHKERRQ(ierr);
   ierr = VecDuplicate(x,&r);CHKERRQ(ierr);
diff -r 23e7928e179a src/snes/examples/tutorials/ex14.c
--- a/src/snes/examples/tutorials/ex14.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex14.c	Fri Mar 11 16:29:15 2011 -0700
@@ -97,7 +97,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,-4,PETSC_DECIDE,PETSC_DECIDE,
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,-4,PETSC_DECIDE,PETSC_DECIDE,
                     PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(ierr);
 
   /*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -212,7 +212,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(user->da,PETSC_IGNORE,&Mx,&My,&Mz,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   lambda = user->param;
   hx     = 1.0/(PetscReal)(Mx-1);
@@ -287,7 +287,7 @@
   PetscFunctionBegin;
   ierr = DMGetLocalVector(user->da,&localX);CHKERRQ(ierr);
   ierr = DMDAGetInfo(user->da,PETSC_IGNORE,&Mx,&My,&Mz,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   lambda = user->param;
   hx     = 1.0/(PetscReal)(Mx-1);
@@ -384,7 +384,7 @@
 
   ierr = DMGetLocalVector(user->da,&localX);CHKERRQ(ierr);
   ierr = DMDAGetInfo(user->da,PETSC_IGNORE,&Mx,&My,&Mz,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   lambda = user->param;
   hx     = 1.0/(PetscReal)(Mx-1);
diff -r 23e7928e179a src/snes/examples/tutorials/ex18.c
--- a/src/snes/examples/tutorials/ex18.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex18.c	Fri Mar 11 16:29:15 2011 -0700
@@ -90,7 +90,7 @@
   /*
       Set the DMDA (grid structure) for the grids.
   */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,5,5,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,5,5,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da);CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
 
@@ -168,7 +168,7 @@
 
   PetscFunctionBegin;
   ierr = DMGetLocalVector(dmmg->dm,&localX);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(dmmg->dm,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dmmg->dm,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   hx    = one/(PetscReal)(mx-1);  hy    = one/(PetscReal)(my-1);
   hxdhy = hx/hy;               hydhx = hy/hx;
   tleft = user->tleft;         tright = user->tright;
@@ -344,7 +344,7 @@
   PetscFunctionBegin;
   ierr = DMGetLocalVector(dmmg->dm,&localX);CHKERRQ(ierr);
   *flg = SAME_NONZERO_PATTERN;
-  ierr = DMDAGetInfo(dmmg->dm,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dmmg->dm,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   hx    = one/(PetscReal)(mx-1);  hy     = one/(PetscReal)(my-1);
   hxdhy = hx/hy;               hydhx  = hy/hx;
   tleft = user->tleft;         tright = user->tright;
diff -r 23e7928e179a src/snes/examples/tutorials/ex19.c
--- a/src/snes/examples/tutorials/ex19.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex19.c	Fri Mar 11 16:29:15 2011 -0700
@@ -104,12 +104,12 @@
       Create distributed array multigrid object (DMMG) to manage parallel grid and vectors
       for principal unknowns (x) and governing residuals (f)
     */
-    ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,4,1,0,0,&da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,4,1,0,0,&da);CHKERRQ(ierr);
     ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
     ierr = DMDestroy(da);CHKERRQ(ierr);
 
     ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&mx,&my,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                     PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
+                     PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
     /* 
      Problem parameters (velocity of lid, prandtl, and grashof numbers)
     */
@@ -207,7 +207,7 @@
 
   grashof = user->grashof;
 
-  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   dx  = 1.0/(mx-1);
 
   /*
diff -r 23e7928e179a src/snes/examples/tutorials/ex19tu.c
--- a/src/snes/examples/tutorials/ex19tu.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex19tu.c	Fri Mar 11 16:29:15 2011 -0700
@@ -106,14 +106,14 @@
       Create distributed array multigrid object (DMMG) to manage parallel grid and vectors
       for principal unknowns (x) and governing residuals (f)
     */
-    ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,4,1,0,0,&da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,4,1,0,0,&da);CHKERRQ(ierr);
     ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
     ierr = DMDestroy(da);CHKERRQ(ierr);
     ierr = PetscPrintf(comm,"mx = %d, my= %d\n",
 		       mx,my);CHKERRQ(ierr);
 
     ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&mx,&my,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                     PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
+                     PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
     ierr = PetscPrintf(comm,"mx = %d, my= %d\n",
 		       mx,my);CHKERRQ(ierr);
    /* 
@@ -212,7 +212,7 @@
 
   grashof = user->grashof;
 
-  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   dx  = 1.0/(mx-1);
 
   /*
diff -r 23e7928e179a src/snes/examples/tutorials/ex20.c
--- a/src/snes/examples/tutorials/ex20.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex20.c	Fri Mar 11 16:29:15 2011 -0700
@@ -90,7 +90,7 @@
   /*
       Set the DMDA (grid structure) for the grids.
   */
-  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-5,-5,-5,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-5,-5,-5,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
 
@@ -170,7 +170,7 @@
 
   PetscFunctionBegin;
   ierr = DMGetLocalVector(dmmg->dm,&localX);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(dmmg->dm,PETSC_NULL,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dmmg->dm,PETSC_NULL,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   hx    = one/(PetscReal)(mx-1);  hy    = one/(PetscReal)(my-1);  hz = one/(PetscReal)(mz-1);
   hxhydhz = hx*hy/hz;   hyhzdhx = hy*hz/hx;   hzhxdhy = hz*hx/hy;
   tleft = user->tleft;         tright = user->tright;
@@ -488,7 +488,7 @@
 
   PetscFunctionBegin;
   ierr = DMGetLocalVector(dmmg->dm,&localX);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(dmmg->dm,PETSC_NULL,&mx,&my,&mz,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dmmg->dm,PETSC_NULL,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   hx    = one/(PetscReal)(mx-1);  hy    = one/(PetscReal)(my-1);  hz = one/(PetscReal)(mz-1);
   hxhydhz = hx*hy/hz;   hyhzdhx = hy*hz/hx;   hzhxdhy = hz*hx/hy;
   tleft = user->tleft;         tright = user->tright;
diff -r 23e7928e179a src/snes/examples/tutorials/ex21.c
--- a/src/snes/examples/tutorials/ex21.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex21.c	Fri Mar 11 16:29:15 2011 -0700
@@ -62,9 +62,9 @@
   ierr = DMCompositeCreate(PETSC_COMM_WORLD,&user.packer);CHKERRQ(ierr);
   user.nredundant = 1;
   ierr = DMCompositeAddArray(user.packer,0,user.nredundant);CHKERRQ(ierr);
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,-5,1,1,PETSC_NULL,&user.da1);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,-5,1,1,PETSC_NULL,&user.da1);CHKERRQ(ierr);
   ierr = DMCompositeAddDM(user.packer,(DM)user.da1);CHKERRQ(ierr);
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,-5,1,1,PETSC_NULL,&user.da2);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,-5,1,1,PETSC_NULL,&user.da2);CHKERRQ(ierr);
   ierr = DMCompositeAddDM(user.packer,(DM)user.da2);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(user.packer,&U);CHKERRQ(ierr);
   ierr = VecDuplicate(U,&FU);CHKERRQ(ierr);
@@ -118,7 +118,7 @@
   ierr = DMCompositeScatter(user->packer,U,w,vu,vlambda);CHKERRQ(ierr);
 
   ierr = DMDAGetCorners(user->da1,&xs,PETSC_NULL,PETSC_NULL,&xm,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(user->da1,0,&N,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(user->da1,0,&N,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(user->da1,vu,&u);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(user->da1,vfu,&fu);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(user->da1,vlambda,&lambda);CHKERRQ(ierr);
diff -r 23e7928e179a src/snes/examples/tutorials/ex22.c
--- a/src/snes/examples/tutorials/ex22.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex22.c	Fri Mar 11 16:29:15 2011 -0700
@@ -109,7 +109,7 @@
   /* Create a global vector that includes a single redundant array and two da arrays */
   ierr = DMCompositeCreate(PETSC_COMM_WORLD,&packer);CHKERRQ(ierr);
   ierr = DMCompositeAddArray(packer,0,1);CHKERRQ(ierr);
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,-5,2,1,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,-5,2,1,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCompositeAddDM(packer,(DM)da);CHKERRQ(ierr);
 
 
@@ -174,7 +174,7 @@
   ierr = DMCompositeGetAccess(packer,FU,&fw,&vfu_lambda);CHKERRQ(ierr);
 
   ierr = DMDAGetCorners(da,&xs,PETSC_NULL,PETSC_NULL,&xm,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&N,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&N,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(da,vu_lambda,&u_lambda);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(da,vfu_lambda,&fu_lambda);CHKERRQ(ierr);
   d    = N-1.0;
@@ -279,7 +279,7 @@
   ierr = DMCompositeRestoreAccess(packer,U,&w,&u_lambda);CHKERRQ(ierr);
 
   ierr = DMCompositeGetEntries(packer,&m,&da);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&N,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&N,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = VecDuplicate(U,&Uexact);CHKERRQ(ierr);
   ierr = ExactSolution(packer,Uexact);CHKERRQ(ierr);
   ierr = VecAXPY(Uexact,-1.0,U);CHKERRQ(ierr);
diff -r 23e7928e179a src/snes/examples/tutorials/ex23.c
--- a/src/snes/examples/tutorials/ex23.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex23.c	Fri Mar 11 16:29:15 2011 -0700
@@ -58,7 +58,7 @@
   ierr = PetscOptionsInsert(&argc,&argv,PETSC_NULL);CHKERRQ(ierr); 
   
   /* Create a global vector from a da arrays */
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,-5,1,1,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,-5,1,1,PETSC_NULL,&da);CHKERRQ(ierr);
 
   /* create graphics windows */
   ierr = PetscViewerDrawOpen(PETSC_COMM_WORLD,0,"u - state variables",-1,-1,-1,-1,&user.u_viewer);CHKERRQ(ierr);
@@ -103,7 +103,7 @@
   ierr = DMGlobalToLocalEnd(da,U,INSERT_VALUES,vu);CHKERRQ(ierr);
 
   ierr = DMDAGetCorners(da,&xs,PETSC_NULL,PETSC_NULL,&xm,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&N,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&N,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(da,vu,&u);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(da,FU,&fu);CHKERRQ(ierr);
   d    = N-1.0;
diff -r 23e7928e179a src/snes/examples/tutorials/ex24.c
--- a/src/snes/examples/tutorials/ex24.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex24.c	Fri Mar 11 16:29:15 2011 -0700
@@ -135,7 +135,7 @@
   /* create DMComposite object to manage composite vector */
   ierr = DMCompositeCreate(PETSC_COMM_WORLD,&packer);CHKERRQ(ierr);
   ierr = DMCompositeAddArray(packer,0,1);CHKERRQ(ierr);
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,-5,1,1,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,-5,1,1,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMCompositeAddDM(packer,(DM)da);CHKERRQ(ierr);
   ierr = DMCompositeAddDM(packer,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
@@ -266,7 +266,7 @@
 
   ierr = DMCompositeGetEntries(packer,&nredundant,&da,PETSC_IGNORE);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da,&xs,PETSC_NULL,PETSC_NULL,&xm,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da,0,&N,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&N,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   d    = (N-1.0);
   h    = 1.0/d;
   h2   = 2.0*h;
diff -r 23e7928e179a src/snes/examples/tutorials/ex25.c
--- a/src/snes/examples/tutorials/ex25.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex25.c	Fri Mar 11 16:29:15 2011 -0700
@@ -58,7 +58,7 @@
   /*
       Set the DMDA (grid structure) for the grids.
   */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-5,-5,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-5,-5,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da);CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
 
@@ -109,7 +109,7 @@
 
   PetscFunctionBegin;
   ierr = DMGetLocalVector(dmmg->dm,&localT);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(dmmg->dm,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dmmg->dm,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   hx    = 1.0/(PetscReal)(mx-1);  hy    = 1.0/(PetscReal)(my-1);
  
   /* Get ghost points */
diff -r 23e7928e179a src/snes/examples/tutorials/ex26.c
--- a/src/snes/examples/tutorials/ex26.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex26.c	Fri Mar 11 16:29:15 2011 -0700
@@ -100,7 +100,7 @@
      Create distributed array (DMDA) to manage parallel grid and vectors
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
   ierr = PetscOptionsGetInt(PETSC_NULL,"-n",&grids,PETSC_NULL);CHKERRQ(ierr);
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,grids,dof,stencil_width,PETSC_NULL,&user.da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,grids,dof,stencil_width,PETSC_NULL,&user.da);CHKERRQ(ierr);
   
   /*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Extract global vectors from DMDA; then duplicate for remaining
@@ -254,7 +254,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(user->da,PETSC_IGNORE,&Mx,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   /*
      Get a pointer to vector data.
@@ -408,7 +408,7 @@
 
   ierr = DMGetLocalVector(user->da,&localX);CHKERRQ(ierr);
   ierr = DMDAGetInfo(user->da,PETSC_IGNORE,&Mx,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx     = 1.0/(PetscReal)(Mx-1);  dhx    = 1.0/hx;
 
diff -r 23e7928e179a src/snes/examples/tutorials/ex27.c
--- a/src/snes/examples/tutorials/ex27.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex27.c	Fri Mar 11 16:29:15 2011 -0700
@@ -163,12 +163,12 @@
       Create distributed array multigrid object (DMMG) to manage parallel grid and vectors
       for principal unknowns (x) and governing residuals (f)
     */
-    ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,4,1,0,0,&da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,4,1,0,0,&da);CHKERRQ(ierr);
     ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
     ierr = DMDestroy(da);CHKERRQ(ierr);
 
     ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&mx,&my,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                     PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
+                     PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
     /* 
      Problem parameters (velocity of lid, prandtl, and grashof numbers)
     */
@@ -277,7 +277,7 @@
   da = (dmmg[param->mglevels-1]->dm);
   grashof = user->param->grashof;
 
-  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   dx  = 1.0/(mx-1);
 
   /*
diff -r 23e7928e179a src/snes/examples/tutorials/ex28.c
--- a/src/snes/examples/tutorials/ex28.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex28.c	Fri Mar 11 16:29:15 2011 -0700
@@ -340,14 +340,14 @@
   PetscBool      view_draw;
 
   PetscInitialize(&argc,&argv,0,help);
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,-10,1,1,PETSC_NULL,&dau);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,-10,1,1,PETSC_NULL,&dau);CHKERRQ(ierr);
   ierr = DMDACreateOwnershipRanges(dau);CHKERRQ(ierr); /* Ensure that the ownership ranges agree so that we can get a compatible grid for the coefficient */
   ierr = DMDAGetOwnershipRanges(dau,&lxu,0,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(dau,0, &m,0,0, &nprocs,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dau,0, &m,0,0, &nprocs,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = PetscMalloc(nprocs*sizeof(*lxk),&lxk);CHKERRQ(ierr);
   ierr = PetscMemcpy(lxk,lxu,nprocs*sizeof(*lxk));CHKERRQ(ierr);
   lxk[0]--;
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,m-1,1,1,lxk,&dak);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,m-1,1,1,lxk,&dak);CHKERRQ(ierr);
   ierr = PetscFree(lxk);CHKERRQ(ierr);
 
   ierr = DMCompositeCreate(PETSC_COMM_WORLD,&pack);CHKERRQ(ierr);
diff -r 23e7928e179a src/snes/examples/tutorials/ex29.c
--- a/src/snes/examples/tutorials/ex29.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex29.c	Fri Mar 11 16:29:15 2011 -0700
@@ -150,7 +150,7 @@
       parallel grid and vectors for principal unknowns (x) and
       governing residuals (f)
     */
-    ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_XYPERIODIC, DMDA_STENCIL_STAR, -5, -5,
+    ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_PERIODIC, DMDA_BOUNDARY_PERIODIC, DMDA_STENCIL_STAR, -5, -5,
                       PETSC_DECIDE, PETSC_DECIDE, 4, 1, 0, 0, &da);CHKERRQ(ierr);
 
     /* overwrite the default sparsity pattern toone specific for
@@ -191,7 +191,7 @@
     /* Initialize stuff related to time stepping */
     /*======================================================================*/
 
-    ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&mx,&my,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+    ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
 
     tsCtx.fnorm_ini   = 0;  
     tsCtx.max_steps   = 1000000;   
@@ -265,7 +265,7 @@
       ierr = PetscPrintf(PETSC_COMM_WORLD, "# viscosity = %G, resistivity = %G, "
 			 "skin_depth # = %G, larmor_radius # = %G\n",
 			 param.nu, param.eta, param.d_e, param.rho_s);CHKERRQ(ierr);
-      ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&m,&n,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+      ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&m,&n,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
       ierr = PetscPrintf(PETSC_COMM_WORLD,"Problem size %D by %D\n",m,n);CHKERRQ(ierr);
       ierr = PetscPrintf(PETSC_COMM_WORLD,"dx %G dy %G dt %G ratio dt/min(dx,dy) %G\n",lx/mx,ly/my,tsCtx.dt,dt_ratio);CHKERRQ(ierr);
     }
@@ -376,7 +376,7 @@
   de2   = sqr(param->d_e);
 
   da   = (dmmg[param->mglevels-1]->dm);
-  ierr = DMDAGetInfo(da,0,&mx,&my,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
 
   dhx   = mx/lx;              dhy = my/ly;
   hx    = one/dhx;             hy = one/dhy;
@@ -471,7 +471,7 @@
 
   PetscFunctionBegin;
 
-  ierr = DMDAGetInfo(da,0,&mx,&my,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
 
   ierr = DMDAGetCorners(da,&xs,&ys,PETSC_NULL,&xm,&ym,PETSC_NULL);CHKERRQ(ierr);
 
diff -r 23e7928e179a src/snes/examples/tutorials/ex3.c
--- a/src/snes/examples/tutorials/ex3.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex3.c	Fri Mar 11 16:29:15 2011 -0700
@@ -110,7 +110,7 @@
   /*
      Create distributed array (DMDA) to manage parallel grid and vectors
   */
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,N,1,1,PETSC_NULL,&ctx.da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,N,1,1,PETSC_NULL,&ctx.da);CHKERRQ(ierr);
 
   /*
      Extract global and local vectors from DMDA; then duplicate for remaining
@@ -347,7 +347,7 @@
   */
   ierr = DMDAGetCorners(da,&xs,PETSC_NULL,PETSC_NULL,&xm,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
   ierr = DMDAGetInfo(da,PETSC_NULL,&M,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,
-                   PETSC_NULL,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
+                   PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
 
   /*
      Set function values for boundary points; define local interior grid point range:
@@ -415,7 +415,7 @@
     Get range of locally owned matrix
   */
   ierr = DMDAGetInfo(da,PETSC_NULL,&M,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,
-                   PETSC_NULL,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
+                   PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
 
   /*
      Determine starting and ending local indices for interior grid points.
diff -r 23e7928e179a src/snes/examples/tutorials/ex30.c
--- a/src/snes/examples/tutorials/ex30.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex30.c	Fri Mar 11 16:29:15 2011 -0700
@@ -90,7 +90,7 @@
 } Parameter;
 
 typedef struct { /* grid parameters */
-  DMDABoundaryType periodic;
+  DMDABoundaryType bx,by;
   DMDAStencilType  stencil;
   PetscInt       corner,ni,nj,jlid,jfault,inose;
   PetscInt       dof,stencil_width,mglevels;
@@ -187,7 +187,7 @@
      for principal unknowns (x) and governing residuals (f)
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 
   ierr = DMMGCreate(comm,grid.mglevels,user,&dmmg);CHKERRQ(ierr); 
-  ierr = DMDACreate2d(comm,grid.periodic,grid.stencil,grid.ni,grid.nj,PETSC_DECIDE,PETSC_DECIDE,grid.dof,grid.stencil_width,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(comm,grid.bx,grid.by,grid.stencil,grid.ni,grid.nj,PETSC_DECIDE,PETSC_DECIDE,grid.dof,grid.stencil_width,0,0,&da);CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
   ierr = DMDASetFieldName(DMMGGetDM(dmmg),0,"x-velocity");CHKERRQ(ierr);
@@ -201,7 +201,7 @@
      for principal unknowns (x) and governing residuals (f)
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 
   ierr = DMMGCreate(comm,grid.mglevels,&user,&dmmg);CHKERRQ(ierr); 
-  ierr = DMDACreate2d(comm,grid.periodic,grid.stencil,grid.ni,grid.nj,PETSC_DECIDE,PETSC_DECIDE,grid.dof,grid.stencil_width,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(comm,grid.bx,grid.by,grid.stencil,grid.ni,grid.nj,PETSC_DECIDE,PETSC_DECIDE,grid.dof,grid.stencil_width,0,0,&da);CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
   ierr = DMDASetFieldName(DMMGGetDM(dmmg),0,"x-velocity");CHKERRQ(ierr);
@@ -222,7 +222,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Set up the SNES solver with callback functions.
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMMGSetSNESLocal(dmmg,FormFunctionLocal,0,0,0);CHKERRQ(ierr);
+  ierr = DMMGSetSNESLocal(dmmg,FormFunctionLocal,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMMGSetFromOptions(dmmg);CHKERRQ(ierr);
   ierr = DMMGSetInitialGuess(dmmg,FormInitialGuess);CHKERRQ(ierr);
   ierr = SNESSetConvergenceTest(DMMGGetSNES(dmmg),SNESConverged_Interactive,(void*)user,PETSC_NULL);CHKERRQ(ierr);
@@ -927,7 +927,8 @@
   param->depth         = grid->dz*(grid->nj-2);                            /* km */
   grid->inose          = 0;                                         /* gridpoints*/
   ierr = PetscOptionsGetInt(PETSC_NULL,"-inose",&(grid->inose),PETSC_NULL);CHKERRQ(ierr);
-  grid->periodic       = DMDA_NONPERIODIC;
+  grid->bx       = DMDA_BOUNDARY_NONE;
+  grid->by       = DMDA_BOUNDARY_NONE;
   grid->stencil        = DMDA_STENCIL_BOX;
   grid->dof            = 4;
   grid->stencil_width  = 2;
diff -r 23e7928e179a src/snes/examples/tutorials/ex31.c
--- a/src/snes/examples/tutorials/ex31.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex31.c	Fri Mar 11 16:29:15 2011 -0700
@@ -123,7 +123,7 @@
     ierr = DMCompositeCreate(app.comm,&app.pack);CHKERRQ(ierr);
 
     /* 6 fluid unknowns, 3 ghost points on each end for either periodicity or simply boundary conditions */
-    ierr = DMDACreate1d(app.comm,DMDA_XPERIODIC,app.nxv,6,3,0,&da);CHKERRQ(ierr);
+    ierr = DMDACreate1d(app.comm,DMDA_BOUNDARY_PERIODIC,app.nxv,6,3,0,&da);CHKERRQ(ierr);
     ierr = DMDASetFieldName(da,0,"prss");CHKERRQ(ierr);
     ierr = DMDASetFieldName(da,1,"ergg");CHKERRQ(ierr);
     ierr = DMDASetFieldName(da,2,"ergf");CHKERRQ(ierr);
@@ -133,12 +133,12 @@
     ierr = DMCompositeAddDM(app.pack,(DM)da);CHKERRQ(ierr);
     ierr = DMDestroy(da);CHKERRQ(ierr);
 
-    ierr = DMDACreate2d(app.comm,DMDA_YPERIODIC,DMDA_STENCIL_STAR,app.nxv,app.nyv,PETSC_DETERMINE,1,1,1,0,0,&da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(app.comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_PERIODIC,DMDA_STENCIL_STAR,app.nxv,app.nyv,PETSC_DETERMINE,1,1,1,0,0,&da);CHKERRQ(ierr);
     ierr = DMDASetFieldName(da,0,"Tempature");CHKERRQ(ierr);
     ierr = DMCompositeAddDM(app.pack,(DM)da);CHKERRQ(ierr);
     ierr = DMDestroy(da);CHKERRQ(ierr);
 
-    ierr = DMDACreate2d(app.comm,DMDA_XYPERIODIC,DMDA_STENCIL_STAR,app.nxv,app.nyvf,PETSC_DETERMINE,1,2,1,0,0,&da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(app.comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,app.nxv,app.nyvf,PETSC_DETERMINE,1,2,1,0,0,&da);CHKERRQ(ierr);
     ierr = DMDASetFieldName(da,0,"Phi");CHKERRQ(ierr);
     ierr = DMDASetFieldName(da,1,"Pre");CHKERRQ(ierr);
     ierr = DMCompositeAddDM(app.pack,(DM)da);CHKERRQ(ierr);
@@ -526,7 +526,7 @@
   ierr = DMMGCreate(app->comm,1,0,&app->fdmmg);CHKERRQ(ierr);
   ierr = DMMGSetOptionsPrefix(app->fdmmg,"phi_");CHKERRQ(ierr);
   ierr = DMMGSetUser(app->fdmmg,0,app);CHKERRQ(ierr);
-  ierr = DMDACreate2d(app->comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,app->nxv,app->nyvf,PETSC_DETERMINE,1,1,1,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(app->comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,app->nxv,app->nyvf,PETSC_DETERMINE,1,1,1,0,0,&da);CHKERRQ(ierr);
   ierr = DMMGSetDM(app->fdmmg,(DM)da);CHKERRQ(ierr); 
   ierr = DMMGSetKSP(app->fdmmg,PETSC_NULL,MyFormMatrix);CHKERRQ(ierr);
   app->dx = DMMGGetRHS(app->fdmmg);
diff -r 23e7928e179a src/snes/examples/tutorials/ex32.c
--- a/src/snes/examples/tutorials/ex32.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex32.c	Fri Mar 11 16:29:15 2011 -0700
@@ -115,12 +115,12 @@
     for principal unknowns (x) and governing residuals (f)
   */
   dof  = 4;
-  ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,dof,1,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,dof,1,0,0,&da);CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
 
   ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&mx,&my,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                     PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
+                     PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
 
   /* Problem parameters (velocity of lid, prandtl, and grashof numbers) */
   user.lidvelocity = 1.0/(mx*my);
@@ -184,7 +184,7 @@
   ierr = DMMGCreate(comm,nlevels,&user,&dmmg1);CHKERRQ(ierr);
   dof  = 3;
   user.COMPOSITE_MODEL = PETSC_FALSE;
-  ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,dof,1,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,dof,1,0,0,&da);CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg1,(DM)da);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da,0,"x-velocity");CHKERRQ(ierr);
   ierr = DMDASetFieldName(da,1,"y-velocity");CHKERRQ(ierr);
@@ -215,7 +215,7 @@
   ierr = DMMGCreate(comm,nlevels,&user,&dmmg2);CHKERRQ(ierr);
   dof  = 1;
   user.COMPOSITE_MODEL = PETSC_FALSE;
-  ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,dof,1,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,dof,1,0,0,&da);CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg2,(DM)da);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da,0,"temperature");CHKERRQ(ierr);
   ierr = DMDestroy(da);CHKERRQ(ierr);
@@ -308,7 +308,7 @@
   Field          **x;
 
   grashof = user->grashof;
-  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   dx  = 1.0/(mx-1);
 
   /*
@@ -356,7 +356,7 @@
   PetscErrorCode ierr;
   Field1         **x;
 
-  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da,&xs,&ys,PETSC_NULL,&xm,&ym,PETSC_NULL);CHKERRQ(ierr);
 
   ierr = DMDAVecGetArray(da,X,&x);CHKERRQ(ierr);
@@ -384,7 +384,7 @@
   Field2         **x;
 
   grashof = user->grashof;
-  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   dx  = 1.0/(mx-1);
 
   ierr = DMDAGetCorners(da,&xs,&ys,PETSC_NULL,&xm,&ym,PETSC_NULL);CHKERRQ(ierr);
diff -r 23e7928e179a src/snes/examples/tutorials/ex39f90.F
--- a/src/snes/examples/tutorials/ex39f90.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex39f90.F	Fri Mar 11 16:29:15 2011 -0700
@@ -215,7 +215,8 @@
 
 ! This really needs only the star-type stencil, but we use the box
 ! stencil temporarily.
-      call DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,   &
+      call DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,            &
+     &     DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,                            &
      &     -4,-4,PETSC_DECIDE,PETSC_DECIDE,1,1,                         &
      &     PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,user%da,ierr)
       call DMDAGetInfo(user%da,PETSC_NULL_INTEGER,user%mx,user%my,        &
diff -r 23e7928e179a src/snes/examples/tutorials/ex4.c
--- a/src/snes/examples/tutorials/ex4.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex4.c	Fri Mar 11 16:29:15 2011 -0700
@@ -113,7 +113,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,-3,-3,PETSC_DECIDE,PETSC_DECIDE,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,-3,-3,PETSC_DECIDE,PETSC_DECIDE,
                     1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da, 0, "ooblek");CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg, (DM) da);CHKERRQ(ierr);
@@ -210,7 +210,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   lambda = user->lambda;
   hx     = 1.0/(PetscReal)(Mx-1);
diff -r 23e7928e179a src/snes/examples/tutorials/ex40f90.F
--- a/src/snes/examples/tutorials/ex40f90.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex40f90.F	Fri Mar 11 16:29:15 2011 -0700
@@ -20,7 +20,8 @@
 
       call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
 
-      call DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,              &
+      call DMDACreate2d(PETSC_COMM_WORLD,                               &
+     &     DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,                       &
      &                DMDA_STENCIL_BOX,                                 &
      &                -10,-10,PETSC_DECIDE,PETSC_DECIDE,2,1,            &
      &                PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,da,ierr)
diff -r 23e7928e179a src/snes/examples/tutorials/ex46.c
--- a/src/snes/examples/tutorials/ex46.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex46.c	Fri Mar 11 16:29:15 2011 -0700
@@ -92,7 +92,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,
                     1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(ierr);
   ierr = DMDASetUniformCoordinates(user.da, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0);CHKERRQ(ierr);
   ierr = DMMGCreate(PETSC_COMM_WORLD, 1, &user, &dmmg);CHKERRQ(ierr);
@@ -157,7 +157,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(user->da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   D      = user->D;
   hx     = 1.0/(PetscReal)(Mx-1);
diff -r 23e7928e179a src/snes/examples/tutorials/ex48.c
--- a/src/snes/examples/tutorials/ex48.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex48.c	Fri Mar 11 16:29:15 2011 -0700
@@ -554,7 +554,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetGhostCorners(da2prm,&ys,&xs,0,&ym,&xm,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da2prm,0, &my,&mx,0, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da2prm,0, &my,&mx,0, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(da2prm,prm,&p);CHKERRQ(ierr);
   for (i=xs; i<xs+xm; i++) {
     for (j=ys; j<ys+ym; j++) {
@@ -580,11 +580,11 @@
     DMDAStencilType  st;
     DM da = dmmg[i]->dm,da2prm;
     Vec X;
-    ierr = DMDAGetInfo(da,&dim, &Mz,&My,&Mx, 0,&my,&mx, 0,&s,0,&st);CHKERRQ(ierr);
+    ierr = DMDAGetInfo(da,&dim, &Mz,&My,&Mx, 0,&my,&mx, 0,&s,0,0,0,&st);CHKERRQ(ierr);
     if (dim == 2) {
-      ierr = DMDAGetInfo(da,&dim, &My,&Mx,0, &my,&mx,0, 0,&s,0,&st);CHKERRQ(ierr);
+      ierr = DMDAGetInfo(da,&dim, &My,&Mx,0, &my,&mx,0, 0,&s,0,0,0,&st);CHKERRQ(ierr);
     }
-    ierr = DMDACreate2d(((PetscObject)thi)->comm,DMDA_XYPERIODIC,st,My,Mx,my,mx,sizeof(PrmNode)/sizeof(PetscScalar),s,0,0,&da2prm);CHKERRQ(ierr);
+    ierr = DMDACreate2d(((PetscObject)thi)->comm,DMDA_BOUNDARY_PERIODIC,DMDA_BOUNDARY_PERIODIC,st,My,Mx,my,mx,sizeof(PrmNode)/sizeof(PetscScalar),s,0,0,&da2prm);CHKERRQ(ierr);
     ierr = DMCreateLocalVector(da2prm,&X);CHKERRQ(ierr);
     {
       PetscReal Lx = thi->Lx / thi->units->meter,Ly = thi->Ly / thi->units->meter,Lz = thi->Lz / thi->units->meter;
@@ -650,7 +650,7 @@
   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,0, 0,&my,&mx, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0, 0,&my,&mx, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da,&zs,&ys,&xs,&zm,&ym,&xm);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(da,X,&x);CHKERRQ(ierr);
   ierr = THIDAGetPrm(da,&prm);CHKERRQ(ierr);
@@ -855,7 +855,7 @@
 
   PetscFunctionBegin;
   *min = *max = *mean = 0;
-  ierr = DMDAGetInfo(da,0, &mz,&my,&mx, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0, &mz,&my,&mx, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da,&zs,&ys,&xs,&zm,&ym,&xm);CHKERRQ(ierr);
   if (zs != 0 || zm != mz) SETERRQ(PETSC_COMM_SELF,1,"Unexpected decomposition");
   ierr = DMDAVecGetArray(da,X,&x);CHKERRQ(ierr);
@@ -1253,10 +1253,10 @@
   } else {
     dac = dac0;
   }
-  ierr = DMDAGetInfo(dac,&dim, &N,&M,0, &n,&m,0, &dof,&s,0,&st);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(dac,&dim, &N,&M,0, &n,&m,0, &dof,&s,0,0,0,&st);CHKERRQ(ierr);
   if (dim != 2) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"This function can only refine 2D DMDAs");
   /* Creates a 3D DMDA with the same map-plane layout as the 2D one, with contiguous columns */
-  ierr = DMDACreate3d(((PetscObject)dac)->comm,DMDA_YZPERIODIC,st,thi->zlevels,N,M,1,n,m,dof,s,NULL,NULL,NULL,&daf);CHKERRQ(ierr);
+  ierr = DMDACreate3d(((PetscObject)dac)->comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_PERIODIC,DMDA_BOUNDARY_PERIODIC,st,thi->zlevels,N,M,1,n,m,dof,s,PETSC_NULL,PETSC_NULL,PETSC_NULL,&daf);CHKERRQ(ierr);
   daf->ops->getmatrix        = dac->ops->getmatrix;
   daf->ops->getinterpolation = dac->ops->getinterpolation;
   daf->ops->getcoloring      = dac->ops->getcoloring;
@@ -1282,7 +1282,7 @@
   PetscValidHeaderSpecific(daf,DM_CLASSID,2);
   PetscValidPointer(A,3);
   if (scale) PetscValidPointer(scale,4);
-  ierr = DMDAGetInfo(daf,&dim,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(daf,&dim,0,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   if (dim  == 2) {
     /* We are in the 2D problem and use normal DMDA interpolation */
     ierr = DMGetInterpolation(dac,daf,A,scale);CHKERRQ(ierr);
@@ -1290,7 +1290,7 @@
     PetscInt i,j,k,xs,ys,zs,xm,ym,zm,mx,my,mz,rstart,cstart;
     Mat B;
 
-    ierr = DMDAGetInfo(daf,0, &mz,&my,&mx, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+    ierr = DMDAGetInfo(daf,0, &mz,&my,&mx, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
     ierr = DMDAGetCorners(daf,&zs,&ys,&xs,&zm,&ym,&xm);CHKERRQ(ierr);
     if (zs != 0) SETERRQ(PETSC_COMM_SELF,1,"unexpected");
     ierr = MatCreate(((PetscObject)daf)->comm,&B);CHKERRQ(ierr);
@@ -1328,7 +1328,7 @@
   ISLocalToGlobalMapping ltog,ltogb;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,&dim, 0,0,0, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,&dim, 0,0,0, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   if (dim != 3) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Expected DMDA to be 3D");
   ierr = DMDAGetCorners(da,0,0,0,&zm,&ym,&xm);CHKERRQ(ierr);
   ierr = DMGetLocalToGlobalMapping(da,&ltog);CHKERRQ(ierr);
@@ -1367,7 +1367,7 @@
 
   PetscFunctionBegin;
   comm = ((PetscObject)thi)->comm;
-  ierr = DMDAGetInfo(da,0, &mz,&my,&mx, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0, &mz,&my,&mx, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr);
   ierr = PetscViewerASCIIOpen(comm,filename,&viewer);CHKERRQ(ierr);
@@ -1488,12 +1488,12 @@
     }
     ierr = PetscOptionsEnd();CHKERRQ(ierr);
     if (thi->coarse2d) {
-      ierr = DMDACreate2d(comm,DMDA_XYPERIODIC,DMDA_STENCIL_BOX,N,M,PETSC_DETERMINE,PETSC_DETERMINE,sizeof(Node)/sizeof(PetscScalar),1,0,0,&da);CHKERRQ(ierr);
+      ierr = DMDACreate2d(comm,DMDA_BOUNDARY_PERIODIC,DMDA_BOUNDARY_PERIODIC,DMDA_STENCIL_BOX,N,M,PETSC_DETERMINE,PETSC_DETERMINE,sizeof(Node)/sizeof(PetscScalar),1,0,0,&da);CHKERRQ(ierr);
       da->ops->refinehierarchy  = DMRefineHierarchy_THI;
       da->ops->getinterpolation = DMGetInterpolation_DA_THI;
       ierr = PetscObjectCompose((PetscObject)da,"THI",(PetscObject)thi);CHKERRQ(ierr);
     } else {
-      ierr = DMDACreate3d(comm,DMDA_YZPERIODIC,DMDA_STENCIL_BOX,P,N,M,1,PETSC_DETERMINE,PETSC_DETERMINE,sizeof(Node)/sizeof(PetscScalar),1,0,0,0,&da);CHKERRQ(ierr);
+      ierr = DMDACreate3d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_PERIODIC,DMDA_BOUNDARY_PERIODIC, DMDA_STENCIL_BOX,P,N,M,1,PETSC_DETERMINE,PETSC_DETERMINE,sizeof(Node)/sizeof(PetscScalar),1,0,0,0,&da);CHKERRQ(ierr);
     }
     ierr = DMDASetFieldName(da,0,"x-velocity");CHKERRQ(ierr);
     ierr = DMDASetFieldName(da,1,"y-velocity");CHKERRQ(ierr);
diff -r 23e7928e179a src/snes/examples/tutorials/ex49.c
--- a/src/snes/examples/tutorials/ex49.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex49.c	Fri Mar 11 16:29:15 2011 -0700
@@ -105,12 +105,12 @@
       Create distributed array multigrid object (DMMG) to manage parallel grid and vectors
       for principal unknowns (x) and governing residuals (f)
     */
-    ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,4,1,0,0,&da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,4,1,0,0,&da);CHKERRQ(ierr);
     ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
     ierr = DMDestroy(da);CHKERRQ(ierr);
 
     ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&mx,&my,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                     PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
+                     PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
     /* 
      Problem parameters (velocity of lid, prandtl, and grashof numbers)
     */
@@ -203,7 +203,7 @@
 
   grashof = user->grashof;
 
-  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   dx  = 1.0/(mx-1);
 
   /*
diff -r 23e7928e179a src/snes/examples/tutorials/ex4tu.c
--- a/src/snes/examples/tutorials/ex4tu.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex4tu.c	Fri Mar 11 16:29:15 2011 -0700
@@ -103,13 +103,13 @@
       Create distributed array multigrid object (DMMG) to manage parallel grid and vectors
       for principal unknowns (x) and governing residuals (f)
     */
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,-4,-4,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,-4,-4,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
     
     ierr = DMMGSetDM(dmmg,(DM)da);CHKERRQ(ierr);
     ierr = DMDestroy(da);CHKERRQ(ierr);
 
     ierr = DMDAGetInfo(DMMGGetDM(dmmg),0,&mx,&my,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                     PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
+                     PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
     ierr = PetscPrintf(comm,"mx = %d, my= %d\n",
 		       mx,my);CHKERRQ(ierr);
  
@@ -187,7 +187,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
  
   lambda = user->lambda;
   hx     = 1.0/(PetscReal)(Mx-1);
diff -r 23e7928e179a src/snes/examples/tutorials/ex5.c
--- a/src/snes/examples/tutorials/ex5.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex5.c	Fri Mar 11 16:29:15 2011 -0700
@@ -104,7 +104,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,
                     1,1,PETSC_NULL,PETSC_NULL,&user.da);CHKERRQ(ierr);
   ierr = DMDASetUniformCoordinates(user.da, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0);CHKERRQ(ierr);
 
@@ -279,7 +279,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(user->da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   lambda = user->param;
   hx     = 1.0/(PetscReal)(Mx-1);
@@ -455,7 +455,7 @@
   ierr = PetscObjectSetName((PetscObject)localX,"localX");CHKERRQ(ierr);
   ierr = PetscObjectSetName((PetscObject)localF,"localF");CHKERRQ(ierr);
   ierr = DMDAGetInfo(user->da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   lambda = user->param;
   hx     = 1.0/(PetscReal)(Mx-1);
diff -r 23e7928e179a src/snes/examples/tutorials/ex50.c
--- a/src/snes/examples/tutorials/ex50.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex50.c	Fri Mar 11 16:29:15 2011 -0700
@@ -106,11 +106,11 @@
       Create distributed array multigrid object (DMMG) to manage parallel grid and vectors
       for principal unknowns (x) and governing residuals (f)
   */
-  ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,4,1,0,0,&da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,4,1,0,0,&da);CHKERRQ(ierr);
   ierr = SNESSetDM(snes,(DM)da);CHKERRQ(ierr);
   
   ierr = DMDAGetInfo(da,0,&mx,&my,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-		   PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
+		   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr);
   /* 
      Problem parameters (velocity of lid, prandtl, and grashof numbers)
   */
@@ -190,7 +190,7 @@
 
   grashof = user->grashof;
 
-  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da,0,&mx,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   dx  = 1.0/(mx-1);
 
   /*
diff -r 23e7928e179a src/snes/examples/tutorials/ex51.c
--- a/src/snes/examples/tutorials/ex51.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex51.c	Fri Mar 11 16:29:15 2011 -0700
@@ -18,7 +18,7 @@
   ierr = PetscInitialize(&argc,&argv,0,0);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(PETSC_COMM_WORLD, &rank);CHKERRQ(ierr);
   /* Create 2D DMDA */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_NONPERIODIC, DMDA_STENCIL_STAR, M, N, PETSC_DECIDE, PETSC_DECIDE, 1, 1, PETSC_NULL, PETSC_NULL, &da);CHKERRQ(ierr);
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE, DMDA_STENCIL_STAR, M, N, PETSC_DECIDE, PETSC_DECIDE, 1, 1, PETSC_NULL, PETSC_NULL, &da);CHKERRQ(ierr);
   /* Create 1D DMDAs along two directions */
   ierr = DMDAGetOwnershipRanges(da, &lx, &ly, PETSC_NULL);CHKERRQ(ierr);
   ierr = DMDAGetLocalInfo(da, &info);CHKERRQ(ierr);
@@ -30,8 +30,8 @@
   ierr = MPI_Comm_size(commY, &subsize);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(commY, &subrank);CHKERRQ(ierr);
   ierr = PetscPrintf(PETSC_COMM_SELF, "[%d]Y subrank: %d subsize: %d\n", rank, subrank, subsize);
-  ierr = DMDACreate1d(commX, DMDA_NONPERIODIC, M, dof, 1, lx, &daX);CHKERRQ(ierr);
-  ierr = DMDACreate1d(commY, DMDA_NONPERIODIC, N, dof, 1, ly, &daY);CHKERRQ(ierr);
+  ierr = DMDACreate1d(commX, DMDA_BOUNDARY_NONE, M, dof, 1, lx, &daX);CHKERRQ(ierr);
+  ierr = DMDACreate1d(commY, DMDA_BOUNDARY_NONE, N, dof, 1, ly, &daY);CHKERRQ(ierr);
   /* Create 1D vectors for basis functions */
   ierr = DMGetGlobalVector(daX, &basisX);CHKERRQ(ierr);
   ierr = DMGetGlobalVector(daY, &basisY);CHKERRQ(ierr);
diff -r 23e7928e179a src/snes/examples/tutorials/ex5f.F
--- a/src/snes/examples/tutorials/ex5f.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex5f.F	Fri Mar 11 16:29:15 2011 -0700
@@ -110,7 +110,8 @@
 
 ! This really needs only the star-type stencil, but we use the box
 ! stencil temporarily.
-      call DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,                      &
+      call DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,            &
+     &     DMDA_BOUNDARY_NONE,                                          &
      &     DMDA_STENCIL_STAR,i4,i4,PETSC_DECIDE,PETSC_DECIDE,i1,i1,                &
      &     PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,da,ierr)
 
diff -r 23e7928e179a src/snes/examples/tutorials/ex5f90.F
--- a/src/snes/examples/tutorials/ex5f90.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex5f90.F	Fri Mar 11 16:29:15 2011 -0700
@@ -229,7 +229,8 @@
 
 ! This really needs only the star-type stencil, but we use the box
 ! stencil temporarily.
-      call DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,              &
+      call DMDACreate2d(PETSC_COMM_WORLD,                               &
+     &     DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,                      &
      &     DMDA_STENCIL_BOX,nfour,nfour,PETSC_DECIDE,PETSC_DECIDE,          &
      &     ione,ione,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,user%da,ierr)
       call DMDAGetInfo(user%da,PETSC_NULL_INTEGER,user%mx,user%my,        &
diff -r 23e7928e179a src/snes/examples/tutorials/ex7.c
--- a/src/snes/examples/tutorials/ex7.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex7.c	Fri Mar 11 16:29:15 2011 -0700
@@ -145,7 +145,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,-3,-3,PETSC_DECIDE,PETSC_DECIDE,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,-3,-3,PETSC_DECIDE,PETSC_DECIDE,
                     3,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da, 0, "ooblek");CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg, (DM) da);CHKERRQ(ierr);
@@ -276,7 +276,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   lambda = user->lambda;
   hx     = 1.0/(PetscReal)(Mx-1);
diff -r 23e7928e179a src/snes/examples/tutorials/ex8.c
--- a/src/snes/examples/tutorials/ex8.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/snes/examples/tutorials/ex8.c	Fri Mar 11 16:29:15 2011 -0700
@@ -118,7 +118,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,-3,-3,PETSC_DECIDE,PETSC_DECIDE,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,-3,-3,PETSC_DECIDE,PETSC_DECIDE,
                     1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da, 0, "ooblek");CHKERRQ(ierr);
   ierr = DMMGSetDM(dmmg, (DM) da);CHKERRQ(ierr);
@@ -217,7 +217,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   lambda = user->lambda;
   hx     = 1.0/(PetscReal)(Mx-1);
diff -r 23e7928e179a src/ts/examples/tests/ex1.c
--- a/src/ts/examples/tests/ex1.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tests/ex1.c	Fri Mar 11 16:29:15 2011 -0700
@@ -73,7 +73,7 @@
   appctx.norm_2 = 0.0; appctx.norm_max = 0.0;
 
   /* Set up the ghost point communication pattern */ 
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,appctx.M,1,1,PETSC_NULL,&appctx.da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,appctx.M,1,1,PETSC_NULL,&appctx.da);CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(appctx.da,&appctx.global);CHKERRQ(ierr);
   ierr = VecGetLocalSize(appctx.global,&m);CHKERRQ(ierr);
   ierr = DMCreateLocalVector(appctx.da,&appctx.local);CHKERRQ(ierr);
diff -r 23e7928e179a src/ts/examples/tests/ex1f.F
--- a/src/ts/examples/tests/ex1f.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tests/ex1f.F	Fri Mar 11 16:29:15 2011 -0700
@@ -75,7 +75,7 @@
 
 !   Set up the ghost point communication pattern                       
 
-      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,M,i1,i1,            &
+      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,M,i1,i1,            &
      &     PETSC_NULL_INTEGER,da,ierr)
       call DMCreateGlobalVector(da,global,ierr) 
       call VecGetLocalSize(global,m,ierr) 
diff -r 23e7928e179a src/ts/examples/tutorials/ex10.c
--- a/src/ts/examples/tutorials/ex10.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex10.c	Fri Mar 11 16:29:15 2011 -0700
@@ -801,9 +801,9 @@
     (radiation temperature).  It is not necessary to create a DMDA for this, but this way
     output and visualization will have meaningful variable names and correct scales.
   */
-  ierr = DMDAGetInfo(rd->da,0, &M,0,0, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(rd->da,0, &M,0,0, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetOwnershipRanges(rd->da,&lx,0,0);CHKERRQ(ierr);
-  ierr = DMDACreate1d(((PetscObject)rd->da)->comm,DMDA_NONPERIODIC,M,1,0,lx,&da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(((PetscObject)rd->da)->comm,DMDA_BOUNDARY_NONE,M,1,0,lx,&da);CHKERRQ(ierr);
   ierr = DMDASetUniformCoordinates(da,0.,rd->L,0.,0.,0.,0.);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da,0,"T_rad");CHKERRQ(ierr);
   ierr = DMCreateGlobalVector(da,&Y);CHKERRQ(ierr);
@@ -1015,7 +1015,7 @@
     break;
   }
 
-  ierr = DMDACreate1d(comm,DMDA_NONPERIODIC,-20,sizeof(RDNode)/sizeof(PetscScalar),1,PETSC_NULL,&rd->da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(comm,DMDA_BOUNDARY_NONE,-20,sizeof(RDNode)/sizeof(PetscScalar),1,PETSC_NULL,&rd->da);CHKERRQ(ierr);
   ierr = DMDASetFieldName(rd->da,0,"E");CHKERRQ(ierr);
   ierr = DMDASetFieldName(rd->da,1,"T");CHKERRQ(ierr);
   ierr = DMDASetUniformCoordinates(rd->da,0.,1.,0.,0.,0.,0.);CHKERRQ(ierr);
diff -r 23e7928e179a src/ts/examples/tutorials/ex11.c
--- a/src/ts/examples/tutorials/ex11.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex11.c	Fri Mar 11 16:29:15 2011 -0700
@@ -50,7 +50,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-8,-8,PETSC_DECIDE,PETSC_DECIDE,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-8,-8,PETSC_DECIDE,PETSC_DECIDE,
                     1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
 
   /*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -153,7 +153,7 @@
   PetscFunctionBegin;
   ierr = DMGetLocalVector(da,&localX);CHKERRQ(ierr);
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                     PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx     = 1.0/(PetscReal)(Mx-1); sx = 1.0/(hx*hx);
   hy     = 1.0/(PetscReal)(My-1); sy = 1.0/(hy*hy);
@@ -220,7 +220,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx     = 1.0/(PetscReal)(Mx-1);
   hy     = 1.0/(PetscReal)(My-1);
diff -r 23e7928e179a src/ts/examples/tutorials/ex12.c
--- a/src/ts/examples/tutorials/ex12.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex12.c	Fri Mar 11 16:29:15 2011 -0700
@@ -57,7 +57,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-8,-8,PETSC_DECIDE,PETSC_DECIDE,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-8,-8,PETSC_DECIDE,PETSC_DECIDE,
                     2,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
 
   /*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -161,7 +161,7 @@
   PetscFunctionBegin;
   ierr = DMGetLocalVector(da,&localX);CHKERRQ(ierr);
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx     = 1.0/(PetscReal)(Mx-1); sx = 1.0/(hx*hx);
   hy     = 1.0/(PetscReal)(My-1); sy = 1.0/(hy*hy);
@@ -229,7 +229,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx     = 1.0/(PetscReal)(Mx-1);
   hy     = 1.0/(PetscReal)(My-1);
diff -r 23e7928e179a src/ts/examples/tutorials/ex13.c
--- a/src/ts/examples/tutorials/ex13.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex13.c	Fri Mar 11 16:29:15 2011 -0700
@@ -54,7 +54,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-8,-8,PETSC_DECIDE,PETSC_DECIDE,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-8,-8,PETSC_DECIDE,PETSC_DECIDE,
                     1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
 
   /*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -156,7 +156,7 @@
   PetscFunctionBegin;
   ierr = DMGetLocalVector(da,&localU);CHKERRQ(ierr);
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx     = 1.0/(PetscReal)(Mx-1); sx = 1.0/(hx*hx);
   hy     = 1.0/(PetscReal)(My-1); sy = 1.0/(hy*hy);
@@ -249,7 +249,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx     = 1.0/(PetscReal)(Mx-1);
   hy     = 1.0/(PetscReal)(My-1);
diff -r 23e7928e179a src/ts/examples/tutorials/ex14.c
--- a/src/ts/examples/tutorials/ex14.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex14.c	Fri Mar 11 16:29:15 2011 -0700
@@ -679,7 +679,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetGhostCorners(da2prm,&ys,&xs,0,&ym,&xm,0);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da2prm,0, &my,&mx,0, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da2prm,0, &my,&mx,0, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   for (i=xs; i<xs+xm; i++) {
     for (j=ys; j<ys+ym; j++) {
       PetscReal xx = thi->Lx*i/mx,yy = thi->Ly*j/my;
@@ -706,7 +706,7 @@
   ierr = DMCompositeGetAccess(pack,X,&X3g,&X2g);CHKERRQ(ierr);
   ierr = DMGetLocalVector(da2,&X2);CHKERRQ(ierr);
 
-  ierr = DMDAGetInfo(da3,0, 0,&my,&mx, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da3,0, 0,&my,&mx, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da3,&zs,&ys,&xs,&zm,&ym,&xm);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(da3,X3g,&x);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(da2,X2,&prm);CHKERRQ(ierr);
@@ -1046,7 +1046,7 @@
   ierr = DMCompositeGetEntries(pack,&da3,&da2);CHKERRQ(ierr);
   ierr = DMCompositeGetAccess(pack,X,&X3,&X2);CHKERRQ(ierr);
   *min = *max = *mean = 0;
-  ierr = DMDAGetInfo(da3,0, &mz,&my,&mx, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da3,0, &mz,&my,&mx, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(da3,&zs,&ys,&xs,&zm,&ym,&xm);CHKERRQ(ierr);
   if (zs != 0 || zm != mz) SETERRQ(PETSC_COMM_SELF,1,"Unexpected decomposition");
   ierr = DMDAVecGetArray(da3,X3,&x);CHKERRQ(ierr);
@@ -1448,7 +1448,7 @@
   comm = ((PetscObject)thi)->comm;
   ierr = DMCompositeGetEntries(pack,&da3,&da2);CHKERRQ(ierr);
   ierr = DMCompositeGetAccess(pack,X,&X3,&X2);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(da3,0, &mz,&my,&mx, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da3,0, &mz,&my,&mx, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr);
   ierr = PetscViewerASCIIOpen(comm,filename,&viewer3);CHKERRQ(ierr);
@@ -1663,7 +1663,7 @@
   {
     PetscInt Mx,My,mx,my,s;
     DMDAStencilType st;
-    ierr = DMDAGetInfo(da3,0, 0,&My,&Mx, 0,&my,&mx, 0,&s,0,&st);CHKERRQ(ierr);
+    ierr = DMDAGetInfo(da3,0, 0,&My,&Mx, 0,&my,&mx, 0,&s,0,0,0,&st);CHKERRQ(ierr);
     ierr = DMDACreate2d(((PetscObject)thi)->comm,DMDA_XYPERIODIC,st,My,Mx,my,mx,sizeof(PrmNode)/sizeof(PetscScalar),s,0,0,&da2);CHKERRQ(ierr);
   }
 
@@ -1692,7 +1692,7 @@
     PetscReal Lx = thi->Lx / thi->units->meter,Ly = thi->Ly / thi->units->meter,Lz = thi->Lz / thi->units->meter;
     PetscInt Mx,My,Mz;
     ierr = DMCompositeGetEntries(pack,&da3,&da2);CHKERRQ(ierr);
-    ierr = DMDAGetInfo(da3,0, &Mz,&My,&Mx, 0,0,0, 0,0,0,0);CHKERRQ(ierr);
+    ierr = DMDAGetInfo(da3,0, &Mz,&My,&Mx, 0,0,0, 0,0,0,0,0,0);CHKERRQ(ierr);
     ierr = PetscPrintf(((PetscObject)thi)->comm,"Level %d domain size (m) %8.2g x %8.2g x %8.2g, num elements %3d x %3d x %3d (%8d), size (m) %g x %g x %g\n",i,Lx,Ly,Lz,Mx,My,Mz,Mx*My*Mz,Lx/Mx,Ly/My,1000./(Mz-1));CHKERRQ(ierr);
   }
   ierr = DMMGSetInitialGuess(dmmg,THIInitialDMMG);CHKERRQ(ierr);
diff -r 23e7928e179a src/ts/examples/tutorials/ex15.c
--- a/src/ts/examples/tutorials/ex15.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex15.c	Fri Mar 11 16:29:15 2011 -0700
@@ -86,9 +86,9 @@
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
   if (user.nstencilpts == 5){
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-11,-11,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-11,-11,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   } else if (user.nstencilpts == 9){
-    ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_BOX,-11,-11,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
+    ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,-11,-11,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
   } else {
     SETERRQ1(PETSC_COMM_WORLD,PETSC_ERR_SUP,"nstencilpts %d is not supported",user.nstencilpts);
   }
@@ -184,7 +184,7 @@
   PetscFunctionBegin;
   ierr = DMGetLocalVector(da,&localU);CHKERRQ(ierr);
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx     = 1.0/(PetscReal)(Mx-1); sx = 1.0/(hx*hx);
   hy     = 1.0/(PetscReal)(My-1); sy = 1.0/(hy*hy);
@@ -276,7 +276,7 @@
   PetscScalar    vals[5],hx,hy,sx,sy;
 
   PetscFunctionBegin;
-  ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+  ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
   ierr = DMDAGetCorners(da,&xs,&ys,PETSC_NULL,&xm,&ym,PETSC_NULL);CHKERRQ(ierr);
 
   hx = 1.0/(PetscReal)(Mx-1); sx = 1.0/(hx*hx);
@@ -340,7 +340,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx     = 1.0/(PetscReal)(Mx-1);
   hy     = 1.0/(PetscReal)(My-1);
diff -r 23e7928e179a src/ts/examples/tutorials/ex17.c
--- a/src/ts/examples/tutorials/ex17.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex17.c	Fri Mar 11 16:29:15 2011 -0700
@@ -67,7 +67,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,-11,1,1,PETSC_NULL,&da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,-11,1,1,PETSC_NULL,&da);CHKERRQ(ierr);
 
   /*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Extract global vectors from DMDA; 
@@ -169,7 +169,7 @@
   PetscFunctionBegin;
   ierr = DMGetLocalVector(da,&localU);CHKERRQ(ierr);
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx = 1.0/(PetscReal)(Mx-1); sx = 1.0/(hx*hx);
 
@@ -237,7 +237,7 @@
   PetscFunctionBegin;
   ierr = MatGetOwnershipRange(*Jpre,&rstart,&rend);CHKERRQ(ierr);
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
   hx = 1.0/(PetscReal)(Mx-1); sx = 1.0/(hx*hx);
   for (i=rstart; i<rend; i++) {
     nc    = 0;
@@ -286,7 +286,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx = 1.0/(PetscReal)(Mx-1);
 
diff -r 23e7928e179a src/ts/examples/tutorials/ex2.c
--- a/src/ts/examples/tutorials/ex2.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex2.c	Fri Mar 11 16:29:15 2011 -0700
@@ -110,7 +110,7 @@
      and to set up the ghost point communication pattern.  There are M 
      total grid values spread equally among all the processors.
   */ 
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,appctx.m,1,1,PETSC_NULL,
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,appctx.m,1,1,PETSC_NULL,
                     &appctx.da);CHKERRQ(ierr);
 
   /*
diff -r 23e7928e179a src/ts/examples/tutorials/ex2f.F
--- a/src/ts/examples/tutorials/ex2f.F	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex2f.F	Fri Mar 11 16:29:15 2011 -0700
@@ -118,7 +118,7 @@
 !  Set up the ghost point communication pattern.  There are m total
 !  grid values spread equally among all the processors.
       i1 = 1
-      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,m,i1,i1,                &
+      call DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,m,i1,i1,                &
      &     PETSC_NULL_INTEGER,da,ierr)
 
 !  Extract global and local vectors from DMDA; then duplicate for remaining
diff -r 23e7928e179a src/ts/examples/tutorials/ex4.c
--- a/src/ts/examples/tutorials/ex4.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex4.c	Fri Mar 11 16:29:15 2011 -0700
@@ -131,7 +131,7 @@
      total grid values spread equally among all the processors.
   */ 
 
-  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,m,1,1,PETSC_NULL,&appctx.da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,m,1,1,PETSC_NULL,&appctx.da);CHKERRQ(ierr);
 
   /*
      Extract global and local vectors from DMDA; we use these to store the
diff -r 23e7928e179a src/ts/examples/tutorials/ex7.c
--- a/src/ts/examples/tutorials/ex7.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex7.c	Fri Mar 11 16:29:15 2011 -0700
@@ -49,7 +49,7 @@
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Create distributed array (DMDA) to manage parallel grid and vectors
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-8,-8,PETSC_DECIDE,PETSC_DECIDE,
+  ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-8,-8,PETSC_DECIDE,PETSC_DECIDE,
                     1,1,PETSC_NULL,PETSC_NULL,&da);CHKERRQ(ierr);
 
   /*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -153,7 +153,7 @@
   PetscFunctionBegin;
   ierr = DMGetLocalVector(da,&localX);CHKERRQ(ierr);
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx     = 1.0/(PetscReal)(Mx-1); sx = 1.0/(hx*hx);
   hy     = 1.0/(PetscReal)(My-1); sy = 1.0/(hy*hy);
@@ -220,7 +220,7 @@
 
   PetscFunctionBegin;
   ierr = DMDAGetInfo(da,PETSC_IGNORE,&Mx,&My,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,
-                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
+                   PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);
 
   hx     = 1.0/(PetscReal)(Mx-1);
   hy     = 1.0/(PetscReal)(My-1);
diff -r 23e7928e179a src/ts/examples/tutorials/ex9.c
--- a/src/ts/examples/tutorials/ex9.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/src/ts/examples/tutorials/ex9.c	Fri Mar 11 16:29:15 2011 -0700
@@ -1061,7 +1061,7 @@
 
   PetscFunctionBegin;
   ierr = DMGetLocalVector(ctx->da,&Xloc);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(ctx->da,0, &Mx,0,0, 0,0,0, &dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(ctx->da,0, &Mx,0,0, 0,0,0, &dof,0,0,0,0,0);CHKERRQ(ierr);
   hx = (ctx->xmax - ctx->xmin)/Mx;
   ierr = DMGlobalToLocalBegin(ctx->da,X,INSERT_VALUES,Xloc);CHKERRQ(ierr);
   ierr = DMGlobalToLocalEnd  (ctx->da,X,INSERT_VALUES,Xloc);CHKERRQ(ierr);
@@ -1164,7 +1164,7 @@
 
   PetscFunctionBegin;
   if (!ctx->physics.sample) SETERRQ(PETSC_COMM_SELF,1,"Physics has not provided a sampling function");
-  ierr = DMDAGetInfo(ctx->da,0, &Mx,0,0, 0,0,0, &dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(ctx->da,0, &Mx,0,0, 0,0,0, &dof,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(ctx->da,&xs,0,0,&xm,0,0);CHKERRQ(ierr);
   ierr = DMDAVecGetArray(ctx->da,U,&u);CHKERRQ(ierr);
   ierr = PetscMalloc(dof*sizeof uj[0],&uj);CHKERRQ(ierr);
@@ -1204,7 +1204,7 @@
     ierr = DMGlobalToLocalEnd  (da,X,INSERT_VALUES,Xloc);CHKERRQ(ierr);
     ierr = DMDAVecGetArray(da,Xloc,&x);CHKERRQ(ierr);
     ierr = DMDAGetCorners(da,&xs,0,0,&xm,0,0);CHKERRQ(ierr);
-    ierr = DMDAGetInfo(da,0, &Mx,0,0, 0,0,0, &dof,0,0,0);CHKERRQ(ierr);
+    ierr = DMDAGetInfo(da,0, &Mx,0,0, 0,0,0, &dof,0,0,0,0,0);CHKERRQ(ierr);
     tvsum = 0;
     for (i=xs; i<xs+xm; i++) {
       for (j=0; j<dof; j++) tvsum += PetscAbsScalar(x[i*dof+j] - x[(i-1)*dof+j]);
@@ -1321,7 +1321,7 @@
   }
 
   /* Create a DMDA to manage the parallel grid */
-  ierr = DMDACreate1d(comm,DMDA_XPERIODIC,-50,ctx.physics.dof,2,PETSC_NULL,&ctx.da);CHKERRQ(ierr);
+  ierr = DMDACreate1d(comm,DMDA_BOUNDARY_PERIODIC,-50,ctx.physics.dof,2,PETSC_NULL,&ctx.da);CHKERRQ(ierr);
   /* Inform the DMDA of the field names provided by the physics. */
   /* The names will be shown in the title bars when run with -ts_monitor_solution */
   for (i=0; i<ctx.physics.dof; i++) {
@@ -1330,7 +1330,7 @@
   /* Allow customization of the DMDA at runtime, mostly to change problem size with -da_grid_x M */
   ierr = DMSetFromOptions(ctx.da);CHKERRQ(ierr);
   ierr = DMSetUp(ctx.da);CHKERRQ(ierr);
-  ierr = DMDAGetInfo(ctx.da,0, &Mx,0,0, 0,0,0, &dof,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(ctx.da,0, &Mx,0,0, 0,0,0, &dof,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetCorners(ctx.da,&xs,0,0,&xm,0,0);CHKERRQ(ierr);
 
   /* Set coordinates of cell centers */
diff -r 23e7928e179a tutorials/multiphysics/mp.c
--- a/tutorials/multiphysics/mp.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/tutorials/multiphysics/mp.c	Fri Mar 11 16:29:15 2011 -0700
@@ -47,7 +47,7 @@
 	- Lap(Omega) + Div([U*Omega,V*Omega]) - GR*Grad_x(T) = 0
         where T is given by the given x.temp
         - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,3,1,0,0,&da1);CHKERRQ(ierr);
+  ierr = DMDACreate2d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,3,1,0,0,&da1);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da1,0,"x-velocity");CHKERRQ(ierr);
   ierr = DMDASetFieldName(da1,1,"y-velocity");CHKERRQ(ierr);
   ierr = DMDASetFieldName(da1,2,"Omega");CHKERRQ(ierr);
@@ -57,7 +57,7 @@
         - Lap(T) + PR*Div([U*T,V*T]) = 0        
         where U and V are given by the given x.u and x.v
         - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da2);CHKERRQ(ierr);
+  ierr = DMDACreate2d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da2);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da2,0,"temperature");CHKERRQ(ierr);
 
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -83,7 +83,7 @@
   ierr = DMMGSetUp(dmmg_comp);CHKERRQ(ierr);
 
   /* Problem parameters (velocity of lid, prandtl, and grashof numbers) */
-  ierr = DMDAGetInfo(da1,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da1,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   user.lidvelocity = 1.0/(mx*my);
   user.prandtl     = 1.0;
   user.grashof     = 1000.0; 
@@ -224,7 +224,7 @@
   ierr = MPI_Comm_rank(((PetscObject)dmcomposite)->comm,&rank);CHKERRQ(ierr);
   /* printf("[%d] __rstart %d, __nrows %d, __start %d, __end %d,\n",rank,__rstart,__nrows,__start,__end);*/
   ierr =  DMCompositeGetEntries(dmcomposite,&da1,&da2);CHKERRQ(ierr);
-  ierr =  DMDAGetInfo(da1,0,&M,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr =  DMDAGetInfo(da1,0,&M,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr  = DMDAGetCorners(da1,&istart,&jstart,PETSC_NULL,&in,&jn,PETSC_NULL);CHKERRQ(ierr);
 
   /* coupling from physics 1 to physics 2 */
diff -r 23e7928e179a tutorials/multiphysics/p1.c
--- a/tutorials/multiphysics/p1.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/tutorials/multiphysics/p1.c	Fri Mar 11 16:29:15 2011 -0700
@@ -45,7 +45,7 @@
 	- Lap(Omega) + Div([U*Omega,V*Omega]) - GR*Grad_x(T) = 0
         where T is given by the given x.temp
         - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,3,1,0,0,&da1);CHKERRQ(ierr);
+  ierr = DMDACreate2d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,3,1,0,0,&da1);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da1,0,"x-velocity");CHKERRQ(ierr);
   ierr = DMDASetFieldName(da1,1,"y-velocity");CHKERRQ(ierr);
   ierr = DMDASetFieldName(da1,2,"Omega");CHKERRQ(ierr);
@@ -59,7 +59,7 @@
   ierr = DMMGSetSNES(dmmg,FormFunction,0);CHKERRQ(ierr);
   ierr = DMMGSetFromOptions(dmmg);CHKERRQ(ierr);
 
-  ierr = DMDAGetInfo(da1,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da1,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   user.lidvelocity = 1.0/(mx*my);
   user.prandtl     = 1.0;
   user.grashof     = 1.0;
diff -r 23e7928e179a tutorials/multiphysics/p2.c
--- a/tutorials/multiphysics/p2.c	Thu Mar 10 22:14:51 2011 -0600
+++ b/tutorials/multiphysics/p2.c	Fri Mar 11 16:29:15 2011 -0700
@@ -43,7 +43,7 @@
         - Lap(T) + PR*Div([U*T,V*T]) = 0        
         where U and V are given by the given x.u and x.v
         - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-  ierr = DMDACreate2d(comm,DMDA_NONPERIODIC,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da2);CHKERRQ(ierr);
+  ierr = DMDACreate2d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,&da2);CHKERRQ(ierr);
   ierr = DMDASetFieldName(da2,0,"temperature");CHKERRQ(ierr);
 
   /* Create the solver object and attach the grid/physics info */
@@ -55,7 +55,7 @@
   ierr = DMMGSetSNES(dmmg,FormFunction,0);CHKERRQ(ierr);
   ierr = DMMGSetFromOptions(dmmg);CHKERRQ(ierr);
 
-  ierr = DMDAGetInfo(da2,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
+  ierr = DMDAGetInfo(da2,PETSC_NULL,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   user.lidvelocity = 1.0/(mx*my);
   user.prandtl     = 1.0;
   user.grashof     = 1.0;


More information about the petsc-dev mailing list