Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_ScatterResidual_BlockedEpetra_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_BLOCKEDEPETRA_DECL_HPP
12#define PANZER_EVALUATOR_SCATTER_RESIDUAL_BLOCKEDEPETRA_DECL_HPP
13
14#include "Phalanx_config.hpp"
15#include "Phalanx_Evaluator_Macros.hpp"
16#include "Phalanx_MDField.hpp"
17
18#include "Teuchos_ParameterList.hpp"
19
20#include "PanzerDiscFE_config.hpp"
21#include "Panzer_Dimension.hpp"
22#include "Panzer_Traits.hpp"
25
27
28namespace Thyra {
29 template <typename> class ProductVectorBase;
30 template <typename> class BlockedLinearOpBase;
31}
32
33namespace panzer {
34
35class GlobalIndexer;
36
41template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterResidual_BlockedEpetra
42 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
43 public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
45public:
46 typedef typename EvalT::ScalarT ScalarT;
47
48 ScatterResidual_BlockedEpetra(const Teuchos::ParameterList& p) {}
49
50 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
51 { return Teuchos::rcp(new ScatterResidual_BlockedEpetra<EvalT,TRAITS,LO,GO>(pl)); }
52
53 void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager<TRAITS>& vm)
54 { }
55 void evaluateFields(typename TRAITS::EvalData d)
56 { std::cout << "unspecialized version of \"ScatterResidual_BlockedEpetra::evaluateFields\" on "+PHX::print<EvalT>()+" \" should not be used!" << std::endl;
57 TEUCHOS_ASSERT(false); }
58};
59
60// **************************************************************
61// **************************************************************
62// * Specializations
63// **************************************************************
64// **************************************************************
65
66
67// **************************************************************
68// Residual
69// **************************************************************
70template<typename TRAITS,typename LO,typename GO>
72 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
73 public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
75
76public:
77
78 ScatterResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
79 const std::vector<Teuchos::RCP<const GlobalIndexer> > & /* cIndexers */,
80 bool /* useDiscreteAdjoint=false */)
81 : rowIndexers_(rIndexers) {}
82
83 ScatterResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
84 const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
85 const Teuchos::ParameterList& p,
86 bool useDiscreteAdjoint=false);
87
88 void postRegistrationSetup(typename TRAITS::SetupData d,
90
91 void preEvaluate(typename TRAITS::PreEvalData d);
92
93 void evaluateFields(typename TRAITS::EvalData workset);
94
95 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
96 { return Teuchos::rcp(new ScatterResidual_BlockedEpetra<panzer::Traits::Residual,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl)); }
97
98private:
100
101 // dummy field so that the evaluator will have something to do
102 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
103
104 // fields that need to be scattered will be put in this vector
105 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
106
107 std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
108 std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
109
110 std::vector<int> indexerIds_; // block index
111 std::vector<int> subFieldIds_; // sub field numbers
112
113 // This maps the scattered field names to the DOF manager field
114 // For instance a Navier-Stokes map might look like
115 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
116 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
117 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
118
119 std::string globalDataKey_; // what global data does this fill?
120
121 Teuchos::RCP<Thyra::ProductVectorBase<double> > r_;
122
124};
125
126// **************************************************************
127// Tangent
128// **************************************************************
129template<typename TRAITS,typename LO,typename GO>
131 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
132 public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
134
135public:
136
137 ScatterResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
138 const std::vector<Teuchos::RCP<const GlobalIndexer> > & /* cIndexers */,
139 bool /* useDiscreteAdjoint=false */)
140 : rowIndexers_(rIndexers) {}
141
142 ScatterResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
143 const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
144 const Teuchos::ParameterList& p,
145 bool useDiscreteAdjoint=false);
146
147 void postRegistrationSetup(typename TRAITS::SetupData d,
149
150 void preEvaluate(typename TRAITS::PreEvalData d);
151
152 void evaluateFields(typename TRAITS::EvalData workset);
153
154 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
155 { return Teuchos::rcp(new ScatterResidual_BlockedEpetra<panzer::Traits::Tangent,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl)); }
156
157private:
159
160 // dummy field so that the evaluator will have something to do
161 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
162
163 // fields that need to be scattered will be put in this vector
164 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
165
166 std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
167 std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
168
169 std::vector<int> indexerIds_; // block index
170 std::vector<int> subFieldIds_; // sub field numbers
171
172 // This maps the scattered field names to the DOF manager field
173 // For instance a Navier-Stokes map might look like
174 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
175 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
176 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
177
178 std::string globalDataKey_; // what global data does this fill?
179
180 Teuchos::RCP<Thyra::ProductVectorBase<double> > r_;
181
183};
184
185// **************************************************************
186// Jacobian
187// **************************************************************
188
189template<typename TRAITS,typename LO,typename GO>
191 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
192 public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
194
195public:
196
217 ScatterResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
218 const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
219 bool useDiscreteAdjoint=false)
220 : rowIndexers_(rIndexers), colIndexers_(cIndexers), useDiscreteAdjoint_(useDiscreteAdjoint) {}
221
222 ScatterResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
223 const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
224 const Teuchos::ParameterList& p,
225 bool useDiscreteAdjoint=false);
226
227 void postRegistrationSetup(typename TRAITS::SetupData d,
229
230 void preEvaluate(typename TRAITS::PreEvalData d);
231
232 void evaluateFields(typename TRAITS::EvalData workset);
233
234 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
235 { return Teuchos::rcp(new ScatterResidual_BlockedEpetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl,useDiscreteAdjoint_)); }
236
237private:
238
240
241 // dummy field so that the evaluator will have something to do
242 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
243
244 // fields that need to be scattered will be put in this vector
245 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
246
247 std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
248 std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
249
250 std::vector<int> indexerIds_; // block index
251 std::vector<int> subFieldIds_; // sub field numbers
252
253 // This maps the scattered field names to the DOF manager field
254 // For instance a Navier-Stokes map might look like
255 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
256 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
257 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
258
259 std::string globalDataKey_; // what global data does this fill?
261
262 Teuchos::RCP<Thyra::ProductVectorBase<double> > r_;
263 Teuchos::RCP<Thyra::BlockedLinearOpBase<double> > Jac_;
264
266};
267
268}
269
270// optionally include hessian support
271#ifdef Panzer_BUILD_HESSIAN_SUPPORT
273#endif
274
275// **************************************************************
276#endif
Non-templated empty base class for template managers.
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
ScatterResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &cIndexers, bool useDiscreteAdjoint=false)
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
ScatterResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &, bool)
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
ScatterResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &, bool)
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Pushes residual values into the residual vector for a Newton-based solve.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &vm)