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 GatherVelocityRMS<EvalT, Traits>::
00017 GatherVelocityRMS(const Teuchos::ParameterList& p,
00018 const Teuchos::RCP<Albany::Layouts>& dl) :
00019 velocityRMS (p.get<std::string> ("Velocity RMS Name"), dl->node_vector ),
00020 numVertices(0), worksetSize(0), numVecDim(0)
00021 {
00022 this->addEvaluatedField(velocityRMS);
00023 this->setName("Gather Velocity RMS"+PHX::TypeString<EvalT>::value);
00024 }
00025
00026 template<typename EvalT, typename Traits>
00027 GatherVelocityRMS<EvalT, Traits>::
00028 GatherVelocityRMS(const Teuchos::ParameterList& p) :
00029 velocityRMS (p.get<std::string> ("Velocity RMS Name"),p.get<Teuchos::RCP<PHX::DataLayout> >("Data Layout") ),
00030 numVertices(0), worksetSize(0), numVecDim(0)
00031 {
00032 this->addEvaluatedField(velocityRMS);
00033 this->setName("Gather Velocity RMS"+PHX::TypeString<EvalT>::value);
00034 }
00035
00036
00037 template<typename EvalT, typename Traits>
00038 void GatherVelocityRMS<EvalT, Traits>::postRegistrationSetup(typename Traits::SetupData d,
00039 PHX::FieldManager<Traits>& fm)
00040 {
00041 this->utils.setFieldData(velocityRMS,fm);
00042
00043 typename std::vector< typename PHX::template MDField<ScalarT,Cell,Node, VecDim>::size_type > dims;
00044 velocityRMS.dimensions(dims);
00045
00046 worksetSize = dims[0];
00047 numVertices = dims[1];
00048 numVecDim = dims[2];
00049 }
00050
00051
00052 template<typename EvalT, typename Traits>
00053 void GatherVelocityRMS<EvalT, Traits>::evaluateFields(typename Traits::EvalData workset)
00054 {
00055 unsigned int numCells = workset.numCells;
00056 Teuchos::ArrayRCP<Teuchos::ArrayRCP<double*> > wsVelocityRMS = workset.wsVelocityRMS;
00057
00058 for (std::size_t cell=0; cell < numCells; ++cell) {
00059 for (std::size_t node = 0; node < numVertices; ++node) {
00060 for (std::size_t dim = 0; dim < numVecDim; ++dim) {
00061 velocityRMS(cell,node,dim) = wsVelocityRMS[cell][node][dim];
00062 }
00063 }
00064 }
00065
00066
00067
00068
00069
00070 for (std::size_t cell=numCells; cell < worksetSize; ++cell) {
00071 for (std::size_t node = 0; node < numVertices; ++node) {
00072 for (std::size_t dim = 0; dim < numVecDim; ++dim) {
00073 velocityRMS(cell,node,dim) = velocityRMS(0,node,dim );
00074 }
00075 }
00076 }
00077 }
00078
00079 }