Panzer  Version of the Day
Panzer_GatherSolution_BlockedEpetra_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_BLOCKEDEPETRA_DECL_HPP
44 #define PANZER_EVALUATOR_GATHER_SOLUTION_BLOCKEDEPETRA_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 // thyra forward decl
60 namespace Thyra {
61  template <typename> class ProductVectorBase;
62 }
63 
64 namespace panzer {
65 
66 class BlockedEpetraLinearObjContainer;
67 
68 template <typename LocalOrdinalT,typename GlobalOrdinalT>
69 class UniqueGlobalIndexer; //forward declaration
70 
78 template<typename EvalT, typename TRAITS,typename LO,typename GO> class GatherSolution_BlockedEpetra
79  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
80  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
82 public:
83  typedef typename EvalT::ScalarT ScalarT;
84 
86 
89 
90  void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager<TRAITS>& vm)
91  { }
92  void evaluateFields(typename TRAITS::EvalData d)
93  { std::cout << "unspecialized version of \"GatherSolution_BlockedEpetra::evaluateFields\" on "+PHX::typeAsString<EvalT>()+"\" should not be used!" << std::endl;
94  TEUCHOS_ASSERT(false); }
95 };
96 
97 // **************************************************************
98 // **************************************************************
99 // * Specializations
100 // **************************************************************
101 // **************************************************************
102 
103 
104 // **************************************************************
105 // Residual
106 // **************************************************************
107 template<typename TRAITS,typename LO,typename GO>
109  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
110  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
112 
113 
114 public:
115 
117  : indexers_(indexers) {}
118 
120  const Teuchos::ParameterList& p);
121 
122  void postRegistrationSetup(typename TRAITS::SetupData d,
124 
125  void preEvaluate(typename TRAITS::PreEvalData d);
126 
127  void evaluateFields(typename TRAITS::EvalData d);
128 
131 
132 
133 private:
134 
135  typedef typename panzer::Traits::Residual EvalT;
137 
138  std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > indexers_;
139 
140  std::vector<int> indexerIds_; // block index
141  std::vector<int> subFieldIds_; // sub field numbers
142 
143  std::vector< PHX::MDField<ScalarT,Cell,NODE> > gatherFields_;
144 
145  std::vector<std::string> indexerNames_;
147  std::string globalDataKey_; // what global data does this fill?
148 
150 
151  // Fields for storing tangent components dx/dp of solution vector x
152  // These are not actually used by the residual specialization of this evaluator,
153  // even if they are supplied, but it is useful to declare them as dependencies anyway
154  // when saving the tangent components to the output file
156  std::vector< std::vector< PHX::MDField<const ScalarT,Cell,NODE> > > tangentFields_;
157 
159 };
160 
161 // **************************************************************
162 // Tangent
163 // **************************************************************
164 template<typename TRAITS,typename LO,typename GO>
166  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
167  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
169 
170 
171 public:
172 
174  : indexers_(indexers) {}
175 
177  const Teuchos::ParameterList& p);
178 
179  void postRegistrationSetup(typename TRAITS::SetupData d,
181 
182  void preEvaluate(typename TRAITS::PreEvalData d);
183 
184  void evaluateFields(typename TRAITS::EvalData d);
185 
188 
189 
190 private:
191 
192  typedef typename panzer::Traits::Tangent EvalT;
194 
195  std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > indexers_;
196 
197  std::vector<int> indexerIds_; // block index
198  std::vector<int> subFieldIds_; // sub field numbers
199 
200  std::vector< PHX::MDField<ScalarT,Cell,NODE> > gatherFields_;
201 
202  std::vector<std::string> indexerNames_;
204  std::string globalDataKey_; // what global data does this fill?
205 
207 
208  // Fields for storing tangent components dx/dp of solution vector x
210  std::vector< std::vector< PHX::MDField<const ScalarT,Cell,NODE> > > tangentFields_;
211 
213 };
214 
215 // **************************************************************
216 // Jacobian
217 // **************************************************************
218 template<typename TRAITS,typename LO,typename GO>
220  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
221  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
223 
224 public:
225 
227  : indexers_(indexers) {}
228 
230  const Teuchos::ParameterList& p);
231 
232  void postRegistrationSetup(typename TRAITS::SetupData d,
234 
235  void preEvaluate(typename TRAITS::PreEvalData d);
236 
237  void evaluateFields(typename TRAITS::EvalData d);
238 
241 
242 private:
243 
244  typedef typename panzer::Traits::Jacobian EvalT;
246 
247  std::vector<Teuchos::RCP<const UniqueGlobalIndexer<LO,int> > > indexers_;
248 
249  std::vector<int> indexerIds_; // block index
250  std::vector<int> subFieldIds_; // sub field numbers
251 
252  std::vector< PHX::MDField<ScalarT,Cell,NODE> > gatherFields_;
253 
254  std::vector<std::string> indexerNames_;
257  std::string sensitivitiesName_; // This sets which gather operations have sensitivities
258  bool applySensitivities_; // This is a local variable that is used by evaluateFields
259  // to turn on/off a certain set of sensitivities
260  std::string globalDataKey_; // what global data does this fill?
261  int gatherSeedIndex_; // what gather seed in the workset to use
262  // if less than zero then use alpha or beta
263  // as appropriate
264 
266 
268 };
269 
270 }
271 
272 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
274 #endif
275 
276 // **************************************************************
277 #endif
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
GatherSolution_BlockedEpetra(const std::vector< Teuchos::RCP< const UniqueGlobalIndexer< LO, int > > > &indexers)
GatherSolution_BlockedEpetra(const std::vector< Teuchos::RCP< const UniqueGlobalIndexer< LO, int > > > &indexers)
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
PHX::MDField< ScalarT > vector
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &vm)
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
Gathers solution values from the Newton solution vector into the nodal fields of the field manager...
std::vector< std::vector< PHX::MDField< const ScalarT, Cell, NODE > > > tangentFields_
#define TEUCHOS_ASSERT(assertion_test)
GatherSolution_BlockedEpetra(const std::vector< Teuchos::RCP< const UniqueGlobalIndexer< LO, int > > > &indexers)
std::vector< std::vector< PHX::MDField< const ScalarT, Cell, NODE > > > tangentFields_
Non-templated empty base class for template managers.