65 const Teuchos::ParameterList& p) :
72 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 scatterFields_[fd] = PHX::MDField<const ScalarT,Cell,Point,Dim>(names[fd],intRule->dl_vector);
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 Vectors");
120 typename Traits::EvalData workset)
125 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
126 std::string blockId = this->wda(workset).block_id;
127 std::string d_mod[3] = {
"X",
"Y",
"Z"};
130 for(std::size_t fieldIndex = 0; fieldIndex < scatterFields_.size(); fieldIndex++)
132 PHX::MDField<const ScalarT,panzer::Cell,panzer::Point,panzer::Dim> &
field = scatterFields_[fieldIndex];
133 std::string fieldName =
field.fieldTag().name();
134 int numCells =
field.extent(0);
136 int numDims =
field.extent(2);
138 for (
int dim = 0; dim < numDims; dim++)
144 for(
int i = 0; i < numCells; i++)
148 average(i,0) += Sacado::scalarValue(
field(i,j,dim));
155 if (!varScaleFactors_.is_null())
157 std::map<std::string,double> *tmp_sfs = varScaleFactors_.get();
158 if(tmp_sfs->find(fieldName) != tmp_sfs->end())
159 scalef = (*tmp_sfs)[fieldName];
162 mesh_->setCellFieldData(fieldName+d_mod[dim],blockId,localCellIds,average.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.