libMesh
eim_classes.h
Go to the documentation of this file.
1 #ifndef EIM_CLASSES_H
2 #define EIM_CLASSES_H
3 
4 // libMesh includes
5 #include "libmesh/rb_eim_construction.h"
6 #include "libmesh/rb_eim_evaluation.h"
7 #include "libmesh/auto_ptr.h" // libmesh_make_unique
8 
9 // Example includes
10 #include "assembly.h"
11 
12 // Bring in bits from the libMesh namespace.
13 // Just the bits we're using, since this is a header.
16 #ifndef LIBMESH_HAVE_CXX14_MAKE_UNIQUE
18 #endif
19 
20 // A simple subclass of RBEIMEvaluation. Overload
21 // evaluate_parametrized_function to define the
22 // function that we "empirically" interpolate.
24 {
25 public:
26 
27  SimpleEIMEvaluation(const libMesh::Parallel::Communicator & comm) :
28  RBEIMEvaluation(comm)
29  {
30  attach_parametrized_function(&sg);
31  }
32 
37 };
38 
39 // A simple subclass of RBEIMConstruction.
40 class SimpleEIMConstruction : public RBEIMConstruction
41 {
42 public:
43 
48  const std::string & name_in,
49  const unsigned int number_in)
50  : Parent(es, name_in, number_in)
51  {
52  }
53 
57  typedef RBEIMConstruction Parent;
58 
62  virtual std::unique_ptr<ElemAssembly> build_eim_assembly(unsigned int index)
63  {
64  return libmesh_make_unique<EIM_F>(*this, index);
65  }
66 
70  virtual void init_data()
71  {
72  Parent::init_data();
73 
74  set_inner_product_assembly(ip);
75  }
76 
80  virtual void init_implicit_system()
81  {
82  this->add_variable ("L2_proj_var", libMesh::FIRST);
83  }
84 
88  virtual void init_explicit_system()
89  {
90  u_var = get_explicit_system().add_variable ("f_EIM", libMesh::FIRST);
91  }
92 
96  unsigned int u_var;
97 
102 };
103 
104 #endif
SimpleEIMConstruction
Definition: eim_classes.h:40
SimpleEIMEvaluation
Definition: eim_classes.h:23
SimpleEIMConstruction::build_eim_assembly
virtual std::unique_ptr< ElemAssembly > build_eim_assembly(unsigned int index)
Provide an implementation of build_eim_assembly.
Definition: eim_classes.h:62
SimpleEIMConstruction::ip
EIM_IP_assembly ip
Inner product assembly object.
Definition: eim_classes.h:101
SimpleEIMConstruction::SimpleEIMConstruction
SimpleEIMConstruction(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Constructor.
Definition: eim_classes.h:47
libMesh::RBEIMEvaluation
This class is part of the rbOOmit framework.
Definition: rb_eim_evaluation.h:51
libMesh::EquationSystems
This is the EquationSystems class.
Definition: equation_systems.h:74
libMesh::make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: auto_ptr.h:45
SimpleEIMConstruction::u_var
unsigned int u_var
Variable number for u.
Definition: eim_classes.h:96
ShiftedGaussian
Definition: assembly.h:39
EIM_IP_assembly
Definition: assembly.h:84
SimpleEIMEvaluation::SimpleEIMEvaluation
SimpleEIMEvaluation(const libMesh::Parallel::Communicator &comm)
Definition: eim_classes.h:27
SimpleEIMConstruction::Parent
RBEIMConstruction Parent
The type of the parent.
Definition: eim_classes.h:57
SimpleEIMConstruction::init_implicit_system
virtual void init_implicit_system()
Initialize the implicit system that is used to perform L2 projections.
Definition: eim_classes.h:80
SimpleEIMConstruction::init_explicit_system
virtual void init_explicit_system()
Initialize the explicit system that is used to store the basis functions.
Definition: eim_classes.h:88
libMesh::FIRST
Definition: enum_order.h:42
SimpleEIMEvaluation::sg
ShiftedGaussian sg
Parametrized function that we approximate with EIM.
Definition: eim_classes.h:36
SimpleEIMConstruction::init_data
virtual void init_data()
Initialize data structures.
Definition: eim_classes.h:70