LoAdSG
depthIterator.h
1//
2// Created by to35jepo on 5/8/23.
3//
4
5#ifndef RUN_DEPTHITERATOR_H
6#define RUN_DEPTHITERATOR_H
7
8
9#include "../sgrid/sparseGrid.h"
10
11class DepthList {
12
13public:
14 DepthList(AdaptiveSparseGrid_Base& grid){
15
16 for(unsigned long k=0; k<grid.getMaximalOccupiedSecondTable(); k++){
17 IndexDimension I = grid.getIndexOfTable(k);
18 Depth T(I);
19
20
21 bool addT = true;
22 for (auto it = mylist.begin(); it != mylist.end(); ++it) {
23 if(*it==T){
24 addT = false;
25 break;
26 }
27 }
28 //auto it = std::find(mylist.begin(), mylist.end(), T);
29
30 if (addT) {
31 mylist.push_back(T);
32 }
33 }
34
35 int ret=0;
36
37
38 for (auto it = mylist.begin(); it != mylist.end(); ++it) {
39 int sum = 0;
40 for(int d=0;d<DimensionSparseGrid;d++){
41 sum+=it->at(d);
42 if(MaxDepth.at(d)<it->at(d))
43 MaxDepth.set(it->at(d),d);
44 }
45 if(ret<sum)ret=sum;
46
47 }
48
49 maxLOne=ret;
50 }
51
52 bool isIncluded(Depth T){
53 auto it = std::find(mylist.begin(), mylist.end(), T);
54 if (it != mylist.end()) {
55 return true;
56 }
57 return false;
58 }
59
60
61 int getMaxLOne() {
62 return maxLOne;
63 }
64
65 Depth getMaxDepth(){
66 return MaxDepth;
67 }
68
69 std::list<Depth>::iterator begin_all(){
70 return mylist.begin();
71 }
72
73 std::list<Depth>::iterator end_all(){
74 return mylist.end();
75 }
76
77 std::list<Depth>::iterator begin_sorted(){
78 return sortedlist.begin();
79 }
80
81 std::list<Depth>::iterator end_sorted(){
82 return sortedlist.end();
83 }
84
85
86 void recursiveDepth(bool *Restrictions, bool checkProlongation, int d, Depth *T);
87
88 void recursiveDepthNeumann(bool *Restrictions, bool checkProlongation, int d, Depth *T);
89
90 void sortDepths(bool *Restrictions);
91
92 void sortDepthsNeumann(bool *Restrictions);
93
94 void sortFineToCoarse();
95
96
97 std::list<Depth> *getAllDepths() { return &mylist; }
98 std::list<Depth> *getSortierteTiefen() { return &sortedlist; }
99
100private:
101 std::list<Depth> mylist;
102 std::list<Depth> sortedlist;
103 int maxLOne;
104 Depth MaxDepth;
105
106};
107
108
109#endif //RUN_DEPTHITERATOR_H
Definition sparseGrid.h:86
IndexDimension getIndexOfTable(unsigned long i)
Definition sparseGrid.h:566