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 
19 
20 #include "PanzerDiscFE_config.hpp"
21 #include "Panzer_Dimension.hpp"
22 #include "Panzer_Traits.hpp"
25 
26 #include "Panzer_NodeType.hpp"
27 
29 
31 
32 namespace panzer {
33 
34 class GlobalIndexer;
35 
44 template<typename EvalT, typename Traits,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
46 
47 // **************************************************************
48 // **************************************************************
49 // * Specializations
50 // **************************************************************
51 // **************************************************************
52 
53 
54 // **************************************************************
55 // Residual
56 // **************************************************************
57 template<typename TRAITS,typename LO,typename GO,typename NodeT>
58 class ScatterResidual_Tpetra<panzer::Traits::Residual,TRAITS,LO,GO,NodeT>
59  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
60  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
62 
63 public:
65  : globalIndexer_(indexer) {}
66 
68  const Teuchos::ParameterList& p);
69 
70  void postRegistrationSetup(typename TRAITS::SetupData d,
72 
73  void preEvaluate(typename TRAITS::PreEvalData d);
74 
75  void evaluateFields(typename TRAITS::EvalData workset);
76 
79 
80 private:
82 
83  // dummy field so that the evaluator will have something to do
85 
86  // fields that need to be scattered will be put in this vector
87  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
88 
89  // maps the local (field,element,basis) triplet to a global ID
90  // for scattering
92  std::vector<int> fieldIds_; // field IDs needing mapping
93 
94  // This maps the scattered field names to the DOF manager field
95  // For instance a Navier-Stokes map might look like
96  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
97  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
99 
100  std::string globalDataKey_; // what global data does this fill?
102 
103  PHX::View<int**> scratch_lids_;
104  std::vector<PHX::View<int*> > scratch_offsets_;
105 
107 };
108 
109 // **************************************************************
110 // Tangent
111 // **************************************************************
112 template<typename TRAITS,typename LO,typename GO,typename NodeT>
113 class ScatterResidual_Tpetra<panzer::Traits::Tangent,TRAITS,LO,GO,NodeT>
114  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
115  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
117 
118 public:
120  : globalIndexer_(indexer) {}
121 
123  const Teuchos::ParameterList& p);
124 
125  void postRegistrationSetup(typename TRAITS::SetupData d,
127 
128  void preEvaluate(typename TRAITS::PreEvalData d);
129 
130  void evaluateFields(typename TRAITS::EvalData workset);
131 
134 
135 private:
137 
138  // dummy field so that the evaluator will have something to do
140 
141  // fields that need to be scattered will be put in this vector
142  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
143 
144  // maps the local (field,element,basis) triplet to a global ID
145  // for scattering
147  std::vector<int> fieldIds_; // field IDs needing mapping
148 
149  // This maps the scattered field names to the DOF manager field
150  // For instance a Navier-Stokes map might look like
151  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
152  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
154 
155  std::string globalDataKey_; // what global data does this fill?
156 
157  std::vector< Teuchos::ArrayRCP<double> > dfdp_vectors_;
158 
160 };
161 
162 // **************************************************************
163 // Jacobian
164 // **************************************************************
165 template<typename TRAITS,typename LO,typename GO,typename NodeT>
166 class ScatterResidual_Tpetra<panzer::Traits::Jacobian,TRAITS,LO,GO,NodeT>
167  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
168  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
170 
171 public:
172 
174  : globalIndexer_(indexer) {}
175 
177  const Teuchos::ParameterList& pl);
178 
179  void postRegistrationSetup(typename TRAITS::SetupData d,
181 
182  void preEvaluate(typename TRAITS::PreEvalData d);
183 
184  void evaluateFields(typename TRAITS::EvalData workset);
185 
188 
189 private:
190 
192 
193  // dummy field so that the evaluator will have something to do
195 
196  // fields that need to be scattered will be put in this vector
197  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
198 
199  // maps the local (field,element,basis) triplet to a global ID
200  // for scattering
202  std::vector<int> fieldIds_; // field IDs needing mapping
203 
204  // This maps the scattered field names to the DOF manager field
205  // For instance a Navier-Stokes map might look like
206  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
207  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
209 
210  std::string globalDataKey_; // what global data does this fill?
212 
214 
217  std::vector<PHX::View<int*> > scratch_offsets_;
218 
221 };
222 
223 }
224 
225 // optionally include hessian support
226 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
228 #endif
229 
230 // **************************************************************
231 #endif
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
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_