43 #ifndef PANZER_STK_SCATTER_CELL_QUANTITY_IMPL_HPP
44 #define PANZER_STK_SCATTER_CELL_QUANTITY_IMPL_HPP
46 #include "Teuchos_Assert.hpp"
48 #include "Phalanx_config.hpp"
49 #include "Phalanx_Evaluator_Macros.hpp"
50 #include "Phalanx_MDField.hpp"
51 #include "Phalanx_DataLayout.hpp"
52 #include "Phalanx_DataLayout_MDALayout.hpp"
57 #include "Teuchos_FancyOStream.hpp"
58 #include "Teuchos_ArrayRCP.hpp"
60 namespace panzer_stk {
62 template<
typename EvalT,
typename Traits>
71 std::string scatterName = p.
get<std::string>(
"Scatter Name");
72 int worksetSize = p.
get<
int>(
"Workset Size");
74 const std::vector<std::string> & names =
81 for (std::size_t fd = 0; fd < names.size(); ++fd) {
82 scatterFields_[fd] = PHX::MDField<const ScalarT,Cell>(names[fd],dl_cell);
87 PHX::Tag<ScalarT> scatterHolder(scatterName,
Teuchos::rcp(
new PHX::MDALayout<panzer::Dummy>(0)));
88 this->addEvaluatedField(scatterHolder);
90 this->setName(scatterName+
": STK-Scatter Cell Quantity Fields");
93 template<
typename EvalT,
typename Traits>
97 typename Traits::SetupData ,
100 for (std::size_t fd = 0; fd < scatterFields_.size(); ++fd)
101 std::string fieldName = scatterFields_[fd].fieldTag().name();
104 template<
typename EvalT,
typename Traits>
108 typename Traits::EvalData workset)
113 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
114 std::string blockId = this->wda(workset).block_id;
116 for(std::size_t fieldIndex=0; fieldIndex<scatterFields_.size();fieldIndex++) {
117 PHX::MDField<const ScalarT,panzer::Cell> &
field = scatterFields_[fieldIndex];
122 for(
unsigned i=0; i<field.extent(0);i++)
123 value(i,0) = Sacado::ScalarValue<ScalarT>::eval(
field(i));
125 mesh_->setCellFieldData(field.fieldTag().name(),blockId,localCellIds,value);
ScatterCellQuantity(const Teuchos::ParameterList &p)
std::vector< PHX::MDField< const ScalarT, panzer::Cell > > scatterFields_
T & get(const std::string &name, T def_value)
PHX::MDField< Scalar, T0 > buildStaticArray(const std::string &str, int d0) 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)