Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ScatterResidual_Tpetra_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Panzer: A partial differential equation assembly
4 // engine for strongly coupled complex multiphysics systems
5 //
6 // Copyright 2011 NTESS and the Panzer contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 #ifndef PANZER_EVALUATOR_SCATTER_RESIDUAL_TPETRA_DECL_HPP
12 #define PANZER_EVALUATOR_SCATTER_RESIDUAL_TPETRA_DECL_HPP
13 
14 #include "Phalanx_config.hpp"
15 #include "Phalanx_Evaluator_Macros.hpp"
16 #include "Phalanx_MDField.hpp"
17 #include "Phalanx_KokkosViewOfViews.hpp"
18 
20 
21 #include "PanzerDiscFE_config.hpp"
22 #include "Panzer_Dimension.hpp"
23 #include "Panzer_Traits.hpp"
26 
27 #include "Panzer_NodeType.hpp"
28 
30 
32 
33 namespace panzer {
34 
35 class GlobalIndexer;
36 
45 template<typename EvalT, typename Traits,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
47 
48 // **************************************************************
49 // **************************************************************
50 // * Specializations
51 // **************************************************************
52 // **************************************************************
53 
54 
55 // **************************************************************
56 // Residual
57 // **************************************************************
58 template<typename TRAITS,typename LO,typename GO,typename NodeT>
59 class ScatterResidual_Tpetra<panzer::Traits::Residual,TRAITS,LO,GO,NodeT>
60  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
61  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
63 
64 public:
66  : globalIndexer_(indexer) {}
67 
69  const Teuchos::ParameterList& p);
70 
71  void postRegistrationSetup(typename TRAITS::SetupData d,
73 
74  void preEvaluate(typename TRAITS::PreEvalData d);
75 
76  void evaluateFields(typename TRAITS::EvalData workset);
77 
80 
81 private:
83 
84  // dummy field so that the evaluator will have something to do
86 
87  // fields that need to be scattered will be put in this vector
88  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
89 
90  // maps the local (field,element,basis) triplet to a global ID
91  // for scattering
93  std::vector<int> fieldIds_; // field IDs needing mapping
94 
95  // This maps the scattered field names to the DOF manager field
96  // For instance a Navier-Stokes map might look like
97  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
98  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
100 
101  std::string globalDataKey_; // what global data does this fill?
103 
104  PHX::View<int**> scratch_lids_;
105  std::vector<PHX::View<int*> > scratch_offsets_;
106 
108 };
109 
110 // **************************************************************
111 // Tangent
112 // **************************************************************
113 template<typename TRAITS,typename LO,typename GO,typename NodeT>
114 class ScatterResidual_Tpetra<panzer::Traits::Tangent,TRAITS,LO,GO,NodeT>
115  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
116  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
118 
119 public:
121  : globalIndexer_(indexer) {}
122 
124  const Teuchos::ParameterList& p);
125 
126  void postRegistrationSetup(typename TRAITS::SetupData d,
128 
129  void preEvaluate(typename TRAITS::PreEvalData d);
130 
131  void evaluateFields(typename TRAITS::EvalData workset);
132 
135 
136 private:
138  typedef typename panzer::Traits::RealType RealT;
139 
140  // dummy field so that the evaluator will have something to do
142 
143  // fields that need to be scattered will be put in this vector
144  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
145 
146  // maps the local (field,element,basis) triplet to a global ID
147  // for scattering
149  std::vector<int> fieldIds_; // field IDs needing mapping
150 
151  // This maps the scattered field names to the DOF manager field
152  // For instance a Navier-Stokes map might look like
153  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
154  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
156 
157  std::string globalDataKey_; // what global data does this fill?
159 
162 
163  PHX::View<int**> scratch_lids_;
164  std::vector<PHX::View<int*> > scratch_offsets_;
165 
167 };
168 
169 // **************************************************************
170 // Jacobian
171 // **************************************************************
172 template<typename TRAITS,typename LO,typename GO,typename NodeT>
173 class ScatterResidual_Tpetra<panzer::Traits::Jacobian,TRAITS,LO,GO,NodeT>
174  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
175  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
177 
178 public:
179 
181  : globalIndexer_(indexer) {}
182 
184  const Teuchos::ParameterList& pl);
185 
186  void postRegistrationSetup(typename TRAITS::SetupData d,
188 
189  void preEvaluate(typename TRAITS::PreEvalData d);
190 
191  void evaluateFields(typename TRAITS::EvalData workset);
192 
195 
196 private:
197 
199 
200  // dummy field so that the evaluator will have something to do
202 
203  // fields that need to be scattered will be put in this vector
204  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
205 
206  // maps the local (field,element,basis) triplet to a global ID
207  // for scattering
209  std::vector<int> fieldIds_; // field IDs needing mapping
210 
211  // This maps the scattered field names to the DOF manager field
212  // For instance a Navier-Stokes map might look like
213  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
214  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
216 
217  std::string globalDataKey_; // what global data does this fill?
219 
221 
224  std::vector<PHX::View<int*> > scratch_offsets_;
225 
228 };
229 
230 }
231 
232 // optionally include hessian support
233 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
235 #endif
236 
237 // **************************************************************
238 #endif
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Teuchos::RCP< const TpetraLinearObjContainer< double, LO, GO, NodeT > > tpetraContainer_
PHX::ViewOfViews< 1, Kokkos::View< RealT **, Kokkos::LayoutLeft, PHX::Device > > dfdpFieldsVoV_
Storage for the tangent data.
Teuchos::RCP< const TpetraLinearObjContainer< double, LO, GO, NodeT > > tpetraContainer_
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Kokkos::View< typename Sacado::ScalarType< ScalarT >::type **, Kokkos::LayoutRight, PHX::Device > scratch_vals_
Pushes residual values into the residual vector for a Newton-based solve.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Non-templated empty base class for template managers.
Teuchos::RCP< const TpetraLinearObjContainer< double, LO, GO, NodeT > > tpetraContainer_