LoAdSG
komponente.h
1//
2// Created by scherner on 01.03.21.
3//
4
5#ifndef GRUN_KOMPONENTE_H
6#define GRUN_KOMPONENTE_H
7#include "sparseGrid.h"
8
9
10
11
12class ZusammenhangsKomponente {
13public:
14 ZusammenhangsKomponente(AdaptiveSparseGrid_Base *grid_, Depth T_);
15
16 ~ZusammenhangsKomponente() { delete[] marker; };
17 enum Marker {
18 nicht, arbeite
19 };
20
24 unsigned long findAnicht(unsigned long iNow, unsigned long& iNow_mapping);
25
31 IndexDimension StartSearchComponent(unsigned long iNow) {
32
33 maxIndex = grid->getIndexOfTable(iNow);
34 minIndex = maxIndex;
35 T = Depth(maxIndex);
36 return minIndex;
37
38 };
39
40 IndexDimension getMinIndex() { return minIndex; };
41
42 IndexDimension getMaxIndex() { return maxIndex; };
43
44 Depth getDepth() { return T; };
45
46
47 virtual void recursiveMarkArbeite(IndexDimension indexNow, unsigned long iNow);
48
49protected:
51 Marker *marker;
52 unsigned long secondTableLength;
53
54 IndexDimension maxIndex;
55 IndexDimension minIndex;
56
57 Depth T;
58};
59
60
61class ZusammenhangsKomponente_Neumann : public ZusammenhangsKomponente {
62public:
63 ZusammenhangsKomponente_Neumann(AdaptiveSparseGrid_Base *grid_, Depth T_) : ZusammenhangsKomponente(grid_, T_) {};
64
65 inline void recursiveMarkArbeite(IndexDimension indexNow, unsigned long iNow) {
66 marker[iNow] = arbeite;
67
68
69 //Rekursion
70 for (MultiDimFiveCompass mc; mc.goon(); ++mc) {
71 double val;
72 IndexDimension J = indexNow.nextFive_Neumann(&mc, T, &val);
73
74 unsigned long indexOfData;
75 if (grid->occupied(indexOfData, J)) {
76 if (grid->workonindex(indexOfData)) {
77
78 Marker m = marker[indexOfData];
79 if (m != arbeite) {
80 if (Depth(J) == T) {
81 maxIndex = IndexDimension::Maximum(maxIndex, J);
82 minIndex = IndexDimension::Minimum(minIndex, J);
83 recursiveMarkArbeite(J, indexOfData);
84 } else {
85
86 maxIndex = IndexDimension::Maximum(maxIndex, J);
87 minIndex = IndexDimension::Minimum(minIndex, J);
88 }
89 }
90 }
91 }
92 }
93 //max min erneuern -> wichtig: Tiefe ändert sich dadurch nicht
94 maxIndex = IndexDimension::Maximum(maxIndex, indexNow);
95 minIndex = IndexDimension::Minimum(minIndex, indexNow);
96 };
97
98 inline void markArbeite(unsigned long iNow) {
99 marker[iNow] = arbeite;
100 }
101};
102
103
104#endif //GRUN_KOMPONENTE_H
Definition sparseGrid.h:86
Definition index.h:436