PlayaSerialGhostView.hpp

00001 /* @HEADER@ */
00002 //
00003 /* @HEADER@ */
00004 
00005 #ifndef PLAYA_SERIAL_GHOSTVIEW_HPP
00006 #define PLAYA_SERIAL_GHOSTVIEW_HPP
00007 
00008 #include "PlayaDefs.hpp"
00009 #include "PlayaGhostView.hpp"
00010 #include "PlayaSerialVector.hpp"
00011 #include "Teuchos_Utils.hpp"
00012 
00013 
00014 
00015 namespace Playa
00016 {
00017 using namespace Teuchos;
00018 
00019 
00023 class SerialGhostView : public GhostView<double>
00024 {
00025 public:
00027   SerialGhostView(const RCP<SerialVector>& vec)
00028     : vec_(vec) 
00029     {;}
00030 
00032   virtual ~SerialGhostView(){;}
00033 
00035   bool isAccessible(int globalIndex) const 
00036     {return true;}
00037 
00039   const double& getElement(int globalIndex) const 
00040     {return (*vec_)[globalIndex];}
00041 
00043   void getElements(const int* globalIndices, int numElems,
00044     Array<double>& elems) const 
00045     {
00046       vec_->getElements(globalIndices, numElems, elems);
00047     }
00048 
00050   void print(std::ostream& os) const {os << vec_->description();}
00051 private:
00052   RCP<const SerialVector> vec_;
00053 };
00054   
00055 }
00056 
00057 #endif

doxygen