Panzer  Version of the Day
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 class Epetra_CrsMatrix;
61 
62 namespace panzer {
63 
64 class EpetraLinearObjContainer;
65 
66 template <typename LocalOrdinalT,typename GlobalOrdinalT>
67 class UniqueGlobalIndexer;
68 
77 template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterDirichletResidual_Epetra;
78 
79 // **************************************************************
80 // **************************************************************
81 // * Specializations
82 // **************************************************************
83 // **************************************************************
84 
85 
86 // **************************************************************
87 // Residual
88 // **************************************************************
89 template<typename TRAITS,typename LO,typename GO>
91  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
92  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
94 
95 public:
97  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & cIndexer=Teuchos::null)
98  : globalIndexer_(indexer) {}
99 
101  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & cIndexer,
102  const Teuchos::ParameterList& p);
103 
104  void postRegistrationSetup(typename TRAITS::SetupData d,
106 
107  void preEvaluate(typename TRAITS::PreEvalData d);
108 
109  void evaluateFields(typename TRAITS::EvalData workset);
110 
112  { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Residual,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
113 
114 private:
116 
117  // dummy field so that the evaluator will have something to do
119 
120  // fields that need to be scattered will be put in this vector
121  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
122 
123  // maps the local (field,element,basis) triplet to a global ID
124  // for scattering
126  std::vector<int> fieldIds_; // field IDs needing mapping
127 
128  // This maps the scattered field names to the DOF manager field
129  // For instance a Navier-Stokes map might look like
130  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
131  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
133 
134  std::size_t num_nodes;
135 
136  std::size_t side_subcell_dim_;
137  std::size_t local_side_id_;
138 
140 
142 
143  std::string globalDataKey_; // what global data does this fill?
145 
148 
149  // If set to true, scattering an initial condition
151 
152  // Allows runtime disabling of dirichlet BCs on node-by-node basis
153  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
154 };
155 
156 // **************************************************************
157 // Tangent
158 // **************************************************************
159 template<typename TRAITS,typename LO,typename GO>
161  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
162  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
164 
165 public:
167  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & cIndexer=Teuchos::null)
168  : globalIndexer_(indexer) {}
169 
171  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & cIndexer,
172  const Teuchos::ParameterList& p);
173 
174  void postRegistrationSetup(typename TRAITS::SetupData d,
176 
177  void preEvaluate(typename TRAITS::PreEvalData d);
178 
179  void evaluateFields(typename TRAITS::EvalData workset);
180 
182  { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Tangent,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
183 
184 private:
186 
187  // dummy field so that the evaluator will have something to do
189 
190  // fields that need to be scattered will be put in this vector
191  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
192 
193  // maps the local (field,element,basis) triplet to a global ID
194  // for scattering
196  std::vector<int> fieldIds_; // field IDs needing mapping
197 
198  // This maps the scattered field names to the DOF manager field
199  // For instance a Navier-Stokes map might look like
200  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
201  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
203 
204  std::vector<Teuchos::RCP<Epetra_Vector> > dfdp_vectors_;
205 
206  std::size_t num_nodes;
207 
208  std::size_t side_subcell_dim_;
209  std::size_t local_side_id_;
210 
212 
214 
215  std::string globalDataKey_; // what global data does this fill?
217 
220 
221  // If set to true, scattering an initial condition
223 
224  // Allows runtime disabling of dirichlet BCs on node-by-node basis
225  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
226 };
227 
228 // **************************************************************
229 // Jacobian
230 // **************************************************************
231 template<typename TRAITS,typename LO,typename GO>
233  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
234  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
236 
237 public:
239  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & cIndexer=Teuchos::null)
240  : globalIndexer_(indexer), colGlobalIndexer_(cIndexer) {}
241 
243  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & cIndexer,
244  const Teuchos::ParameterList& p);
245 
246  void preEvaluate(typename TRAITS::PreEvalData d);
247 
248  void postRegistrationSetup(typename TRAITS::SetupData d,
250 
251  void evaluateFields(typename TRAITS::EvalData workset);
252 
254  { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(globalIndexer_,colGlobalIndexer_,pl)); }
255 
256 private:
257 
259 
260  // dummy field so that the evaluator will have something to do
262 
263  // fields that need to be scattered will be put in this vector
264  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
265 
266  // maps the local (field,element,basis) triplet to a global ID
267  // for scattering
269  std::vector<int> fieldIds_; // field IDs needing mapping
270 
271  // This maps the scattered field names to the DOF manager field
272  // For instance a Navier-Stokes map might look like
273  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
274  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
276 
277  std::size_t num_nodes;
278  std::size_t num_eq;
279 
280  std::size_t side_subcell_dim_;
281  std::size_t local_side_id_;
282 
284 
285  std::string globalDataKey_; // what global data does this fill?
287 
289 
292 
293  // Allows runtime disabling of dirichlet BCs on node-by-node basis
294  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
295 
297 };
298 
299 }
300 
301 // optionally include hessian support
302 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
304 #endif
305 
306 // **************************************************************
307 #endif
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
ScatterDirichletResidual_Epetra(const Teuchos::RCP< const UniqueGlobalIndexer< LO, GO > > &indexer, const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &cIndexer=Teuchos::null)
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 UniqueGlobalIndexer< LO, GO > > &indexer, const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &cIndexer=Teuchos::null)
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
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
ScatterDirichletResidual_Epetra(const Teuchos::RCP< const UniqueGlobalIndexer< LO, GO > > &indexer, const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &cIndexer=Teuchos::null)
Non-templated empty base class for template managers.
Pushes residual values into the residual vector for a Newton-based solve.