HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
BCExtrapolate.c
Go to the documentation of this file.
1 
6 #include <stdlib.h>
7 #include <basic.h>
8 #include <arrayfunctions.h>
9 #include <boundaryconditions.h>
10 
14  void *b,
15  void *m,
16  int ndims,
17  int nvars,
18  int *size,
19  int ghosts,
20  double *phi,
21  double waqt
22  )
23 {
24  DomainBoundary *boundary = (DomainBoundary*) b;
25 
26  int dim = boundary->dim;
27  int face = boundary->face;
28 
29  if (boundary->on_this_proc) {
30  int bounds[ndims], indexb[ndims], indexi[ndims];
31  _ArraySubtract1D_(bounds,boundary->ie,boundary->is,ndims);
32  _ArraySetValue_(indexb,ndims,0);
33  int done = 0;
34  while (!done) {
35  _ArrayCopy1D_(indexb,indexi,ndims);
36  _ArrayAdd1D_(indexi,indexi,boundary->is,ndims);
37  if (face == 1) indexi[dim] = ghosts-1-indexb[dim];
38  else if (face == -1) indexi[dim] = size[dim]-indexb[dim]-1;
39  else return(1);
40  int p1,p2;
41  _ArrayIndex1DWO_(ndims,size,indexb,boundary->is,ghosts,p1);
42  _ArrayIndex1D_(ndims,size,indexi,ghosts,p2);
43  _ArrayCopy1D_((phi+nvars*p2),(phi+nvars*p1),nvars);
44  _ArrayIncrementIndex_(ndims,bounds,indexb,done);
45  }
46  }
47  return(0);
48 }
Containts the structures and definitions for boundary condition implementation.
int BCExtrapolateU(void *b, void *m, int ndims, int nvars, int *size, int ghosts, double *phi, double waqt)
Definition: BCExtrapolate.c:13
Some basic definitions and macros.
Structure containing the variables and function pointers defining a boundary.
#define _ArraySubtract1D_(x, a, b, size)
#define _ArrayAdd1D_(x, a, b, size)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArraySetValue_(x, size, value)
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.