Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ScatterResidual_Tpetra_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_TPETRA_DECL_HPP
44 #define PANZER_EVALUATOR_SCATTER_RESIDUAL_TPETRA_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 
58 #include "Panzer_NodeType.hpp"
59 
61 
63 
64 namespace panzer {
65 
66 class GlobalIndexer;
67 
76 template<typename EvalT, typename Traits,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
78 
79 // **************************************************************
80 // **************************************************************
81 // * Specializations
82 // **************************************************************
83 // **************************************************************
84 
85 
86 // **************************************************************
87 // Residual
88 // **************************************************************
89 template<typename TRAITS,typename LO,typename GO,typename NodeT>
90 class ScatterResidual_Tpetra<panzer::Traits::Residual,TRAITS,LO,GO,NodeT>
91  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
92  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
94 
95 public:
97  : globalIndexer_(indexer) {}
98 
100  const Teuchos::ParameterList& p);
101 
102  void postRegistrationSetup(typename TRAITS::SetupData d,
104 
105  void preEvaluate(typename TRAITS::PreEvalData d);
106 
107  void evaluateFields(typename TRAITS::EvalData workset);
108 
111 
112 private:
114 
115  // dummy field so that the evaluator will have something to do
117 
118  // fields that need to be scattered will be put in this vector
119  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
120 
121  // maps the local (field,element,basis) triplet to a global ID
122  // for scattering
124  std::vector<int> fieldIds_; // field IDs needing mapping
125 
126  // This maps the scattered field names to the DOF manager field
127  // For instance a Navier-Stokes map might look like
128  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
129  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
131 
132  std::string globalDataKey_; // what global data does this fill?
134 
135  PHX::View<int**> scratch_lids_;
136  std::vector<PHX::View<int*> > scratch_offsets_;
137 
139 };
140 
141 // **************************************************************
142 // Tangent
143 // **************************************************************
144 template<typename TRAITS,typename LO,typename GO,typename NodeT>
145 class ScatterResidual_Tpetra<panzer::Traits::Tangent,TRAITS,LO,GO,NodeT>
146  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
147  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
149 
150 public:
152  : globalIndexer_(indexer) {}
153 
155  const Teuchos::ParameterList& p);
156 
157  void postRegistrationSetup(typename TRAITS::SetupData d,
159 
160  void preEvaluate(typename TRAITS::PreEvalData d);
161 
162  void evaluateFields(typename TRAITS::EvalData workset);
163 
166 
167 private:
169 
170  // dummy field so that the evaluator will have something to do
172 
173  // fields that need to be scattered will be put in this vector
174  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
175 
176  // maps the local (field,element,basis) triplet to a global ID
177  // for scattering
179  std::vector<int> fieldIds_; // field IDs needing mapping
180 
181  // This maps the scattered field names to the DOF manager field
182  // For instance a Navier-Stokes map might look like
183  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
184  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
186 
187  std::string globalDataKey_; // what global data does this fill?
188 
189  std::vector< Teuchos::ArrayRCP<double> > dfdp_vectors_;
190 
192 };
193 
194 // **************************************************************
195 // Jacobian
196 // **************************************************************
197 template<typename TRAITS,typename LO,typename GO,typename NodeT>
198 class ScatterResidual_Tpetra<panzer::Traits::Jacobian,TRAITS,LO,GO,NodeT>
199  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
200  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
202 
203 public:
204 
206  : globalIndexer_(indexer) {}
207 
209  const Teuchos::ParameterList& pl);
210 
211  void postRegistrationSetup(typename TRAITS::SetupData d,
213 
214  void preEvaluate(typename TRAITS::PreEvalData d);
215 
216  void evaluateFields(typename TRAITS::EvalData workset);
217 
220 
221 private:
222 
224 
225  // dummy field so that the evaluator will have something to do
227 
228  // fields that need to be scattered will be put in this vector
229  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
230 
231  // maps the local (field,element,basis) triplet to a global ID
232  // for scattering
234  std::vector<int> fieldIds_; // field IDs needing mapping
235 
236  // This maps the scattered field names to the DOF manager field
237  // For instance a Navier-Stokes map might look like
238  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
239  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
241 
242  std::string globalDataKey_; // what global data does this fill?
244 
246 
249  std::vector<PHX::View<int*> > scratch_offsets_;
250 
253 };
254 
255 }
256 
257 // optionally include hessian support
258 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
260 #endif
261 
262 // **************************************************************
263 #endif
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Teuchos::RCP< const TpetraLinearObjContainer< double, LO, GO, NodeT > > tpetraContainer_
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
Kokkos::View< typename Sacado::ScalarType< ScalarT >::type **, Kokkos::LayoutRight, PHX::Device > scratch_vals_
Pushes residual values into the residual vector for a Newton-based solve.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Non-templated empty base class for template managers.
Teuchos::RCP< const TpetraLinearObjContainer< double, LO, GO, NodeT > > tpetraContainer_