Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include <vector>
00008 #include <string>
00009
00010 #include "Teuchos_TestForException.hpp"
00011 #include "Phalanx_DataLayout.hpp"
00012
00013 namespace PHAL {
00014
00015 template<typename EvalT, typename Traits>
00016 GatherFlowFactor<EvalT, Traits>::
00017 GatherFlowFactor(const Teuchos::ParameterList& p,
00018 const Teuchos::RCP<Albany::Layouts>& dl) :
00019 flowFactor (p.get<std::string> ("Flow Factor Name"), dl->cell_scalar2 ),
00020 worksetSize(0)
00021 {
00022 this->addEvaluatedField(flowFactor);
00023 this->setName("Gather Flow Factor"+PHX::TypeString<EvalT>::value);
00024 }
00025
00026
00027 template<typename EvalT, typename Traits>
00028 void GatherFlowFactor<EvalT, Traits>::postRegistrationSetup(typename Traits::SetupData d,
00029 PHX::FieldManager<Traits>& fm)
00030 {
00031 this->utils.setFieldData(flowFactor,fm);
00032
00033 typename std::vector< typename PHX::template MDField<ScalarT,Cell>::size_type > dims;
00034 flowFactor.dimensions(dims);
00035
00036 worksetSize = dims[0];
00037 }
00038
00039
00040 template<typename EvalT, typename Traits>
00041 void GatherFlowFactor<EvalT, Traits>::evaluateFields(typename Traits::EvalData workset)
00042 {
00043 unsigned int numCells = workset.numCells;
00044 Teuchos::ArrayRCP<double> wsFlowFactor = workset.wsFlowFactor;
00045
00046 for (std::size_t cell=0; cell < numCells; ++cell)
00047 flowFactor(cell) = wsFlowFactor[cell];
00048
00049
00050
00051
00052 for (std::size_t cell=numCells; cell < worksetSize; ++cell)
00053 flowFactor(cell) = flowFactor(0);
00054 }
00055 }