HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TrilinearInterpolation.c
Go to the documentation of this file.
1 
6 #include <mathfunctions.h>
7 
23  double xmin,
24  double xmax,
25  double ymin,
26  double ymax,
27  double zmin,
28  double zmax,
29  double x,
30  double y,
31  double z,
32  double *coeffs
33  )
34 {
35  double vol_inv = 1 / ((xmax-xmin)*(ymax-ymin)*(zmax-zmin));
36  double tldx1 = x - xmin;
37  double tldx2 = xmax - x;
38  double tldy1 = y - ymin;
39  double tldy2 = ymax - y;
40  double tldz1 = z - zmin;
41  double tldz2 = zmax - z;
42 
43  coeffs[0] = tldz2 * tldy2 * tldx2 * vol_inv;
44  coeffs[1] = tldz2 * tldy2 * tldx1 * vol_inv;
45  coeffs[2] = tldz2 * tldy1 * tldx2 * vol_inv;
46  coeffs[3] = tldz2 * tldy1 * tldx1 * vol_inv;
47  coeffs[4] = tldz1 * tldy2 * tldx2 * vol_inv;
48  coeffs[5] = tldz1 * tldy2 * tldx1 * vol_inv;
49  coeffs[6] = tldz1 * tldy1 * tldx2 * vol_inv;
50  coeffs[7] = tldz1 * tldy1 * tldx1 * vol_inv;
51 
52  return;
53 }
void TrilinearInterpCoeffs(double, double, double, double, double, double, double, double, double, double *)
Contains function definitions for common mathematical functions.