65 const Teuchos::ParameterList& p) :
71 std::string scatterName = p.get<std::string>(
"Scatter Name");
74 if (p.isParameter(
"Variable Scale Factors Map"))
75 varScaleFactors_ = p.get<Teuchos::RCP<std::map<std::string,double>>>(
"Variable Scale Factors Map");
77 const std::vector<std::string> & names =
78 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"Field Names"));
80 Teuchos::RCP<panzer::IntegrationRule> intRule =
81 p.get< Teuchos::RCP<panzer::IntegrationRule> >(
"IR");
86 for (std::size_t fd = 0; fd < names.size(); ++fd) {
88 PHX::MDField<const ScalarT,Cell,Point>(names[fd],intRule->dl_scalar);
93 PHX::Tag<ScalarT> scatterHolder(scatterName,Teuchos::rcp(
new PHX::MDALayout<panzer::Dummy>(0)));
94 this->addEvaluatedField(scatterHolder);
96 this->setName(scatterName+
": STK-Scatter Cell Fields");
117 typename Traits::EvalData workset)
122 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
123 std::string blockId = this->wda(workset).block_id;
125 for(std::size_t fieldIndex=0; fieldIndex<scatterFields_.size();fieldIndex++) {
126 auto field = scatterFields_[fieldIndex].get_static_view();
129 Kokkos::parallel_for(
"ScatterCellAvgQuantity",
field.extent(0), KOKKOS_LAMBDA(
int i) {
130 for(
unsigned j=0; j<
field.extent(1);j++)
131 average(i,0) += Sacado::scalarValue(
field(i,j));
132 average(i,0) /=
field.extent(1);
136 std::string varname = scatterFields_[fieldIndex].fieldTag().name();
139 if (!varScaleFactors_.is_null())
141 std::map<std::string,double> *tmp_sfs = varScaleFactors_.get();
142 if(tmp_sfs->find(varname) != tmp_sfs->end())
143 scalef = (*tmp_sfs)[varname];
146 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.