Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ConstantFlux_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_CONSTANT_FLUX_IMPL_HPP
12 #define PANZER_CONSTANT_FLUX_IMPL_HPP
13 
14 namespace panzer {
15 
16 //**********************************************************************
17 template<typename EvalT, typename Traits>
20  const Teuchos::ParameterList& p) :
21  flux( p.get<std::string>("Flux Field Name"),
22  p.get< Teuchos::RCP<PHX::DataLayout> >("Data Layout") )
23 {
24  const Teuchos::ParameterList& flux_values = p.sublist("Flux Values");
25 
26  for (Teuchos::ParameterList::ConstIterator i = flux_values.begin(); i != flux_values.end(); ++i)
27  values.push_back(Teuchos::getValue<double>(i->second));
28 
29  this->addEvaluatedField(flux);
30 
31  std::string n = "ConstantFlux: " + flux.fieldTag().name();
32  this->setName(n);
33 }
34 
35 //**********************************************************************
36 template<typename EvalT, typename Traits>
37 void
40  typename Traits::SetupData /* worksets */,
42 {
43  using namespace PHX;
44  this->utils.setFieldData(flux,fm);
45 
46  TEUCHOS_ASSERT(static_cast<std::size_t>(flux.extent(2)) == values.size());
47 
48  auto flux_v = flux.get_static_view();
49 
50  for (int dim = 0; dim < flux_v.extent_int(2); ++dim) {
51  auto val = values[dim];
52  Kokkos::parallel_for ("ConstantFlux", flux.extent_int(0), KOKKOS_LAMBDA( const int cell) {
53  for (int ip = 0; ip < flux_v.extent_int(1); ++ip)
54  flux_v(cell,ip,dim) = val;
55  });
56  }
57  Kokkos::fence();
58 }
59 
60 //**********************************************************************
61 template<typename EvalT, typename Traits>
62 void
65  typename Traits::EvalData /* d */)
66 { }
67 
68 //**********************************************************************
69 
70 }
71 
72 #endif
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
std::vector< ScalarT > values
ConstIterator end() const
ConstantFlux(const Teuchos::ParameterList &p)
params_t::ConstIterator ConstIterator
ConstIterator begin() const
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
#define TEUCHOS_ASSERT(assertion_test)
PHX::MDField< ScalarT > flux
void evaluateFields(typename Traits::EvalData d)