libROM  v1.0
Data-driven physical simulation library
Hyperreduction.h
1 
11 // Description: Interface to hyperreduction algorithms.
12 
13 #ifndef included_Hyperreduction_h
14 #define included_Hyperreduction_h
15 
16 
17 #include <string>
18 #include <unordered_map>
19 
20 #include <vector>
21 #include <memory>
22 
23 namespace CAROM {
24 
25 enum SamplingType
26 {
27  deim, // Default, DEIM
28  gnat, // GNAT
29  qdeim, // QDEIM
30  sopt // S-OPT
31 };
32 
33 static std::unordered_map<std::string, SamplingType> SamplingTypeMap =
34 {
35  {"deim", deim},
36  {"gnat", gnat},
37  {"qdeim", qdeim},
38  {"sopt", sopt}
39 };
40 
41 class Matrix;
42 
44 {
45 public:
46 
47  Hyperreduction(SamplingType stype) :
48  samplingType(stype)
49  { }
50 
51  Hyperreduction(const char* sampling_type);
52 
53  void SetSamplingType(SamplingType stype)
54  {
55  samplingType = stype;
56  }
57 
58  void ComputeSamples(const std::shared_ptr<Matrix> & f_basis,
59  int num_f_basis_vectors_used,
60  std::vector<int>& f_sampled_row,
61  std::vector<int>& f_sampled_rows_per_proc,
62  Matrix& f_basis_sampled_inv,
63  int myid,
64  int num_procs,
65  const int num_samples_req = -1,
66  std::vector<int> *init_samples=NULL,
67  bool qr_factorize = false);
68 
69 private:
70  SamplingType samplingType;
71 };
72 
73 }
74 #endif