VertexCFD  0.0-dev
VertexCFD_Closure_ExternalFields.hpp
1 #ifndef VERTEXCFD_CLOSURE_EXTERNALFIELDS_HPP
2 #define VERTEXCFD_CLOSURE_EXTERNALFIELDS_HPP
3 
4 #include <drivers/VertexCFD_ExternalFieldsManager.hpp>
5 
6 #include <Panzer_Dimension.hpp>
7 #include <Panzer_Evaluator_WithBaseImpl.hpp>
8 #include <Panzer_GlobalIndexer.hpp>
9 #include <Panzer_PureBasis.hpp>
10 
11 #include <Phalanx_Evaluator_Derived.hpp>
12 #include <Phalanx_FieldManager.hpp>
13 #include <Phalanx_KokkosDeviceTypes.hpp>
14 #include <Phalanx_MDField.hpp>
15 
16 #include <Teuchos_RCP.hpp>
17 
18 #include <Kokkos_Core.hpp>
19 
20 #include <string>
21 #include <vector>
22 
23 namespace VertexCFD
24 {
25 namespace ClosureModel
26 {
27 //---------------------------------------------------------------------------//
28 // Add external fields from another physics manager as a closure model. This
29 // will gather the fields and put them at the basis points.
30 //---------------------------------------------------------------------------//
31 template<class EvalType, class Traits>
32 class ExternalFields : public panzer::EvaluatorWithBaseImpl<Traits>,
33  public PHX::EvaluatorDerived<EvalType, Traits>
34 {
35  public:
36  using scalar_type = typename EvalType::ScalarT;
37 
38  ExternalFields(const std::string& evaluator_name,
39  const Teuchos::RCP<const ExternalFieldsManager<Traits>>&
40  external_fields_manager,
41  const std::vector<std::string>& external_field_names,
42  const Teuchos::RCP<const panzer::PureBasis>& basis);
43 
44  void postRegistrationSetup(typename Traits::SetupData d,
45  PHX::FieldManager<Traits>& fm);
46 
47  void evaluateFields(typename Traits::EvalData d);
48 
49  private:
50  int _num_field;
51 
52  public:
53  std::vector<PHX::MDField<scalar_type, panzer::Cell, panzer::BASIS>>
54  _external_fields;
55 
56  private:
57  Teuchos::RCP<const panzer::GlobalIndexer> _global_indexer;
58  std::vector<int> _field_ids;
59  Kokkos::View<double*, PHX::Device> _ghosted_field_data;
60  Kokkos::View<int**, PHX::Device> _scratch_lids;
61  std::vector<Kokkos::View<int*, PHX::Device>> _scratch_offsets;
62 };
63 
64 //---------------------------------------------------------------------------//
65 
66 } // end namespace ClosureModel
67 } // namespace VertexCFD
68 
69 #endif // end VERTEXCFD_CLOSURE_EXTERNALFIELDS_HPP
VertexCFD
Definition: tstMethodManufacturedSolutionBC.cpp:23
VertexCFD::ExternalFieldsManager
Definition: VertexCFD_ExternalFieldsManager.hpp:23
VertexCFD::ClosureModel::ExternalFields
Definition: VertexCFD_Closure_ExternalFields.hpp:34