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 
65 template <typename LocalOrdinalT,typename GlobalOrdinalT>
66 class UniqueGlobalIndexer;
67 
76 template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterDirichletResidual_Epetra;
77 
78 // **************************************************************
79 // **************************************************************
80 // * Specializations
81 // **************************************************************
82 // **************************************************************
83 
84 
85 // **************************************************************
86 // Residual
87 // **************************************************************
88 template<typename TRAITS,typename LO,typename GO>
90  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
91  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
93 
94 public:
96  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & /* cIndexer=Teuchos::null */)
97  : globalIndexer_(indexer) {}
98 
100  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & cIndexer,
101  const Teuchos::ParameterList& p);
102 
103  void postRegistrationSetup(typename TRAITS::SetupData d,
105 
106  void preEvaluate(typename TRAITS::PreEvalData d);
107 
108  void evaluateFields(typename TRAITS::EvalData workset);
109 
111  { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Residual,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
112 
113 private:
115 
116  // dummy field so that the evaluator will have something to do
118 
119  // fields that need to be scattered will be put in this vector
120  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
121 
122  // maps the local (field,element,basis) triplet to a global ID
123  // for scattering
125  std::vector<int> fieldIds_; // field IDs needing mapping
126 
127  // This maps the scattered field names to the DOF manager field
128  // For instance a Navier-Stokes map might look like
129  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
130  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
132 
133  std::size_t num_nodes;
134 
135  std::size_t side_subcell_dim_;
136  std::size_t local_side_id_;
137 
139 
141 
142  std::string globalDataKey_; // what global data does this fill?
144 
147 
148  // If set to true, scattering an initial condition
150 
151  // Allows runtime disabling of dirichlet BCs on node-by-node basis
152  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
153 };
154 
155 // **************************************************************
156 // Tangent
157 // **************************************************************
158 template<typename TRAITS,typename LO,typename GO>
160  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
161  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
163 
164 public:
166  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & /* cIndexer=Teuchos::null */)
167  : globalIndexer_(indexer) {}
168 
170  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & cIndexer,
171  const Teuchos::ParameterList& p);
172 
173  void postRegistrationSetup(typename TRAITS::SetupData d,
175 
176  void preEvaluate(typename TRAITS::PreEvalData d);
177 
178  void evaluateFields(typename TRAITS::EvalData workset);
179 
181  { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Tangent,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
182 
183 private:
185 
186  // dummy field so that the evaluator will have something to do
188 
189  // fields that need to be scattered will be put in this vector
190  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
191 
192  // maps the local (field,element,basis) triplet to a global ID
193  // for scattering
195  std::vector<int> fieldIds_; // field IDs needing mapping
196 
197  // This maps the scattered field names to the DOF manager field
198  // For instance a Navier-Stokes map might look like
199  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
200  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
202 
203  std::vector<Teuchos::RCP<Epetra_Vector> > dfdp_vectors_;
204 
205  std::size_t num_nodes;
206 
207  std::size_t side_subcell_dim_;
208  std::size_t local_side_id_;
209 
211 
213 
214  std::string globalDataKey_; // what global data does this fill?
216 
219 
220  // If set to true, scattering an initial condition
222 
223  // Allows runtime disabling of dirichlet BCs on node-by-node basis
224  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
225 };
226 
227 // **************************************************************
228 // Jacobian
229 // **************************************************************
230 template<typename TRAITS,typename LO,typename GO>
232  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
233  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
235 
236 public:
238  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & cIndexer=Teuchos::null)
239  : globalIndexer_(indexer), colGlobalIndexer_(cIndexer) {}
240 
242  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & cIndexer,
243  const Teuchos::ParameterList& p);
244 
245  void preEvaluate(typename TRAITS::PreEvalData d);
246 
247  void postRegistrationSetup(typename TRAITS::SetupData d,
249 
250  void evaluateFields(typename TRAITS::EvalData workset);
251 
253  { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(globalIndexer_,colGlobalIndexer_,pl)); }
254 
255 private:
256 
258 
259  // dummy field so that the evaluator will have something to do
261 
262  // fields that need to be scattered will be put in this vector
263  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
264 
265  // maps the local (field,element,basis) triplet to a global ID
266  // for scattering
268  std::vector<int> fieldIds_; // field IDs needing mapping
269 
270  // This maps the scattered field names to the DOF manager field
271  // For instance a Navier-Stokes map might look like
272  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
273  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
275 
276  std::size_t num_nodes;
277  std::size_t num_eq;
278 
279  std::size_t side_subcell_dim_;
280  std::size_t local_side_id_;
281 
283 
284  std::string globalDataKey_; // what global data does this fill?
286 
288 
291 
292  // Allows runtime disabling of dirichlet BCs on node-by-node basis
293  std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
294 
296 };
297 
298 }
299 
300 // optionally include hessian support
301 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
303 #endif
304 
305 // **************************************************************
306 #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)
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
ScatterDirichletResidual_Epetra(const Teuchos::RCP< const UniqueGlobalIndexer< LO, GO > > &indexer, const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &)
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 UniqueGlobalIndexer< LO, GO > > &indexer, const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &)
Non-templated empty base class for template managers.
Pushes residual values into the residual vector for a Newton-based solve.