Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ScatterDirichletResidual_BlockedTpetra.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_BLOCKEDTPETRA_HPP
12 #define PANZER_EVALUATOR_SCATTER_DIRICHLET_RESIDUAL_BLOCKEDTPETRA_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 }
31 
32 namespace panzer {
33 
34 class BlockedDOFManager;
35 class GlobalIndexer;
36 
45 template <typename EvalT,typename TRAITS,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
47  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
48  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
50 public:
51  typedef typename EvalT::ScalarT ScalarT;
53  { }
54 
56  const Teuchos::ParameterList& p);
57 
60 
61  void postRegistrationSetup(typename TRAITS::SetupData /* d */, PHX::FieldManager<TRAITS>& /* vm */)
62  { }
63  void evaluateFields(typename TRAITS::EvalData /* d */)
64  { std::cout << "unspecialized version of \"ScatterDirichletResidual_BlockedTpetra::evaluateFields\" on \""+PHX::print<EvalT>()+"\" should not be used!" << std::endl;
65  TEUCHOS_ASSERT(false); }
66 };
67 
68 // **************************************************************
69 // **************************************************************
70 // * Specializations
71 // **************************************************************
72 // **************************************************************
73 
74 
75 // **************************************************************
76 // Residual
77 // **************************************************************
78 template <typename TRAITS,typename LO,typename GO,typename NodeT>
80  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
81  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
83 
84 public:
86  : globalIndexer_(indexer) {}
87 
89  const Teuchos::ParameterList& p);
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:
103  typedef typename TRAITS::RealType RealType;
104 
106  typedef Tpetra::Vector<RealType,LO,GO,NodeT> VectorType;
107  typedef Tpetra::CrsMatrix<RealType,LO,GO,NodeT> CrsMatrixType;
108  typedef Tpetra::CrsGraph<LO,GO,NodeT> CrsGraphType;
109  typedef Tpetra::Map<LO,GO,NodeT> MapType;
110  typedef Tpetra::Import<LO,GO,NodeT> ImportType;
111  typedef Tpetra::Export<LO,GO,NodeT> ExportType;
112 
113  // dummy field so that the evaluator will have something to do
115 
116  // fields that need to be scattered will be put in this vector
117  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
118 
119  // maps the local (field,element,basis) triplet to a global ID
120  // for scattering
122 
126  std::vector<Teuchos::RCP<const panzer::GlobalIndexer>> fieldGlobalIndexers_;
127 
129  std::vector<int> fieldIds_;
130 
133  std::vector<int> productVectorBlockIndex_;
134 
135  // This maps the scattered field names to the DOF manager field
136  // For instance a Navier-Stokes map might look like
137  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
138  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
140 
142  PHX::View<LO**> worksetLIDs_;
143 
145  std::vector<PHX::View<int*>> fieldOffsets_;
146 
150  std::vector<PHX::View<int*>> basisIndexForMDFieldOffsets_;
151 
152  std::size_t side_subcell_dim_;
153  std::size_t local_side_id_;
154 
156  std::string globalDataKey_; // what global data does this fill?
158 
161 
162  // If set to true, scattering an initial condition
164 
165  // Allows runtime disabling of dirichlet BCs on node-by-node basis
166  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
167 
169 };
170 
171 // **************************************************************
172 // Jacobian
173 // **************************************************************
174 template <typename TRAITS,typename LO,typename GO,typename NodeT>
176  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
177  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
179 
180 public:
182  : globalIndexer_(indexer) {}
183 
185  const Teuchos::ParameterList& p);
186 
187  void preEvaluate(typename TRAITS::PreEvalData d);
188 
189  void postRegistrationSetup(typename TRAITS::SetupData d,
191 
192  void evaluateFields(typename TRAITS::EvalData workset);
193 
196 
197 private:
199  typedef typename TRAITS::RealType RealType;
200 
202  typedef Tpetra::Operator<RealType,LO,GO,NodeT> OperatorType;
203  typedef Tpetra::CrsMatrix<RealType,LO,GO,NodeT> CrsMatrixType;
204  typedef Tpetra::Map<LO,GO,NodeT> MapType;
205 
206  typedef Thyra::TpetraLinearOp<RealType,LO,GO,NodeT> ThyraLinearOp;
207 
208  // dummy field so that the evaluator will have something to do
210 
211  // fields that need to be scattered will be put in this vector
212  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
213 
214  // maps the local (field,element,basis) triplet to a global ID
215  // for scattering
217 
218  std::vector<int> fieldIds_; // field IDs needing mapping
219 
222  std::vector<int> productVectorBlockIndex_;
223 
224  // This maps the scattered field names to the DOF manager field
225  // For instance a Navier-Stokes map might look like
226  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
227  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
229 
230  std::size_t side_subcell_dim_;
231  std::size_t local_side_id_;
232 
234  std::string globalDataKey_; // what global data does this fill?
236 
238  PHX::View<LO**> worksetLIDs_;
239 
241  std::vector<PHX::View<int*>> fieldOffsets_;
242 
246  std::vector<PHX::View<int*>> basisIndexForMDFieldOffsets_;
247 
249  PHX::View<LO*> blockOffsets_;
250 
253 
254  // Allows runtime disabling of dirichlet BCs on node-by-node basis
255  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
256 
258  static constexpr int maxDerivativeArraySize_ = 256;
259 
261 };
262 
263 }
264 
265 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
267 #endif
268 
269 // **************************************************************
270 #endif
ScatterDirichletResidual_BlockedTpetra(const Teuchos::RCP< const BlockedDOFManager > &)
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.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
PHX::View< LO * > blockOffsets_
The offset values of the blocked DOFs per element. Size of number of blocks in the product vector + 1...
virtual void preEvaluate(typename Traits::PreEvalData d)=0
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
std::vector< PHX::View< int * > > fieldOffsets_
Offset into the cell lids for each field. Size of number of fields to scatter.
Pushes residual values into the residual vector for a Newton-based solve.
#define TEUCHOS_ASSERT(assertion_test)
void postRegistrationSetup(typename TRAITS::SetupData, PHX::FieldManager< TRAITS > &)
Non-templated empty base class for template managers.