43 #ifndef PANZER_STK_SCATTER_FIELDS_IMPL_HPP
44 #define PANZER_STK_SCATTER_FIELDS_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"
59 namespace panzer_stk {
61 template <
typename EvalT,
typename TraitsT>
66 const std::vector<std::string> & names)
68 std::vector<double> scaling;
70 initialize(scatterName,mesh,basis,names,scaling);
73 template <
typename EvalT,
typename TraitsT>
78 const std::vector<std::string> & names,
79 const std::vector<double> & scaling)
81 initialize(scatterName,mesh,basis,names,scaling);
84 template <
typename EvalT,
typename TraitsT>
89 const std::vector<std::string> & names,
90 const std::vector<double> & scaling)
98 bool correctScaling = (names.size()==scaling.size()) || (scaling.size()==0);
100 "panzer_stk::ScatterFields evaluator requites a consistent number of scaling parameters (equal to the number of field names) "
101 "or an empty \"Field Scaling\" vector");
104 scatterFields_.resize(names.size());
105 for (std::size_t fd = 0; fd < names.size(); ++fd) {
107 PHX::MDField<const ScalarT,Cell,NODE>(names[fd],basis->
functional);
108 this->addDependentField(scatterFields_[fd]);
115 PHX::Tag<ScalarT> scatterHolder(scatterName,
Teuchos::rcp(
new PHX::MDALayout<panzer::Dummy>(0)));
116 this->addEvaluatedField(scatterHolder);
118 this->setName(scatterName+
": STK-Scatter Fields");
121 template <
typename EvalT,
typename TraitsT>
126 for (std::size_t fd = 0; fd < scatterFields_.size(); ++fd)
127 std::string fieldName = scatterFields_[fd].fieldTag().name();
130 template <
typename EvalT,
typename TraitsT>
142 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
143 std::string blockId = this->wda(workset).block_id;
145 for(std::size_t fieldIndex=0; fieldIndex<scatterFields_.size();fieldIndex++) {
147 double scaling = (scaling_.size()>0) ? scaling_[fieldIndex] : 1.0;
151 mesh_->setSolutionFieldData(scatterFields_[fieldIndex].fieldTag().name(),blockId,
152 localCellIds,scatterFields_[fieldIndex],scaling);
154 mesh_->setCellFieldData(scatterFields_[fieldIndex].fieldTag().name(),blockId,
155 localCellIds,scatterFields_[fieldIndex],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)
EElementSpace getElementSpace() const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void postRegistrationSetup(typename TraitsT::SetupData d, PHX::FieldManager< TraitsT > &fm)
BASIS NODE
Spatial Dimension Tag.
#define TEUCHOS_ASSERT(assertion_test)
Teuchos::RCP< PHX::DataLayout > functional
<Cell,Basis> or <Cell,Basis>
ScatterFields(const std::string &scatterName, const Teuchos::RCP< STK_Interface > mesh, const Teuchos::RCP< const panzer::PureBasis > &basis, const std::vector< std::string > &names)
void evaluateFields(typename TraitsT::EvalData d)