Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_VectorToScalar_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_VECTOR_TO_SCALAR_DECL_HPP
12 #define PANZER_EVALUATOR_VECTOR_TO_SCALAR_DECL_HPP
13 
14 #include <vector>
15 #include <string>
16 #include "Phalanx_Evaluator_Macros.hpp"
17 #include "Phalanx_MDField.hpp"
19 
20 namespace panzer {
21 
22 template<typename EvalT, typename Traits>
24  :
25  public panzer::EvaluatorWithBaseImpl<Traits>,
26  public PHX::EvaluatorDerived<EvalT, Traits>
27 {
28  public:
29 
31  const Teuchos::ParameterList& p);
32 
33  void
35  typename Traits::EvalData d);
36 
37  private:
38 
39  using ScalarT = typename EvalT::ScalarT;
40 
41  std::vector< PHX::MDField<ScalarT,Cell,Point> > scalar_fields;
43 
44 public:
45 
49  VectorToScalar(const PHX::FieldTag & input,
50  const std::vector<PHX::Tag<ScalarT>> & output);
51 
52 }; // end of class VectorToScalar
53 
54 
67 template <typename EvalT,typename Traits>
69  const std::string & scalarPrefix,
70  const std::vector<std::string> & postfix,
71  const Teuchos::RCP<const PHX::DataLayout> & vectorLayout,
72  const Teuchos::RCP<const PHX::DataLayout> & scalarLayout)
73 {
74  using Teuchos::RCP;
75  using Teuchos::rcp;
76  using Teuchos::rcp_const_cast;
77 
78  RCP<std::vector<std::string> > scalarNames = rcp(new std::vector<std::string>);
79  for(std::size_t i=0;i<postfix.size();i++)
80  scalarNames->push_back(scalarPrefix+postfix[i]);
81 
83  input.set("Vector Name",vectorName);
84  input.set("Scalar Names",scalarNames.getConst());
85  input.set("Data Layout Vector",rcp_const_cast<PHX::DataLayout>(vectorLayout));
86  input.set("Data Layout Scalar",rcp_const_cast<PHX::DataLayout>(scalarLayout));
87 
88  return rcp(new VectorToScalar<EvalT,Traits>(input));
89 }
90 
102 template <typename EvalT,typename Traits>
104  const std::vector<std::string> & postfix,
105  const Teuchos::RCP<const PHX::DataLayout> & vectorLayout,
106  const Teuchos::RCP<const PHX::DataLayout> & scalarLayout)
107 {
108  return vectorToScalarEvaluator<EvalT,Traits>(vectorName,vectorName,postfix,vectorLayout,scalarLayout);
109 }
110 
111 }
112 
113 #endif
RCP< const T > getConst() const
PHX::MDField< const ScalarT, Cell, Point, Dim > vector_field
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Teuchos::RCP< PHX::Evaluator< Traits > > vectorToScalarEvaluator(const std::string &vectorName, const std::string &scalarPrefix, const std::vector< std::string > &postfix, const Teuchos::RCP< const PHX::DataLayout > &vectorLayout, const Teuchos::RCP< const PHX::DataLayout > &scalarLayout)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
std::vector< PHX::MDField< ScalarT, Cell, Point > > scalar_fields
VectorToScalar(const Teuchos::ParameterList &p)
void evaluateFields(typename Traits::EvalData d)
typename EvalT::ScalarT ScalarT