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 
19 
20 #include "PanzerDiscFE_config.hpp"
21 #include "Panzer_Dimension.hpp"
22 #include "Panzer_Traits.hpp"
25 
27 
28 namespace panzer {
29 
30 // Forward declarations
31 class BlockedDOFManager;
32 class GlobalIndexer;
33 
38 template <typename EvalT,typename TRAITS,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
40  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
41  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
43 public:
44  typedef typename EvalT::ScalarT ScalarT;
45 
47  { }
49  const Teuchos::ParameterList& p);
50 
53 
54  void postRegistrationSetup(typename TRAITS::SetupData /* d */, PHX::FieldManager<TRAITS>& /* vm */)
55  { }
56  void evaluateFields(typename TRAITS::EvalData /* d */)
57  { std::cout << "unspecialized version of \"ScatterResidual_BlockedTpetra::evaluateFields\" on \""+PHX::print<EvalT>()+"\" should not be used!" << std::endl;
58  TEUCHOS_ASSERT(false); }
59 };
60 
61 // **************************************************************
62 // **************************************************************
63 // * Specializations
64 // **************************************************************
65 // **************************************************************
66 
67 
68 // **************************************************************
69 // Residual
70 // **************************************************************
71 template <typename TRAITS,typename LO,typename GO,typename NodeT>
72 class ScatterResidual_BlockedTpetra<panzer::Traits::Residual,TRAITS,LO,GO,NodeT>
73  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
74  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
76 
77 public:
79  : globalIndexer_(indexer) {}
80 
82  const Teuchos::ParameterList& p);
83 
84  void postRegistrationSetup(typename TRAITS::SetupData d,
86 
87  void preEvaluate(typename TRAITS::PreEvalData d);
88 
89  void evaluateFields(typename TRAITS::EvalData workset);
90 
93 
94 private:
96  typedef typename TRAITS::RealType RealType;
97 
99  typedef Tpetra::Vector<RealType,LO,GO,NodeT> VectorType;
100  typedef Tpetra::CrsMatrix<RealType,LO,GO,NodeT> CrsMatrixType;
101  typedef Tpetra::CrsGraph<LO,GO,NodeT> CrsGraphType;
102  typedef Tpetra::Map<LO,GO,NodeT> MapType;
103  typedef Tpetra::Import<LO,GO,NodeT> ImportType;
104  typedef Tpetra::Export<LO,GO,NodeT> ExportType;
105 
108 
110  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
111 
114 
116  std::vector<Teuchos::RCP<const panzer::GlobalIndexer>> fieldGlobalIndexers_;
117 
119  std::vector<int> fieldIds_;
120 
123  std::vector<int> productVectorBlockIndex_;
124 
125  // This maps the scattered field names to the DOF manager field
126  // For instance a Navier-Stokes map might look like
127  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
128  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
130 
131  std::string globalDataKey_; // what global data does this fill?
133 
135  PHX::View<LO**> worksetLIDs_;
136 
138  std::vector<PHX::View<int*>> fieldOffsets_;
139 
141 };
142 
143 // **************************************************************
144 // Jacobian
145 // **************************************************************
146 
147 template <typename TRAITS,typename LO,typename GO,typename NodeT>
148 class ScatterResidual_BlockedTpetra<panzer::Traits::Jacobian,TRAITS,LO,GO,NodeT>
149  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
150  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
152 
153 public:
154 
176  : globalIndexer_(indexer) {}
177 
179  const Teuchos::ParameterList& p);
180 
181  void postRegistrationSetup(typename TRAITS::SetupData d,
183 
184  void preEvaluate(typename TRAITS::PreEvalData d);
185 
186  void evaluateFields(typename TRAITS::EvalData workset);
187 
190 
191 private:
193  typedef typename TRAITS::RealType RealType;
194 
196  typedef Tpetra::Operator<RealType,LO,GO,NodeT> OperatorType;
197  typedef Tpetra::CrsMatrix<RealType,LO,GO,NodeT> CrsMatrixType;
198  typedef Tpetra::Map<LO,GO,NodeT> MapType;
199 
200  typedef Thyra::TpetraLinearOp<RealType,LO,GO,NodeT> ThyraLinearOp;
201 
202  // dummy field so that the evaluator will have something to do
204 
205  // fields that need to be scattered will be put in this vector
206  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
207 
208  // maps the local (field,element,basis) triplet to a global ID
209  // for scattering
211 
212  std::vector<int> fieldIds_; // field IDs needing mapping
213 
216  std::vector<int> productVectorBlockIndex_;
217 
218  // This maps the scattered field names to the DOF manager field
219  // For instance a Navier-Stokes map might look like
220  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
221  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
223 
224  std::string globalDataKey_; // what global data does this fill?
226 
229 
232 
234  std::vector<PHX::View<int*>> fieldOffsets_;
235 
237  PHX::View<LO*> blockOffsets_;
238 
240 };
241 
242 }
243 
244 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
246 #endif
247 
248 // **************************************************************
249 #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. 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< 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 void preEvaluate(typename Traits::PreEvalData d)=0
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Teuchos::RCP< const BlockedTpetraLinearObjContainer< RealType, LO, GO, NodeT > > blockedContainer_
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)
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.
Kokkos::View< LO **, Kokkos::LayoutRight, PHX::Device > worksetLIDs_
Local indices for unknowns.