• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

PHAL_GatherThickness_Def.hpp

Go to the documentation of this file.
00001 //*****************************************************************//
00002 //    Albany 2.0:  Copyright 2012 Sandia Corporation               //
00003 //    This Software is released under the BSD license detailed     //
00004 //    in the file "license.txt" in the top-level Albany directory  //
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); //get dimensions
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   // Since Intrepid will later perform calculations on the entire workset size
00054   // and not just the used portion, we must fill the excess with reasonable 
00055   // values. Leaving this out leads to calculations on singular elements.
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 }

Generated on Wed Mar 26 2014 18:36:41 for Albany: a Trilinos-based PDE code by  doxygen 1.7.1