SundanceCellLIDMappedFieldWrapper.hpp
Go to the documentation of this file.
00001 #ifndef SUNDANCE_CELLLID_MAPPED_FIELDWRAPPER_H
00002 #define SUNDANCE_CELLLID_MAPPED_FIELDWRAPPER_H
00003 
00004 #include "SundanceFieldBase.hpp"
00005 
00006 namespace Sundance
00007 {
00008 
00009 using Teuchos::Array;
00010 using Teuchos::RCP;
00011 
00012 class CellLIDMappedFieldWrapper : public FieldBase
00013 {
00014 public:
00015   /** */
00016   CellLIDMappedFieldWrapper(int cellDim,
00017     int nFuncs, const RCP<Array<double> >& data)
00018     : cellDim_(cellDim), nFuncs_(nFuncs), data_(data) {}
00019 
00020   /** virtual dtor */
00021   virtual ~CellLIDMappedFieldWrapper(){}
00022 
00023   /** */
00024   double getData(int cellDim, int cellID, int elem) const 
00025     {
00026       TEUCHOS_TEST_FOR_EXCEPT(cellDim != cellDim_);
00027       return (*data_)[cellID*nFuncs_ + elem];
00028     }
00029   
00030   /** */
00031   bool isDefined(int cellDim, int cellID, int elem) const 
00032     {return true;}
00033   
00034   /** */
00035   int numElems() const {return nFuncs_;}
00036   
00037   /** */
00038   bool isPointData() const {return cellDim_==0;}
00039   
00040   /* */
00041   GET_RCP(FieldBase);
00042 
00043 private:
00044   int cellDim_;
00045   int nFuncs_;
00046   RCP<Array<double> > data_;
00047 };
00048 
00049 
00050 
00051 }
00052 
00053 #endif

Site Contact