Dune Core Modules (2.7.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#ifndef DUNE_INDEXSET_HH
4#define DUNE_INDEXSET_HH
5
6#include <algorithm>
10#include <iostream>
11
12#include "localindex.hh"
13
14#include <stdint.h> // for uint32_t
15
16namespace Dune
17{
27 // forward declarations
28
29 template<class TG, class TL>
30 class IndexPair;
31
37 template<class TG, class TL>
38 std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair);
39
40 template<class TG, class TL>
41 bool operator==(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
42
43 template<class TG, class TL>
44 bool operator!=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
45
46 template<class TG, class TL>
47 bool operator<(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
48
49 template<class TG, class TL>
50 bool operator>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
51
52 template<class TG, class TL>
53 bool operator<=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
54
55 template<class TG, class TL>
56 bool operator >=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
57
58 template<class TG, class TL>
59 bool operator==(const IndexPair<TG,TL>&, const TG&);
60
61 template<class TG, class TL>
62 bool operator!=(const IndexPair<TG,TL>&, const TG&);
63
64 template<class TG, class TL>
65 bool operator<(const IndexPair<TG,TL>&, const TG&);
66
67 template<class TG, class TL>
68 bool operator>(const IndexPair<TG,TL>&, const TG&);
69
70 template<class TG, class TL>
71 bool operator<=(const IndexPair<TG,TL>&, const TG&);
72
73 template<class TG, class TL>
74 bool operator >=(const IndexPair<TG,TL>&, const TG&);
75
76 template<typename T>
77 struct MPITraits;
78
82 template<class TG, class TL>
84 {
85 friend std::ostream& operator<<<>(std::ostream&, const IndexPair<TG,TL>&);
86 friend bool operator==<>(const IndexPair<TG,TL>&, 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 TG &);
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 struct MPITraits<IndexPair<TG,TL> >;
99
100 public:
106 typedef TG GlobalIndex;
107
119 typedef TL LocalIndex;
120
128
140
146 inline const GlobalIndex& global() const;
147
153 inline LocalIndex& local();
154
160 inline const LocalIndex& local() const;
161
167 inline void setLocal(int index);
168 private:
170 GlobalIndex global_;
172 LocalIndex local_;
173 };
174
180 {
189 RESIZE
199 };
200
205
206 // Forward declaration
207 template<class I> class GlobalLookupIndexSet;
208
215 template<typename TG, typename TL, int N=100>
217 {
218 friend class GlobalLookupIndexSet<ParallelIndexSet<TG,TL,N> >;
219
220 public:
225 typedef TG GlobalIndex;
226
238 typedef TL LocalIndex;
239
244
245 enum {
252 arraySize= (N>0) ? N : 1
253 };
254
256 class iterator :
257 public ArrayList<IndexPair,N>::iterator
258 {
259 typedef typename ArrayList<IndexPair,N>::iterator
260 Father;
262 public:
263 iterator(ParallelIndexSet<TG,TL,N>& indexSet, const Father& father)
264 : Father(father), indexSet_(&indexSet)
265 {}
266
267 private:
277 inline void markAsDeleted() const
278 {
279#ifndef NDEBUG
280 if(indexSet_->state_ != RESIZE)
281 DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
282 <<"while in RESIZE state!");
283#endif
284 Father::operator*().local().setState(DELETED);
285 }
286
288 ParallelIndexSet<TG,TL,N>* indexSet_;
289
290 };
291
292
293
295 typedef typename
298
303
309 {
310 return state_;
311 }
312
319
328 inline void add(const GlobalIndex& global);
329
338 inline void add(const GlobalIndex& global, const LocalIndex& local);
339
347 inline void markAsDeleted(const iterator& position);
348
361 void endResize();
362
373 inline IndexPair&
374 operator[](const GlobalIndex& global);
375
385 inline IndexPair&
386 at(const GlobalIndex& global);
387
397 inline bool
398 exists (const GlobalIndex& global) const;
399
410 inline const IndexPair&
411 operator[](const GlobalIndex& global) const;
412
422 inline const IndexPair&
423 at(const GlobalIndex& global) const;
424
429 inline iterator begin();
430
435 inline iterator end();
436
441 inline const_iterator begin() const;
442
447 inline const_iterator end() const;
448
458 inline void renumberLocal();
459
466 inline int seqNo() const;
467
472 inline size_t size() const;
473
474 private:
476 ArrayList<IndexPair,N> localIndices_;
478 ArrayList<IndexPair,N> newIndices_;
482 int seqNo_;
484 bool deletedEntries_;
489 inline void merge();
490 };
491
492
498 template<class TG, class TL, int N>
499 std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet);
500
506 template<class I>
508 {
509 public:
514
519
524
529
531
538 GlobalLookupIndexSet(const ParallelIndexSet& indexset, std::size_t size);
539
546
551
561 inline const IndexPair&
562 operator[](const GlobalIndex& global) const;
563
567 inline const IndexPair*
568 pair(const std::size_t& local) const;
569
574 inline const_iterator begin() const;
575
580 inline const_iterator end() const;
581
588 inline int seqNo() const;
589
594 inline size_t size() const;
595 private:
599 const ParallelIndexSet& indexSet_;
600
604 std::size_t size_;
605
609 std::vector<const IndexPair*> indices_;
610
611 };
612
613
614 template<typename T>
615 struct LocalIndexComparator
616 {
617 static bool compare(const T& t1, const T& t2){
620 return false;
621 }
622 };
623
624 template<class TG, class TL>
625 struct IndexSetSortFunctor
626 {
627 bool operator()(const IndexPair<TG,TL>& i1, const IndexPair<TG,TL>& i2)
628 {
629 return i1.global()<i2.global() || (i1.global()==i2.global() &&
630 LocalIndexComparator<TL>::compare(i1.local(),
631 i2.local()));
632 }
633 };
634
635
636
637 template<class TG, class TL>
638 inline std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair)
639 {
640 os<<"{global="<<pair.global_<<", local="<<pair.local_<<"}";
641 return os;
642 }
643
644 template<class TG, class TL, int N>
645 inline std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet)
646 {
647 typedef typename ParallelIndexSet<TG,TL,N>::const_iterator Iterator;
648 Iterator end = indexSet.end();
649 os<<"{";
650 for(Iterator index = indexSet.begin(); index != end; ++index)
651 os<<*index<<" ";
652 os<<"}";
653 return os;
654
655 }
656
657 template<class TG, class TL>
658 inline bool operator==(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
659 {
660 return a.global_==b.global_;
661 }
662
663 template<class TG, class TL>
664 inline bool operator!=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
665 {
666 return a.global_!=b.global_;
667 }
668
669 template<class TG, class TL>
670 inline bool operator<(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
671 {
672 return a.global_<b.global_;
673 }
674
675 template<class TG, class TL>
676 inline bool operator>(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
677 {
678 return a.global_>b.global_;
679 }
680
681 template<class TG, class TL>
682 inline bool operator<=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
683 {
684 return a.global_<=b.global_;
685 }
686
687 template<class TG, class TL>
688 inline bool operator >=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
689 {
690 return a.global_>=b.global_;
691 }
692
693 template<class TG, class TL>
694 inline bool operator==(const IndexPair<TG,TL>& a, const TG& b)
695 {
696 return a.global_==b;
697 }
698
699 template<class TG, class TL>
700 inline bool operator!=(const IndexPair<TG,TL>& a, const TG& b)
701 {
702 return a.global_!=b;
703 }
704
705 template<class TG, class TL>
706 inline bool operator<(const IndexPair<TG,TL>& a, const TG& b)
707 {
708 return a.global_<b;
709 }
710
711 template<class TG, class TL>
712 inline bool operator>(const IndexPair<TG,TL>& a, const TG& b)
713 {
714 return a.global_>b;
715 }
716
717 template<class TG, class TL>
718 inline bool operator<=(const IndexPair<TG,TL>& a, const TG& b)
719 {
720 return a.global_<=b;
721 }
722
723 template<class TG, class TL>
724 inline bool operator >=(const IndexPair<TG,TL>& a, const TG& b)
725 {
726 return a.global_>=b;
727 }
728
729#ifndef DOXYGEN
730
731 template<class TG, class TL>
732 IndexPair<TG,TL>::IndexPair(const TG& global, const TL& local)
733 : global_(global), local_(local){}
734
735 template<class TG, class TL>
736 IndexPair<TG,TL>::IndexPair(const TG& global)
737 : global_(global), local_(){}
738
739 template<class TG, class TL>
740 IndexPair<TG,TL>::IndexPair()
741 : global_(), local_(){}
742
743 template<class TG, class TL>
744 inline const TG& IndexPair<TG,TL>::global() const {
745 return global_;
746 }
747
748 template<class TG, class TL>
749 inline TL& IndexPair<TG,TL>::local() {
750 return local_;
751 }
752
753 template<class TG, class TL>
754 inline const TL& IndexPair<TG,TL>::local() const {
755 return local_;
756 }
757
758 template<class TG, class TL>
759 inline void IndexPair<TG,TL>::setLocal(int local){
760 local_=local;
761 }
762
763 template<class TG, class TL, int N>
765 : state_(GROUND), seqNo_(0)
766 {}
767
768 template<class TG, class TL, int N>
770 {
771
772 // Checks in unproductive code
773#ifndef NDEBUG
774 if(state_!=GROUND)
775 DUNE_THROW(InvalidIndexSetState,
776 "IndexSet has to be in GROUND state, when "
777 << "beginResize() is called!");
778#endif
779
780 state_ = RESIZE;
781 deletedEntries_ = false;
782 }
783
784 template<class TG, class TL, int N>
785 inline void ParallelIndexSet<TG,TL,N>::add(const GlobalIndex& global)
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 {
799 // Checks in unproductive code
800#ifndef NDEBUG
801 if(state_ != RESIZE)
802 DUNE_THROW(InvalidIndexSetState, "Indices can only be added "
803 <<"while in RESIZE state!");
804#endif
805 newIndices_.push_back(IndexPair(global,local));
806 }
807
808 template<class TG, class TL, int N>
809 inline void ParallelIndexSet<TG,TL,N>::markAsDeleted(const iterator& global)
810 {
811 // Checks in unproductive code
812#ifndef NDEBUG
813 if(state_ != RESIZE)
814 DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
815 <<"while in RESIZE state!");
816#endif
817 deletedEntries_ = true;
818
819 global.markAsDeleted();
820 }
821
822 template<class TG, class TL, int N>
824 // Checks in unproductive code
825#ifndef NDEBUG
826 if(state_ != RESIZE)
827 DUNE_THROW(InvalidIndexSetState, "endResize called while not "
828 <<"in RESIZE state!");
829#endif
830
831 std::sort(newIndices_.begin(), newIndices_.end(), IndexSetSortFunctor<TG,TL>());
832 merge();
833 seqNo_++;
834 state_ = GROUND;
835 }
836
837
838 template<class TG, class TL, int N>
839 inline void ParallelIndexSet<TG,TL,N>::merge(){
840 if(localIndices_.size()==0)
841 {
842 localIndices_=newIndices_;
843 newIndices_.clear();
844 }
845 else if(newIndices_.size()>0 || deletedEntries_)
846 {
847 ArrayList<IndexPair,N> tempPairs;
848 typedef typename ArrayList<IndexPair,N>::iterator iterator;
849 typedef typename ArrayList<IndexPair,N>::const_iterator const_iterator;
850
851 iterator old=localIndices_.begin();
852 iterator added=newIndices_.begin();
853 const const_iterator endold=localIndices_.end();
854 const const_iterator endadded=newIndices_.end();
855
856 while(old != endold && added!= endadded)
857 {
858 if(old->local().state()==DELETED) {
859 old.eraseToHere();
860 }
861 else
862 {
863 if(old->global() < added->global() ||
864 (old->global() == added->global()
865 && LocalIndexComparator<TL>::compare(old->local(),added->local())))
866 {
867 tempPairs.push_back(*old);
868 old.eraseToHere();
869 continue;
870 }else
871 {
872 tempPairs.push_back(*added);
873 added.eraseToHere();
874 }
875 }
876 }
877
878 while(old != endold)
879 {
880 if(old->local().state()!=DELETED) {
881 tempPairs.push_back(*old);
882 }
883 old.eraseToHere();
884 }
885
886 while(added!= endadded)
887 {
888 tempPairs.push_back(*added);
889 added.eraseToHere();
890 }
891 localIndices_ = tempPairs;
892 }
893 }
894
895
896 template<class TG, class TL, int N>
897 inline const IndexPair<TG,TL>&
898 ParallelIndexSet<TG,TL,N>::at(const TG& global) const
899 {
900 // perform a binary search
901 int low=0, high=localIndices_.size()-1, probe=-1;
902
903 while(low<high)
904 {
905 probe = (high + low) / 2;
906 if(global <= localIndices_[probe].global())
907 high = probe;
908 else
909 low = probe+1;
910 }
911
912 if(probe==-1)
913 DUNE_THROW(RangeError, "No entries!");
914
915 if( localIndices_[low].global() != global)
916 DUNE_THROW(RangeError, "Could not find entry of "<<global);
917 else
918 return localIndices_[low];
919 }
920
921 template<class TG, class TL, int N>
922 inline const IndexPair<TG,TL>&
923 ParallelIndexSet<TG,TL,N>::operator[](const TG& global) const
924 {
925 // perform a binary search
926 int low=0, high=localIndices_.size()-1, probe=-1;
927
928 while(low<high)
929 {
930 probe = (high + low) / 2;
931 if(global <= localIndices_[probe].global())
932 high = probe;
933 else
934 low = probe+1;
935 }
936
937 return localIndices_[low];
938 }
939 template<class TG, class TL, int N>
940 inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::at(const TG& global)
941 {
942 // perform a binary search
943 int low=0, high=localIndices_.size()-1, probe=-1;
944
945 while(low<high)
946 {
947 probe = (high + low) / 2;
948 if(localIndices_[probe].global() >= global)
949 high = probe;
950 else
951 low = probe+1;
952 }
953
954 if(probe==-1)
955 DUNE_THROW(RangeError, "No entries!");
956
957 if( localIndices_[low].global() != global)
958 DUNE_THROW(RangeError, "Could not find entry of "<<global);
959 else
960 return localIndices_[low];
961 }
962
963 template<class TG, class TL, int N>
964 inline bool ParallelIndexSet<TG,TL,N>::exists (const TG& global) const
965 {
966 // perform a binary search
967 int low=0, high=localIndices_.size()-1, probe=-1;
968
969 while(low<high)
970 {
971 probe = (high + low) / 2;
972 if(localIndices_[probe].global() >= global)
973 high = probe;
974 else
975 low = probe+1;
976 }
977
978 if(probe==-1)
979 return false;
980
981 if( localIndices_[low].global() != global)
982 return false;
983 return true;
984 }
985
986 template<class TG, class TL, int N>
987 inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::operator[](const TG& global)
988 {
989 // perform a binary search
990 int low=0, high=localIndices_.size()-1, probe=-1;
991
992 while(low<high)
993 {
994 probe = (high + low) / 2;
995 if(localIndices_[probe].global() >= global)
996 high = probe;
997 else
998 low = probe+1;
999 }
1000
1001 return localIndices_[low];
1002 }
1003 template<class TG, class TL, int N>
1004 inline typename ParallelIndexSet<TG,TL,N>::iterator
1006 {
1007 return iterator(*this, localIndices_.begin());
1008 }
1009
1010
1011 template<class TG, class TL, int N>
1012 inline typename ParallelIndexSet<TG,TL,N>::iterator
1014 {
1015 return iterator(*this,localIndices_.end());
1016 }
1017
1018 template<class TG, class TL, int N>
1021 {
1022 return localIndices_.begin();
1023 }
1024
1025
1026 template<class TG, class TL, int N>
1029 {
1030 return localIndices_.end();
1031 }
1032
1033 template<class TG, class TL, int N>
1035#ifndef NDEBUG
1036 if(state_==RESIZE)
1037 DUNE_THROW(InvalidIndexSetState, "IndexSet has to be in "
1038 <<"GROUND state for renumberLocal()");
1039#endif
1040
1041 typedef typename ArrayList<IndexPair,N>::iterator iterator;
1042 const const_iterator end_ = end();
1043 uint32_t index=0;
1044
1045 for(iterator pair=begin(); pair!=end_; index++, ++pair)
1046 pair->local()=index;
1047 }
1048
1049 template<class TG, class TL, int N>
1050 inline int ParallelIndexSet<TG,TL,N>::seqNo() const
1051 {
1052 return seqNo_;
1053 }
1054
1055 template<class TG, class TL, int N>
1056 inline size_t ParallelIndexSet<TG,TL,N>::size() const
1057 {
1058 return localIndices_.size();
1059 }
1060
1061 template<class I>
1062 GlobalLookupIndexSet<I>::GlobalLookupIndexSet(const I& indexset,
1063 std::size_t size)
1064 : indexSet_(indexset), size_(size),
1065 indices_(size_, static_cast<const IndexPair*>(0))
1066 {
1067 const_iterator end_ = indexSet_.end();
1068
1069 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair) {
1070 assert(pair->local()<size_);
1071 indices_[pair->local()] = &(*pair);
1072 }
1073 }
1074
1075 template<class I>
1076 GlobalLookupIndexSet<I>::GlobalLookupIndexSet(const I& indexset)
1077 : indexSet_(indexset), size_(0)
1078 {
1079 const_iterator end_ = indexSet_.end();
1080 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
1081 size_=std::max(size_,static_cast<std::size_t>(pair->local()));
1082
1083 indices_.resize(++size_, 0);
1084
1085 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
1086 indices_[pair->local()] = &(*pair);
1087 }
1088
1089 template<class I>
1090 GlobalLookupIndexSet<I>::~GlobalLookupIndexSet()
1091 {}
1092
1093 template<class I>
1094 inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>*
1095 GlobalLookupIndexSet<I>::pair(const std::size_t& local) const
1096 {
1097 return indices_[local];
1098 }
1099
1100 template<class I>
1101 inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>&
1102 GlobalLookupIndexSet<I>::operator[](const GlobalIndex& global) const
1103 {
1104 return indexSet_[global];
1105 }
1106
1107 template<class I>
1108 typename I::const_iterator GlobalLookupIndexSet<I>::begin() const
1109 {
1110 return indexSet_.begin();
1111 }
1112
1113 template<class I>
1114 typename I::const_iterator GlobalLookupIndexSet<I>::end() const
1115 {
1116 return indexSet_.end();
1117 }
1118
1119 template<class I>
1120 inline size_t GlobalLookupIndexSet<I>::size() const
1121 {
1122 return size_;
1123 }
1124
1125 template<class I>
1126 inline int GlobalLookupIndexSet<I>::seqNo() const
1127 {
1128 return indexSet_.seqNo();
1129 }
1130
1131 template<typename TG, typename TL, int N, typename TG1, typename TL1, int N1>
1132 bool operator==(const ParallelIndexSet<TG,TL,N>& idxset,
1133 const ParallelIndexSet<TG1,TL1,N1>& idxset1)
1134 {
1135 if(idxset.size()!=idxset1.size())
1136 return false;
1137 typedef typename ParallelIndexSet<TG,TL,N>::const_iterator Iter;
1138 typedef typename ParallelIndexSet<TG1,TL1,N1>::const_iterator Iter1;
1139 Iter iter=idxset.begin();
1140 for(Iter1 iter1=idxset1.begin(); iter1 != idxset1.end(); ++iter, ++iter1) {
1141 if(iter1->global()!=iter->global())
1142 return false;
1143 typedef typename ParallelIndexSet<TG,TL,N>::LocalIndex PI;
1144 const PI& pi=iter->local(), pi1=iter1->local();
1145
1146 if(pi!=pi1)
1147 return false;
1148 }
1149 return true;
1150 }
1151
1152 template<typename TG, typename TL, int N, typename TG1, typename TL1, int N1>
1153 bool operator!=(const ParallelIndexSet<TG,TL,N>& idxset,
1154 const ParallelIndexSet<TG1,TL1,N1>& idxset1)
1155 {
1156 return !(idxset==idxset1);
1157 }
1158
1159
1160#endif // DOXYGEN
1161
1162}
1163#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:256
A dynamically growing random access list.
Definition: arraylist.hh:60
A constant random access iterator for the Dune::ArrayList class.
Definition: arraylist.hh:377
Decorates an index set with the possibility to find a global index that is mapped to a specific local...
Definition: indexset.hh:508
A pair consisting of a global and local index.
Definition: indexset.hh:84
Exception indicating that the index set is not in the expected state.
Definition: indexset.hh:204
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:279
The iterator over the pairs.
Definition: indexset.hh:258
Manager class for the mapping between local indices and globally unique indices.
Definition: indexset.hh:217
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:180
void renumberLocal()
Renumbers the local index numbers.
bool exists(const GlobalIndex &global) const
Find the index pair with a specific global id.
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:297
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.
const IndexPair & at(const GlobalIndex &global) const
Find the index pair with a specific global id.
GlobalLookupIndexSet(const ParallelIndexSet &indexset)
Constructor.
TL LocalIndex
the type of the local index.
Definition: indexset.hh:119
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:528
const_iterator begin() const
Get an iterator over the indices positioned at the first index.
const IndexPair & operator[](const GlobalIndex &global) const
Find the index pair with a specific global id.
const ParallelIndexSetState & state()
Get the state the index set is in.
Definition: indexset.hh:308
const_iterator begin() const
Get an iterator over the indices positioned at the first index.
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:513
TL LocalIndex
The type of the local index, e.g. ParallelLocalIndex.
Definition: indexset.hh:238
void markAsDeleted(const iterator &position)
Mark an index as deleted.
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition: indexset.hh:518
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.
void add(const GlobalIndex &global, const LocalIndex &local)
Add an new index to the set.
const_iterator end() const
Get an iterator over the indices positioned after the last 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:225
std::ostream & operator<<(std::ostream &os, const ParallelIndexSet< TG, TL, N > &indexSet)
Print an index set.
Definition: indexset.hh:645
TG GlobalIndex
the type of the global index.
Definition: indexset.hh:106
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:523
Dune::IndexPair< GlobalIndex, LocalIndex > IndexPair
The type of the pair stored.
Definition: indexset.hh:243
@ RESIZE
Indicates that the index set is currently being resized.
Definition: indexset.hh:189
@ GROUND
The default mode. Indicates that the index set is ready to be used.
Definition: indexset.hh:185
@ arraySize
The size of the individual arrays in the underlying ArrayList.
Definition: indexset.hh:252
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentionally unused function parameters with.
Definition: unused.hh:25
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:635
EnableIfInterOperable< T1, T2, bool >::type operator>(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:681
EnableIfInterOperable< T1, T2, bool >::type operator<=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:658
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:235
EnableIfInterOperable< T1, T2, bool >::type operator>=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:703
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:257
auto max(ADLTag< 0 >, const V &v1, const V &v2)
implements binary Simd::max()
Definition: defaults.hh:79
Provides classes for use as the local index in ParallelIndexSet.
Dune namespace.
Definition: alignedallocator.hh:14
A traits class describing the mapping of types onto MPI_Datatypes.
Definition: mpitraits.hh:38
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)