LAMA
/home/brandes/workspace/LAMA/src/lama/distribution/BlockDistribution.hpp
Go to the documentation of this file.
00001 
00033 #ifndef LAMA_BLOCKDISTRIBUTION_HPP_
00034 #define LAMA_BLOCKDISTRIBUTION_HPP_
00035 
00036 // for dll_import
00037 #include <lama/config.hpp>
00038 
00039 // base classes
00040 #include <lama/distribution/Distribution.hpp>
00041 
00042 namespace lama
00043 {
00044 
00050 class LAMA_DLL_IMPORTEXPORT BlockDistribution: public Distribution
00051 {
00052 public:
00053 
00059     BlockDistribution(const IndexType globalSize, const CommunicatorPtr communicator);
00060 
00061     virtual ~BlockDistribution();
00062 
00067     static void getRange( IndexType& lb, IndexType& ub,
00068                           const IndexType n, const PartitionId rank, const PartitionId size );
00069 
00070     virtual bool isLocal( const IndexType index ) const;
00071 
00078     virtual PartitionId getOwner( const IndexType globalIndex ) const;
00079 
00080     virtual IndexType getLocalSize() const;
00081 
00082     virtual IndexType local2global(const IndexType localIndex) const;
00083 
00084     virtual IndexType global2local(const IndexType globalIndex) const;
00085 
00086     virtual bool isEqual(const Distribution& other) const;
00087 
00088     virtual void writeAt(std::ostream& stream) const;
00089 
00093     virtual void computeOwners(
00094         const std::vector<IndexType>& requiredIndexes,
00095         std::vector<PartitionId>& owners) const;
00096 
00099     static DistributionPtr create( const IndexType globalSize,
00100                                    const CommunicatorPtr communicator);
00101 
00102     void printDistributionVector( std::string problem ) const;
00103 
00104 protected:
00105 
00106     LAMA_LOG_DECL_STATIC_LOGGER(logger);
00107 
00108 private:
00109 
00110     BlockDistribution();  // disable default constructor as it has no size
00111 
00112     IndexType mBlockSize; 
00113     IndexType lb, ub;     
00114 };
00115 
00116 }
00117 
00118 #endif // LAMA_BLOCKDISTRIBUTION_HPP_