libROM  v1.0
Data-driven physical simulation library
SnapshotDMD.h
1 #ifndef included_SnapshotDMD_h
2 #define included_SnapshotDMD_h
3 
4 #include "DMD.h"
5 #include <vector>
6 
7 namespace CAROM {
8 
9 class Vector;
10 class SnapshotDMD : public DMD
11 {
12 public:
13 
24  SnapshotDMD(int dim, double dt, bool alt_output_basis = false,
25  std::shared_ptr<Vector> state_offset = nullptr) :
26  DMD(dim, dt, alt_output_basis, state_offset) {}
27 
35  SnapshotDMD(std::string base_file_name) : DMD(base_file_name) {}
36 
40  ~SnapshotDMD();
41 
48  void interpolateToNSnapshots(int n);
49 
60  void train(int k, const Matrix* W0 = NULL, double linearity_tol = 0.0);
61 
70  void train(double energy_fraction, const Matrix* W0 = NULL,
71  double linearity_tol = 0.0);
72 
76  std::vector<std::shared_ptr<Vector>> getSnapshotVectors()
77  {
78  return d_snapshots;
79  }
80 protected:
101  friend void getParametricDMD<SnapshotDMD>(std::unique_ptr<SnapshotDMD>&
102  parametric_dmd,
103  const std::vector<Vector>& parameter_points,
104  std::vector<SnapshotDMD*>& dmds,
105  const Vector & desired_point,
106  std::string rbf,
107  std::string interp_method,
108  double closest_rbf_val,
109  bool reorthogonalize_W);
110 
123  SnapshotDMD(std::vector<std::complex<double>> & eigs,
124  std::shared_ptr<Matrix> & phi_real,
125  std::shared_ptr<Matrix> & phi_imaginary, int k, double dt,
126  double t_offset, std::shared_ptr<Vector> & state_offset) :
127  DMD(eigs, phi_real, phi_imaginary, k, dt, t_offset, state_offset) {}
128 
129 private:
130 };
131 }
132 #endif
Definition: DMD.h:71
std::vector< std::shared_ptr< Vector > > d_snapshots
std::vector holding the snapshots.
Definition: DMD.h:362
std::vector< std::shared_ptr< Vector > > getSnapshotVectors()
Returns a copy of the current snapshot vector "d_snapshots".
Definition: SnapshotDMD.h:76
SnapshotDMD(std::vector< std::complex< double >> &eigs, std::shared_ptr< Matrix > &phi_real, std::shared_ptr< Matrix > &phi_imaginary, int k, double dt, double t_offset, std::shared_ptr< Vector > &state_offset)
Constructor.
Definition: SnapshotDMD.h:123
SnapshotDMD(int dim, double dt, bool alt_output_basis=false, std::shared_ptr< Vector > state_offset=nullptr)
Constructor. Basic DMD with uniform time step size. Inherited directly from base DMD class.
Definition: SnapshotDMD.h:24
void interpolateToNSnapshots(int n)
Interpolate the current snapshots to n, new snapshots distributed uniformly over the currently sample...
Definition: SnapshotDMD.cpp:49
SnapshotDMD(std::string base_file_name)
Constructor. DMD from saved models. Inherited directly from base DMD class.
Definition: SnapshotDMD.h:35
~SnapshotDMD()
Destroy the SnapshotDMD object.
Definition: SnapshotDMD.cpp:22
void train(int k, const Matrix *W0=NULL, double linearity_tol=0.0)
Train the DMD model with specified reduced dimension. If k is too large then new snapshots are comput...
Definition: SnapshotDMD.cpp:26