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 GatherSurfaceVelocity<EvalT, Traits>::
00017 GatherSurfaceVelocity(const Teuchos::ParameterList& p,
00018 const Teuchos::RCP<Albany::Layouts>& dl) :
00019 surfaceVelocity (p.get<std::string> ("Surface Velocity Name"), dl->node_vector ),
00020 numVertices(0), worksetSize(0), numVecDim(0)
00021 {
00022 this->addEvaluatedField(surfaceVelocity);
00023 this->setName("Gather Surface Velocity"+PHX::TypeString<EvalT>::value);
00024 }
00025
00026 template<typename EvalT, typename Traits>
00027 GatherSurfaceVelocity<EvalT, Traits>::
00028 GatherSurfaceVelocity(const Teuchos::ParameterList& p) :
00029 surfaceVelocity (p.get<std::string> ("Surface Velocity Name"),p.get<Teuchos::RCP<PHX::DataLayout> >("Data Layout") ),
00030 numVertices(0), worksetSize(0), numVecDim(0)
00031 {
00032 this->addEvaluatedField(surfaceVelocity);
00033 this->setName("Gather Surface Velocity"+PHX::TypeString<EvalT>::value);
00034 }
00035
00036
00037 template<typename EvalT, typename Traits>
00038 void GatherSurfaceVelocity<EvalT, Traits>::postRegistrationSetup(typename Traits::SetupData d,
00039 PHX::FieldManager<Traits>& fm)
00040 {
00041 this->utils.setFieldData(surfaceVelocity,fm);
00042
00043 typename std::vector< typename PHX::template MDField<ScalarT,Cell,Node, VecDim>::size_type > dims;
00044 surfaceVelocity.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 GatherSurfaceVelocity<EvalT, Traits>::evaluateFields(typename Traits::EvalData workset)
00054 {
00055 unsigned int numCells = workset.numCells;
00056 Teuchos::ArrayRCP<Teuchos::ArrayRCP<double*> > wsSurfaceVelocity = workset.wsSurfaceVelocity;
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 surfaceVelocity(cell,node,dim) = wsSurfaceVelocity[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 surfaceVelocity(cell,node,dim) = surfaceVelocity(0,node,dim );
00074 }
00075 }
00076 }
00077 }
00078
00079 }