Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ScatterDirichletResidual_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_DIRICHLET_RESIDUAL_BLOCKEDEPETRA_DECL_HPP
12 #define PANZER_EVALUATOR_SCATTER_DIRICHLET_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 ScalarT> class ProductVectorBase;
30  template <typename ScalarT> class BlockedLinearOpBase;
31 }
32 
33 namespace panzer {
34 
35 class GlobalIndexer;
36 
45 template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterDirichletResidual_BlockedEpetra
46  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
47  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
49 public:
50  typedef typename EvalT::ScalarT ScalarT;
51 
53 
56 
57  void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager<TRAITS>& vm)
58  { }
59  void evaluateFields(typename TRAITS::EvalData d)
60  { std::cout << "unspecialized version of \"ScatterDirichletResidual_BlockedEpetra::evaluateFields\" on \""+PHX::print<EvalT>()+"\" should not be used!" << std::endl;
61  TEUCHOS_ASSERT(false); }
62 };
63 
64 // **************************************************************
65 // **************************************************************
66 // * Specializations
67 // **************************************************************
68 // **************************************************************
69 
70 
71 // **************************************************************
72 // Residual
73 // **************************************************************
74 template<typename TRAITS,typename LO,typename GO>
76  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
77  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
79 
80 public:
81 
83  const std::vector<Teuchos::RCP<const GlobalIndexer> > & /* cIndexers */)
84  : rowIndexers_(rIndexers) {}
85 
87  const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
88  const Teuchos::ParameterList& p,
89  bool useDiscreteAdjoint=false);
90 
91  void postRegistrationSetup(typename TRAITS::SetupData d,
93 
94  void preEvaluate(typename TRAITS::PreEvalData d);
95 
96  void evaluateFields(typename TRAITS::EvalData workset);
97 
100 
101 private:
104 
105  // dummy field so that the evaluator will have something to do
107 
108  // fields that need to be scattered will be put in this vector
109  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
110 
111  std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
112  std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
113 
114  std::vector<int> indexerIds_; // block index
115  std::vector<int> subFieldIds_; // sub field numbers
116 
117  // This maps the scattered field names to the DOF manager field
118  // For instance a Navier-Stokes map might look like
119  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
120  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
122 
123  std::size_t num_nodes;
124 
125  std::size_t side_subcell_dim_;
126  std::size_t local_side_id_;
127 
130  std::string globalDataKey_; // what global data does this fill?
131 
134 
135  // If set to true, scattering an initial condition
137 
138  // Allows runtime disabling of dirichlet BCs on node-by-node basis
139  std::vector< BCFieldType > applyBC_;
140 
142 };
143 
144 // **************************************************************
145 // Tangent
146 // **************************************************************
147 template<typename TRAITS,typename LO,typename GO>
149  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
150  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
152 
153 public:
154 
156  const std::vector<Teuchos::RCP<const GlobalIndexer> > & /* cIndexers */)
157  : rowIndexers_(rIndexers) {}
158 
160  const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
161  const Teuchos::ParameterList& p,
162  bool useDiscreteAdjoint=false);
163 
164  void postRegistrationSetup(typename TRAITS::SetupData d,
166 
167  void preEvaluate(typename TRAITS::PreEvalData d);
168 
169  void evaluateFields(typename TRAITS::EvalData workset);
170 
173 
174 private:
177 
178  // dummy field so that the evaluator will have something to do
180 
181  // fields that need to be scattered will be put in this vector
182  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
183 
184  std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
185  std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
186 
187  std::vector<int> indexerIds_; // block index
188  std::vector<int> subFieldIds_; // sub field numbers
189 
190  // This maps the scattered field names to the DOF manager field
191  // For instance a Navier-Stokes map might look like
192  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
193  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
195 
196  std::size_t num_nodes;
197 
198  std::size_t side_subcell_dim_;
199  std::size_t local_side_id_;
200 
203  std::string globalDataKey_; // what global data does this fill?
204 
207 
208  // If set to true, scattering an initial condition
210 
211  // Allows runtime disabling of dirichlet BCs on node-by-node basis
212  std::vector< BCFieldType > applyBC_;
213 
215 };
216 
217 // **************************************************************
218 // Jacobian
219 // **************************************************************
220 template<typename TRAITS,typename LO,typename GO>
222  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
223  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
225 
226 public:
227 
229  const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers)
230  : rowIndexers_(rIndexers), colIndexers_(cIndexers) {}
231 
233  const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
234  const Teuchos::ParameterList& p,
235  bool useDiscreteAdjoint=false);
236 
237  void preEvaluate(typename TRAITS::PreEvalData d);
238 
239  void postRegistrationSetup(typename TRAITS::SetupData d,
241 
242  void evaluateFields(typename TRAITS::EvalData workset);
243 
246 
247 private:
248 
251 
252  // dummy field so that the evaluator will have something to do
254 
255  // fields that need to be scattered will be put in this vector
256  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
257 
258  std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
259  std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
260 
261  std::vector<int> indexerIds_; // block index
262  std::vector<int> subFieldIds_; // sub field numbers
263 
264  // This maps the scattered field names to the DOF manager field
265  // For instance a Navier-Stokes map might look like
266  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
267  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
269 
270  std::size_t num_nodes;
271  std::size_t num_eq;
272 
273  std::size_t side_subcell_dim_;
274  std::size_t local_side_id_;
275 
277  std::string globalDataKey_; // what global data does this fill?
278 
281 
284 
285  // Allows runtime disabling of dirichlet BCs on node-by-node basis
286  std::vector< BCFieldType > applyBC_;
287 
289 };
290 
291 }
292 
293 // optionally include hessian support
294 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
296 #endif
297 
298 // **************************************************************
299 #endif
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
ScatterDirichletResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &)
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &vm)
ScatterDirichletResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &)
Pushes residual values into the residual vector for a Newton-based solve.
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
virtual void preEvaluate(typename Traits::PreEvalData d)=0
#define TEUCHOS_ASSERT(assertion_test)
ScatterDirichletResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &cIndexers)
Non-templated empty base class for template managers.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const