Panzer  Version of the Day
Panzer_ScatterDirichletResidual_BlockedEpetra_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Panzer: A partial differential equation assembly
5 // engine for strongly coupled complex multiphysics systems
6 // Copyright (2011) Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39 // Eric C. Cyr (eccyr@sandia.gov)
40 // ***********************************************************************
41 // @HEADER
42 
43 #ifndef PANZER_EVALUATOR_SCATTER_DIRICHLET_RESIDUAL_BLOCKEDEPETRA_DECL_HPP
44 #define PANZER_EVALUATOR_SCATTER_DIRICHLET_RESIDUAL_BLOCKEDEPETRA_DECL_HPP
45 
46 #include "Phalanx_config.hpp"
47 #include "Phalanx_Evaluator_Macros.hpp"
48 #include "Phalanx_MDField.hpp"
49 
51 
52 #include "PanzerDiscFE_config.hpp"
53 #include "Panzer_Dimension.hpp"
54 #include "Panzer_Traits.hpp"
57 
59 
60 namespace Thyra {
61  template <typename ScalarT> class ProductVectorBase;
62  template <typename ScalarT> class BlockedLinearOpBase;
63 }
64 
65 namespace panzer {
66 
67 template <typename LocalOrdinalT,typename GlobalOrdinalT>
68 class UniqueGlobalIndexer;
69 
70 template <typename LocalOrdinalT,typename GlobalOrdinalT>
71 class BlockedDOFManager; //forward declaration
72 
81 template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterDirichletResidual_BlockedEpetra
82  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
83  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
85 public:
86  typedef typename EvalT::ScalarT ScalarT;
87 
89 
92 
93  void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager<TRAITS>& vm)
94  { }
95  void evaluateFields(typename TRAITS::EvalData d)
96  { std::cout << "unspecialized version of \"ScatterDirichletResidual_BlockedEpetra::evaluateFields\" on \""+PHX::typeAsString<EvalT>()+"\" should not be used!" << std::endl;
97  TEUCHOS_ASSERT(false); }
98 };
99 
100 // **************************************************************
101 // **************************************************************
102 // * Specializations
103 // **************************************************************
104 // **************************************************************
105 
106 
107 // **************************************************************
108 // Residual
109 // **************************************************************
110 template<typename TRAITS,typename LO,typename GO>
112  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
113  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
115 
116 public:
117 
119  const std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > & cIndexers)
120  : rowIndexers_(rIndexers) {}
121 
123  const std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > & cIndexers,
124  const Teuchos::ParameterList& p,
125  bool useDiscreteAdjoint=false);
126 
127  void postRegistrationSetup(typename TRAITS::SetupData d,
129 
130  void preEvaluate(typename TRAITS::PreEvalData d);
131 
132  void evaluateFields(typename TRAITS::EvalData workset);
133 
136 
137 private:
139 
140  // dummy field so that the evaluator will have something to do
142 
143  // fields that need to be scattered will be put in this vector
144  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
145 
146  std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > rowIndexers_;
147  std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > colIndexers_;
148 
149  std::vector<int> indexerIds_; // block index
150  std::vector<int> subFieldIds_; // sub field numbers
151 
152  // This maps the scattered field names to the DOF manager field
153  // For instance a Navier-Stokes map might look like
154  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
155  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
157 
158  std::size_t num_nodes;
159 
160  std::size_t side_subcell_dim_;
161  std::size_t local_side_id_;
162 
165  std::string globalDataKey_; // what global data does this fill?
166 
169 
170  // If set to true, scattering an initial condition
172 
173  // Allows runtime disabling of dirichlet BCs on node-by-node basis
174  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
175 
177 };
178 
179 // **************************************************************
180 // Tangent
181 // **************************************************************
182 template<typename TRAITS,typename LO,typename GO>
184  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
185  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
187 
188 public:
189 
191  const std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > & cIndexers)
192  : rowIndexers_(rIndexers) {}
193 
195  const std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > & cIndexers,
196  const Teuchos::ParameterList& p,
197  bool useDiscreteAdjoint=false);
198 
199  void postRegistrationSetup(typename TRAITS::SetupData d,
201 
202  void preEvaluate(typename TRAITS::PreEvalData d);
203 
204  void evaluateFields(typename TRAITS::EvalData workset);
205 
208 
209 private:
211 
212  // dummy field so that the evaluator will have something to do
214 
215  // fields that need to be scattered will be put in this vector
216  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
217 
218  std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > rowIndexers_;
219  std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > colIndexers_;
220 
221  std::vector<int> indexerIds_; // block index
222  std::vector<int> subFieldIds_; // sub field numbers
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 num_nodes;
231 
232  std::size_t side_subcell_dim_;
233  std::size_t local_side_id_;
234 
237  std::string globalDataKey_; // what global data does this fill?
238 
241 
242  // If set to true, scattering an initial condition
244 
245  // Allows runtime disabling of dirichlet BCs on node-by-node basis
246  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
247 
249 };
250 
251 // **************************************************************
252 // Jacobian
253 // **************************************************************
254 template<typename TRAITS,typename LO,typename GO>
256  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
257  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
259 
260 public:
261 
263  const std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > & cIndexers)
264  : rowIndexers_(rIndexers), colIndexers_(cIndexers) {}
265 
267  const std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > & cIndexers,
268  const Teuchos::ParameterList& p,
269  bool useDiscreteAdjoint=false);
270 
271  void preEvaluate(typename TRAITS::PreEvalData d);
272 
273  void postRegistrationSetup(typename TRAITS::SetupData d,
275 
276  void evaluateFields(typename TRAITS::EvalData workset);
277 
280 
281 private:
282 
284 
285  // dummy field so that the evaluator will have something to do
287 
288  // fields that need to be scattered will be put in this vector
289  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
290 
291  std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > rowIndexers_;
292  std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > colIndexers_;
293 
294  std::vector<int> indexerIds_; // block index
295  std::vector<int> subFieldIds_; // sub field numbers
296 
297  // This maps the scattered field names to the DOF manager field
298  // For instance a Navier-Stokes map might look like
299  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
300  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
302 
303  std::size_t num_nodes;
304  std::size_t num_eq;
305 
306  std::size_t side_subcell_dim_;
307  std::size_t local_side_id_;
308 
310  std::string globalDataKey_; // what global data does this fill?
311 
314 
317 
318  // Allows runtime disabling of dirichlet BCs on node-by-node basis
319  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
320 
322 };
323 
324 }
325 
326 // optionally include hessian support
327 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
329 #endif
330 
331 // **************************************************************
332 #endif
ScatterDirichletResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const UniqueGlobalIndexer< LO, int > > > &rIndexers, const std::vector< Teuchos::RCP< const UniqueGlobalIndexer< LO, int > > > &cIndexers)
ScatterDirichletResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const UniqueGlobalIndexer< LO, int > > > &rIndexers, const std::vector< Teuchos::RCP< const UniqueGlobalIndexer< LO, int > > > &cIndexers)
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &vm)
PHX::MDField< ScalarT > vector
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.
ScatterDirichletResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const UniqueGlobalIndexer< LO, int > > > &rIndexers, const std::vector< Teuchos::RCP< const UniqueGlobalIndexer< LO, int > > > &cIndexers)
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
#define TEUCHOS_ASSERT(assertion_test)
Non-templated empty base class for template managers.