Panzer  Version of the Day
Panzer_GatherSolution_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_GATHER_SOLUTION_EPETRA_DECL_HPP
44 #define PANZER_EVALUATOR_GATHER_SOLUTION_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 
60 
61 class Epetra_Vector;
62 class Epetra_CrsMatrix;
63 
64 namespace panzer {
65 
66 template <typename LocalOrdinalT,typename GlobalOrdinalT>
67 class UniqueGlobalIndexer; //forward declaration
68 
76 template<typename EvalT, typename TRAITS,typename LO,typename GO> class GatherSolution_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 
95 public:
96 
98  globalIndexer_(indexer) {}
99 
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 d);
109 
112 
113 private:
114 
115  typedef typename panzer::Traits::Residual EvalT;
117 
118  // maps the local (field,element,basis) triplet to a global ID
119  // for scattering
121  std::vector<int> fieldIds_; // field IDs needing mapping
122 
123  std::vector< PHX::MDField<ScalarT,Cell,NODE> > gatherFields_;
124 
125  std::vector<std::string> indexerNames_;
127  std::string globalDataKey_; // what global data does this fill?
128 
130 
131  // Fields for storing tangent components dx/dp of solution vector x
132  // These are not actually used by the residual specialization of this evaluator,
133  // even if they are supplied, but it is useful to declare them as dependencies anyway
134  // when saving the tangent components to the output file
136  std::vector< std::vector< PHX::MDField<const ScalarT,Cell,NODE> > > tangentFields_;
137 
139 };
140 
141 // **************************************************************
142 // Tangent
143 // **************************************************************
144 template<typename TRAITS,typename LO,typename GO>
146  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
147  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
149 
150 
151 public:
152 
154  globalIndexer_(indexer) {}
155 
157  const Teuchos::ParameterList& p);
158 
159  void postRegistrationSetup(typename TRAITS::SetupData d,
161 
162  void preEvaluate(typename TRAITS::PreEvalData d);
163 
164  void evaluateFields(typename TRAITS::EvalData d);
165 
168 
169 private:
170 
171  typedef typename panzer::Traits::Tangent EvalT;
173  //typedef typename panzer::Traits::RealType RealT;
174 
175  // maps the local (field,element,basis) triplet to a global ID
176  // for scattering
178  std::vector<int> fieldIds_; // field IDs needing mapping
179 
180  std::vector< PHX::MDField<ScalarT,Cell,NODE> > gatherFields_;
181 
182  std::vector<std::string> indexerNames_;
184  std::string globalDataKey_; // what global data does this fill?
185 
187 
188  // Fields for storing tangent components dx/dp of solution vector x
190  std::vector< std::vector< PHX::MDField<const ScalarT,Cell,NODE> > > tangentFields_;
191 
193 };
194 
195 // **************************************************************
196 // Jacobian
197 // **************************************************************
198 template<typename TRAITS,typename LO,typename GO>
200  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
201  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
203 
204 public:
206  globalIndexer_(indexer) {}
207 
209  const Teuchos::ParameterList& p);
210 
211  void postRegistrationSetup(typename TRAITS::SetupData d,
213 
214  void preEvaluate(typename TRAITS::PreEvalData d);
215 
216  void evaluateFields(typename TRAITS::EvalData d);
217 
220 
221 private:
222 
223  typedef typename panzer::Traits::Jacobian EvalT;
225 
226  // maps the local (field,element,basis) triplet to a global ID
227  // for scattering
229  std::vector<int> fieldIds_; // field IDs needing mapping
230 
231  std::vector< PHX::MDField<ScalarT,Cell,NODE> > gatherFields_;
232 
233  std::vector<std::string> indexerNames_;
235  bool disableSensitivities_; // This disables sensitivities absolutely
236  std::string sensitivitiesName_; // This sets which gather operations have sensitivities
237  bool applySensitivities_; // This is a local variable that is used by evaluateFields
238  // to turn on/off a certain set of sensitivities
239  std::string globalDataKey_; // what global data does this fill?
240  int gatherSeedIndex_; // what gather seed in the workset to use
241  // if less than zero then use alpha or beta
242  // as appropriate
243 
245 
247 };
248 
249 }
250 
251 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
253 #endif
254 
255 // **************************************************************
256 #endif
Gathers solution values from the Newton solution vector into the nodal fields of the field manager...
GatherSolution_Epetra(const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &indexer)
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.
std::vector< std::vector< PHX::MDField< const ScalarT, Cell, NODE > > > tangentFields_
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
GatherSolution_Epetra(const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &indexer)
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
std::vector< std::vector< PHX::MDField< const ScalarT, Cell, NODE > > > tangentFields_
GatherSolution_Epetra(const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &indexer)
Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > globalIndexer_
Non-templated empty base class for template managers.