VertexCFD  0.0-dev
VertexCFD_ResponseManager.hpp
1 #ifndef VERTEXCFD_RESPONSEMANAGER_HPP
2 #define VERTEXCFD_RESPONSEMANAGER_HPP
3 
4 #include "drivers/VertexCFD_PhysicsManager.hpp"
5 
6 #include <Panzer_WorksetDescriptor.hpp>
7 
8 #include <Thyra_VectorBase.hpp>
9 
10 #include <Teuchos_Array.hpp>
11 #include <Teuchos_RCP.hpp>
12 
13 #include <string>
14 #include <unordered_map>
15 #include <vector>
16 
17 namespace VertexCFD
18 {
19 namespace Response
20 {
22 {
23  public:
24  explicit ResponseManager(Teuchos::RCP<PhysicsManager> physics_manager);
25 
26  void addFunctionalResponse(
27  const std::string& name,
28  const std::string& field_name,
29  const std::vector<panzer::WorksetDescriptor>& workset_descriptors);
30  void addFunctionalResponse(const std::string& name,
31  const std::string& field_name);
32  void addMinValueResponse(const std::string& name,
33  const std::string& field_name);
34  void addMinValueResponse(
35  const std::string& name,
36  const std::string& field_name,
37  const std::vector<panzer::WorksetDescriptor>& workset_descriptors);
38  void addMaxValueResponse(
39  const std::string& name,
40  const std::string& field_name,
41  const std::vector<panzer::WorksetDescriptor>& workset_descriptors);
42  void addMaxValueResponse(const std::string& name,
43  const std::string& field_name);
44  void addProbeResponse(
45  const std::string& name,
46  const std::string& field_name,
47  const Teuchos::Array<double>& point,
48  const std::vector<panzer::WorksetDescriptor>& workset_descriptors);
49  void addProbeResponse(const std::string& name,
50  const std::string& field_name,
51  const Teuchos::Array<double>& point);
52  void activateResponse(const int index = 0);
53  void activateResponse(const std::string& name);
54  void activateAll();
55  void deactivateAll();
56  bool isActive(const int index);
57  bool isActive(const std::string& name);
58  void
59  evaluateResponses(const Teuchos::RCP<Thyra::VectorBase<double>>& x,
60  const Teuchos::RCP<Thyra::VectorBase<double>>& x_dot);
61 
62  int numResponses() const;
63  int globalIndex(const int index = 0) const;
64  int globalIndex(const std::string& name) const;
65  const std::string& name(const int index = 0) const;
66  double value(const int index = 0) const;
67  double value(const std::string& name) const;
68 
69  private:
70  int _num_responses;
71  Teuchos::RCP<PhysicsManager> _physics_manager;
72  std::vector<panzer::WorksetDescriptor> _default_workset_descriptors;
73  std::vector<int> _index_map;
74  std::unordered_map<std::string, int> _name_map;
75  std::vector<Teuchos::RCP<Thyra::VectorBase<double>>> _resp_vectors;
76  std::vector<bool> _is_active;
77 
78  void addExtremeValueResponse(
79  const bool use_max,
80  const std::string& name,
81  const std::string& field_name,
82  const std::vector<panzer::WorksetDescriptor>& workset_descriptors);
83 
84  template<class Builder>
85  void addResponseFromBuilder(
86  const std::string& name,
87  const std::vector<panzer::WorksetDescriptor>& workset_descriptors,
88  const Builder& builder);
89 };
90 
91 //---------------------------------------------------------------------------//
92 // Create a response manager from a parameter list.
93 Teuchos::RCP<ResponseManager>
94 createResponseManager(Teuchos::RCP<PhysicsManager> physics_manager,
95  Teuchos::ParameterList& response_params,
96  std::vector<int>& response_output_freq);
97 
98 } // namespace Response
99 } // namespace VertexCFD
100 
101 #endif // VERTEXCFD_RESPONSEMANAGER_HPP
VertexCFD
Definition: tstMethodManufacturedSolutionBC.cpp:23
VertexCFD::Response::ResponseManager
Definition: VertexCFD_ResponseManager.hpp:22