43 #ifndef PANZER_STK_SCATTER_CELL_AVG_QUANTITY_IMPL_HPP 44 #define PANZER_STK_SCATTER_CELL_AVG_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" 68 std::string scatterName = p.get<std::string>(
"Scatter Name");
70 const std::vector<std::string> & names =
71 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"Field Names"));
73 Teuchos::RCP<panzer::IntegrationRule> intRule =
74 p.get< Teuchos::RCP<panzer::IntegrationRule> >(
"IR");
79 for (std::size_t fd = 0; fd < names.size(); ++fd) {
81 PHX::MDField<const ScalarT,Cell,Point>(names[fd],intRule->dl_scalar);
86 PHX::Tag<ScalarT> scatterHolder(scatterName,Teuchos::rcp(
new PHX::MDALayout<panzer::Dummy>(0)));
87 this->addEvaluatedField(scatterHolder);
89 this->setName(scatterName+
": STK-Scatter Cell Fields");
109 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
110 std::string blockId = this->wda(workset).block_id;
112 for(std::size_t fieldIndex=0; fieldIndex<
scatterFields_.size();fieldIndex++) {
113 PHX::MDField<const ScalarT,panzer::Cell,panzer::Point> &
field =
scatterFields_[fieldIndex];
114 PHX::MDField<double,panzer::Cell,panzer::NODE>
average = af.
buildStaticArray<double,panzer::Cell,panzer::NODE>(
"",
field.dimension(0),1);
116 for(
unsigned i=0; i<
field.dimension(0);i++) {
117 for(
unsigned j=0; j<
field.dimension(1);j++)
118 average(i,0) += Sacado::ScalarValue<ScalarT>::eval(
field(i,j));
PHX_POST_REGISTRATION_SETUP(ScatterCellAvgQuantity, d, fm)
PHX::MDField< Scalar, T0 > buildStaticArray(const std::string &str, int d0) const
std::vector< PHX::MDField< const ScalarT, panzer::Cell, panzer::Point > > scatterFields_
PHX::MDField< ScalarT, Cell > average
PHX_EVALUATE_FIELDS(ScatterCellAvgQuantity, workset)
Teuchos::RCP< STK_Interface > mesh_
PHX_EVALUATOR_CTOR(ScatterCellAvgQuantity, p)
PHX::MDField< const ScalarT, Cell, IP > field
panzer_stk::STK_Interface::SolutionFieldType VariableField
std::vector< VariableField * > stkFields_