Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ReorderADValues_Evaluator_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_ReorderADValues_Evaluator_decl_hpp__
12 #define __Panzer_ReorderADValues_Evaluator_decl_hpp__
13 
14 #include "Phalanx_config.hpp"
15 #include "Phalanx_Evaluator_Macros.hpp"
16 #include "Phalanx_MDField.hpp"
17 
19 
20 #include "PanzerDiscFE_config.hpp"
21 #include "Panzer_Dimension.hpp"
22 #include "Panzer_Traits.hpp"
24 
26 
27 namespace panzer {
28 
29 class GlobalIndexer;
30 
37 template<typename EvalT, typename TRAITS>
39  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
40  public PHX::EvaluatorDerived<EvalT, TRAITS> {
41 public:
42  typedef typename EvalT::ScalarT ScalarT;
43 
44  ReorderADValues_Evaluator(const std::string & outPrefix,
45  const std::vector<std::string> & inFieldNames,
46  const std::vector<Teuchos::RCP<PHX::DataLayout> > & fieldLayouts,
47  const std::string & elementBlock,
48  const GlobalIndexer & indexerSrc,
49  const GlobalIndexer & indexerDest);
50 
51  ReorderADValues_Evaluator(const std::string & outPrefix,
52  const std::vector<std::string> & inFieldNames,
53  const std::vector<std::string> & inDOFs,
54  const std::vector<std::string> & outDOFs,
55  const std::vector<Teuchos::RCP<PHX::DataLayout> > & fieldLayouts,
56  const std::string & elementBlock,
57  const GlobalIndexer & indexerSrc,
58  const GlobalIndexer & indexerDest);
59 
60  void evaluateFields(typename TRAITS::EvalData d);
61 
62 private:
63  // fields to be modified
64  std::vector< PHX::MDField<const ScalarT> > inFields_;
65 
66  // fields that need to be modified
67  std::vector< PHX::MDField<ScalarT> > outFields_;
68 };
69 
70 // **************************************************************
71 // **************************************************************
72 // * Specializations
73 // **************************************************************
74 // **************************************************************
75 
76 
77 // **************************************************************
78 // Jacobian
79 // **************************************************************
80 template<typename TRAITS>
81 class ReorderADValues_Evaluator<typename TRAITS::Jacobian,TRAITS>
82  : public panzer::EvaluatorWithBaseImpl<TRAITS>,
83  public PHX::EvaluatorDerived<typename TRAITS::Jacobian, TRAITS> {
84 
85 public:
86 
87  ReorderADValues_Evaluator(const std::string & outPrefix,
88  const std::vector<std::string> & inFieldNames,
89  const std::vector<Teuchos::RCP<PHX::DataLayout> > & fieldLayouts,
90  const std::string & elementBlock,
91  const GlobalIndexer & indexerSrc,
92  const GlobalIndexer & indexerDest);
93 
94  ReorderADValues_Evaluator(const std::string & outPrefix,
95  const std::vector<std::string> & inFieldNames,
96  const std::vector<std::string> & inDOFs,
97  const std::vector<std::string> & outDOFs,
98  const std::vector<Teuchos::RCP<PHX::DataLayout> > & fieldLayouts,
99  const std::string & elementBlock,
100  const GlobalIndexer & indexerSrc,
101  const GlobalIndexer & indexerDest);
102 
103  void evaluateFields(typename TRAITS::EvalData workset);
104 
105 private:
106  typedef typename TRAITS::Jacobian::ScalarT ScalarT;
107 
108  void buildSrcToDestMap(const std::string & elementBlock,
109  const GlobalIndexer & indexerSrc,
110  const GlobalIndexer & indexerDest);
111 
112  // Build a source to destination map using all the pairs
113  // of field numers in the <code>fieldNumberMaps</code>
114  void buildSrcToDestMap(const std::string & elementBlock,
115  const std::map<int,int> & fieldNumberMaps,
116  const GlobalIndexer & indexerSrc,
117  const GlobalIndexer & indexerDest);
118 
119  // fields to be modified
120  std::vector< PHX::MDField<const ScalarT> > inFields_;
121 
122  // fields that need to be modified
123  std::vector< PHX::MDField<ScalarT> > outFields_;
124 
125  // This allows indexing into a destination sized vector and
126  // maps to a source vector. If a value is less then 0
127  // then that implies that value is not mapped. That is a strange
128  // case but this structure supports it
130 
133 };
134 
135 }
136 
137 // **************************************************************
138 #endif
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
std::vector< PHX::MDField< ScalarT > > outFields_
std::vector< PHX::MDField< const ScalarT > > inFields_
Reorders the ad values of a specified field to match a different unique global indexer.
ReorderADValues_Evaluator(const std::string &outPrefix, const std::vector< std::string > &inFieldNames, const std::vector< Teuchos::RCP< PHX::DataLayout > > &fieldLayouts, const std::string &elementBlock, const GlobalIndexer &indexerSrc, const GlobalIndexer &indexerDest)