Chombo + EB + MF  3.2
Spline1DMapping.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _SPLINE1DMAPPING_H_
12 #define _SPLINE1DMAPPING_H_
13 
14 #include "REAL.H"
15 #include "Vector.H"
16 
17 #include "NamespaceHeader.H"
18 
19 
20 // Class to calculate a vertical mapping with splines
21 // Point data read from ParmParse initially, parameterized on [0,1]
23 {
24  private:
28  static const int s_order;
34 
35  public:
37 
39 
40  Spline1DMapping(Vector<Real>& a_points);
41 
42  // Read from ParmParse with tag "splineMapping.xxx"
43  void readParmParseInputs();
44 
45  void print();
46 
47  const Real* getPoints();
48 
49  int getNumPoints();
50 
51  /**
52  * Using the spline to interpolate at \xi \in [0,1]
53  */
54  Real getValue(const Real a_xi);
55 
56  /**
57  * Using the spline to interpolate a derivative at \xi \in [0,1]
58  */
59  Real getDerivative(const Real a_xi);
60 
61  void buildFromPoints(Vector<Real>& a_newPoints);
62 
63  /**
64  * Reinterpolates this mapping to a new size, using the existing
65  * spline to interpolate new values.
66  */
67  void reinterpolate(int a_newNumPoints);
68 
69  protected:
70 
71  // Code adapted from: triadiagonal
72  // http://www.pcs.cnu.edu/~bbradie/cpp/interp.C
73  void tridiagonal(Vector<Real>& a_lower, Vector<Real>& a_diag, Vector<Real>& a_upper,
74  Vector<Real>& a_rhs);
75 
76  // Code adapted from: cubic_nak
77  // http://www.pcs.cnu.edu/~bbradie/cpp/interp.C
78  void buildSpline();
79 
80 };
81 
82 #include "NamespaceFooter.H"
83 
84 #endif
Vector< Real > m_deriv3
Definition: Spline1DMapping.H:33
Real m_tol
Definition: Spline1DMapping.H:25
Definition: Spline1DMapping.H:22
Vector< Real > m_points
Definition: Spline1DMapping.H:30
static const int s_order
Definition: Spline1DMapping.H:28
Real * m_ptrPoints
Definition: Spline1DMapping.H:29
double Real
Definition: REAL.H:33
Vector< Real > m_deriv1
Definition: Spline1DMapping.H:31
int m_verbosity
Definition: Spline1DMapping.H:26
Vector< Real > m_deriv2
Definition: Spline1DMapping.H:32
void readParmParseInputs()
Real getDerivative(const Real a_xi)
void reinterpolate(int a_newNumPoints)
void tridiagonal(Vector< Real > &a_lower, Vector< Real > &a_diag, Vector< Real > &a_upper, Vector< Real > &a_rhs)
void buildFromPoints(Vector< Real > &a_newPoints)
int m_numPoints
Definition: Spline1DMapping.H:27
Real getValue(const Real a_xi)
const Real * getPoints()