# DACreate2d

Creates an object that will manage the communication of two-dimensional regular array data that is distributed across some processors.

### Synopsis

    #include "petscda.h"
    PetscErrorCode PETSCDM_DLLEXPORT DACreate2d(MPI_Comm comm,DAPeriodicType wrap,DAStencilType stencil_type,
                              PetscInt M,PetscInt N,PetscInt m,PetscInt n,PetscInt dof,PetscInt s,PetscInt *lx,PetscInt *ly,DA *inra)

Collective on MPI_Comm

### Input Parameters

| comm | - MPI communicator
| wrap | - type of periodicity should the array have. Use one of DA_NONPERIODIC, DA_XPERIODIC, DA_YPERIODIC, or DA_XYPERIODIC.
| stencil_type | - stencil type. Use either DA_STENCIL_BOX or DA_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>)
| m,n | - corresponding number of processors in each dimension (or PETSC_DECIDE to have calculated)
| dof | - number of degrees of freedom per node
| s | - stencil width
| lx, ly | - arrays containing the number of nodes in each cell along the x and y coordinates, or PETSC_NULL. If non-null, these must be of length as m and n, and the corresponding m and n cannot be PETSC_DECIDE. The sum of the lx[] entries must be M, and the sum of the ly[] entries must be N.

### Output Parameter

inra -the resulting distributed array object

### Options Database Key

| -da_view | - Calls DAView() at the conclusion of DACreate2d()
| -da_grid_x <nx> | - number of grid points in x direction, if M < 0
| -da_grid_y <ny> | - number of grid points in y direction, if N < 0
| -da_processors_x <nx> | - number of processors in x direction
| -da_processors_y <ny> | - number of processors in y direction
| -da_refine_x | - refinement ratio in x direction
| -da_refine_y | - refinement ratio in y direction

### Notes

The stencil type DA_STENCIL_STAR with width 1 corresponds to the standard 5-pt stencil, while DA_STENCIL_BOX with width 1 denotes the standard 9-pt stencil.

The array data itself is NOT stored in the DA, it is stored in Vec objects; The appropriate vector objects can be obtained with calls to DACreateGlobalVector() and DACreateLocalVector() and calls to VecDuplicate() if more are needed.

### Keywords

distributed array, create, two-dimensional

### See Also

DADestroy(), DAView(), DACreate1d(), DACreate3d(), DAGlobalToLocalBegin(), DAGetRefinementFactor(),
DAGlobalToLocalEnd(), DALocalToGlobal(), DALocalToLocalBegin(), DALocalToLocalEnd(), DASetRefinementFactor(), DAGetInfo(), DACreateGlobalVector(), DACreateLocalVector(), DACreateNaturalVector(), DALoad(), DAView()

Level:beginner
Location: src/dm/da/src/da2.c
Index of all DA routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/ksp/ksp/examples/tutorials/ex29.c.html
src/ksp/ksp/examples/tutorials/ex32.c.html
src/ksp/ksp/examples/tutorials/ex14f.F.html
src/snes/examples/tutorials/ex5.c.html
src/snes/examples/tutorials/ex18.c.html
src/snes/examples/tutorials/ex19.c.html
src/snes/examples/tutorials/ex25.c.html
src/snes/examples/tutorials/ex27.c.html
src/snes/examples/tutorials/ex29.c.html
src/snes/examples/tutorials/ex30.c.html
src/snes/examples/tutorials/ex31.c.html