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