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

PHAL_GatherFlowFactor_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 GatherFlowFactor<EvalT, Traits>::
00017 GatherFlowFactor(const Teuchos::ParameterList& p,
00018                               const Teuchos::RCP<Albany::Layouts>& dl) :
00019   flowFactor  (p.get<std::string> ("Flow Factor Name"), dl->cell_scalar2 ),
00020   worksetSize(0)
00021 {  
00022   this->addEvaluatedField(flowFactor);
00023   this->setName("Gather Flow Factor"+PHX::TypeString<EvalT>::value);
00024 }
00025 
00026 // **********************************************************************
00027 template<typename EvalT, typename Traits> 
00028 void GatherFlowFactor<EvalT, Traits>::postRegistrationSetup(typename Traits::SetupData d,
00029                       PHX::FieldManager<Traits>& fm)
00030 {
00031   this->utils.setFieldData(flowFactor,fm);
00032 
00033   typename std::vector< typename PHX::template MDField<ScalarT,Cell>::size_type > dims;
00034   flowFactor.dimensions(dims); //get dimensions
00035 
00036   worksetSize = dims[0];
00037 }
00038 
00039 // **********************************************************************
00040 template<typename EvalT, typename Traits>
00041 void GatherFlowFactor<EvalT, Traits>::evaluateFields(typename Traits::EvalData workset)
00042 { 
00043   unsigned int numCells = workset.numCells;
00044   Teuchos::ArrayRCP<double> wsFlowFactor = workset.wsFlowFactor;
00045 
00046   for (std::size_t cell=0; cell < numCells; ++cell)
00047         flowFactor(cell) = wsFlowFactor[cell];
00048 
00049   // Since Intrepid will later perform calculations on the entire workset size
00050   // and not just the used portion, we must fill the excess with reasonable 
00051   // values. Leaving this out leads to calculations on singular elements.
00052   for (std::size_t cell=numCells; cell < worksetSize; ++cell)
00053         flowFactor(cell) = flowFactor(0);
00054 }
00055 }

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