libROM  v1.0
Data-driven physical simulation library
PCHIPInterpolator.h
1 #ifndef included_PCHIPInterpolator_h
2 #define included_PCHIPInterpolator_h
3 
4 #include <vector>
5 #include <string>
6 #include <memory>
7 
8 namespace CAROM {
9 
10 class Matrix;
11 class Vector;
12 
20 {
21 public:
22 
23 
25  {}
27  {}
28 
41  void interpolate(std::vector<Vector>& snapshot_ts,
42  std::vector<std::shared_ptr<Vector>>& snapshots,
43  std::vector<Vector>& output_ts,
44  std::vector<std::shared_ptr<Vector>>& output_snapshots);
45 
59  void interpolate(std::vector<Vector>& snapshot_ts,
60  std::vector<std::shared_ptr<Vector>>& snapshots,
61  int n_out,
62  std::vector<Vector>& output_ts,
63  std::vector<std::shared_ptr<Vector>>& output_snapshots);
64 
65 private:
66 
67  double computeDerivative(double S1, double S2, double h1, double h2) const;
68  double computeH1(double x, double xl, double xr) const;
69  double computeH2(double x, double xl, double xr) const;
70  double computeH3(double x, double xl, double xr) const;
71  double computeH4(double x, double xl, double xr) const;
72  double computePhi(double t) const;
73  double computePsi(double t) const;
74  int sign(double a) const;
75 };
76 
77 }
78 #endif
void interpolate(std::vector< Vector > &snapshot_ts, std::vector< std::shared_ptr< Vector >> &snapshots, std::vector< Vector > &output_ts, std::vector< std::shared_ptr< Vector >> &output_snapshots)
Compute new snapshots interpolated from snapshot_ts to output_ts.