32 const Teuchos::RCP<STK_Interface> mesh,
33 const Teuchos::RCP<const panzer::PureBasis> & basis,
34 const std::vector<std::string> & names)
36 std::vector<double> scaling;
38 initialize(scatterName,mesh,basis,names,scaling);
44 const Teuchos::RCP<STK_Interface> mesh,
45 const Teuchos::RCP<const panzer::PureBasis> & basis,
46 const std::vector<std::string> & names,
47 const std::vector<double> & scaling)
49 initialize(scatterName,mesh,basis,names,scaling);
55 const Teuchos::RCP<STK_Interface> mesh,
56 const Teuchos::RCP<const panzer::PureBasis> & basis,
57 const std::vector<std::string> & names,
58 const std::vector<double> & scaling)
66 bool correctScaling = (names.size()==scaling.size()) || (scaling.size()==0);
67 TEUCHOS_TEST_FOR_EXCEPTION(!correctScaling,std::invalid_argument,
68 "panzer_stk::ScatterFields evaluator requites a consistent number of scaling parameters (equal to the number of field names) "
69 "or an empty \"Field Scaling\" vector");
72 scatterFields_.resize(names.size());
73 for (std::size_t fd = 0; fd < names.size(); ++fd) {
75 PHX::MDField<const ScalarT,Cell,NODE>(names[fd],basis->functional);
76 this->addDependentField(scatterFields_[fd]);
83 PHX::Tag<ScalarT> scatterHolder(scatterName,Teuchos::rcp(
new PHX::MDALayout<panzer::Dummy>(0)));
84 this->addEvaluatedField(scatterHolder);
86 this->setName(scatterName+
": STK-Scatter Fields");
110 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
111 std::string blockId = this->wda(workset).block_id;
113 for(std::size_t fieldIndex=0; fieldIndex<scatterFields_.size();fieldIndex++) {
115 double scaling = (scaling_.size()>0) ? scaling_[fieldIndex] : 1.0;
119 mesh_->setSolutionFieldData(scatterFields_[fieldIndex].fieldTag().name(),blockId,
120 localCellIds,scatterFields_[fieldIndex].get_view(),scaling);
122 mesh_->setCellFieldData(scatterFields_[fieldIndex].fieldTag().name(),blockId,
123 localCellIds,scatterFields_[fieldIndex].get_view(),scaling);
void initialize(const std::string &scatterName, const Teuchos::RCP< STK_Interface > mesh, const Teuchos::RCP< const panzer::PureBasis > &basis, const std::vector< std::string > &names, const std::vector< double > &scaling)