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 template <typename LocalOrdinalT,typename GlobalOrdinalT>
67 class UniqueGlobalIndexer;
68 
77 template<typename EvalT, typename Traits,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
79 
80 // **************************************************************
81 // **************************************************************
82 // * Specializations
83 // **************************************************************
84 // **************************************************************
85 
86 
87 // **************************************************************
88 // Residual
89 // **************************************************************
90 template<typename TRAITS,typename LO,typename GO,typename NodeT>
91 class ScatterResidual_Tpetra<panzer::Traits::Residual,TRAITS,LO,GO,NodeT>
92  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
93  public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
95 
96 public:
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 workset);
109 
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::string globalDataKey_; // what global data does this fill?
135 
136  Kokkos::View<int**,PHX::Device> scratch_lids_;
137  std::vector<Kokkos::View<int*,PHX::Device> > scratch_offsets_;
138 
140 };
141 
142 // **************************************************************
143 // Tangent
144 // **************************************************************
145 template<typename TRAITS,typename LO,typename GO,typename NodeT>
146 class ScatterResidual_Tpetra<panzer::Traits::Tangent,TRAITS,LO,GO,NodeT>
147  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
148  public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
150 
151 public:
153  : globalIndexer_(indexer) {}
154 
156  const Teuchos::ParameterList& p);
157 
158  void postRegistrationSetup(typename TRAITS::SetupData d,
160 
161  void preEvaluate(typename TRAITS::PreEvalData d);
162 
163  void evaluateFields(typename TRAITS::EvalData workset);
164 
167 
168 private:
170 
171  // dummy field so that the evaluator will have something to do
173 
174  // fields that need to be scattered will be put in this vector
175  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
176 
177  // maps the local (field,element,basis) triplet to a global ID
178  // for scattering
180  std::vector<int> fieldIds_; // field IDs needing mapping
181 
182  // This maps the scattered field names to the DOF manager field
183  // For instance a Navier-Stokes map might look like
184  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
185  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
187 
188  std::string globalDataKey_; // what global data does this fill?
189 
190  std::vector< Teuchos::ArrayRCP<double> > dfdp_vectors_;
191 
193 };
194 
195 // **************************************************************
196 // Jacobian
197 // **************************************************************
198 template<typename TRAITS,typename LO,typename GO,typename NodeT>
199 class ScatterResidual_Tpetra<panzer::Traits::Jacobian,TRAITS,LO,GO,NodeT>
200  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
201  public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
203 
204 public:
205 
207  : globalIndexer_(indexer) {}
208 
210  const Teuchos::ParameterList& pl);
211 
212  void postRegistrationSetup(typename TRAITS::SetupData d,
214 
215  void preEvaluate(typename TRAITS::PreEvalData d);
216 
217  void evaluateFields(typename TRAITS::EvalData workset);
218 
221 
222 private:
223 
225 
226  // dummy field so that the evaluator will have something to do
228 
229  // fields that need to be scattered will be put in this vector
230  std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
231 
232  // maps the local (field,element,basis) triplet to a global ID
233  // for scattering
235  std::vector<int> fieldIds_; // field IDs needing mapping
236 
237  // This maps the scattered field names to the DOF manager field
238  // For instance a Navier-Stokes map might look like
239  // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
240  // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
242 
243  std::string globalDataKey_; // what global data does this fill?
245 
247 
248  Kokkos::View<int**,PHX::Device> scratch_lids_;
249  std::vector<Kokkos::View<int*,PHX::Device> > scratch_offsets_;
250 };
251 
252 }
253 
254 // optionally include hessian support
255 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
257 #endif
258 
259 // **************************************************************
260 #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)
ScatterResidual_Tpetra(const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &indexer)
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
ScatterResidual_Tpetra(const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &indexer)
Pushes residual values into the residual vector for a Newton-based solve.
ScatterResidual_Tpetra(const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &indexer)
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_