Dune Core Modules (2.3.1)

indexset.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3// $Id$
4#ifndef DUNE_INDEXSET_HH
5#define DUNE_INDEXSET_HH
6
7#include <algorithm>
10#include <dune/common/unused.hh>
11#include <iostream>
12
13#include "localindex.hh"
14
15#include <stdint.h> // for uint32_t
16
17namespace Dune
18{
28 // forward declarations
29
30 template<class TG, class TL>
31 class IndexPair;
32
38 template<class TG, class TL>
39 std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair);
40
41 template<class TG, class TL>
42 bool operator==(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
43
44 template<class TG, class TL>
45 bool operator!=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
46
47 template<class TG, class TL>
48 bool operator<(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
49
50 template<class TG, class TL>
51 bool operator>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
52
53 template<class TG, class TL>
54 bool operator<=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
55
56 template<class TG, class TL>
57 bool operator >=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
58
59 template<class TG, class TL>
60 bool operator==(const IndexPair<TG,TL>&, const TG&);
61
62 template<class TG, class TL>
63 bool operator!=(const IndexPair<TG,TL>&, const TG&);
64
65 template<class TG, class TL>
66 bool operator<(const IndexPair<TG,TL>&, const TG&);
67
68 template<class TG, class TL>
69 bool operator>(const IndexPair<TG,TL>&, const TG&);
70
71 template<class TG, class TL>
72 bool operator<=(const IndexPair<TG,TL>&, const TG&);
73
74 template<class TG, class TL>
75 bool operator >=(const IndexPair<TG,TL>&, const TG&);
76
77 template<typename T>
78 struct MPITraits;
79
83 template<class TG, class TL>
85 {
86 friend std::ostream& operator<<<>(std::ostream&, const IndexPair<TG,TL>&);
87 friend bool operator==<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
88 friend bool operator!=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
89 friend bool operator< <>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
90 friend bool operator><>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
91 friend bool operator<=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
92 friend bool operator>=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
93 friend bool operator==<>(const IndexPair<TG,TL>&, const TG &);
94 friend bool operator!=<>(const IndexPair<TG,TL>&, const TG &);
95 friend bool operator< <>(const IndexPair<TG,TL>&, const TG &);
96 friend bool operator> <>(const IndexPair<TG,TL>&, const TG &);
97 friend bool operator<=<>(const IndexPair<TG,TL>&, const TG &);
98 friend bool operator>=<>(const IndexPair<TG,TL>&, const TG &);
99 friend struct MPITraits<IndexPair<TG,TL> >;
100
101 public:
107 typedef TG GlobalIndex;
108
120 typedef TL LocalIndex;
121
129
141
147 inline const GlobalIndex& global() const;
148
154 inline LocalIndex& local();
155
161 inline const LocalIndex& local() const;
162
168 inline void setLocal(int index);
169 private:
171 GlobalIndex global_;
173 LocalIndex local_;
174 };
175
181 {
190 RESIZE
200 };
201
206
207 // Forward declaration
208 template<class I> class GlobalLookupIndexSet;
209
216 template<typename TG, typename TL, int N=100>
218 {
219 friend class GlobalLookupIndexSet<ParallelIndexSet<TG,TL,N> >;
220
221 public:
226 typedef TG GlobalIndex;
227
239 typedef TL LocalIndex;
240
245
246 enum {
253 arraySize= (N>0) ? N : 1
254 };
255
257 class iterator :
258 public ArrayList<IndexPair,N>::iterator
259 {
260 typedef typename ArrayList<IndexPair,N>::iterator
261 Father;
263 public:
264 iterator(ParallelIndexSet<TG,TL,N>& indexSet, const Father& father)
265 : Father(father), indexSet_(&indexSet)
266 {}
267
268 iterator(const iterator& other)
269 : Father(other), indexSet_(other.indexSet_)
270 {}
271
272 iterator& operator==(const iterator& other)
273 {
274 Father::operator==(other);
275 indexSet_ = other.indexSet_;
276 }
277
278 private:
286 inline void markAsDeleted() const throw(InvalidIndexSetState)
287 {
288#ifndef NDEBUG
289 if(indexSet_->state_ != RESIZE)
290 DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
291 <<"while in RESIZE state!");
292#endif
293 Father::operator*().local().setState(DELETED);
294 }
295
297 ParallelIndexSet<TG,TL,N>* indexSet_;
298
299 };
300
301
302
304 typedef typename
307
312
318 {
319 return state_;
320 }
321
328
337 inline void add(const GlobalIndex& global) throw(InvalidIndexSetState);
338
347 inline void add(const GlobalIndex& global, const LocalIndex& local)
349
357 inline void markAsDeleted(const iterator& position)
359
373
384 inline IndexPair&
385 operator[](const GlobalIndex& global);
386
396 inline IndexPair&
397 at(const GlobalIndex& global);
398
409 inline const IndexPair&
410 operator[](const GlobalIndex& global) const;
411
421 inline const IndexPair&
422 at(const GlobalIndex& global) const;
423
428 inline iterator begin();
429
434 inline iterator end();
435
440 inline const_iterator begin() const;
441
446 inline const_iterator end() const;
447
457 inline void renumberLocal();
458
465 inline int seqNo() const;
466
471 inline size_t size() const;
472
473 private:
475 ArrayList<IndexPair,N> localIndices_;
477 ArrayList<IndexPair,N> newIndices_;
481 int seqNo_;
483 bool deletedEntries_;
488 inline void merge();
489 };
490
491
497 template<class TG, class TL, int N>
498 std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet);
499
505 template<class I>
507 {
508 public:
513
518
523
528
530
537 GlobalLookupIndexSet(const ParallelIndexSet& indexset, std::size_t size);
538
545
550
560 inline const IndexPair&
561 operator[](const GlobalIndex& global) const;
562
566 inline const IndexPair*
567 pair(const std::size_t& local) const;
568
573 inline const_iterator begin() const;
574
579 inline const_iterator end() const;
580
587 inline int seqNo() const;
588
593 inline size_t size() const;
594 private:
598 const ParallelIndexSet& indexSet_;
599
603 std::size_t size_;
604
608 std::vector<const IndexPair*> indices_;
609
610 };
611
612
613 template<typename T>
614 struct LocalIndexComparator
615 {
616 static bool compare(const T& t1, const T& t2){
619 return false;
620 }
621 };
622
623 template<class TG, class TL>
624 struct IndexSetSortFunctor
625 {
626 bool operator()(const IndexPair<TG,TL>& i1, const IndexPair<TG,TL>& i2)
627 {
628 return i1.global()<i2.global() || (i1.global()==i2.global() &&
629 LocalIndexComparator<TL>::compare(i1.local(),
630 i2.local()));
631 }
632 };
633
634
635
636 template<class TG, class TL>
637 inline std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair)
638 {
639 os<<"{global="<<pair.global_<<", local="<<pair.local_<<"}";
640 return os;
641 }
642
643 template<class TG, class TL, int N>
644 inline std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet)
645 {
646 typedef typename ParallelIndexSet<TG,TL,N>::const_iterator Iterator;
647 Iterator end = indexSet.end();
648 os<<"{";
649 for(Iterator index = indexSet.begin(); index != end; ++index)
650 os<<*index<<" ";
651 os<<"}";
652 return os;
653
654 }
655
656 template<class TG, class TL>
657 inline bool operator==(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
658 {
659 return a.global_==b.global_;
660 }
661
662 template<class TG, class TL>
663 inline bool operator!=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
664 {
665 return a.global_!=b.global_;
666 }
667
668 template<class TG, class TL>
669 inline bool operator<(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
670 {
671 return a.global_<b.global_;
672 }
673
674 template<class TG, class TL>
675 inline bool operator>(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
676 {
677 return a.global_>b.global_;
678 }
679
680 template<class TG, class TL>
681 inline bool operator<=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
682 {
683 return a.global_<=b.global_;
684 }
685
686 template<class TG, class TL>
687 inline bool operator >=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
688 {
689 return a.global_>=b.global_;
690 }
691
692 template<class TG, class TL>
693 inline bool operator==(const IndexPair<TG,TL>& a, const TG& b)
694 {
695 return a.global_==b;
696 }
697
698 template<class TG, class TL>
699 inline bool operator!=(const IndexPair<TG,TL>& a, const TG& b)
700 {
701 return a.global_!=b;
702 }
703
704 template<class TG, class TL>
705 inline bool operator<(const IndexPair<TG,TL>& a, const TG& b)
706 {
707 return a.global_<b;
708 }
709
710 template<class TG, class TL>
711 inline bool operator>(const IndexPair<TG,TL>& a, const TG& b)
712 {
713 return a.global_>b;
714 }
715
716 template<class TG, class TL>
717 inline bool operator<=(const IndexPair<TG,TL>& a, const TG& b)
718 {
719 return a.global_<=b;
720 }
721
722 template<class TG, class TL>
723 inline bool operator >=(const IndexPair<TG,TL>& a, const TG& b)
724 {
725 return a.global_>=b;
726 }
727
728#ifndef DOXYGEN
729
730 template<class TG, class TL>
731 IndexPair<TG,TL>::IndexPair(const TG& global, const TL& local)
732 : global_(global), local_(local){}
733
734 template<class TG, class TL>
735 IndexPair<TG,TL>::IndexPair(const TG& global)
736 : global_(global), local_(){}
737
738 template<class TG, class TL>
739 IndexPair<TG,TL>::IndexPair()
740 : global_(), local_(){}
741
742 template<class TG, class TL>
743 inline const TG& IndexPair<TG,TL>::global() const {
744 return global_;
745 }
746
747 template<class TG, class TL>
748 inline TL& IndexPair<TG,TL>::local() {
749 return local_;
750 }
751
752 template<class TG, class TL>
753 inline const TL& IndexPair<TG,TL>::local() const {
754 return local_;
755 }
756
757 template<class TG, class TL>
758 inline void IndexPair<TG,TL>::setLocal(int local){
759 local_=local;
760 }
761
762 template<class TG, class TL, int N>
764 : state_(GROUND), seqNo_(0)
765 {}
766
767 template<class TG, class TL, int N>
768 void ParallelIndexSet<TG,TL,N>::beginResize() throw(InvalidIndexSetState)
769 {
770
771 // Checks in unproductive code
772#ifndef NDEBUG
773 if(state_!=GROUND)
774 DUNE_THROW(InvalidIndexSetState,
775 "IndexSet has to be in GROUND state, when "
776 << "beginResize() is called!");
777#endif
778
779 state_ = RESIZE;
780 deletedEntries_ = false;
781 }
782
783 template<class TG, class TL, int N>
784 inline void ParallelIndexSet<TG,TL,N>::add(const GlobalIndex& global)
785 throw(InvalidIndexSetState)
786 {
787 // Checks in unproductive code
788#ifndef NDEBUG
789 if(state_ != RESIZE)
790 DUNE_THROW(InvalidIndexSetState, "Indices can only be added "
791 <<"while in RESIZE state!");
792#endif
793 newIndices_.push_back(IndexPair(global));
794 }
795
796 template<class TG, class TL, int N>
797 inline void ParallelIndexSet<TG,TL,N>::add(const TG& global, const TL& local)
798 throw(InvalidIndexSetState)
799 {
800 // Checks in unproductive code
801#ifndef NDEBUG
802 if(state_ != RESIZE)
803 DUNE_THROW(InvalidIndexSetState, "Indices can only be added "
804 <<"while in RESIZE state!");
805#endif
806 newIndices_.push_back(IndexPair(global,local));
807 }
808
809 template<class TG, class TL, int N>
810 inline void ParallelIndexSet<TG,TL,N>::markAsDeleted(const iterator& global)
811 throw(InvalidIndexSetState){
812 // Checks in unproductive code
813#ifndef NDEBUG
814 if(state_ != RESIZE)
815 DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
816 <<"while in RESIZE state!");
817#endif
818 deletedEntries_ = true;
819
820 global.markAsDeleted();
821 }
822
823 template<class TG, class TL, int N>
824 void ParallelIndexSet<TG,TL,N>::endResize() throw(InvalidIndexSetState){
825 // Checks in unproductive code
826#ifndef NDEBUG
827 if(state_ != RESIZE)
828 DUNE_THROW(InvalidIndexSetState, "endResize called while not "
829 <<"in RESIZE state!");
830#endif
831
832 std::sort(newIndices_.begin(), newIndices_.end(), IndexSetSortFunctor<TG,TL>());
833 merge();
834 seqNo_++;
835 state_ = GROUND;
836 }
837
838
839 template<class TG, class TL, int N>
840 inline void ParallelIndexSet<TG,TL,N>::merge(){
841 if(localIndices_.size()==0)
842 {
843 localIndices_=newIndices_;
844 newIndices_.clear();
845 }
846 else if(newIndices_.size()>0 || deletedEntries_)
847 {
848 ArrayList<IndexPair,N> tempPairs;
849 typedef typename ArrayList<IndexPair,N>::iterator iterator;
850 typedef typename ArrayList<IndexPair,N>::const_iterator const_iterator;
851
852 iterator old=localIndices_.begin();
853 iterator added=newIndices_.begin();
854 const const_iterator endold=localIndices_.end();
855 const const_iterator endadded=newIndices_.end();
856
857 while(old != endold && added!= endadded)
858 {
859 if(old->local().state()==DELETED) {
860 old.eraseToHere();
861 }
862 else
863 {
864 if(old->global() < added->global() ||
865 (old->global() == added->global()
866 && LocalIndexComparator<TL>::compare(old->local(),added->local())))
867 {
868 tempPairs.push_back(*old);
869 old.eraseToHere();
870 continue;
871 }else
872 {
873 tempPairs.push_back(*added);
874 added.eraseToHere();
875 }
876 }
877 }
878
879 while(old != endold)
880 {
881 if(old->local().state()!=DELETED) {
882 tempPairs.push_back(*old);
883 }
884 old.eraseToHere();
885 }
886
887 while(added!= endadded)
888 {
889 tempPairs.push_back(*added);
890 added.eraseToHere();
891 }
892 localIndices_ = tempPairs;
893 }
894 }
895
896
897 template<class TG, class TL, int N>
898 inline const IndexPair<TG,TL>&
899 ParallelIndexSet<TG,TL,N>::at(const TG& global) const
900 {
901 // perform a binary search
902 int low=0, high=localIndices_.size()-1, probe=-1;
903
904 while(low<high)
905 {
906 probe = (high + low) / 2;
907 if(global <= localIndices_[probe].global())
908 high = probe;
909 else
910 low = probe+1;
911 }
912
913 if(probe==-1)
914 DUNE_THROW(RangeError, "No entries!");
915
916 if( localIndices_[low].global() != global)
917 DUNE_THROW(RangeError, "Could not find entry of "<<global);
918 else
919 return localIndices_[low];
920 }
921
922 template<class TG, class TL, int N>
923 inline const IndexPair<TG,TL>&
924 ParallelIndexSet<TG,TL,N>::operator[](const TG& global) const
925 {
926 // perform a binary search
927 int low=0, high=localIndices_.size()-1, probe=-1;
928
929 while(low<high)
930 {
931 probe = (high + low) / 2;
932 if(global <= localIndices_[probe].global())
933 high = probe;
934 else
935 low = probe+1;
936 }
937
938 return localIndices_[low];
939 }
940 template<class TG, class TL, int N>
941 inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::at(const TG& global)
942 {
943 // perform a binary search
944 int low=0, high=localIndices_.size()-1, probe=-1;
945
946 while(low<high)
947 {
948 probe = (high + low) / 2;
949 if(localIndices_[probe].global() >= global)
950 high = probe;
951 else
952 low = probe+1;
953 }
954
955 if(probe==-1)
956 DUNE_THROW(RangeError, "No entries!");
957
958 if( localIndices_[low].global() != global)
959 DUNE_THROW(RangeError, "Could not find entry of "<<global);
960 else
961 return localIndices_[low];
962 }
963
964 template<class TG, class TL, int N>
965 inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::operator[](const TG& global)
966 {
967 // perform a binary search
968 int low=0, high=localIndices_.size()-1, probe=-1;
969
970 while(low<high)
971 {
972 probe = (high + low) / 2;
973 if(localIndices_[probe].global() >= global)
974 high = probe;
975 else
976 low = probe+1;
977 }
978
979 return localIndices_[low];
980 }
981 template<class TG, class TL, int N>
982 inline typename ParallelIndexSet<TG,TL,N>::iterator
984 {
985 return iterator(*this, localIndices_.begin());
986 }
987
988
989 template<class TG, class TL, int N>
990 inline typename ParallelIndexSet<TG,TL,N>::iterator
992 {
993 return iterator(*this,localIndices_.end());
994 }
995
996 template<class TG, class TL, int N>
999 {
1000 return localIndices_.begin();
1001 }
1002
1003
1004 template<class TG, class TL, int N>
1007 {
1008 return localIndices_.end();
1009 }
1010
1011 template<class TG, class TL, int N>
1013#ifndef NDEBUG
1014 if(state_==RESIZE)
1015 DUNE_THROW(InvalidIndexSetState, "IndexSet has to be in "
1016 <<"GROUND state for renumberLocal()");
1017#endif
1018
1019 typedef typename ArrayList<IndexPair,N>::iterator iterator;
1020 const const_iterator end_ = end();
1021 uint32_t index=0;
1022
1023 for(iterator pair=begin(); pair!=end_; index++, ++pair)
1024 pair->local()=index;
1025 }
1026
1027 template<class TG, class TL, int N>
1028 inline int ParallelIndexSet<TG,TL,N>::seqNo() const
1029 {
1030 return seqNo_;
1031 }
1032
1033 template<class TG, class TL, int N>
1034 inline size_t ParallelIndexSet<TG,TL,N>::size() const
1035 {
1036 return localIndices_.size();
1037 }
1038
1039 template<class I>
1040 GlobalLookupIndexSet<I>::GlobalLookupIndexSet(const I& indexset,
1041 std::size_t size)
1042 : indexSet_(indexset), size_(size),
1043 indices_(size_, static_cast<const IndexPair*>(0))
1044 {
1045 const_iterator end_ = indexSet_.end();
1046
1047 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair) {
1048 assert(pair->local()<size_);
1049 indices_[pair->local()] = &(*pair);
1050 }
1051 }
1052
1053 template<class I>
1054 GlobalLookupIndexSet<I>::GlobalLookupIndexSet(const I& indexset)
1055 : indexSet_(indexset), size_(0)
1056 {
1057 const_iterator end_ = indexSet_.end();
1058 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
1059 size_=std::max(size_,static_cast<std::size_t>(pair->local()));
1060
1061 indices_.resize(++size_, 0);
1062
1063 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
1064 indices_[pair->local()] = &(*pair);
1065 }
1066
1067 template<class I>
1068 GlobalLookupIndexSet<I>::~GlobalLookupIndexSet()
1069 {}
1070
1071 template<class I>
1072 inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>*
1073 GlobalLookupIndexSet<I>::pair(const std::size_t& local) const
1074 {
1075 return indices_[local];
1076 }
1077
1078 template<class I>
1079 inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>&
1080 GlobalLookupIndexSet<I>::operator[](const GlobalIndex& global) const
1081 {
1082 return indexSet_[global];
1083 }
1084
1085 template<class I>
1086 typename I::const_iterator GlobalLookupIndexSet<I>::begin() const
1087 {
1088 return indexSet_.begin();
1089 }
1090
1091 template<class I>
1092 typename I::const_iterator GlobalLookupIndexSet<I>::end() const
1093 {
1094 return indexSet_.end();
1095 }
1096
1097 template<class I>
1098 inline size_t GlobalLookupIndexSet<I>::size() const
1099 {
1100 return size_;
1101 }
1102
1103 template<class I>
1104 inline int GlobalLookupIndexSet<I>::seqNo() const
1105 {
1106 return indexSet_.seqNo();
1107 }
1108
1109 template<typename TG, typename TL, int N, typename TG1, typename TL1, int N1>
1110 bool operator==(const ParallelIndexSet<TG,TL,N>& idxset,
1111 const ParallelIndexSet<TG1,TL1,N1>& idxset1)
1112 {
1113 if(idxset.size()!=idxset1.size())
1114 return false;
1115 typedef typename ParallelIndexSet<TG,TL,N>::const_iterator Iter;
1116 typedef typename ParallelIndexSet<TG1,TL1,N1>::const_iterator Iter1;
1117 Iter iter=idxset.begin();
1118 for(Iter1 iter1=idxset1.begin(); iter1 != idxset1.end(); ++iter, ++iter1) {
1119 if(iter1->global()!=iter->global())
1120 return false;
1121 typedef typename ParallelIndexSet<TG,TL,N>::LocalIndex PI;
1122 const PI& pi=iter->local(), pi1=iter1->local();
1123
1124 if(pi!=pi1)
1125 return false;
1126 }
1127 return true;
1128 }
1129
1130 template<typename TG, typename TL, int N, typename TG1, typename TL1, int N1>
1131 bool operator!=(const ParallelIndexSet<TG,TL,N>& idxset,
1132 const ParallelIndexSet<TG1,TL1,N1>& idxset1)
1133 {
1134 return !(idxset==idxset1);
1135 }
1136
1137
1138#endif // DOXYGEN
1139
1140}
1141#endif
Implements a random-access container that can efficiently change size (similar to std::deque)
A random access iterator for the Dune::ArrayList class.
Definition: arraylist.hh:259
A dynamically growing random access list.
Definition: arraylist.hh:61
A constant random access iterator for the Dune::ArrayList class.
Definition: arraylist.hh:380
Base class for Dune-Exceptions.
Definition: exceptions.hh:92
Decorates an index set with the possibility to find a global index that is mapped to a specific local...
Definition: indexset.hh:507
A pair consisting of a global and local index.
Definition: indexset.hh:85
Exception indicating that the index set is not in the expected state.
Definition: indexset.hh:205
The iterator over the pairs.
Definition: indexset.hh:259
Manager class for the mapping between local indices and globally unique indices.
Definition: indexset.hh:218
Reference operator*() const
Dereferencing operator.
Definition: iteratorfacades.hh:490
A few common exception classes.
IndexPair & operator[](const GlobalIndex &global)
Find the index pair with a specific global id.
void beginResize()
Indicate that the index set is to be resized.
ParallelIndexSetState
The states the index set can be in.
Definition: indexset.hh:181
void renumberLocal()
Renumbers the local index numbers.
size_t size() const
Get the total number (public and nonpublic) indices.
ArrayList< IndexPair, N >::const_iterator const_iterator
The constant iterator over the pairs.
Definition: indexset.hh:306
void add(const GlobalIndex &global)
Add an new index to the set.
const_iterator end() const
Get an iterator over the indices positioned after the last index.
const LocalIndex & local() const
Get the local index.
GlobalLookupIndexSet(const ParallelIndexSet &indexset)
Constructor.
TL LocalIndex
the type of the local index.
Definition: indexset.hh:120
int seqNo() const
Get the internal sequence number.
iterator begin()
Get an iterator over the indices positioned at the first index.
iterator end()
Get an iterator over the indices positioned after the last index.
ParallelIndexSet::const_iterator const_iterator
The iterator over the index pairs.
Definition: indexset.hh:527
const_iterator begin() const
Get an iterator over the indices positioned at the first index.
const ParallelIndexSetState & state()
Get the state the index set is in.
Definition: indexset.hh:317
const IndexPair & operator[](const GlobalIndex &global) const
Find the index pair with a specific global id.
IndexPair()
Construct a new Pair.
I ParallelIndexSet
The type of the index set.
Definition: indexset.hh:512
TL LocalIndex
The type of the local index, e.g. ParallelLocalIndex.
Definition: indexset.hh:239
void markAsDeleted(const iterator &position)
Mark an index as deleted.
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition: indexset.hh:517
IndexPair(const GlobalIndex &global, const LocalIndex &local)
Constructs a new Pair.
void setLocal(int index)
Set the local index.
const GlobalIndex & global() const
Get the global index.
IndexPair & at(const GlobalIndex &global)
Find the index pair with a specific global id.
ParallelIndexSet()
Constructor.
void endResize()
Indicate that the resizing finishes.
~GlobalLookupIndexSet()
Destructor.
const IndexPair * pair(const std::size_t &local) const
Get the index pair corresponding to a local index.
LocalIndex & local()
Get the local index.
size_t size() const
Get the total number (public and nonpublic) indices.
IndexPair(const GlobalIndex &global)
Constructs a new Pair.
TG GlobalIndex
the type of the global index. This type has to provide at least a operator< for sorting.
Definition: indexset.hh:226
TG GlobalIndex
the type of the global index.
Definition: indexset.hh:107
int seqNo() const
Get the internal sequence number.
GlobalLookupIndexSet(const ParallelIndexSet &indexset, std::size_t size)
Constructor.
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition: indexset.hh:522
Dune::IndexPair< GlobalIndex, LocalIndex > IndexPair
The type of the pair stored.
Definition: indexset.hh:244
@ RESIZE
Indicates that the index set is currently being resized.
Definition: indexset.hh:190
@ GROUND
The default mode. Indicates that the index set is ready to be used.
Definition: indexset.hh:186
@ arraySize
The size of the individual arrays in the underlying ArrayList.
Definition: indexset.hh:253
std::ostream & operator<<(std::ostream &s, const array< T, N > &e)
Output operator for array.
Definition: array.hh:159
#define DUNE_THROW(E, m)
Definition: exceptions.hh:244
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition: iteratorfacades.hh:231
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition: iteratorfacades.hh:253
Provides classes for use as the local index in ParallelIndexSet.
Dune namespace.
Definition: alignment.hh:14
STL namespace.
A traits class describing the mapping of types onto MPI_Datatypes.
Definition: mpitraits.hh:37
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentional unused function parameters with.
Definition: unused.hh:18
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)