dune-common 2.1.1
indexset.hh
Go to the documentation of this file.
00001 // $Id$
00002 #ifndef DUNE_INDEXSET_HH
00003 #define DUNE_INDEXSET_HH
00004 
00005 #include<algorithm>
00006 #include<dune/common/arraylist.hh>
00007 #include<dune/common/exceptions.hh>
00008 #include<iostream>
00009 
00010 #include"localindex.hh"
00011 
00012 #include <stdint.h> // for uint32_t
00013 
00014 namespace Dune
00015 {
00025   // forward declarations
00026 
00027   template<class TG, class TL>
00028   class IndexPair;
00029   
00035   template<class TG, class TL>
00036   std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair);
00037 
00038   template<class TG, class TL>
00039   bool operator==(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00040 
00041   template<class TG, class TL>
00042   bool operator!=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00043     
00044   template<class TG, class TL>
00045   bool operator<(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00046 
00047   template<class TG, class TL>
00048   bool operator>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00049 
00050   template<class TG, class TL>
00051   bool operator<=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00052 
00053   template<class TG, class TL>
00054   bool operator >=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00055 
00056   template<class TG, class TL>
00057   bool operator==(const IndexPair<TG,TL>&, const TG&);
00058 
00059   template<class TG, class TL>
00060   bool operator!=(const IndexPair<TG,TL>&, const TG&);
00061     
00062   template<class TG, class TL>
00063   bool operator<(const IndexPair<TG,TL>&, const TG&);
00064 
00065   template<class TG, class TL>
00066   bool operator>(const IndexPair<TG,TL>&, const TG&);
00067 
00068   template<class TG, class TL>
00069   bool operator<=(const IndexPair<TG,TL>&, const TG&);
00070 
00071   template<class TG, class TL>
00072   bool operator >=(const IndexPair<TG,TL>&, const TG&);
00073   
00074   template<typename T>
00075   class MPITraits;
00076   
00080   template<class TG, class TL>
00081   class IndexPair
00082   {
00083     friend std::ostream& operator<<<>(std::ostream&, const IndexPair<TG,TL>&);
00084     friend bool operator==<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00085     friend bool operator!=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00086     friend bool operator< <>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00087     friend bool operator><>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00088     friend bool operator<=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00089     friend bool operator>=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
00090     friend bool operator==<>(const IndexPair<TG,TL>&, const TG&);
00091     friend bool operator!=<>(const IndexPair<TG,TL>&, const TG&);
00092     friend bool operator< <>(const IndexPair<TG,TL>&, const TG&);
00093     friend bool operator> <>(const IndexPair<TG,TL>&, const TG&);
00094     friend bool operator<=<>(const IndexPair<TG,TL>&, const TG&);
00095     friend bool operator>=<>(const IndexPair<TG,TL>&, const TG&);
00096     friend class MPITraits<IndexPair<TG,TL> >;
00097     
00098   public:
00104     typedef TG GlobalIndex;
00105         
00117     typedef TL LocalIndex;
00118 
00125     IndexPair(const GlobalIndex& global, const LocalIndex& local);
00126 
00130     IndexPair();
00137     IndexPair(const GlobalIndex& global);
00138 
00144     inline const GlobalIndex& global() const;
00145         
00151     inline LocalIndex& local();
00152 
00158     inline const LocalIndex& local()const;
00159 
00165     inline void setLocal(int index);
00166   private:
00168     GlobalIndex global_;
00170     LocalIndex local_;
00171   };
00172 
00177   enum ParallelIndexSetState 
00178     {
00183     GROUND, 
00187     RESIZE
00197   };
00198 
00202   class InvalidIndexSetState: public Exception{};
00203   
00204   // Forward declaration
00205   template<class I> class GlobalLookupIndexSet;
00206   
00213   template<typename TG, typename TL, int N=100>
00214   class ParallelIndexSet
00215   {
00216     friend class GlobalLookupIndexSet<ParallelIndexSet<TG,TL,N> >;
00217     
00218   public:    
00223     typedef TG GlobalIndex;
00224         
00236     typedef TL LocalIndex;
00237 
00241     typedef Dune::IndexPair<GlobalIndex,LocalIndex> IndexPair;
00242     
00243     enum{
00250       arraySize= (N>0)?N:1
00251         };
00252 
00254     class iterator : 
00255       public ArrayList<IndexPair,N>::iterator
00256     {
00257       typedef typename ArrayList<IndexPair,N>::iterator
00258       Father;
00259       friend class ParallelIndexSet<GlobalIndex,LocalIndex,N>;
00260     public:
00261       iterator(ParallelIndexSet<TG,TL,N>& indexSet, const Father& father)
00262         : Father(father), indexSet_(&indexSet)
00263       {}
00264 
00265       iterator(const iterator& other)
00266         : Father(other), indexSet_(other.indexSet_)
00267       {}
00268 
00269       iterator& operator==(const iterator& other)
00270       {
00271         Father::operator==(other);
00272         indexSet_ = other.indexSet_;
00273       }
00274             
00275     private:      
00283       inline void markAsDeleted() const throw(InvalidIndexSetState)
00284       {
00285 #ifndef NDEBUG
00286         if(indexSet_->state_ != RESIZE)
00287           DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
00288                      <<"while in RESIZE state!");
00289 #endif
00290         Father::operator*().local().setState(DELETED);
00291       }
00292 
00294       ParallelIndexSet<TG,TL,N>* indexSet_;
00295       
00296     };
00297     
00298     
00299 
00301     typedef typename 
00302     ArrayList<IndexPair,N>::const_iterator 
00303     const_iterator;
00304 
00308     ParallelIndexSet();
00309         
00314     inline const ParallelIndexSetState& state();
00315         
00321     void beginResize() throw(InvalidIndexSetState);
00322 
00331     inline void add(const GlobalIndex& global) throw(InvalidIndexSetState);
00332 
00341     inline void add(const GlobalIndex& global, const LocalIndex& local)
00342       throw(InvalidIndexSetState);
00343 
00351     inline void markAsDeleted(const iterator& position) 
00352       throw(InvalidIndexSetState);
00353 
00366     void endResize() throw(InvalidIndexSetState);
00367 
00378     inline IndexPair& 
00379     operator[](const GlobalIndex& global);
00380 
00390     inline IndexPair& 
00391     at(const GlobalIndex& global);
00392 
00403     inline const IndexPair& 
00404     operator[](const GlobalIndex& global) const;
00405 
00415     inline const IndexPair& 
00416     at(const GlobalIndex& global) const;
00417 
00422     inline iterator begin();
00423 
00428     inline iterator end();
00429 
00434     inline const_iterator begin() const;
00435 
00440     inline const_iterator end() const;
00441 
00451     inline void renumberLocal();
00452 
00459     inline int seqNo() const;
00460 
00465     inline size_t size() const;
00466 
00467   private:
00469     ArrayList<IndexPair,N> localIndices_;
00471     ArrayList<IndexPair,N> newIndices_;
00473     ParallelIndexSetState state_;
00475     int seqNo_;
00477     bool deletedEntries_;
00482     inline void merge();
00483   };
00484 
00485   
00491   template<class TG, class TL, int N>
00492   std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet);
00493   
00499   template<class I>
00500   class GlobalLookupIndexSet
00501   {
00502   public:
00506     typedef I ParallelIndexSet;
00507     
00511     typedef typename ParallelIndexSet::LocalIndex LocalIndex;
00512     
00516     typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
00517 
00521     typedef typename ParallelIndexSet::const_iterator const_iterator;
00522     
00523     typedef Dune::IndexPair<typename I::GlobalIndex, typename I::LocalIndex> IndexPair;
00524     
00531     GlobalLookupIndexSet(const ParallelIndexSet& indexset, std::size_t size);
00532     
00538     GlobalLookupIndexSet(const ParallelIndexSet& indexset);
00539     
00543     ~GlobalLookupIndexSet();
00544     
00554     inline const IndexPair& 
00555     operator[](const GlobalIndex& global) const;
00556 
00560     inline const IndexPair*
00561     pair(const std::size_t& local) const;
00562     
00567     inline const_iterator begin() const;
00568 
00573     inline const_iterator end() const;
00574 
00581     inline int seqNo() const;
00582 
00587     inline size_t size() const;
00588   private:
00592     const ParallelIndexSet& indexSet_;
00593     
00597     std::size_t size_;
00598 
00602     std::vector<const IndexPair*> indices_;
00603     
00604   };
00605   
00606   
00607   template<typename T>
00608   struct LocalIndexComparator
00609   {
00610     static bool compare(const T& t1, const T& t2){
00611       return false;
00612     }
00613   };
00614 
00615   template<class TG, class TL>
00616   struct IndexSetSortFunctor
00617   {
00618     bool operator()(const IndexPair<TG,TL>& i1, const IndexPair<TG,TL>& i2)
00619     {
00620       return i1.global()<i2.global() || (i1.global()==i2.global() && 
00621                                         LocalIndexComparator<TL>::compare(i1.local(),
00622                                                                           i2.local()));
00623     }
00624   };
00625     
00626     
00627 
00628   template<class TG, class TL>
00629   inline std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair)
00630   {
00631     os<<"{global="<<pair.global_<<", local="<<pair.local_<<"}";
00632     return os;
00633   }
00634 
00635   template<class TG, class TL, int N>
00636   inline std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet)
00637   {
00638     typedef typename ParallelIndexSet<TG,TL,N>::const_iterator Iterator;
00639     Iterator end = indexSet.end();
00640     os<<"{";
00641     for(Iterator index = indexSet.begin(); index != end; ++index)
00642       os<<*index<<" ";
00643     os<<"}";
00644     return os;
00645     
00646   }
00647   
00648   template<class TG, class TL>
00649   inline bool operator==(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
00650   {
00651     return a.global_==b.global_;
00652   }
00653 
00654   template<class TG, class TL>
00655   inline bool operator!=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
00656   {
00657     return a.global_!=b.global_;
00658   }
00659     
00660   template<class TG, class TL>
00661   inline bool operator<(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
00662   {
00663     return a.global_<b.global_;
00664   }
00665 
00666   template<class TG, class TL>
00667   inline bool operator>(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
00668   {
00669     return a.global_>b.global_;
00670   }
00671 
00672   template<class TG, class TL>
00673   inline bool operator<=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
00674   {
00675     return a.global_<=b.global_;
00676   }
00677 
00678   template<class TG, class TL>
00679   inline bool operator >=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
00680   {
00681     return a.global_>=b.global_;
00682   }
00683   
00684   template<class TG, class TL>
00685   inline bool operator==(const IndexPair<TG,TL>& a, const TG& b)
00686   {
00687     return a.global_==b;
00688   }
00689 
00690   template<class TG, class TL>
00691   inline bool operator!=(const IndexPair<TG,TL>& a, const TG& b)
00692   {
00693     return a.global_!=b;
00694   }
00695     
00696   template<class TG, class TL>
00697   inline bool operator<(const IndexPair<TG,TL>& a, const TG& b)
00698   {
00699     return a.global_<b;
00700   }
00701 
00702   template<class TG, class TL>
00703   inline bool operator>(const IndexPair<TG,TL>& a, const TG& b)
00704   {
00705     return a.global_>b;
00706   }
00707 
00708   template<class TG, class TL>
00709   inline bool operator<=(const IndexPair<TG,TL>& a, const TG& b)
00710   {
00711     return a.global_<=b;
00712   }
00713 
00714   template<class TG, class TL>
00715   inline bool operator >=(const IndexPair<TG,TL>& a, const TG& b)
00716   {
00717     return a.global_>=b;
00718   }
00719 
00720 #ifndef DOXYGEN
00721   
00722   template<class TG, class TL>
00723   IndexPair<TG,TL>::IndexPair(const TG& global, const TL& local)
00724     : global_(global), local_(local){}
00725 
00726   template<class TG, class TL>
00727   IndexPair<TG,TL>::IndexPair(const TG& global)
00728     : global_(global), local_(){}
00729 
00730   template<class TG, class TL>
00731   IndexPair<TG,TL>::IndexPair()
00732     : global_(), local_(){}
00733 
00734   template<class TG, class TL>
00735   inline const TG& IndexPair<TG,TL>::global() const{
00736     return global_;
00737   }
00738 
00739   template<class TG, class TL>
00740   inline TL& IndexPair<TG,TL>::local() {
00741     return local_;
00742   }
00743 
00744   template<class TG, class TL>
00745   inline const TL& IndexPair<TG,TL>::local() const{
00746     return local_;
00747   }
00748 
00749   template<class TG, class TL>
00750   inline void IndexPair<TG,TL>::setLocal(int local){
00751     local_=local;
00752   }
00753 
00754   template<class TG, class TL, int N>
00755   ParallelIndexSet<TG,TL,N>::ParallelIndexSet()
00756     : state_(GROUND), seqNo_(0)
00757   {}
00758 
00759   template<class TG, class TL, int N>
00760   void ParallelIndexSet<TG,TL,N>::beginResize() throw(InvalidIndexSetState)
00761   {
00762 
00763     // Checks in unproductive code
00764 #ifndef NDEBUG
00765     if(state_!=GROUND)
00766       DUNE_THROW(InvalidIndexSetState, 
00767                  "IndexSet has to be in GROUND state, when "
00768                  << "beginResize() is called!");
00769 #endif
00770         
00771     state_ = RESIZE;
00772     deletedEntries_ = false;
00773   }
00774 
00775   template<class TG, class TL, int N>
00776   inline void ParallelIndexSet<TG,TL,N>::add(const GlobalIndex& global) 
00777     throw(InvalidIndexSetState)
00778   {
00779     // Checks in unproductive code
00780 #ifndef NDEBUG
00781     if(state_ != RESIZE)
00782       DUNE_THROW(InvalidIndexSetState, "Indices can only be added "
00783                  <<"while in RESIZE state!");
00784 #endif
00785     newIndices_.push_back(IndexPair(global));
00786   }
00787 
00788   template<class TG, class TL, int N>
00789   inline void ParallelIndexSet<TG,TL,N>::add(const TG& global, const TL& local) 
00790     throw(InvalidIndexSetState)
00791   {
00792     // Checks in unproductive code
00793 #ifndef NDEBUG
00794     if(state_ != RESIZE)
00795       DUNE_THROW(InvalidIndexSetState, "Indices can only be added "
00796                  <<"while in RESIZE state!");
00797 #endif
00798     newIndices_.push_back(IndexPair(global,local));
00799   }
00800 
00801   template<class TG, class TL, int N>
00802   inline void ParallelIndexSet<TG,TL,N>::markAsDeleted(const iterator& global)
00803     throw(InvalidIndexSetState){
00804     // Checks in unproductive code    
00805 #ifndef NDEBUG
00806     if(state_ != RESIZE)
00807       DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
00808                  <<"while in RESIZE state!");
00809 #endif    
00810     deletedEntries_ = true;
00811 
00812     global.markAsDeleted();
00813   }
00814 
00815   template<class TG, class TL, int N>
00816   void ParallelIndexSet<TG,TL,N>::endResize() throw(InvalidIndexSetState){
00817     // Checks in unproductive code
00818 #ifndef NDEBUG
00819     if(state_ != RESIZE)
00820       DUNE_THROW(InvalidIndexSetState, "endResize called while not "
00821                  <<"in RESIZE state!");
00822 #endif
00823         
00824     std::sort(newIndices_.begin(), newIndices_.end(), IndexSetSortFunctor<TG,TL>());
00825     merge();
00826     seqNo_++;
00827     state_ = GROUND;
00828   }
00829     
00830   
00831   template<class TG, class TL, int N>
00832   inline void ParallelIndexSet<TG,TL,N>::merge(){
00833     if(localIndices_.size()==0)
00834       {
00835         localIndices_=newIndices_;
00836         newIndices_.clear();
00837       }
00838     else if(newIndices_.size()>0 || deletedEntries_)
00839       {
00840         ArrayList<IndexPair,N> tempPairs;
00841         typedef typename ArrayList<IndexPair,N>::iterator iterator;
00842         typedef typename ArrayList<IndexPair,N>::const_iterator const_iterator;
00843         
00844         iterator old=localIndices_.begin();
00845         iterator added=newIndices_.begin();
00846         const const_iterator endold=localIndices_.end();
00847         const const_iterator endadded=newIndices_.end();
00848                 
00849         while(old != endold && added!= endadded)
00850           {
00851             if(old->local().state()==DELETED){
00852               old.eraseToHere();
00853             }
00854             else
00855               {
00856                 if(old->global() < added->global() ||
00857                    (old->global() == added->global()
00858                     && LocalIndexComparator<TL>::compare(old->local(),added->local())))
00859                   {
00860                     tempPairs.push_back(*old);
00861                     old.eraseToHere();
00862                     continue;
00863                   }else                    
00864                   {
00865                     tempPairs.push_back(*added);
00866                     added.eraseToHere();
00867                   }
00868               }
00869           }
00870 
00871         while(old != endold)
00872           {
00873             if(old->local().state()!=DELETED){
00874               tempPairs.push_back(*old);
00875             }
00876             old.eraseToHere();
00877           }
00878 
00879         while(added!= endadded)
00880           {
00881             tempPairs.push_back(*added);
00882             added.eraseToHere();
00883           }
00884         localIndices_ = tempPairs;
00885       }
00886   }
00887 
00888 
00889   template<class TG, class TL, int N>
00890   inline const IndexPair<TG,TL>& 
00891   ParallelIndexSet<TG,TL,N>::at(const TG& global) const
00892   {
00893     // perform a binary search
00894     int low=0, high=localIndices_.size()-1, probe=-1;
00895 
00896     while(low<high)
00897       {
00898         probe = (high + low) / 2;
00899         if(global <= localIndices_[probe].global())
00900           high = probe;
00901         else
00902           low = probe+1;
00903       }
00904 
00905     if(probe==-1)
00906       DUNE_THROW(RangeError, "No entries!");
00907 
00908     if( localIndices_[low].global() != global)
00909       DUNE_THROW(RangeError, "Could not find entry of "<<global);
00910     else
00911       return localIndices_[low];
00912   }
00913 
00914  template<class TG, class TL, int N>
00915   inline const IndexPair<TG,TL>& 
00916   ParallelIndexSet<TG,TL,N>::operator[](const TG& global) const
00917   {
00918     // perform a binary search
00919     int low=0, high=localIndices_.size()-1, probe=-1;
00920 
00921     while(low<high)
00922       {
00923         probe = (high + low) / 2;
00924         if(global <= localIndices_[probe].global())
00925           high = probe;
00926         else
00927           low = probe+1;
00928       }
00929 
00930     return localIndices_[low];
00931   }
00932   template<class TG, class TL, int N>
00933   inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::at(const TG& global)
00934   {
00935     // perform a binary search
00936     int low=0, high=localIndices_.size()-1, probe=-1;
00937 
00938     while(low<high)
00939       {
00940         probe = (high + low) / 2;
00941         if(localIndices_[probe].global() >= global)
00942           high = probe;
00943         else
00944           low = probe+1;
00945       }
00946 
00947     if(probe==-1)
00948       DUNE_THROW(RangeError, "No entries!");
00949 
00950     if( localIndices_[low].global() != global)
00951       DUNE_THROW(RangeError, "Could not find entry of "<<global);
00952     else
00953       return localIndices_[low];
00954   }
00955 
00956   template<class TG, class TL, int N>
00957   inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::operator[](const TG& global)
00958   {
00959     // perform a binary search
00960     int low=0, high=localIndices_.size()-1, probe=-1;
00961 
00962     while(low<high)
00963       {
00964         probe = (high + low) / 2;
00965         if(localIndices_[probe].global() >= global)
00966           high = probe;
00967         else
00968           low = probe+1;
00969       }
00970 
00971     return localIndices_[low];
00972   }
00973   template<class TG, class TL, int N>
00974   inline typename ParallelIndexSet<TG,TL,N>::iterator
00975   ParallelIndexSet<TG,TL,N>::begin()
00976   {
00977     return iterator(*this, localIndices_.begin());
00978   }
00979 
00980     
00981   template<class TG, class TL, int N>
00982   inline typename ParallelIndexSet<TG,TL,N>::iterator 
00983   ParallelIndexSet<TG,TL,N>::end()
00984   {
00985     return iterator(*this,localIndices_.end());
00986   }
00987 
00988   template<class TG, class TL, int N>
00989   inline typename ParallelIndexSet<TG,TL,N>::const_iterator 
00990   ParallelIndexSet<TG,TL,N>::begin() const
00991   {
00992     return localIndices_.begin();
00993   }
00994 
00995     
00996   template<class TG, class TL, int N>
00997   inline typename ParallelIndexSet<TG,TL,N>::const_iterator 
00998   ParallelIndexSet<TG,TL,N>::end() const
00999   {
01000     return localIndices_.end();
01001   }
01002 
01003   template<class TG, class TL, int N>
01004   void ParallelIndexSet<TG,TL,N>::renumberLocal(){
01005 #ifndef NDEBUG
01006     if(state_==RESIZE)
01007       DUNE_THROW(InvalidIndexSetState, "IndexSet has to be in "
01008                  <<"GROUND state for renumberLocal()");
01009 #endif
01010 
01011     typedef typename ArrayList<IndexPair,N>::iterator iterator;
01012     const const_iterator end_ = end();
01013     uint32_t index=0;
01014 
01015     for(iterator pair=begin(); pair!=end_; index++, ++pair)
01016       pair->local()=index;
01017   }
01018 
01019   template<class TG, class TL, int N>
01020   inline int ParallelIndexSet<TG,TL,N>::seqNo() const
01021   {
01022     return seqNo_;
01023   }
01024 
01025   template<class TG, class TL, int N>
01026   inline size_t ParallelIndexSet<TG,TL,N>::size() const
01027   {
01028     return localIndices_.size();
01029   }
01030 
01031   template<class I>
01032   GlobalLookupIndexSet<I>::GlobalLookupIndexSet(const I& indexset,
01033                                                 std::size_t size)
01034     : indexSet_(indexset), size_(size), 
01035       indices_(size_, static_cast<const IndexPair*>(0))
01036   {
01037     const_iterator end_ = indexSet_.end();
01038 
01039     for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair){
01040       assert(pair->local()<size_);
01041       indices_[pair->local()] = &(*pair);
01042     }
01043   }
01044 
01045    template<class I>
01046   GlobalLookupIndexSet<I>::GlobalLookupIndexSet(const I& indexset)
01047     : indexSet_(indexset), size_(0)
01048   {
01049     const_iterator end_ = indexSet_.end();
01050     for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
01051       size_=std::max(size_,static_cast<std::size_t>(pair->local()));
01052     
01053     indices_.resize(++size_,  0);
01054     
01055     for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
01056       indices_[pair->local()] = &(*pair);
01057   }
01058 
01059   template<class I>
01060   GlobalLookupIndexSet<I>::~GlobalLookupIndexSet()
01061   {}
01062   
01063   template<class I>
01064   inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>*
01065   GlobalLookupIndexSet<I>::pair(const std::size_t& local) const
01066   {
01067     return indices_[local];
01068   }
01069   
01070   template<class I>
01071   inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>&
01072   GlobalLookupIndexSet<I>::operator[](const GlobalIndex& global) const
01073   {
01074     return indexSet_[global];
01075   }
01076   
01077   template<class I>
01078   typename I::const_iterator GlobalLookupIndexSet<I>::begin() const
01079   {
01080     return indexSet_.begin();
01081   }
01082  
01083   template<class I>
01084   typename I::const_iterator GlobalLookupIndexSet<I>::end() const
01085   {
01086     return indexSet_.end();
01087   }
01088 
01089   template<class I>
01090   inline size_t GlobalLookupIndexSet<I>::size() const
01091   {
01092     return size_;
01093   }
01094   
01095   template<class I>
01096   inline int GlobalLookupIndexSet<I>::seqNo() const
01097   {
01098     return indexSet_.seqNo();
01099   }
01100 
01101 #endif // DOXYGEN
01102 
01103 }
01104 #endif