Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ScatterDirichletResidual_Tpetra_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_TPETRA_DECL_HPP
44 #define PANZER_EVALUATOR_SCATTER_DIRICHLET_RESIDUAL_TPETRA_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 
58 #include "Panzer_NodeType.hpp"
59 
61 
62 namespace panzer {
63 
64 template <typename LocalOrdinalT,typename GlobalOrdinalT>
65 class UniqueGlobalIndexer;
66 
75 template<typename EvalT, typename Traits,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
77 
78 // **************************************************************
79 // **************************************************************
80 // * Specializations
81 // **************************************************************
82 // **************************************************************
83 
84 
85 // **************************************************************
86 // Residual
87 // **************************************************************
88 template<typename TRAITS,typename LO,typename GO,typename NodeT>
89 class ScatterDirichletResidual_Tpetra<panzer::Traits::Residual,TRAITS,LO,GO,NodeT>
90  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
91  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
93 
94 public:
96  : globalIndexer_(indexer) {}
97 
99  const Teuchos::ParameterList& p);
100 
101  void postRegistrationSetup(typename TRAITS::SetupData d,
103 
104  void preEvaluate(typename TRAITS::PreEvalData d);
105 
106  void evaluateFields(typename TRAITS::EvalData workset);
107 
110 
111 private:
114 
115  // dummy field so that the evaluator will have something to do
117 
118  // fields that need to be scattered will be put in this vector
119  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
120 
121  // maps the local (field,element,basis) triplet to a global ID
122  // for scattering
124  std::vector<int> fieldIds_; // field IDs needing mapping
125 
126  // This maps the scattered field names to the DOF manager field
127  // For instance a Navier-Stokes map might look like
128  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
129  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
131 
132  std::size_t num_nodes;
133 
134  std::size_t side_subcell_dim_;
135  std::size_t local_side_id_;
136 
138 
140 
141  std::string globalDataKey_; // what global data does this fill?
143 
146 
147  // If set to true, scattering an initial condition
149 
150  // Allows runtime disabling of dirichlet BCs on node-by-node basis
151  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
152 };
153 
154 // **************************************************************
155 // Tangent
156 // **************************************************************
157 template<typename TRAITS,typename LO,typename GO,typename NodeT>
158 class ScatterDirichletResidual_Tpetra<panzer::Traits::Tangent,TRAITS,LO,GO,NodeT>
159  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
160  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
162 
163 public:
165  : globalIndexer_(indexer) {}
166 
168  const Teuchos::ParameterList& p);
169 
170  void postRegistrationSetup(typename TRAITS::SetupData d,
172 
173  void preEvaluate(typename TRAITS::PreEvalData d);
174 
175  void evaluateFields(typename TRAITS::EvalData workset);
176 
179 
180 private:
183 
184  // dummy field so that the evaluator will have something to do
186 
187  // fields that need to be scattered will be put in this vector
188  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
189 
190  // maps the local (field,element,basis) triplet to a global ID
191  // for scattering
193  std::vector<int> fieldIds_; // field IDs needing mapping
194 
195  // This maps the scattered field names to the DOF manager field
196  // For instance a Navier-Stokes map might look like
197  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
198  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
200 
201  std::size_t num_nodes;
202 
203  std::size_t side_subcell_dim_;
204  std::size_t local_side_id_;
205 
207 
209 
210  std::string globalDataKey_; // what global data does this fill?
212  std::vector< Teuchos::ArrayRCP<double> > dfdp_vectors_;
213 
216 
217  // If set to true, scattering an initial condition
219 
220  // Allows runtime disabling of dirichlet BCs on node-by-node basis
221  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
222 };
223 
224 // **************************************************************
225 // Jacobian
226 // **************************************************************
227 template<typename TRAITS,typename LO,typename GO,typename NodeT>
228 class ScatterDirichletResidual_Tpetra<panzer::Traits::Jacobian,TRAITS,LO,GO,NodeT>
229  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
230  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
232 
233 public:
235  : globalIndexer_(indexer) {}
236 
238  const Teuchos::ParameterList& p);
239 
240  void preEvaluate(typename TRAITS::PreEvalData d);
241 
242  void postRegistrationSetup(typename TRAITS::SetupData d,
244 
245  void evaluateFields(typename TRAITS::EvalData workset);
246 
249 
250 private:
251 
254 
255  // dummy field so that the evaluator will have something to do
257 
258  // fields that need to be scattered will be put in this vector
259  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
260 
261  // maps the local (field,element,basis) triplet to a global ID
262  // for scattering
264  std::vector<int> fieldIds_; // field IDs needing mapping
265 
266  // This maps the scattered field names to the DOF manager field
267  // For instance a Navier-Stokes map might look like
268  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
269  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
271 
272  std::size_t num_nodes;
273  std::size_t num_eq;
274 
275  std::size_t side_subcell_dim_;
276  std::size_t local_side_id_;
277 
279 
281 
282  std::string globalDataKey_; // what global data does this fill?
284 
287 
288  // Allows runtime disabling of dirichlet BCs on node-by-node basis
289  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
290 };
291 
292 }
293 
294 // optionally include hessian support
295 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
297 #endif
298 
299 // **************************************************************
300 #endif
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.
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Non-templated empty base class for template managers.