Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_MultiVariateParameter_impl.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_MULTIVARIATE_PARAMETER_IMPL_HPP
12 #define PANZER_MULTIVARIATE_PARAMETER_IMPL_HPP
13 
14 #include "PanzerDiscFE_config.hpp"
17 #include <cstddef>
18 #include <string>
19 #include <vector>
20 #include <sstream>
21 
22 namespace panzer {
23 
24 //**********************************************************************
25 template<typename EvalT, typename TRAITS>
27 MultiVariateParameter(const std::string parameter_name,
28  const int num_param,
29  const std::string field_name,
30  const Teuchos::RCP<PHX::DataLayout>& data_layout,
31  panzer::ParamLib& param_lib)
32 {
33  target_field = PHX::MDField<ScalarT, Cell, Point>(field_name, data_layout);
34  this->addEvaluatedField(target_field);
35 
36  param.resize(num_param);
37  for (int i=0; i<num_param; ++i) {
38  std::stringstream ss;
39  ss << parameter_name << "_" << i;
40  param[i] = panzer::createAndRegisterScalarParameter<EvalT>(
41  ss.str(),param_lib);
42  }
43 
44  // no initialization, this will be done by someone else (possibly the ME) later
45 
46  std::string n = "Multi-variate Parameter Evaluator";
47  this->setName(n);
48 }
49 
50 //**********************************************************************
51 template<typename EvalT, typename TRAITS>
53 evaluateFields(typename TRAITS::EvalData workset)
54 {
55  ScalarT sum = 0;
56  const int num_param = param.size();
57  for (int i=0; i<num_param; ++i)
58  sum += param[i]->getValue();
59 
60  for (index_t cell = 0; cell < workset.num_cells; ++cell) {
62  pt < target_field.extent(1); ++pt) {
63  target_field(cell,pt) = sum;
64  }
65  }
66 
67 }
68 
69 //**********************************************************************
70 
71 }
72 
73 #endif
void evaluateFields(typename TRAITS::EvalData ud)
MultiVariateParameter(const std::string parameter_name, const int num_param, const std::string field_name, const Teuchos::RCP< PHX::DataLayout > &data_layout, panzer::ParamLib &param_lib)
Sacado::ScalarParameterLibrary< panzer::EvaluationTraits > ParamLib