33 const Teuchos::ParameterList& p) :
39 std::string scatterName = p.get<std::string>(
"Scatter Name");
42 if (p.isParameter(
"Variable Scale Factors Map"))
43 varScaleFactors_ = p.get<Teuchos::RCP<std::map<std::string,double>>>(
"Variable Scale Factors Map");
45 const std::vector<std::string> & names =
46 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"Field Names"));
48 Teuchos::RCP<panzer::IntegrationRule> intRule =
49 p.get< Teuchos::RCP<panzer::IntegrationRule> >(
"IR");
54 for (std::size_t fd = 0; fd < names.size(); ++fd) {
56 PHX::MDField<const ScalarT,Cell,Point>(names[fd],intRule->dl_scalar);
61 PHX::Tag<ScalarT> scatterHolder(scatterName,Teuchos::rcp(
new PHX::MDALayout<panzer::Dummy>(0)));
62 this->addEvaluatedField(scatterHolder);
64 this->setName(scatterName+
": STK-Scatter Cell Fields");
85 typename Traits::EvalData workset)
90 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
91 std::string blockId = this->wda(workset).block_id;
93 for(std::size_t fieldIndex=0; fieldIndex<scatterFields_.size();fieldIndex++) {
94 auto field = scatterFields_[fieldIndex].get_static_view();
97 Kokkos::parallel_for(
"ScatterCellAvgQuantity",
field.extent(0), KOKKOS_LAMBDA(
int i) {
98 for(
unsigned j=0; j<
field.extent(1);j++)
99 average(i,0) += Sacado::scalarValue(
field(i,j));
100 average(i,0) /=
field.extent(1);
104 std::string varname = scatterFields_[fieldIndex].fieldTag().name();
107 if (!varScaleFactors_.is_null())
109 std::map<std::string,double> *tmp_sfs = varScaleFactors_.get();
110 if(tmp_sfs->find(varname) != tmp_sfs->end())
111 scalef = (*tmp_sfs)[varname];
114 mesh_->setCellFieldData(varname,blockId,localCellIds,average,scalef);
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.