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: #undef __FUNCT__  
 11: /*@
 12:    DAGetGhostCorners - Returns the global (x,y,z) indices of the lower left
 13:    corner of the local region, including ghost points.

 15:    Not Collective

 17:    Input Parameter:
 18: .  da - the distributed array

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

 26:    Level: beginner

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

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

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

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

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