11 #ifndef PANZER_STK_SCATTER_CELL_QUANTITY_IMPL_HPP
12 #define PANZER_STK_SCATTER_CELL_QUANTITY_IMPL_HPP
14 #include "Teuchos_Assert.hpp"
16 #include "Phalanx_config.hpp"
17 #include "Phalanx_Evaluator_Macros.hpp"
18 #include "Phalanx_MDField.hpp"
19 #include "Phalanx_DataLayout.hpp"
20 #include "Phalanx_DataLayout_MDALayout.hpp"
25 #include "Teuchos_FancyOStream.hpp"
26 #include "Teuchos_ArrayRCP.hpp"
28 namespace panzer_stk {
30 template<
typename EvalT,
typename Traits>
39 std::string scatterName = p.
get<std::string>(
"Scatter Name");
40 int worksetSize = p.
get<
int>(
"Workset Size");
46 const std::vector<std::string> & names =
53 for (std::size_t fd = 0; fd < names.size(); ++fd) {
60 this->addEvaluatedField(scatterHolder);
62 this->setName(scatterName+
": STK-Scatter Cell Quantity Fields");
65 template<
typename EvalT,
typename Traits>
69 typename Traits::SetupData ,
72 for (std::size_t fd = 0; fd < scatterFields_.size(); ++fd)
73 std::string fieldName = scatterFields_[fd].fieldTag().name();
76 template<
typename EvalT,
typename Traits>
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++) {
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);
ScatterCellQuantity(const Teuchos::ParameterList &p)
std::vector< PHX::MDField< const ScalarT, panzer::Cell > > scatterFields_
T & get(const std::string &name, T def_value)
Teuchos::RCP< std::map< std::string, double > > varScaleFactors_
PHX::MDField< Scalar, T0 > buildStaticArray(const std::string &str, int d0) const
bool isParameter(const std::string &name) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void evaluateFields(typename Traits::EvalData d)
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...
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)