Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ScatterResidual_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_SCATTER_RESIDUAL_BLOCKEDEPETRA_DECL_HPP
44 #define PANZER_EVALUATOR_SCATTER_RESIDUAL_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"
57 
59 
60 namespace Thyra {
61  template <typename> class ProductVectorBase;
62  template <typename> class BlockedLinearOpBase;
63 }
64 
65 namespace panzer {
66 
67 class GlobalIndexer;
68 
73 template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterResidual_BlockedEpetra
74  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
75  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
77 public:
78  typedef typename EvalT::ScalarT ScalarT;
79 
81 
84 
85  void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager<TRAITS>& vm)
86  { }
87  void evaluateFields(typename TRAITS::EvalData d)
88  { std::cout << "unspecialized version of \"ScatterResidual_BlockedEpetra::evaluateFields\" on "+PHX::print<EvalT>()+" \" should not be used!" << std::endl;
89  TEUCHOS_ASSERT(false); }
90 };
91 
92 // **************************************************************
93 // **************************************************************
94 // * Specializations
95 // **************************************************************
96 // **************************************************************
97 
98 
99 // **************************************************************
100 // Residual
101 // **************************************************************
102 template<typename TRAITS,typename LO,typename GO>
104  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
105  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
107 
108 public:
109 
111  const std::vector<Teuchos::RCP<const GlobalIndexer> > & /* cIndexers */,
112  bool /* useDiscreteAdjoint=false */)
113  : rowIndexers_(rIndexers) {}
114 
116  const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
117  const Teuchos::ParameterList& p,
118  bool useDiscreteAdjoint=false);
119 
120  void postRegistrationSetup(typename TRAITS::SetupData d,
122 
123  void preEvaluate(typename TRAITS::PreEvalData d);
124 
125  void evaluateFields(typename TRAITS::EvalData workset);
126 
128  { return Teuchos::rcp(new ScatterResidual_BlockedEpetra<panzer::Traits::Residual,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl)); }
129 
130 private:
132 
133  // dummy field so that the evaluator will have something to do
135 
136  // fields that need to be scattered will be put in this vector
137  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
138 
139  std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
140  std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
141 
142  std::vector<int> indexerIds_; // block index
143  std::vector<int> subFieldIds_; // sub field numbers
144 
145  // This maps the scattered field names to the DOF manager field
146  // For instance a Navier-Stokes map might look like
147  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
148  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
150 
151  std::string globalDataKey_; // what global data does this fill?
152 
154 
156 };
157 
158 // **************************************************************
159 // Tangent
160 // **************************************************************
161 template<typename TRAITS,typename LO,typename GO>
163  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
164  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
166 
167 public:
168 
170  const std::vector<Teuchos::RCP<const GlobalIndexer> > & /* cIndexers */,
171  bool /* useDiscreteAdjoint=false */)
172  : rowIndexers_(rIndexers) {}
173 
175  const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
176  const Teuchos::ParameterList& p,
177  bool useDiscreteAdjoint=false);
178 
179  void postRegistrationSetup(typename TRAITS::SetupData d,
181 
182  void preEvaluate(typename TRAITS::PreEvalData d);
183 
184  void evaluateFields(typename TRAITS::EvalData workset);
185 
187  { return Teuchos::rcp(new ScatterResidual_BlockedEpetra<panzer::Traits::Tangent,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl)); }
188 
189 private:
191 
192  // dummy field so that the evaluator will have something to do
194 
195  // fields that need to be scattered will be put in this vector
196  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
197 
198  std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
199  std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
200 
201  std::vector<int> indexerIds_; // block index
202  std::vector<int> subFieldIds_; // sub field numbers
203 
204  // This maps the scattered field names to the DOF manager field
205  // For instance a Navier-Stokes map might look like
206  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
207  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
209 
210  std::string globalDataKey_; // what global data does this fill?
211 
213 
215 };
216 
217 // **************************************************************
218 // Jacobian
219 // **************************************************************
220 
221 template<typename TRAITS,typename LO,typename GO>
223  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
224  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
226 
227 public:
228 
250  const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
251  bool useDiscreteAdjoint=false)
252  : rowIndexers_(rIndexers), colIndexers_(cIndexers), useDiscreteAdjoint_(useDiscreteAdjoint) {}
253 
255  const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
256  const Teuchos::ParameterList& p,
257  bool useDiscreteAdjoint=false);
258 
259  void postRegistrationSetup(typename TRAITS::SetupData d,
261 
262  void preEvaluate(typename TRAITS::PreEvalData d);
263 
264  void evaluateFields(typename TRAITS::EvalData workset);
265 
267  { return Teuchos::rcp(new ScatterResidual_BlockedEpetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl,useDiscreteAdjoint_)); }
268 
269 private:
270 
272 
273  // dummy field so that the evaluator will have something to do
275 
276  // fields that need to be scattered will be put in this vector
277  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
278 
279  std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
280  std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
281 
282  std::vector<int> indexerIds_; // block index
283  std::vector<int> subFieldIds_; // sub field numbers
284 
285  // This maps the scattered field names to the DOF manager field
286  // For instance a Navier-Stokes map might look like
287  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
288  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
290 
291  std::string globalDataKey_; // what global data does this fill?
293 
296 
298 };
299 
300 }
301 
302 // optionally include hessian support
303 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
305 #endif
306 
307 // **************************************************************
308 #endif
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
ScatterResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &cIndexers, bool useDiscreteAdjoint=false)
ScatterResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &, bool)
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.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
ScatterResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &, bool)
virtual void preEvaluate(typename Traits::PreEvalData d)=0
Pushes residual values into the residual vector for a Newton-based solve.
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &vm)
#define TEUCHOS_ASSERT(assertion_test)
Non-templated empty base class for template managers.