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