Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_GatherSolution_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_GATHER_SOLUTION_BLOCKEDTPETRA_DECL_HPP
12 #define PANZER_EVALUATOR_GATHER_SOLUTION_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"
24 
26 
27 namespace panzer {
28 
29 template <typename ScalarT,typename LocalOrdinalT,typename GlobalOrdinalT,typename NodeT>
31 
32 class GlobalIndexer;
33 class BlockedDOFManager;
34 
42 template <typename EvalT,typename TRAITS,typename S,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
44  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
45  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
47 public:
48  typedef typename EvalT::ScalarT ScalarT;
49 
51  { }
52 
54  const Teuchos::ParameterList& p);
55 
57  { return Teuchos::rcp(new GatherSolution_BlockedTpetra<EvalT,TRAITS,S,LO,GO>(Teuchos::null,pl)); }
58 
59  void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager<TRAITS>& vm)
60  { }
61 
62  void evaluateFields(typename TRAITS::EvalData d)
63  { std::cout << "unspecialized version of \"GatherSolution_BlockedTpetra::evaluateFields\" on \""+PHX::print<EvalT>()+"\" should not be used!" << std::endl;
64  TEUCHOS_ASSERT(false); }
65 };
66 
67 // **************************************************************
68 // **************************************************************
69 // * Specializations
70 // **************************************************************
71 // **************************************************************
72 
73 
74 // **************************************************************
75 // Residual
76 // **************************************************************
77 template <typename TRAITS,typename S,typename LO,typename GO,typename NodeT>
78 class GatherSolution_BlockedTpetra<panzer::Traits::Residual,TRAITS,S,LO,GO,NodeT>
79  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
80  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
82 
83 
84 public:
85 
87  : globalIndexer_(indexer) {}
88 
90  const Teuchos::ParameterList& p);
91 
92  void postRegistrationSetup(typename TRAITS::SetupData d,
94 
95  void preEvaluate(typename TRAITS::PreEvalData d);
96 
97  void evaluateFields(typename TRAITS::EvalData d);
98 
101 
102 
103 private:
104  typedef typename panzer::Traits::Residual EvalT;
106 
108  typedef Tpetra::Vector<S,LO,GO,NodeT> VectorType;
109  typedef Tpetra::CrsMatrix<S,LO,GO,NodeT> CrsMatrixType;
110  typedef Tpetra::CrsGraph<LO,GO,NodeT> CrsGraphType;
111  typedef Tpetra::Map<LO,GO,NodeT> MapType;
112  typedef Tpetra::Import<LO,GO,NodeT> ImportType;
113  typedef Tpetra::Export<LO,GO,NodeT> ExportType;
114 
116  // scattering
118 
120  std::vector<int> fieldIds_;
121 
123  std::vector<Teuchos::RCP<const panzer::GlobalIndexer>> fieldGlobalIndexers_;
124 
127  std::vector<int> productVectorBlockIndex_;
128 
129  std::vector< PHX::MDField<ScalarT,Cell,NODE> > gatherFields_;
130 
131  std::vector<std::string> indexerNames_;
133  std::string globalDataKey_; // what global data does this fill?
134 
136 
137  // Fields for storing tangent components dx/dp of solution vector x
138  // These are not actually used by the residual specialization of this evaluator,
139  // even if they are supplied, but it is useful to declare them as dependencies anyway
140  // when saving the tangent components to the output file
142  std::vector< std::vector< PHX::MDField<const ScalarT,Cell,NODE> > > tangentFields_;
143 
145  PHX::View<LO**> worksetLIDs_;
146 
148  std::vector<PHX::View<int*>> fieldOffsets_;
149 
151 };
152 
153 // **************************************************************
154 // Tangent
155 // **************************************************************
156 template <typename TRAITS,typename S,typename LO,typename GO,typename NodeT>
157 class GatherSolution_BlockedTpetra<panzer::Traits::Tangent,TRAITS,S,LO,GO,NodeT>
158  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
159  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
161 
162 
163 public:
164 
166  : globalIndexer_(indexer) {}
167 
169  const Teuchos::ParameterList& p);
170 
171  void postRegistrationSetup(typename TRAITS::SetupData d,
173 
174  void preEvaluate(typename TRAITS::PreEvalData d);
175 
176  void evaluateFields(typename TRAITS::EvalData d);
177 
180 
181 
182 private:
183  typedef typename panzer::Traits::Tangent EvalT;
185  typedef typename panzer::Traits::RealType RealT;
186 
188  typedef Tpetra::Vector<S,LO,GO,NodeT> VectorType;
189  typedef Tpetra::CrsMatrix<S,LO,GO,NodeT> CrsMatrixType;
190  typedef Tpetra::CrsGraph<LO,GO,NodeT> CrsGraphType;
191  typedef Tpetra::Map<LO,GO,NodeT> MapType;
192  typedef Tpetra::Import<LO,GO,NodeT> ImportType;
193  typedef Tpetra::Export<LO,GO,NodeT> ExportType;
194 
195  // maps the local (field,element,basis) triplet to a global ID
196  // for scattering
198 
199  std::vector<int> fieldIds_; // field IDs needing mapping
200 
203  std::vector<int> productVectorBlockIndex_;
204 
205  std::vector< PHX::MDField<ScalarT,Cell,NODE> > gatherFields_;
206 
207  std::vector<std::string> indexerNames_;
209  std::string globalDataKey_; // what global data does this fill?
210 
212 
214  PHX::View<LO**> worksetLIDs_;
215 
217  std::vector<PHX::View<int*>> fieldOffsets_;
218 
219  // Fields for storing tangent components dx/dp of solution vector x
221  std::vector< std::vector< PHX::MDField<const RealT,Cell,NODE> > > tangentFields_;
223 
225 };
226 
227 // **************************************************************
228 // Jacobian
229 // **************************************************************
230 template <typename TRAITS,typename S,typename LO,typename GO,typename NodeT>
231 class GatherSolution_BlockedTpetra<panzer::Traits::Jacobian,TRAITS,S,LO,GO,NodeT>
232  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
233  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
235 
236 public:
238  : globalIndexer_(indexer) {}
239 
241  const Teuchos::ParameterList& p);
242 
243  void postRegistrationSetup(typename TRAITS::SetupData d,
245 
246  void preEvaluate(typename TRAITS::PreEvalData d);
247 
248  void evaluateFields(typename TRAITS::EvalData d);
249 
252 
253 private:
254  typedef typename panzer::Traits::Jacobian EvalT;
256  typedef typename TRAITS::RealType RealType;
257 
259  typedef Tpetra::Vector<S,LO,GO,NodeT> VectorType;
260  typedef Tpetra::CrsMatrix<S,LO,GO,NodeT> CrsMatrixType;
261  typedef Tpetra::CrsGraph<LO,GO,NodeT> CrsGraphType;
262  typedef Tpetra::Map<LO,GO,NodeT> MapType;
263  typedef Tpetra::Import<LO,GO,NodeT> ImportType;
264  typedef Tpetra::Export<LO,GO,NodeT> ExportType;
265 
266  // maps the local (field,element,basis) triplet to a global ID
267  // for scattering
269 
270  std::vector<int> fieldIds_; // field IDs needing mapping
271 
274  std::vector<int> productVectorBlockIndex_;
275 
276  std::vector< PHX::MDField<ScalarT,Cell,NODE> > gatherFields_;
277 
278  std::vector<std::string> indexerNames_;
281  std::string globalDataKey_; // what global data does this fill?
282 
284 
286  PHX::View<LO**> worksetLIDs_;
287 
289  std::vector<PHX::View<int*>> fieldOffsets_;
290 
292  PHX::View<LO*> blockOffsets_;
293 
295 };
296 
297 }
298 
300 
301 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
303 #endif
304 
305 // **************************************************************
306 #endif
GatherSolution_BlockedTpetra(const Teuchos::RCP< const BlockedDOFManager > &indexer)
std::vector< Teuchos::RCP< const panzer::GlobalIndexer > > fieldGlobalIndexers_
Vector of global indexers, one for each field to gather, respectively.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &vm)
Teuchos::RCP< const BlockedTpetraLinearObjContainer< S, LO, GO, NodeT > > blockedContainer_
PHX::View< LO * > blockOffsets_
The offset values of the blocked DOFs per element. Size of number of blocks in the product vector + 1...
Gathers solution values from the Newton solution vector into the nodal fields of the field manager...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< const BlockedTpetraLinearObjContainer< S, LO, GO, NodeT > > blockedContainer_
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
std::vector< PHX::View< int * > > fieldOffsets_
Offset into the cell lids for each field. Size of number of fields to scatter.
std::vector< PHX::View< int * > > fieldOffsets_
Offset into the cell lids for each field.
std::vector< int > fieldIds_
Field IDs in the local product vector block (not global field id)
virtual void preEvaluate(typename Traits::PreEvalData d)=0
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Teuchos::RCP< const BlockedDOFManager > globalIndexer_
Maps the local (field,element,basis) triplet to a global ID for.
Teuchos::RCP< const BlockedTpetraLinearObjContainer< S, LO, GO, NodeT > > blockedContainer_
#define TEUCHOS_ASSERT(assertion_test)
std::vector< PHX::View< int * > > fieldOffsets_
Offset into the cell lids for each field. Size of number of fields to scatter.
Non-templated empty base class for template managers.