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
166 std::vector<Teuchos::RCP<typename TpetraLinearObjContainer<double,LO,GO,NodeT>::MultiVectorType> > dfdpVectors_;
167
168 PHX::View<int**> scratch_lids_;
169 std::vector<PHX::View<int*> > scratch_offsets_;
170
172};
173
174// **************************************************************
175// Jacobian
176// **************************************************************
177template<typename TRAITS,typename LO,typename GO,typename NodeT>
179 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
180 public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
182
183public:
184
185 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer)
186 : globalIndexer_(indexer) {}
187
188 ScatterResidual_Tpetra(const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
189 const Teuchos::ParameterList& pl);
190
191 void postRegistrationSetup(typename TRAITS::SetupData d,
193
194 void preEvaluate(typename TRAITS::PreEvalData d);
195
196 void evaluateFields(typename TRAITS::EvalData workset);
197
198 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
199 { return Teuchos::rcp(new ScatterResidual_Tpetra<panzer::Traits::Jacobian,TRAITS,LO,GO,NodeT>(globalIndexer_,pl)); }
200
201private:
202
204
205 // dummy field so that the evaluator will have something to do
206 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
207
208 // fields that need to be scattered will be put in this vector
209 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
210
211 // maps the local (field,element,basis) triplet to a global ID
212 // for scattering
213 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
214 std::vector<int> fieldIds_; // field IDs needing mapping
215
216 // This maps the scattered field names to the DOF manager field
217 // For instance a Navier-Stokes map might look like
218 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
219 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
220 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
221
222 std::string globalDataKey_; // what global data does this fill?
223 Teuchos::RCP<const TpetraLinearObjContainer<double,LO,GO,NodeT> > tpetraContainer_;
224
226
227 Kokkos::View<LO**, Kokkos::LayoutRight, PHX::Device> scratch_lids_;
228 Kokkos::View<typename Sacado::ScalarType<ScalarT>::type**, Kokkos::LayoutRight, PHX::Device> scratch_vals_;
229 std::vector<PHX::View<int*> > scratch_offsets_;
230
233};
234
235}
236
237// optionally include hessian support
238#ifdef Panzer_BUILD_HESSIAN_SUPPORT
240#endif
241
242// **************************************************************
243#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
std::vector< Teuchos::RCP< typename TpetraLinearObjContainer< double, LO, GO, NodeT >::MultiVectorType > > dfdpVectors_
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.
Evaluation type for computing the residual and its Jacobian, using FadType as the scalar type.
Evaluation type for computing the residual only, using RealType as the scalar type.
Evaluation type for computing directional derivatives (e.g. parameter sensitivities),...
double RealType
Scalar type used for the Residual evaluation type (plain double).