Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ScatterResidual_BlockedTpetra.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_BLOCKEDTPETRA_DECL_HPP
12 #define PANZER_EVALUATOR_SCATTER_RESIDUAL_BLOCKEDTPETRA_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 
28 
29 namespace panzer {
30 
31 // Forward declarations
32 class BlockedDOFManager;
33 class GlobalIndexer;
34 
39 template <typename EvalT,typename TRAITS,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
41  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
42  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
44 public:
45  typedef typename EvalT::ScalarT ScalarT;
46 
48  { }
50  const Teuchos::ParameterList& p);
51 
54 
55  void postRegistrationSetup(typename TRAITS::SetupData /* d */, PHX::FieldManager<TRAITS>& /* vm */)
56  { }
57  void evaluateFields(typename TRAITS::EvalData /* d */)
58  { std::cout << "unspecialized version of \"ScatterResidual_BlockedTpetra::evaluateFields\" on \""+PHX::print<EvalT>()+"\" should not be used!" << std::endl;
59  TEUCHOS_ASSERT(false); }
60 };
61 
62 // **************************************************************
63 // **************************************************************
64 // * Specializations
65 // **************************************************************
66 // **************************************************************
67 
68 
69 // **************************************************************
70 // Residual
71 // **************************************************************
72 template <typename TRAITS,typename LO,typename GO,typename NodeT>
73 class ScatterResidual_BlockedTpetra<panzer::Traits::Residual,TRAITS,LO,GO,NodeT>
74  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
75  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
77 
78 public:
80  : globalIndexer_(indexer) {}
81 
83  const Teuchos::ParameterList& p);
84 
85  void postRegistrationSetup(typename TRAITS::SetupData d,
87 
88  void preEvaluate(typename TRAITS::PreEvalData d);
89 
90  void evaluateFields(typename TRAITS::EvalData workset);
91 
94 
95 private:
97  typedef typename TRAITS::RealType RealType;
98 
100  typedef Tpetra::Vector<RealType,LO,GO,NodeT> VectorType;
101  typedef Tpetra::CrsMatrix<RealType,LO,GO,NodeT> CrsMatrixType;
102  typedef Tpetra::CrsGraph<LO,GO,NodeT> CrsGraphType;
103  typedef Tpetra::Map<LO,GO,NodeT> MapType;
104  typedef Tpetra::Import<LO,GO,NodeT> ImportType;
105  typedef Tpetra::Export<LO,GO,NodeT> ExportType;
106 
109 
111  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
112 
115 
117  std::vector<Teuchos::RCP<const panzer::GlobalIndexer>> fieldGlobalIndexers_;
118 
120  std::vector<int> fieldIds_;
121 
124  std::vector<int> productVectorBlockIndex_;
125 
126  // This maps the scattered field names to the DOF manager field
127  // For instance a Navier-Stokes map might look like
128  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
129  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
131 
132  std::string globalDataKey_; // what global data does this fill?
134 
136  PHX::View<LO**> worksetLIDs_;
137 
139  std::vector<PHX::View<int*>> fieldOffsets_;
140 
142 };
143 
144 // **************************************************************
145 // Jacobian
146 // **************************************************************
147 
148 template <typename TRAITS,typename LO,typename GO,typename NodeT>
149 class ScatterResidual_BlockedTpetra<panzer::Traits::Jacobian,TRAITS,LO,GO,NodeT>
150  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
151  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
153 
154 public:
155 
177  : globalIndexer_(indexer) {}
178 
180  const Teuchos::ParameterList& p);
181 
182  void postRegistrationSetup(typename TRAITS::SetupData d,
184 
185  void preEvaluate(typename TRAITS::PreEvalData d);
186 
187  void evaluateFields(typename TRAITS::EvalData workset);
188 
191 
192 private:
194  typedef typename TRAITS::RealType RealType;
195 
197  typedef Tpetra::Operator<RealType,LO,GO,NodeT> OperatorType;
198  typedef Tpetra::CrsMatrix<RealType,LO,GO,NodeT> CrsMatrixType;
199  typedef Tpetra::Map<LO,GO,NodeT> MapType;
200 
201  typedef Thyra::TpetraLinearOp<RealType,LO,GO,NodeT> ThyraLinearOp;
202 
203  // dummy field so that the evaluator will have something to do
205 
206  // fields that need to be scattered will be put in this vector
207  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
208 
209  // maps the local (field,element,basis) triplet to a global ID
210  // for scattering
212 
213  std::vector<int> fieldIds_; // field IDs needing mapping
214 
217  std::vector<int> productVectorBlockIndex_;
218 
219  // This maps the scattered field names to the DOF manager field
220  // For instance a Navier-Stokes map might look like
221  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
222  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
224 
225  std::string globalDataKey_; // what global data does this fill?
227 
230 
233 
235  std::vector<PHX::View<int*>> fieldOffsets_;
236 
238  PHX::View<LO*> blockOffsets_;
239 
241 };
242 
243 // **************************************************************
244 // Tangent
245 // **************************************************************
246 template <typename TRAITS,typename LO,typename GO,typename NodeT>
247 class ScatterResidual_BlockedTpetra<panzer::Traits::Tangent,TRAITS,LO,GO,NodeT>
248  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
249  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
251 
252 public:
254  : globalIndexer_(indexer) {}
255 
257  const Teuchos::ParameterList& p);
258 
259  void postRegistrationSetup(typename TRAITS::SetupData d,
261 
262  void preEvaluate(typename TRAITS::PreEvalData d);
263 
264  void evaluateFields(typename TRAITS::EvalData workset);
265 
268 
269 private:
271  typedef typename TRAITS::RealType RealType;
272 
274  typedef Tpetra::Vector<RealType,LO,GO,NodeT> VectorType;
275  typedef Tpetra::CrsMatrix<RealType,LO,GO,NodeT> CrsMatrixType;
276  typedef Tpetra::CrsGraph<LO,GO,NodeT> CrsGraphType;
277  typedef Tpetra::Map<LO,GO,NodeT> MapType;
278  typedef Tpetra::Import<LO,GO,NodeT> ImportType;
279  typedef Tpetra::Export<LO,GO,NodeT> ExportType;
280 
283 
285  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
286 
289 
291  std::vector<Teuchos::RCP<const panzer::GlobalIndexer>> fieldGlobalIndexers_;
292 
294  std::vector<int> fieldIds_;
295 
298  std::vector<int> productVectorBlockIndex_;
299 
300  // This maps the scattered field names to the DOF manager field
301  // For instance a Navier-Stokes map might look like
302  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
303  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
305 
306  std::string globalDataKey_; // what global data does this fill?
308 
311 
313  PHX::View<LO**> worksetLIDs_;
314 
316  std::vector<PHX::View<int*>> fieldOffsets_;
317 
319 };
320 
321 }
322 
323 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
325 #endif
326 
327 // **************************************************************
328 #endif
Teuchos::RCP< PHX::FieldTag > scatterHolder_
Dummy evalauted field so that the evaluator will have something to do.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Pushes residual values into the residual vector for a Newton-based solve.
std::vector< PHX::View< int * > > fieldOffsets_
Offset into the cell lids for each field.
std::vector< PHX::View< int * > > fieldOffsets_
Offset into the cell lids for each field. Size of number of fields to scatter.
void postRegistrationSetup(typename TRAITS::SetupData, PHX::FieldManager< TRAITS > &)
ScatterResidual_BlockedTpetra(const Teuchos::RCP< const BlockedDOFManager > &)
std::vector< int > fieldIds_
Field IDs in the local product vector block (not global field id)
std::vector< int > fieldIds_
Field IDs in the local product vector block (not global field id)
Teuchos::RCP< const BlockedDOFManager > globalIndexer_
Maps the local (field,element,basis) triplet to a global ID for scattering.
std::vector< Teuchos::RCP< const panzer::GlobalIndexer > > fieldGlobalIndexers_
Vector of global indexers, one for each scattered field respectively.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
Teuchos::RCP< const BlockedTpetraLinearObjContainer< RealType, LO, GO, NodeT > > blockedContainer_
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Teuchos::RCP< const BlockedTpetraLinearObjContainer< RealType, LO, GO, NodeT > > blockedContainer_
virtual void preEvaluate(typename Traits::PreEvalData d)=0
std::vector< Teuchos::RCP< const panzer::GlobalIndexer > > fieldGlobalIndexers_
Vector of global indexers, one for each scattered field respectively.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Teuchos::RCP< const BlockedTpetraLinearObjContainer< RealType, LO, GO, NodeT > > blockedContainer_
Teuchos::RCP< PHX::FieldTag > scatterHolder_
Dummy evalauted field so that the evaluator will have something to do.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
PHX::View< LO * > blockOffsets_
The offset values of the blocked DOFs per element. Size of number of blocks in the product vector + 1...
std::vector< PHX::View< int * > > fieldOffsets_
Offset into the cell lids for each field.
std::vector< PHX::MDField< const ScalarT, Cell, NODE > > scatterFields_
Fields that need to be scattered will be put in this vector.
#define TEUCHOS_ASSERT(assertion_test)
std::vector< PHX::MDField< const ScalarT, Cell, NODE > > scatterFields_
Fields that need to be scattered will be put in this vector.
Non-templated empty base class for template managers.
Kokkos::View< typename Sacado::ScalarType< ScalarT >::type **, Kokkos::LayoutRight, PHX::Device > workset_vals_
Scratch space for local values.
Teuchos::RCP< const BlockedDOFManager > globalIndexer_
Maps the local (field,element,basis) triplet to a global ID for scattering.
PHX::ViewOfViews< 2, Kokkos::View< RealType **, Kokkos::LayoutLeft, PHX::Device > > dfdpFieldsVoV_
Storage for the tangent data.
Kokkos::View< LO **, Kokkos::LayoutRight, PHX::Device > worksetLIDs_
Local indices for unknowns.