Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ScatterDirichletResidual_Epetra_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_EPETRA_DECL_HPP
44 #define PANZER_EVALUATOR_SCATTER_DIRICHLET_RESIDUAL_EPETRA_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"
56 
58 
59 class Epetra_Vector;
60 
61 namespace panzer {
62 
63 class EpetraLinearObjContainer;
64 class GlobalIndexer;
65 
74 template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterDirichletResidual_Epetra;
75 
76 // **************************************************************
77 // **************************************************************
78 // * Specializations
79 // **************************************************************
80 // **************************************************************
81 
82 
83 // **************************************************************
84 // Residual
85 // **************************************************************
86 template<typename TRAITS,typename LO,typename GO>
88  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
89  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
91 
92 public:
94  const Teuchos::RCP<const panzer::GlobalIndexer> & /* cIndexer=Teuchos::null */)
95  : globalIndexer_(indexer) {}
96 
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 
109  { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Residual,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
110 
111 private:
113 
114  // dummy field so that the evaluator will have something to do
116 
117  // fields that need to be scattered will be put in this vector
118  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
119 
120  // maps the local (field,element,basis) triplet to a global ID
121  // for scattering
123  std::vector<int> fieldIds_; // field IDs needing mapping
124 
125  // This maps the scattered field names to the DOF manager field
126  // For instance a Navier-Stokes map might look like
127  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
128  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
130 
131  std::size_t num_nodes;
132 
133  std::size_t side_subcell_dim_;
134  std::size_t local_side_id_;
135 
137 
139 
140  std::string globalDataKey_; // what global data does this fill?
142 
145 
146  // If set to true, scattering an initial condition
148 
149  // Allows runtime disabling of dirichlet BCs on node-by-node basis
150  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
151 };
152 
153 // **************************************************************
154 // Tangent
155 // **************************************************************
156 template<typename TRAITS,typename LO,typename GO>
158  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
159  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
161 
162 public:
164  const Teuchos::RCP<const panzer::GlobalIndexer> & /* cIndexer=Teuchos::null */)
165  : globalIndexer_(indexer) {}
166 
169  const Teuchos::ParameterList& p);
170 
171  void postRegistrationSetup(typename TRAITS::SetupData d,
173 
174  void preEvaluate(typename TRAITS::PreEvalData d);
175 
176  void evaluateFields(typename TRAITS::EvalData workset);
177 
179  { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Tangent,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
180 
181 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::vector<Teuchos::RCP<Epetra_Vector> > dfdp_vectors_;
202 
203  std::size_t num_nodes;
204 
205  std::size_t side_subcell_dim_;
206  std::size_t local_side_id_;
207 
209 
211 
212  std::string globalDataKey_; // what global data does this fill?
214 
217 
218  // If set to true, scattering an initial condition
220 
221  // Allows runtime disabling of dirichlet BCs on node-by-node basis
222  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
223 };
224 
225 // **************************************************************
226 // Jacobian
227 // **************************************************************
228 template<typename TRAITS,typename LO,typename GO>
230  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
231  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
233 
234 public:
236  const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer=Teuchos::null)
237  : globalIndexer_(indexer), colGlobalIndexer_(cIndexer) {}
238 
241  const Teuchos::ParameterList& p);
242 
243  void preEvaluate(typename TRAITS::PreEvalData d);
244 
245  void postRegistrationSetup(typename TRAITS::SetupData d,
247 
248  void evaluateFields(typename TRAITS::EvalData workset);
249 
251  { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(globalIndexer_,colGlobalIndexer_,pl)); }
252 
253 private:
254 
256 
257  // dummy field so that the evaluator will have something to do
259 
260  // fields that need to be scattered will be put in this vector
261  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
262 
263  // maps the local (field,element,basis) triplet to a global ID
264  // for scattering
266  std::vector<int> fieldIds_; // field IDs needing mapping
267 
268  // This maps the scattered field names to the DOF manager field
269  // For instance a Navier-Stokes map might look like
270  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
271  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
273 
274  std::size_t num_nodes;
275  std::size_t num_eq;
276 
277  std::size_t side_subcell_dim_;
278  std::size_t local_side_id_;
279 
281 
282  std::string globalDataKey_; // what global data does this fill?
284 
286 
289 
290  // Allows runtime disabling of dirichlet BCs on node-by-node basis
291  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
292 
294 };
295 
296 }
297 
298 // optionally include hessian support
299 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
301 #endif
302 
303 // **************************************************************
304 #endif
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.
ScatterDirichletResidual_Epetra(const Teuchos::RCP< const GlobalIndexer > &indexer, const Teuchos::RCP< const panzer::GlobalIndexer > &cIndexer=Teuchos::null)
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
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.
ScatterDirichletResidual_Epetra(const Teuchos::RCP< const GlobalIndexer > &indexer, const Teuchos::RCP< const panzer::GlobalIndexer > &)
ScatterDirichletResidual_Epetra(const Teuchos::RCP< const GlobalIndexer > &indexer, const Teuchos::RCP< const panzer::GlobalIndexer > &)
Non-templated empty base class for template managers.
Pushes residual values into the residual vector for a Newton-based solve.