OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GridIteratorComponent.h
Go to the documentation of this file.
1#pragma once
3
5{
6private:
7 index_t _resetDistance;
8 index_t _stepWidth;
9
10protected:
14
15 void SetResetDistance() { _resetDistance = (-_endPoint + _startPoint) * _stepWidth; };
16public:
17 //Vll friend von grid um zu checken ob endpoint auch nicht die dimensionen überschreitet.
18 GridIteratorComponent(index_t startPoint, index_t endPoint, index_t stepWidth)
19 : _startPoint(startPoint), _endPoint(endPoint), _stepWidth(stepWidth), _currentPoint(startPoint)
20 {
22 };
24
25 bool HasNext() const
26 {
27 bool hasNext = _currentPoint < _endPoint;
28 return hasNext;
29 };
30
31 /*
32 !ACHTUNG! Konzeptbruch !ACHTUNG!
33 HasNext bezieht sich auf _endPoint welches eine Information vom Subvolumen ist. HasPrior schaut nun auf das gesammte Rechengebiet.
34 Hack für ResultFilterSourceVektorVolumeEdgeToNode.
35 */
36 bool HasPrior()const
37 {
38 bool hasPrior = _currentPoint > 0;
39 return hasPrior;
40 }
41
42 void SetToNext(index_t & index)
43 {
44 index += _stepWidth;
46 };
48 {
49 index += _resetDistance;
51 };
52
53 index_t GetNextTo(index_t index) { return index + _stepWidth; };
54 index_t GetPreviousTo(index_t index) { return index - _stepWidth; };
55
56 index_t GetStartPoint() const { return _startPoint; };
57 index_t GetEndPoint()const { return _endPoint; };
58
59 index_t GetStepwidth() const { return _stepWidth; };
60};
int64_t index_t
Definition SystemDependentDefines.h:13
Definition GridIteratorComponent.h:5
index_t GetStartPoint() const
Definition GridIteratorComponent.h:56
void SetFromLastToFirst(index_t &index)
Definition GridIteratorComponent.h:47
bool HasPrior() const
Definition GridIteratorComponent.h:36
void SetToNext(index_t &index)
Definition GridIteratorComponent.h:42
GridIteratorComponent(index_t startPoint, index_t endPoint, index_t stepWidth)
Definition GridIteratorComponent.h:18
index_t GetNextTo(index_t index)
Definition GridIteratorComponent.h:53
index_t GetStepwidth() const
Definition GridIteratorComponent.h:59
index_t _startPoint
Definition GridIteratorComponent.h:12
void SetResetDistance()
Definition GridIteratorComponent.h:15
index_t GetPreviousTo(index_t index)
Definition GridIteratorComponent.h:54
index_t _currentPoint
Definition GridIteratorComponent.h:11
virtual ~GridIteratorComponent()
Definition GridIteratorComponent.h:23
index_t _endPoint
Definition GridIteratorComponent.h:13
bool HasNext() const
Definition GridIteratorComponent.h:25
index_t GetEndPoint() const
Definition GridIteratorComponent.h:57