00001 /* @HEADER@ */ 00002 // 00003 /* @HEADER@ */ 00004 00005 #ifndef PLAYA_BLOCKVECTORSPACEBASEDECL_HPP 00006 #define PLAYA_BLOCKVECTORSPACEBASEDECL_HPP 00007 00008 #include "PlayaDefs.hpp" 00009 #include "PlayaVectorSpaceBaseDecl.hpp" 00010 00011 namespace Playa 00012 { 00013 00014 /** 00015 * This is a base class for a blocked vector space. It assumes nothing about 00016 * the physical storage of the blocks. 00017 * 00018 * @author Kevin Long (kevin.long@ttu.edu) 00019 */ 00020 template <class Scalar> 00021 class BlockVectorSpaceBase : public VectorSpaceBase<Scalar> 00022 { 00023 public: 00024 /** virtual dtor */ 00025 virtual ~BlockVectorSpaceBase() {;} 00026 00027 /** Compute dimension. The default implementation sums the dimensions 00028 * of all blocks. */ 00029 virtual int dim() const ; 00030 00031 /** Count the locally owned elements */ 00032 virtual int numLocalElements() const ; 00033 00034 /** Check compatibility with another space. The default implementation 00035 * loops over blocks checking compatiblilty at each index. */ 00036 virtual bool isCompatible(const VectorSpaceBase<Scalar>* other) const ; 00037 00038 /** Get a block specified by an integer index. This function 00039 * should hrow an exception if the index is out of range 00040 */ 00041 virtual const VectorSpace<Scalar>& getBlock(int b) const = 0 ; 00042 00043 /** Write a description by recursivle describing the blocks */ 00044 virtual std::string description() const ; 00045 00046 }; 00047 00048 00049 00050 00051 00052 00053 } 00054 00055 #endif