# DMDACreate1d
Creates an object that will manage the communication of  one-dimensional regular array data that is distributed across some processors. 
## Synopsis
```
#include "petscdmda.h"   
PetscErrorCode DMDACreate1d(MPI_Comm comm, DMBoundaryType bx, PetscInt M, PetscInt dof, PetscInt s, const PetscInt lx[], DM *da)
```
Collective


## Input Parameters

- ***comm -*** MPI communicator
- ***bx -*** type of ghost cells at the boundary the array should have, if any. Use
`DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, or `DM_BOUNDARY_PERIODIC`.
- ***M -*** global dimension of the array (that is the number of grid points)
from the command line with -da_grid_x <M>)
- ***dof -*** number of degrees of freedom per node
- ***s -*** stencil width
- ***lx -*** array containing number of nodes in the X direction on each processor,
or NULL. If non-null, must be of length as the number of processes in the MPI_Comm.
The sum of these entries must equal M



## Output Parameter

- ***da -*** the resulting distributed array object



## Options Database Keys

- ***-dm_view -*** Calls `DMView()` at the conclusion of `DMDACreate1d()`
- ***-da_grid_x <nx> -*** number of grid points in x direction
- ***-da_refine_x <rx> -*** refinement factor
- ***-da_refine <n> -*** refine the `DMDA` n times before creating it





## Notes
The array data itself is NOT stored in the `DMDA`, it is stored in `Vec` objects;
The appropriate vector objects can be obtained with calls to `DMCreateGlobalVector()`
and `DMCreateLocalVector()` and calls to `VecDuplicate()` if more are needed.

You must call `DMSetUp()` after this call before using this `DM`.

If you wish to use the options database to change values in the `DMDA` call `DMSetFromOptions()` after this call
but before `DMSetUp()`.


## See Also
 `DMDA`, `DM`, `DMDestroy()`, `DMView()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMGlobalToLocalBegin()`, `DMDASetRefinementFactor()`,
`DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`, `DMLocalToLocalBegin()`, `DMLocalToLocalEnd()`, `DMDAGetRefinementFactor()`,
`DMDAGetInfo()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()`, `DMDACreateNaturalVector()`, `DMLoad()`, `DMDAGetOwnershipRanges()`,
`DMStagCreate1d()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/da/da1.c.html#DMDACreate1d">src/dm/impls/da/da1.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/ex11f90.F90.html">src/dm/tutorials/ex11f90.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/ex3.c.html">src/dm/tutorials/ex3.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/ex51.c.html">src/dm/tutorials/ex51.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/field/tutorials/ex1.c.html">src/dm/field/tutorials/ex1.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex25.c.html">src/ksp/ksp/tutorials/ex25.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex28.c.html">src/ksp/ksp/tutorials/ex28.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex44f.F90.html">src/ksp/ksp/tutorials/ex44f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex59.c.html">src/ksp/ksp/tutorials/ex59.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex65.c.html">src/ksp/ksp/tutorials/ex65.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex67.c.html">src/ksp/ksp/tutorials/ex67.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex69.c.html">src/ksp/ksp/tutorials/ex69.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/da/da1.c)


[Index of all DMDA routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
