Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_ScatterResidual_Epetra_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_EPETRA_DECL_HPP
12#define PANZER_EVALUATOR_SCATTER_RESIDUAL_EPETRA_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"
24
26
27class Epetra_Vector;
28
29namespace panzer {
30
31class EpetraLinearObjContainer;
32
33class GlobalIndexer;
34
52template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterResidual_Epetra;
53
54// **************************************************************
55// **************************************************************
56// * Specializations
57// **************************************************************
58// **************************************************************
59
60
61// **************************************************************
62// Residual
63// **************************************************************
64template<typename TRAITS,typename LO,typename GO>
66 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
67 public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
69
70public:
71 ScatterResidual_Epetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
72 const Teuchos::RCP<const panzer::GlobalIndexer> & /* cIndexer=Teuchos::null */,
73 bool useDiscreteAdjoint=false)
74 : globalIndexer_(indexer),useDiscreteAdjoint_(useDiscreteAdjoint) {}
75
76 ScatterResidual_Epetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
77 const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer,
78 const Teuchos::ParameterList& p,bool=false);
79
80 void postRegistrationSetup(typename TRAITS::SetupData d,
82
83 void preEvaluate(typename TRAITS::PreEvalData d);
84
85 void evaluateFields(typename TRAITS::EvalData workset);
86
87 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
88 { return Teuchos::rcp(new ScatterResidual_Epetra<panzer::Traits::Residual,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
89
90private:
92
93 // dummy field so that the evaluator will have something to do
94 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
95
96 // fields that need to be scattered will be put in this vector
97 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
98
99 // maps the local (field,element,basis) triplet to a global ID
100 // for scattering
101 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
102 std::vector<int> fieldIds_; // field IDs needing mapping
103
104 // This maps the scattered field names to the DOF manager field
105 // For instance a Navier-Stokes map might look like
106 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
107 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
108 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
109
110 std::string globalDataKey_; // what global data does this fill?
111
112 Teuchos::RCP<const EpetraLinearObjContainer> epetraContainer_;
113
115};
116
117// **************************************************************
118// Tangent
119// **************************************************************
120template<typename TRAITS,typename LO,typename GO>
122 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
123 public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
125
126public:
127 ScatterResidual_Epetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
128 const Teuchos::RCP<const panzer::GlobalIndexer> & /* cIndexer=Teuchos::null */,
129 bool useDiscreteAdjoint=false)
130 : globalIndexer_(indexer),useDiscreteAdjoint_(useDiscreteAdjoint) {}
131
132 ScatterResidual_Epetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
133 const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer,
134 const Teuchos::ParameterList& p,bool=false);
135
136 void postRegistrationSetup(typename TRAITS::SetupData d,
138
139 void preEvaluate(typename TRAITS::PreEvalData d);
140
141 void evaluateFields(typename TRAITS::EvalData workset);
142
143 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
144 { return Teuchos::rcp(new ScatterResidual_Epetra<panzer::Traits::Tangent,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
145
146private:
148
149 // dummy field so that the evaluator will have something to do
150 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
151
152 // fields that need to be scattered will be put in this vector
153 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
154
155 // maps the local (field,element,basis) triplet to a global ID
156 // for scattering
157 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
158 std::vector<int> fieldIds_; // field IDs needing mapping
159
160 // This maps the scattered field names to the DOF manager field
161 // For instance a Navier-Stokes map might look like
162 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
163 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
164 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
165
166 std::vector<Teuchos::RCP<Epetra_Vector> > dfdp_vectors_;
167
169};
170
171// **************************************************************
172// Jacobian
173// **************************************************************
174template<typename TRAITS,typename LO,typename GO>
176 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
177 public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
179
180public:
181
182 ScatterResidual_Epetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
183 const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer=Teuchos::null,
184 bool useDiscreteAdjoint=false)
185 : globalIndexer_(indexer), colGlobalIndexer_(cIndexer), useDiscreteAdjoint_(useDiscreteAdjoint) {}
186
187 ScatterResidual_Epetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
188 const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer,
189 const Teuchos::ParameterList& pl,bool useDiscreteAdjoint=false);
190
191 void postRegistrationSetup(typename TRAITS::SetupData d,
193
194 void preEvaluate(typename TRAITS::PreEvalData d);
195
196 void evaluateFields(typename TRAITS::EvalData workset);
197
198 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
199 { return Teuchos::rcp(new ScatterResidual_Epetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(globalIndexer_,colGlobalIndexer_,pl,useDiscreteAdjoint_)); }
200
201private:
202
204
205 // dummy field so that the evaluator will have something to do
206 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
207
208 // fields that need to be scattered will be put in this vector
209 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
210
211 // maps the local (field,element,basis) triplet to a global ID
212 // for scattering
213 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_, colGlobalIndexer_;
214 std::vector<int> fieldIds_; // field IDs needing mapping
215
216 // This maps the scattered field names to the DOF manager field
217 // For instance a Navier-Stokes map might look like
218 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
219 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
220 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
221
222 std::string globalDataKey_; // what global data does this fill?
223
224 Teuchos::RCP<const EpetraLinearObjContainer> epetraContainer_;
225
227
229
230};
231
232}
233
234// optionally include hessian support
235#ifdef Panzer_BUILD_HESSIAN_SUPPORT
237#endif
238
239// **************************************************************
240#endif
Non-templated empty base class for template managers.
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
ScatterResidual_Epetra(const Teuchos::RCP< const panzer::GlobalIndexer > &indexer, const Teuchos::RCP< const panzer::GlobalIndexer > &cIndexer=Teuchos::null, bool useDiscreteAdjoint=false)
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
ScatterResidual_Epetra(const Teuchos::RCP< const panzer::GlobalIndexer > &indexer, const Teuchos::RCP< const panzer::GlobalIndexer > &cIndexer, const Teuchos::ParameterList &pl, bool useDiscreteAdjoint=false)
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
ScatterResidual_Epetra(const Teuchos::RCP< const panzer::GlobalIndexer > &indexer, const Teuchos::RCP< const panzer::GlobalIndexer > &, bool useDiscreteAdjoint=false)
ScatterResidual_Epetra(const Teuchos::RCP< const panzer::GlobalIndexer > &indexer, const Teuchos::RCP< const panzer::GlobalIndexer > &, bool useDiscreteAdjoint=false)
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Pushes residual values into the residual vector for a Newton-based solve.