Panzer Version of the Day
Loading...
Searching...
No Matches
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
50#include "Teuchos_ParameterList.hpp"
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
64namespace panzer {
65
66class GlobalIndexer;
67
76template<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// **************************************************************
89template<typename TRAITS,typename LO,typename GO,typename NodeT>
91 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
92 public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
94
95public:
96 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer)
97 : globalIndexer_(indexer) {}
98
99 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
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
109 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
110 { return Teuchos::rcp(new ScatterResidual_Tpetra<panzer::Traits::Residual,TRAITS,LO,GO,NodeT>(globalIndexer_,pl)); }
111
112private:
114
115 // dummy field so that the evaluator will have something to do
116 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
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
123 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
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"
130 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
131
132 std::string globalDataKey_; // what global data does this fill?
133 Teuchos::RCP<const TpetraLinearObjContainer<double,LO,GO,NodeT> > tpetraContainer_;
134
135 PHX::View<int**> scratch_lids_;
136 std::vector<PHX::View<int*> > scratch_offsets_;
137
139};
140
141// **************************************************************
142// Tangent
143// **************************************************************
144template<typename TRAITS,typename LO,typename GO,typename NodeT>
146 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
147 public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
149
150public:
151 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer)
152 : globalIndexer_(indexer) {}
153
154 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
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
164 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
165 { return Teuchos::rcp(new ScatterResidual_Tpetra<panzer::Traits::Tangent,TRAITS,LO,GO,NodeT>(globalIndexer_,pl)); }
166
167private:
169
170 // dummy field so that the evaluator will have something to do
171 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
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
178 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
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"
185 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
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// **************************************************************
197template<typename TRAITS,typename LO,typename GO,typename NodeT>
199 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
200 public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
202
203public:
204
205 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer)
206 : globalIndexer_(indexer) {}
207
208 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
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
218 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
219 { return Teuchos::rcp(new ScatterResidual_Tpetra<panzer::Traits::Jacobian,TRAITS,LO,GO,NodeT>(globalIndexer_,pl)); }
220
221private:
222
224
225 // dummy field so that the evaluator will have something to do
226 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
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
233 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
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"
240 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
241
242 std::string globalDataKey_; // what global data does this fill?
243 Teuchos::RCP<const TpetraLinearObjContainer<double,LO,GO,NodeT> > tpetraContainer_;
244
246
247 Kokkos::View<LO**, Kokkos::LayoutRight, PHX::Device> scratch_lids_;
248 Kokkos::View<typename Sacado::ScalarType<ScalarT>::type**, Kokkos::LayoutRight, PHX::Device> scratch_vals_;
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
Non-templated empty base class for template managers.
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
Teuchos::RCP< const TpetraLinearObjContainer< double, LO, GO, NodeT > > tpetraContainer_
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Kokkos::View< typename Sacado::ScalarType< ScalarT >::type **, Kokkos::LayoutRight, PHX::Device > scratch_vals_
ScatterResidual_Tpetra(const Teuchos::RCP< const panzer::GlobalIndexer > &indexer, const Teuchos::ParameterList &pl)
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Teuchos::RCP< const TpetraLinearObjContainer< double, LO, GO, NodeT > > tpetraContainer_
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Pushes residual values into the residual vector for a Newton-based solve.