libMesh
eim_classes.h
Go to the documentation of this file.
1 #ifndef EIM_CLASSES_H
2 #define EIM_CLASSES_H
3 
4 // local includes
5 #include "libmesh/rb_eim_construction.h"
6 #include "libmesh/rb_eim_evaluation.h"
7 #include "assembly.h"
8 
9 // A simple subclass of RBEIMEvaluation. Overload
10 // evaluate_parametrized_function to define the
11 // function that we "empirically" interpolate.
12 class SimpleEIMEvaluation : public RBEIMEvaluation
13 {
14 public:
15 
17  : RBEIMEvaluation(comm)
18  {
19  attach_parametrized_function(&g_x);
20  attach_parametrized_function(&g_y);
21  attach_parametrized_function(&g_z);
22  }
23 
27  virtual UniquePtr<RBTheta> build_eim_theta(unsigned int index)
28  {
29  return UniquePtr<RBTheta>(new ThetaEIM(*this, index));
30  }
31 
38 };
39 
40 // A simple subclass of RBEIMConstruction.
41 class SimpleEIMConstruction : public RBEIMConstruction
42 {
43 public:
44 
48  SimpleEIMConstruction (EquationSystems & es,
49  const std::string & name_in,
50  const unsigned int number_in)
51  : Parent(es, name_in, number_in)
52  {
53  }
54 
58  typedef RBEIMConstruction Parent;
59 
63  virtual UniquePtr<ElemAssembly> build_eim_assembly(unsigned int index)
64  {
65  return UniquePtr<ElemAssembly>(new AssemblyEIM(*this, index));
66  }
67 
71  virtual void init_data()
72  {
73  Parent::init_data();
74 
75  set_inner_product_assembly(eim_ip);
76  }
77 
81  virtual void init_implicit_system()
82  {
83  this->add_variable ("L2_proj_var", libMesh::FIRST);
84  }
85 
89  virtual void init_explicit_system()
90  {
91  Gx_var = get_explicit_system().add_variable ("x_comp_of_G", libMesh::FIRST);
92  Gy_var = get_explicit_system().add_variable ("y_comp_of_G", libMesh::FIRST);
93  Gz_var = get_explicit_system().add_variable ("z_comp_of_G", libMesh::FIRST);
94  }
95 
99  unsigned int Gx_var;
100  unsigned int Gy_var;
101  unsigned int Gz_var;
102 
107 };
108 
109 #endif
virtual UniquePtr< RBTheta > build_eim_theta(unsigned int index)
Build a ThetaEIM rather than an RBEIMTheta.
Definition: eim_classes.h:27
unsigned int Gz_var
Definition: eim_classes.h:101
Encapsulates the MPI_Comm object.
Definition: parallel.h:657
Definition: assembly.h:64
unsigned int Gx_var
Variable numbers.
Definition: eim_classes.h:99
unsigned int Gy_var
Definition: eim_classes.h:100
virtual UniquePtr< ElemAssembly > build_eim_assembly(unsigned int index)
Provide an implementation of build_eim_assembly.
Definition: eim_classes.h:63
Definition: assembly.h:76
Ex6EIMInnerProduct eim_ip
Inner product assembly object.
Definition: eim_classes.h:106
virtual void init_implicit_system()
Initialize the implicit system that is used to perform L2 projections.
Definition: eim_classes.h:81
Gx g_x
Parametrized functions that we approximate with EIM.
Definition: eim_classes.h:35
RBEIMConstruction Parent
The type of the parent.
Definition: eim_classes.h:52
SimpleEIMConstruction(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Constructor.
Definition: eim_classes.h:48
SimpleEIMEvaluation(const libMesh::Parallel::Communicator &comm)
Definition: eim_classes.h:16
virtual void init_explicit_system()
Initialize the explicit system that is used to store the basis functions.
Definition: eim_classes.h:89
virtual void init_data()
Initialize data structures.
Definition: eim_classes.h:71
Definition: assembly.h:52