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// Panzer: A partial differential equation assembly
4// engine for strongly coupled complex multiphysics systems
5//
6// Copyright 2011 NTESS and the Panzer contributors.
7// SPDX-License-Identifier: BSD-3-Clause
8// *****************************************************************************
9// @HEADER
10
11#ifndef PANZER_EVALUATOR_SCATTER_RESIDUAL_TPETRA_DECL_HPP
12#define PANZER_EVALUATOR_SCATTER_RESIDUAL_TPETRA_DECL_HPP
13
14#include "Phalanx_config.hpp"
15#include "Phalanx_Evaluator_Macros.hpp"
16#include "Phalanx_MDField.hpp"
17#include "Phalanx_KokkosViewOfViews.hpp"
18
19#include "Teuchos_ParameterList.hpp"
20
21#include "PanzerDiscFE_config.hpp"
22#include "Panzer_Dimension.hpp"
23#include "Panzer_Traits.hpp"
26
27#include "Panzer_NodeType.hpp"
28
30
32
33namespace panzer {
34
35class GlobalIndexer;
36
45template<typename EvalT, typename Traits,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
47
48// **************************************************************
49// **************************************************************
50// * Specializations
51// **************************************************************
52// **************************************************************
53
54
55// **************************************************************
56// Residual
57// **************************************************************
58template<typename TRAITS,typename LO,typename GO,typename NodeT>
60 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
61 public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
63
64public:
65 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer)
66 : globalIndexer_(indexer) {}
67
68 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
69 const Teuchos::ParameterList& p);
70
71 void postRegistrationSetup(typename TRAITS::SetupData d,
73
74 void preEvaluate(typename TRAITS::PreEvalData d);
75
76 void evaluateFields(typename TRAITS::EvalData workset);
77
78 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
79 { return Teuchos::rcp(new ScatterResidual_Tpetra<panzer::Traits::Residual,TRAITS,LO,GO,NodeT>(globalIndexer_,pl)); }
80
81private:
83
84 // dummy field so that the evaluator will have something to do
85 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
86
87 // fields that need to be scattered will be put in this vector
88 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
89
90 // maps the local (field,element,basis) triplet to a global ID
91 // for scattering
92 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
93 std::vector<int> fieldIds_; // field IDs needing mapping
94
95 // This maps the scattered field names to the DOF manager field
96 // For instance a Navier-Stokes map might look like
97 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
98 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
99 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
100
101 std::string globalDataKey_; // what global data does this fill?
102 Teuchos::RCP<const TpetraLinearObjContainer<double,LO,GO,NodeT> > tpetraContainer_;
103
104 PHX::View<int**> scratch_lids_;
105 std::vector<PHX::View<int*> > scratch_offsets_;
106
108};
109
110// **************************************************************
111// Tangent
112// **************************************************************
113template<typename TRAITS,typename LO,typename GO,typename NodeT>
115 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
116 public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
118
119public:
120 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer)
121 : globalIndexer_(indexer) {}
122
123 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
124 const Teuchos::ParameterList& p);
125
126 void postRegistrationSetup(typename TRAITS::SetupData d,
128
129 void preEvaluate(typename TRAITS::PreEvalData d);
130
131 void evaluateFields(typename TRAITS::EvalData workset);
132
133 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
134 { return Teuchos::rcp(new ScatterResidual_Tpetra<panzer::Traits::Tangent,TRAITS,LO,GO,NodeT>(globalIndexer_,pl)); }
135
136private:
139
140 // dummy field so that the evaluator will have something to do
141 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
142
143 // fields that need to be scattered will be put in this vector
144 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
145
146 // maps the local (field,element,basis) triplet to a global ID
147 // for scattering
148 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
149 std::vector<int> fieldIds_; // field IDs needing mapping
150
151 // This maps the scattered field names to the DOF manager field
152 // For instance a Navier-Stokes map might look like
153 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
154 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
155 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
156
157 std::string globalDataKey_; // what global data does this fill?
158 Teuchos::RCP<const TpetraLinearObjContainer<double,LO,GO,NodeT> > tpetraContainer_;
159
161 PHX::ViewOfViews<1,Kokkos::View<RealT**,Kokkos::LayoutLeft,PHX::Device>> dfdpFieldsVoV_;
162
163 PHX::View<int**> scratch_lids_;
164 std::vector<PHX::View<int*> > scratch_offsets_;
165
167};
168
169// **************************************************************
170// Jacobian
171// **************************************************************
172template<typename TRAITS,typename LO,typename GO,typename NodeT>
174 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
175 public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
177
178public:
179
180 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer)
181 : globalIndexer_(indexer) {}
182
183 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
184 const Teuchos::ParameterList& pl);
185
186 void postRegistrationSetup(typename TRAITS::SetupData d,
188
189 void preEvaluate(typename TRAITS::PreEvalData d);
190
191 void evaluateFields(typename TRAITS::EvalData workset);
192
193 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
194 { return Teuchos::rcp(new ScatterResidual_Tpetra<panzer::Traits::Jacobian,TRAITS,LO,GO,NodeT>(globalIndexer_,pl)); }
195
196private:
197
199
200 // dummy field so that the evaluator will have something to do
201 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
202
203 // fields that need to be scattered will be put in this vector
204 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
205
206 // maps the local (field,element,basis) triplet to a global ID
207 // for scattering
208 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
209 std::vector<int> fieldIds_; // field IDs needing mapping
210
211 // This maps the scattered field names to the DOF manager field
212 // For instance a Navier-Stokes map might look like
213 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
214 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
215 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
216
217 std::string globalDataKey_; // what global data does this fill?
218 Teuchos::RCP<const TpetraLinearObjContainer<double,LO,GO,NodeT> > tpetraContainer_;
219
221
222 Kokkos::View<LO**, Kokkos::LayoutRight, PHX::Device> scratch_lids_;
223 Kokkos::View<typename Sacado::ScalarType<ScalarT>::type**, Kokkos::LayoutRight, PHX::Device> scratch_vals_;
224 std::vector<PHX::View<int*> > scratch_offsets_;
225
228};
229
230}
231
232// optionally include hessian support
233#ifdef Panzer_BUILD_HESSIAN_SUPPORT
235#endif
236
237// **************************************************************
238#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_
Teuchos::RCP< const TpetraLinearObjContainer< double, LO, GO, NodeT > > tpetraContainer_
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
PHX::ViewOfViews< 1, Kokkos::View< RealT **, Kokkos::LayoutLeft, PHX::Device > > dfdpFieldsVoV_
Storage for the tangent data.
Pushes residual values into the residual vector for a Newton-based solve.