DMDACoor2d — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# DMDACoor2d

Structure for holding 2d (x and y) coordinates when working with `DMDA`

## Synopsis

    .vb
    DMDACoor2d **coors;
    Vec      vcoors;
    DM       cda;
    DMGetCoordinates(da,&vcoors);
    DMGetCoordinateDM(da,&cda);
    DMDAVecGetArray(cda,vcoors,&coors);
    DMDAGetCorners(cda,&mstart,&nstart,0,&m,&n,0)
    for (i=mstart; i<mstart+m; i++) {
    for (j=nstart; j<nstart+n; j++) {
    x = coors[j][i].x;
    y = coors[j][i].y;
    ......
    }
    }
    DMDAVecRestoreArray(dac,vcoors,&coors);
    .ve

## See Also

DM Basics, `DMDA`, `DMDACoor3d`, `DMDAVecRestoreArray()`, `DMDAVecGetArray()`, `DMGetCoordinateDM()`, `DMGetCoordinates()`

## Level

intermediate

## Location

include/petscdmda.h

## Examples

src/dm/tutorials/ex3.c
src/snes/tutorials/ex5.c
src/dm/tutorials/swarm_ex1.c
src/ksp/ksp/tutorials/ex49.c
src/snes/tutorials/ex55.c
src/snes/tutorials/ex55k.kokkos.cxx
src/ksp/ksp/tutorials/ex70.c
src/snes/tutorials/ex46.c
src/ksp/ksp/tutorials/ex43.c

Index of all DMDA routines
Table of Contents for all manual pages
Index of all manual pages