PlayaDefaultBlockVectorDecl.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 //   
00003  /* @HEADER@ */
00004 
00005 #ifndef PLAYA_DEFAULT_BLOCK_VECTOR_DECL_HPP
00006 #define PLAYA_DEFAULT_BLOCK_VECTOR_DECL_HPP
00007 
00008 #include "PlayaBlockVectorBaseDecl.hpp"
00009 #include "PlayaVectorDecl.hpp"
00010 #include "Teuchos_Array.hpp"
00011 
00012 
00013 namespace Playa
00014 {
00015 using Teuchos::Array;
00016 
00017 /** 
00018  * Base class for blocked vectors 
00019  */
00020 template <class Scalar>
00021 class DefaultBlockVector : public BlockVectorBase<Scalar>
00022 {
00023 public:
00024   /** */
00025   DefaultBlockVector(const VectorSpace<Scalar>& space);
00026 
00027   /** */
00028   DefaultBlockVector(const VectorSpace<Scalar>& space, 
00029     const Array<Vector<Scalar> >& blocks);
00030 
00031   /** */
00032   virtual ~DefaultBlockVector(){}
00033 
00034   /** \name VectorBase interface */
00035   //@{
00036   /** Access to the space in which this vector lives */
00037   RCP<const VectorSpaceBase<double> > space() const {return space_.ptr();}
00038   //@}
00039 
00040   /** */
00041   virtual void setBlock(int b, const Vector<Scalar>& block) ;
00042 
00043   /** */
00044   virtual const Vector<Scalar>& getBlock(int b) const ;
00045 
00046   /** */
00047   virtual Vector<Scalar> getNonConstBlock(int b) ;
00048 
00049   /** */
00050   virtual int numBlocks() const {return blocks_.size();}
00051   
00052 private:
00053   VectorSpace<Scalar> space_;
00054   Teuchos::Array<Vector<Scalar> > blocks_;
00055   
00056 };
00057 
00058 /** \relates Vector */
00059 template <class Scalar> 
00060 Vector<Scalar> blockVector(
00061   const Vector<Scalar>& v1);
00062 
00063 /** \relates Vector */
00064 template <class Scalar> 
00065 Vector<Scalar> blockVector(
00066   const Vector<Scalar>& v1,
00067   const Vector<Scalar>& v2);
00068 
00069 /** \relates Vector */
00070 template <class Scalar> 
00071 Vector<Scalar> blockVector(
00072   const Vector<Scalar>& v1,
00073   const Vector<Scalar>& v2,
00074   const Vector<Scalar>& v3);
00075 
00076 /** \relates Vector */
00077 template <class Scalar> 
00078 Vector<Scalar> blockVector(
00079   const Vector<Scalar>& v1,
00080   const Vector<Scalar>& v2,
00081   const Vector<Scalar>& v3,
00082   const Vector<Scalar>& v4);
00083 
00084 /** \relates Vector */
00085 template <class Scalar> 
00086 Vector<Scalar> blockVector(const Array<Vector<Scalar> >& x);
00087 
00088 
00089 }
00090 
00091 #endif

Site Contact