VertexCFD  0.0-dev
VertexCFD_ScalarParameterObserver.hpp
1 #ifndef VERTEXCFD_SCALARPARAMETEROBSERVER_HPP
2 #define VERTEXCFD_SCALARPARAMETEROBSERVER_HPP
3 
4 #include "VertexCFD_GeneralScalarParameter.hpp"
5 #include "VertexCFD_ScalarParameter.hpp"
6 
7 #include <Panzer_GlobalData.hpp>
8 
9 #include <Teuchos_ParameterList.hpp>
10 
11 #include <string>
12 #include <vector>
13 
14 namespace VertexCFD
15 {
16 namespace Parameter
17 {
18 //---------------------------------------------------------------------------//
19 template<class EvalType>
21 {
22  public:
23  using scalar_type = typename EvalType::ScalarT;
24 
25  // Register a parameter with the observer. The parameter will be extracted
26  // from the parameter list and assigned to the reference (note that this
27  // reference is stored by the underlying parameter). If the parameter is
28  // not in the list the provided default value will be used.
29  void registerParameter(const std::string& name,
30  const double default_value,
31  const Teuchos::ParameterList& plist,
32  scalar_type& ref_to_parameter);
33 
34  // Update the value of all parameters owned by the observer with the
35  // current state of the global data and the current workset.
36  void
37  update(const panzer::GlobalData& global_data,
38  const panzer::Workset& workset,
39  const std::unordered_map<std::string,
40  std::unordered_map<std::string, double>>&
41  general_parameter_data);
42 
43  protected:
44  // After the parameters have been updated, update the state of the
45  // observer as necessary to be consistent with the new parameter
46  // values. This will always be called inside of update() and therefore the
47  // parameter state is guaranteed to be up-to-date.
48  virtual void updateStateWithNewParameters() = 0;
49 
50  private:
51  std::vector<ScalarParameter<EvalType>> _scalar_parameters;
52  std::vector<GeneralScalarParameter<EvalType>> _general_parameters;
53 };
54 
55 //---------------------------------------------------------------------------//
56 
57 } // namespace Parameter
58 } // namespace VertexCFD
59 
60 #endif // end VERTEXCFD_SCALARPARAMETEROBSERVER_HPP
VertexCFD
Definition: tstMethodManufacturedSolutionBC.cpp:23
VertexCFD::Parameter::ScalarParameterObserver
Definition: VertexCFD_ScalarParameterObserver.hpp:21