Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_TensorToStdVector_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_TENSOR_TO_STD_VECTOR_DECL_HPP
12 #define PANZER_EVALUATOR_TENSOR_TO_STD_VECTOR_DECL_HPP
13 
14 #include <vector>
15 #include <string>
16 
17 #include "Phalanx_Evaluator_Macros.hpp"
18 #include "Phalanx_MDField.hpp"
19 
20 namespace panzer {
21 
32 template<typename EvalT, typename Traits>
34  :
35  public PHX::EvaluatorWithBaseImpl<Traits>,
36  public PHX::EvaluatorDerived<EvalT, Traits>
37 {
38  public:
39 
41  const Teuchos::ParameterList& p);
42 
43  void
45  typename Traits::EvalData d);
46 
47  private:
48 
49  using ScalarT = typename EvalT::ScalarT;
50 
53 
55  std::vector<PHX::MDField<ScalarT,Cell,Point,Dim> > vector_fields;
56 
57 }; // end of class TensorToStdVector
58 
59 
72 template <typename EvalT,typename Traits>
74  const std::string & vectorPrefix,
75  const std::vector<std::string> & postfix,
76  const Teuchos::RCP<const PHX::DataLayout> & tensorLayout,
77  const Teuchos::RCP<const PHX::DataLayout> & vectorLayout)
78 {
79  using Teuchos::RCP;
80  using Teuchos::rcp;
81  using Teuchos::rcp_const_cast;
82 
83  RCP<std::vector<std::string> > vectorNames = rcp(new std::vector<std::string>);
84  for(std::size_t i=0;i<postfix.size();i++)
85  vectorNames->push_back(vectorPrefix+postfix[i]);
86 
88  input.set("Tensor Name", tensorName);
89  input.set("Vector Names", vectorNames.getConst());
90  input.set("Data Layout Tensor",rcp_const_cast<PHX::DataLayout>(tensorLayout));
91  input.set("Data Layout Vector",rcp_const_cast<PHX::DataLayout>(vectorLayout));
92 
93  return rcp(new TensorToStdVector<EvalT,Traits>(input));
94 }
95 
107 template <typename EvalT,typename Traits>
109  const std::vector<std::string> & postfix,
110  const Teuchos::RCP<const PHX::DataLayout> & tensorLayout,
111  const Teuchos::RCP<const PHX::DataLayout> & vectorLayout)
112 {
113  return tensorToStdVectorEvaluator<EvalT,Traits>(tensorName,tensorName,postfix,tensorLayout,vectorLayout);
114 }
115 
116 }
117 
118 #endif
RCP< const T > getConst() const
std::vector< PHX::MDField< ScalarT, Cell, Point, Dim > > vector_fields
Vector (to be filled)
TensorToStdVector(const Teuchos::ParameterList &p)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
PHX::MDField< const ScalarT, Cell, Point, Dim, Dim > tensor_field
Tensor (to be distributed to vector)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< PHX::Evaluator< Traits > > tensorToStdVectorEvaluator(const std::string &tensorName, const std::string &vectorPrefix, const std::vector< std::string > &postfix, const Teuchos::RCP< const PHX::DataLayout > &tensorLayout, const Teuchos::RCP< const PHX::DataLayout > &vectorLayout)
Transform at Tensor to a std::vector of PHX-vectors.
void evaluateFields(typename Traits::EvalData d)