Panzer  Version of the Day
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>
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>
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>
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
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::ScatterResidual_Tpetra
ScatterResidual_Tpetra(const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &indexer)
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:206
Teuchos_ParameterList.hpp
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::ScatterResidual_Tpetra
ScatterResidual_Tpetra(const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &indexer)
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:97
Panzer_Traits.hpp
panzer::ScatterResidual_Tpetra< panzer::Traits::Tangent, TRAITS, LO, GO, NodeT >
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:146
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::clone
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:110
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::fieldMap_
Teuchos::RCP< const std::map< std::string, std::string > > fieldMap_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:241
panzer::ScatterResidual_Tpetra< panzer::Traits::Tangent, TRAITS, LO, GO, NodeT >::fieldIds_
std::vector< int > fieldIds_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:180
panzer::Traits::Residual::ScalarT
RealType ScalarT
Definition: Panzer_Traits.hpp:103
panzer::ScatterResidual_Tpetra< panzer::Traits::Tangent, TRAITS, LO, GO, NodeT >::globalIndexer_
Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > globalIndexer_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:179
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::globalDataKey_
std::string globalDataKey_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:243
Panzer_TpetraLinearObjContainer.hpp
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::scatterFields_
std::vector< PHX::MDField< const ScalarT, Cell, NODE > > scatterFields_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:230
panzer::UniqueGlobalIndexer
Definition: Panzer_GatherOrientation_decl.hpp:61
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::ScalarT
panzer::Traits::Residual::ScalarT ScalarT
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:114
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::scatterFields_
std::vector< PHX::MDField< const ScalarT, Cell, NODE > > scatterFields_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:120
panzer::ScatterResidual_Tpetra< panzer::Traits::Tangent, TRAITS, LO, GO, NodeT >::clone
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:165
Teuchos::rcp
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::ScalarT
panzer::Traits::Jacobian::ScalarT ScalarT
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:224
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::tpetraContainer_
Teuchos::RCP< const TpetraLinearObjContainer< double, LO, GO, NodeT > > tpetraContainer_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:134
panzer::CloneableEvaluator
Non-templated empty base class for template managers.
Definition: Panzer_CloneableEvaluator.hpp:52
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::fieldMap_
Teuchos::RCP< const std::map< std::string, std::string > > fieldMap_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:131
Teuchos::RCP
Panzer_CloneableEvaluator.hpp
panzer::ScatterResidual_Tpetra< panzer::Traits::Tangent, TRAITS, LO, GO, NodeT >::ScalarT
panzer::Traits::Tangent::ScalarT ScalarT
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:169
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::scatterHolder_
Teuchos::RCP< PHX::FieldTag > scatterHolder_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:227
Panzer_Evaluator_WithBaseImpl.hpp
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::tpetraContainer_
Teuchos::RCP< const TpetraLinearObjContainer< double, LO, GO, NodeT > > tpetraContainer_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:244
panzer::Traits::Tangent
Definition: Panzer_Traits.hpp:105
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::fieldIds_
std::vector< int > fieldIds_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:125
panzer::Traits::Jacobian
Definition: Panzer_Traits.hpp:104
panzer::ScatterResidual_Tpetra< panzer::Traits::Tangent, TRAITS, LO, GO, NodeT >::globalDataKey_
std::string globalDataKey_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:188
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::globalIndexer_
Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > globalIndexer_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:124
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:91
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::scratch_offsets_
std::vector< Kokkos::View< int *, PHX::Device > > scratch_offsets_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:137
panzer::Traits::Tangent::ScalarT
FadType ScalarT
Definition: Panzer_Traits.hpp:105
Panzer_NodeType.hpp
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::scatterHolder_
Teuchos::RCP< PHX::FieldTag > scatterHolder_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:117
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::clone
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:219
panzer::ScatterResidual_Tpetra
Pushes residual values into the residual vector for a Newton-based solve.
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:78
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::scratch_lids_
Kokkos::View< int **, PHX::Device > scratch_lids_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:248
panzer::ScatterResidual_Tpetra< panzer::Traits::Tangent, TRAITS, LO, GO, NodeT >::scatterHolder_
Teuchos::RCP< PHX::FieldTag > scatterHolder_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:172
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::globalDataKey_
std::string globalDataKey_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:133
panzer::ScatterResidual_Tpetra< panzer::Traits::Residual, TRAITS, LO, GO, NodeT >::scratch_lids_
Kokkos::View< int **, PHX::Device > scratch_lids_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:136
panzer::EvaluatorWithBaseImpl
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
Definition: Panzer_Evaluator_WithBaseImpl.hpp:54
panzer
Definition: Panzer_BasisValues_Evaluator_decl.hpp:54
Panzer_ScatterResidual_Tpetra_Hessian.hpp
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::globalIndexer_
Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > globalIndexer_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:234
Teuchos::ParameterList
panzer::ScatterResidual_Tpetra< panzer::Traits::Tangent, TRAITS, LO, GO, NodeT >::dfdp_vectors_
std::vector< Teuchos::ArrayRCP< double > > dfdp_vectors_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:190
PHX::FieldManager
Definition: Panzer_BCStrategy_Base.hpp:53
panzer::Traits::Jacobian::ScalarT
FadType ScalarT
Definition: Panzer_Traits.hpp:104
panzer::Traits::Residual
Definition: Panzer_Traits.hpp:103
panzer::ScatterResidual_Tpetra< panzer::Traits::Tangent, TRAITS, LO, GO, NodeT >::scatterFields_
std::vector< PHX::MDField< const ScalarT, Cell, NODE > > scatterFields_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:175
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::scratch_offsets_
std::vector< Kokkos::View< int *, PHX::Device > > scratch_offsets_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:249
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >::fieldIds_
std::vector< int > fieldIds_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:235
Panzer_Dimension.hpp
panzer::ScatterResidual_Tpetra< panzer::Traits::Jacobian, TRAITS, LO, GO, NodeT >
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:199
panzer::ScatterResidual_Tpetra< panzer::Traits::Tangent, TRAITS, LO, GO, NodeT >::fieldMap_
Teuchos::RCP< const std::map< std::string, std::string > > fieldMap_
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:186
panzer::ScatterResidual_Tpetra< panzer::Traits::Tangent, TRAITS, LO, GO, NodeT >::ScatterResidual_Tpetra
ScatterResidual_Tpetra(const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &indexer)
Definition: Panzer_ScatterResidual_Tpetra_decl.hpp:152