Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
19 
20 #include "PanzerDiscFE_config.hpp"
21 #include "Panzer_Dimension.hpp"
22 #include "Panzer_Traits.hpp"
24 
26 
27 class Epetra_Vector;
28 
29 namespace panzer {
30 
31 class EpetraLinearObjContainer;
32 
33 class GlobalIndexer;
34 
52 template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterResidual_Epetra;
53 
54 // **************************************************************
55 // **************************************************************
56 // * Specializations
57 // **************************************************************
58 // **************************************************************
59 
60 
61 // **************************************************************
62 // Residual
63 // **************************************************************
64 template<typename TRAITS,typename LO,typename GO>
65 class ScatterResidual_Epetra<panzer::Traits::Residual,TRAITS,LO,GO>
66  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
67  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
69 
70 public:
72  const Teuchos::RCP<const panzer::GlobalIndexer> & /* cIndexer=Teuchos::null */,
73  bool useDiscreteAdjoint=false)
74  : globalIndexer_(indexer),useDiscreteAdjoint_(useDiscreteAdjoint) {}
75 
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 
88  { return Teuchos::rcp(new ScatterResidual_Epetra<panzer::Traits::Residual,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
89 
90 private:
92 
93  // dummy field so that the evaluator will have something to do
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
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"
109 
110  std::string globalDataKey_; // what global data does this fill?
111 
113 
115 };
116 
117 // **************************************************************
118 // Tangent
119 // **************************************************************
120 template<typename TRAITS,typename LO,typename GO>
121 class ScatterResidual_Epetra<panzer::Traits::Tangent,TRAITS,LO,GO>
122  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
123  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
125 
126 public:
128  const Teuchos::RCP<const panzer::GlobalIndexer> & /* cIndexer=Teuchos::null */,
129  bool useDiscreteAdjoint=false)
130  : globalIndexer_(indexer),useDiscreteAdjoint_(useDiscreteAdjoint) {}
131 
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 
144  { return Teuchos::rcp(new ScatterResidual_Epetra<panzer::Traits::Tangent,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
145 
146 private:
148 
149  // dummy field so that the evaluator will have something to do
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
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"
165 
166  std::vector<Teuchos::RCP<Epetra_Vector> > dfdp_vectors_;
167 
169 };
170 
171 // **************************************************************
172 // Jacobian
173 // **************************************************************
174 template<typename TRAITS,typename LO,typename GO>
175 class ScatterResidual_Epetra<panzer::Traits::Jacobian,TRAITS,LO,GO>
176  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
177  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
179 
180 public:
181 
183  const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer=Teuchos::null,
184  bool useDiscreteAdjoint=false)
185  : globalIndexer_(indexer), colGlobalIndexer_(cIndexer), useDiscreteAdjoint_(useDiscreteAdjoint) {}
186 
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 
199  { return Teuchos::rcp(new ScatterResidual_Epetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(globalIndexer_,colGlobalIndexer_,pl,useDiscreteAdjoint_)); }
200 
201 private:
202 
204 
205  // dummy field so that the evaluator will have something to do
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
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"
221 
222  std::string globalDataKey_; // what global data does this fill?
223 
225 
227 
229 
230 };
231 
232 }
233 
234 // optionally include hessian support
235 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
237 #endif
238 
239 // **************************************************************
240 #endif
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
Pushes residual values into the residual vector for a Newton-based solve.
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
Non-templated empty base class for template managers.
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 > &cIndexer=Teuchos::null, bool useDiscreteAdjoint=false)