43#ifndef PANZER_STK_SCATTER_VECTOR_FIELDS_IMPL_HPP
44#define PANZER_STK_SCATTER_VECTOR_FIELDS_IMPL_HPP
46#include "Teuchos_Assert.hpp"
48#include "Phalanx_config.hpp"
49#include "Phalanx_Evaluator_Macros.hpp"
50#include "Phalanx_MDField.hpp"
51#include "Phalanx_DataLayout.hpp"
52#include "Phalanx_DataLayout_MDALayout.hpp"
57#include "Teuchos_FancyOStream.hpp"
61template<
typename EvalT,
typename Traits>
64 const Teuchos::ParameterList& p) :
67 TEUCHOS_ASSERT(
false);
70template <
typename EvalT,
typename TraitsT>
73 const Teuchos::RCP<STK_Interface> mesh,
74 const Teuchos::RCP<const panzer::PointRule> & pointRule,
75 const std::vector<std::string> & names,
76 const std::vector<double> & scaling)
87 TEUCHOS_ASSERT(pointRule->num_points==1);
92 for (std::size_t fd = 0; fd < names.size(); ++fd) {
94 PHX::MDField<const ScalarT,Cell,IP,Dim>(
names_[fd]+
"_"+pointRule->getName(),pointRule->dl_vector);
99 PHX::Tag<ScalarT> scatterHolder(scatterName,Teuchos::rcp(
new PHX::MDALayout<panzer::Dummy>(0)));
100 this->addEvaluatedField(scatterHolder);
102 this->setName(scatterName+
": STK-Scatter Vector Fields");
105template<
typename EvalT,
typename Traits>
109 typename Traits::EvalData )
111 TEUCHOS_ASSERT(
false);
120 std::vector<std::string> dimStrings(3);
126 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
127 std::string blockId = this->wda(workset).block_id;
129 for(
int d=0;d<spatialDimension_;d++) {
130 for(std::size_t fieldIndex=0; fieldIndex<scatterFields_.size();fieldIndex++) {
131 PHX::MDField<const ScalarT,panzer::Cell,panzer::IP,panzer::Dim> &
field = scatterFields_[fieldIndex];
132 std::string fieldName = names_[fieldIndex]+dimStrings[d];
134 PHX::MDField<double,panzer::Cell,panzer::NODE> cellValue
138 double scaling = (scaling_.size()>0) ? scaling_[fieldIndex] : 1.0;
140 auto cellValue_v = cellValue.get_static_view();
141 auto field_v =
field.get_static_view();
142 Kokkos::parallel_for(field_v.extent(0), KOKKOS_LAMBDA (
int i) {
143 cellValue_v(i,0) = field_v(i,0,d);
148 mesh_->setCellFieldData(fieldName,blockId,localCellIds,cellValue.get_view(),scaling);
PHX::MDField< ScalarT, panzer::Cell, panzer::BASIS > field
A field to which we'll contribute, or in which we'll store, the result of computing this integral.
PHX::MDField< Scalar, T0 > buildStaticArray(const std::string &str, int d0) const
std::vector< std::string > names_
ScatterVectorFields(const Teuchos::ParameterList &p)
std::vector< PHX::MDField< const ScalarT, panzer::Cell, panzer::IP, panzer::Dim > > scatterFields_
void evaluateFields(typename Traits::EvalData d)