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 GatherThickness<EvalT, Traits>::
00017 GatherThickness(const Teuchos::ParameterList& p) :
00018 thickness (p.get<std::string> ("Thickness Name"),p.get<Teuchos::RCP<PHX::DataLayout> >("Data Layout") ),
00019 numVertices(0), worksetSize(0)
00020 {
00021 this->addEvaluatedField(thickness);
00022 this->setName("Gather Thickness"+PHX::TypeString<EvalT>::value);
00023 }
00024
00025
00026 template<typename EvalT, typename Traits>
00027 void GatherThickness<EvalT, Traits>::postRegistrationSetup(typename Traits::SetupData d,
00028 PHX::FieldManager<Traits>& fm)
00029 {
00030 this->utils.setFieldData(thickness,fm);
00031
00032 typename std::vector< typename PHX::template MDField<ScalarT,Cell,Vertex>::size_type > dims;
00033 thickness.dimensions(dims);
00034
00035 worksetSize = dims[0];
00036 numVertices = dims[1];
00037 }
00038
00039
00040 template<typename EvalT, typename Traits>
00041 void GatherThickness<EvalT, Traits>::evaluateFields(typename Traits::EvalData workset)
00042 {
00043 unsigned int numCells = workset.numCells;
00044 Teuchos::ArrayRCP<Teuchos::ArrayRCP<double> > wsThickness = workset.wsThickness;
00045
00046 for (std::size_t cell=0; cell < numCells; ++cell) {
00047 for (std::size_t node = 0; node < numVertices; ++node) {
00048 thickness(cell,node) = wsThickness[cell][node];
00049 }
00050 }
00051
00052
00053
00054
00055
00056 for (std::size_t cell=numCells; cell < worksetSize; ++cell) {
00057 for (std::size_t node = 0; node < numVertices; ++node) {
00058 thickness(cell,node) = thickness(0,node);
00059 }
00060 }
00061 }
00062 }