PlayaSerialVectorType.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 //
00003 /* @HEADER@ */
00004 
00005 #ifndef PLAYA_SERIAL_VECTORTYPE_HPP
00006 #define PLAYA_SERIAL_VECTORTYPE_HPP
00007 
00008 #include "PlayaSerialVectorSpace.hpp"
00009 #include "PlayaHandleable.hpp"
00010 #include "PlayaPrintable.hpp"
00011 #include "Teuchos_Describable.hpp"
00012 #include "PlayaVectorTypeBase.hpp"
00013 //#include "PlayaLinearOperatorDecl.hpp"
00014 
00015 
00016 namespace Playa
00017 {
00018 using namespace Teuchos;
00019   
00020 /**
00021  * \!brief Serial vector type is a factory for serial vector spaces. If used
00022 in a SPMD program the spece will be replicated on each processor. 
00023  */
00024 class SerialVectorType : public VectorTypeBase<double>,
00025                          public Handleable<VectorTypeBase<double> >,
00026                          public Printable,
00027                          public Describable
00028 {
00029 public:
00030   /** Construct a vector type */
00031   SerialVectorType();
00032       
00033   /** virtual dtor */
00034   virtual ~SerialVectorType() {;}
00035 
00036   /** create a distributed vector space.
00037    * @param dimension the dimension of the space 
00038    * @param nLocal number of indices owned by the local processor
00039    * @param locallyOwnedIndices array of indices owned by this processor  
00040    */
00041   RCP<const VectorSpaceBase<double> > 
00042   createSpace(int dimension, 
00043     int nLocal,
00044     const int* locallyOwnedIndices,
00045     const MPIComm& comm) const ;
00046 
00047 
00048   /** Default implementation creates a vector space having 
00049    * nLocal elements on each processor. Serial types should override this
00050    * to produce a replicated space. */
00051   virtual VectorSpace<double> 
00052   createEvenlyPartitionedSpace(const MPIComm& comm,
00053     int nLocal) const ;
00054 
00055 
00056   /**  
00057    * Create an importer for accessing ghost elements.
00058    * @param space the distributed vector space on which ghost elements
00059    * are to be shared
00060    * @param nGhost number of ghost elements needed by this processor
00061    * @param ghostIndices read-only C array of off-processor indices needed
00062    * by this processor.
00063    * @return A RCP to a GhostImporter object.
00064    */
00065   RCP<GhostImporter<double> > 
00066   createGhostImporter(const VectorSpace<double>& space,
00067     int nGhost,
00068     const int* ghostIndices) const ;
00069 
00070 
00071   /**
00072    * Create a matrix factory of type compatible with this vector type,
00073    * sized according to the given domain and range spaces.
00074    */
00075   RCP<MatrixFactory<double> >
00076   createMatrixFactory(const VectorSpace<double>& domain,
00077     const VectorSpace<double>& range) const ;
00078 
00079     
00080 
00081   /** \name Printable interface */
00082   //@{
00083   /** Print to stream */
00084   void print(std::ostream& os) const {os << description();}
00085   //@}
00086 
00087   GET_RCP(VectorTypeBase<double>);
00088 };
00089   
00090 }
00091 
00092 #endif

Site Contact