33 const Teuchos::ParameterList& p) :
39 std::string scatterName = p.get<std::string>(
"Scatter Name");
40 int worksetSize = p.get<
int>(
"Workset Size");
43 if (p.isParameter(
"Variable Scale Factors Map"))
44 varScaleFactors_ = p.get<Teuchos::RCP<std::map<std::string,double>>>(
"Variable Scale Factors Map");
46 const std::vector<std::string> & names =
47 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"Field Names"));
49 Teuchos::RCP<PHX::DataLayout> dl_cell = Teuchos::rcp(
new PHX::MDALayout<Cell>(worksetSize));
53 for (std::size_t fd = 0; fd < names.size(); ++fd) {
54 scatterFields_[fd] = PHX::MDField<const ScalarT,Cell>(names[fd],dl_cell);
59 PHX::Tag<ScalarT> scatterHolder(scatterName,Teuchos::rcp(
new PHX::MDALayout<panzer::Dummy>(0)));
60 this->addEvaluatedField(scatterHolder);
62 this->setName(scatterName+
": STK-Scatter Cell Quantity Fields");
80 typename Traits::EvalData workset)
85 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
86 std::string blockId = this->wda(workset).block_id;
88 for(std::size_t fieldIndex=0; fieldIndex<scatterFields_.size();fieldIndex++) {
89 PHX::MDField<const ScalarT,panzer::Cell> &
field = scatterFields_[fieldIndex];
94 for(
unsigned i=0; i<
field.extent(0);i++)
95 value(i,0) = Sacado::scalarValue(
field(i));
97 std::string varname =
field.fieldTag().name();
100 if (!varScaleFactors_.is_null())
102 std::map<std::string,double> *tmp_sfs = varScaleFactors_.get();
103 if(tmp_sfs->find(varname) != tmp_sfs->end())
104 scalef = (*tmp_sfs)[varname];
107 mesh_->setCellFieldData(
field.fieldTag().name(),blockId,localCellIds,value.get_view(),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.