petsc-3.13.1 2020-05-02
Report Typos and Errors

DMStagRestoreProductCoordinateArrays

restore local array access

Synopsis

PetscErrorCode DMStagRestoreProductCoordinateArrays(DM dm,void *arrX,void *arrY,void *arrZ)
Logically Collective

Input Parameter

dm -the DMStag object

Output Parameters

arrX,arrY,arrZ -local 1D coordinate arrays

Notes

This function does not automatically perform a local->global scatter to populate global coordinates from the local coordinates. Thus, it may be required to explicitly perform these operations in some situations, as in the following partial example

  ierr = DMGetCoordinateDM(dm,&cdm);CHKERRQ(ierr);
  for (d=0; d<3; ++d) {
    DM  subdm;
    Vec coor,coor_local;

    ierr = DMProductGetDM(cdm,d,&subdm);CHKERRQ(ierr);
    ierr = DMGetCoordinates(subdm,&coor);CHKERRQ(ierr);
    ierr = DMGetCoordinatesLocal(subdm,&coor_local);CHKERRQ(ierr);
    ierr = DMLocalToGlobal(subdm,coor_local,INSERT_VALUES,coor);CHKERRQ(ierr);
    ierr = PetscPrintf(PETSC_COMM_WORLD,"Coordinates dim %D:\n",d);CHKERRQ(ierr);
    ierr = VecView(coor,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
  }

See Also

DMSTAG, DMStagGetProductCoordinateArrays(), DMStagGetProductCoordinateArraysRead()

Level

intermediate

Location

src/dm/impls/stag/stagutils.c
Index of all DMSTAG routines
Table of Contents for all manual pages
Index of all manual pages