Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
19 
20 #include "PanzerDiscFE_config.hpp"
21 #include "Panzer_Dimension.hpp"
22 #include "Panzer_Traits.hpp"
25 
27 
28 namespace Thyra {
29  template <typename> class ProductVectorBase;
30  template <typename> class BlockedLinearOpBase;
31 }
32 
33 namespace panzer {
34 
35 class GlobalIndexer;
36 
41 template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterResidual_BlockedEpetra
42  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
43  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
45 public:
46  typedef typename EvalT::ScalarT ScalarT;
47 
49 
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 // **************************************************************
70 template<typename TRAITS,typename LO,typename GO>
72  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
73  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
75 
76 public:
77 
79  const std::vector<Teuchos::RCP<const GlobalIndexer> > & /* cIndexers */,
80  bool /* useDiscreteAdjoint=false */)
81  : rowIndexers_(rIndexers) {}
82 
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 
96  { return Teuchos::rcp(new ScatterResidual_BlockedEpetra<panzer::Traits::Residual,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl)); }
97 
98 private:
100 
101  // dummy field so that the evaluator will have something to do
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"
118 
119  std::string globalDataKey_; // what global data does this fill?
120 
122 
124 };
125 
126 // **************************************************************
127 // Tangent
128 // **************************************************************
129 template<typename TRAITS,typename LO,typename GO>
131  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
132  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
134 
135 public:
136 
138  const std::vector<Teuchos::RCP<const GlobalIndexer> > & /* cIndexers */,
139  bool /* useDiscreteAdjoint=false */)
140  : rowIndexers_(rIndexers) {}
141 
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 
155  { return Teuchos::rcp(new ScatterResidual_BlockedEpetra<panzer::Traits::Tangent,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl)); }
156 
157 private:
159 
160  // dummy field so that the evaluator will have something to do
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"
177 
178  std::string globalDataKey_; // what global data does this fill?
179 
181 
183 };
184 
185 // **************************************************************
186 // Jacobian
187 // **************************************************************
188 
189 template<typename TRAITS,typename LO,typename GO>
191  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
192  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
194 
195 public:
196 
218  const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
219  bool useDiscreteAdjoint=false)
220  : rowIndexers_(rIndexers), colIndexers_(cIndexers), useDiscreteAdjoint_(useDiscreteAdjoint) {}
221 
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 
235  { return Teuchos::rcp(new ScatterResidual_BlockedEpetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl,useDiscreteAdjoint_)); }
236 
237 private:
238 
240 
241  // dummy field so that the evaluator will have something to do
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"
258 
259  std::string globalDataKey_; // what global data does this fill?
261 
264 
266 };
267 
268 }
269 
270 // optionally include hessian support
271 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
273 #endif
274 
275 // **************************************************************
276 #endif
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 > > &cIndexers, bool useDiscreteAdjoint=false)
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
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
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 void preEvaluate(typename Traits::PreEvalData d)=0
Pushes residual values into the residual vector for a Newton-based solve.
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &vm)
#define TEUCHOS_ASSERT(assertion_test)
Non-templated empty base class for template managers.