Actual source code: daghost.c

  1: /*$Id: daghost.c,v 1.24 2001/03/23 23:25:00 balay Exp $*/
  2: 
  3: /*
  4:   Code for manipulating distributed regular arrays in parallel.
  5: */

 7:  #include src/dm/da/daimpl.h

  9: /*@
 10:    DAGetGhostCorners - Returns the global (x,y,z) indices of the lower left
 11:    corner of the local region, including ghost points.

 13:    Not Collective

 15:    Input Parameter:
 16: .  da - the distributed array

 18:    Output Parameters:
 19: +  x,y,z - the corner indices (where y and z are optional; these are used
 20:            for 2D and 3D problems)
 21: -  m,n,p - widths in the corresponding directions (where n and p are optional;
 22:            these are used for 2D and 3D problems)

 24:    Level: beginner

 26:    Note:
 27:    The corner information is independent of the number of degrees of 
 28:    freedom per node set with the DACreateXX() routine. Thus the x, y, z, and
 29:    m, n, p can be thought of as coordinates on a logical grid, where each
 30:    grid point has (potentially) several degrees of freedom.
 31:    Any of y, z, n, and p can be passed in as PETSC_NULL if not needed.

 33: .keywords: distributed array, get, ghost, corners, nodes, local indices

 35: .seealso: DAGetCorners(), DACreate1d(), DACreate2d(), DACreate3d()

 37: @*/
 38: int DAGetGhostCorners(DA da,int *x,int *y,int *z,int *m,int *n,int *p)
 39: {
 40:   int w;

 44:   /* since the xs, xe ... have all been multiplied by the number of degrees 
 45:      of freedom per cell, w = da->w, we divide that out before returning.*/
 46:   w = da->w;
 47:   if (x) *x = da->Xs/w; if (m) *m = (da->Xe - da->Xs)/w;
 48:   if (y) *y = da->Ys;   if (n) *n = (da->Ye - da->Ys);
 49:   if (z) *z = da->Zs;   if (p) *p = (da->Ze - da->Zs);
 50:   return(0);
 51: }