LoAdSG
CellStructure.h
1#ifndef CELLSTRUCTURE_H
2#define CELLSTRUCTURE_H
3
4#include "SingleDepthCellStructure.h"
5#include "../iterator/depthIterator.h"
6#include "iterator_neu.h"
7
8class CellData{
9
10
11private:
12
13 std::unordered_multimap<unsigned long,SingleDepthHashCellStructure> _map;
15
16
17
18
19
20public:
21 bool addPoint(const CellDimension &key);
22
23 CellData(AdaptiveSparseGrid_Base &grid):gridBase(grid){
24
25 CellDimension bottomLeft, topRight;
26
27
28 DepthList depthList(grid);
29
30 for (auto it = depthList.begin_all(); it != depthList.end_all(); ++it){
31 Depth T = *it;
32
33 for(int d=0; d<DimensionSparseGrid;d++){
34 bottomLeft.replace(d, Static_CellOneD::nextRight(0,T.at(d)+1));
35 topRight.replace(d,Static_CellOneD::nextLeft(1,T.at(d)+1));
36 }
37 for(RectangularIteratorCells iteratorCells(bottomLeft,topRight); iteratorCells.goon(); ++iteratorCells){
38 CellDimension cellDimension = iteratorCells.getCell();
39 if(cellingrid(cellDimension,grid))
40 addPoint(cellDimension);
41 }
42
43
44
45
46
47 }
48
49 }
50
51 bool cellingrid(CellDimension cell, AdaptiveSparseGrid_Base& grid){
52
53
54 CellIndexIterator cellIndexIterator(&cell);
55 for(;cellIndexIterator.goon(); ++cellIndexIterator){
56 IndexDimension Index = cellIndexIterator.getIndex();
57 unsigned long k;
58 if(Index.isNotAtBoundary() && !(grid.occupied(k,Index))) return false;
59 }
60 return true;
61 }
62 std::unordered_multimap<unsigned long,SingleDepthHashCellStructure>* getMap(){return &_map;};
63
64 SingleDepthHashCellStructure& getGridForDepth(const Depth &D);
65 vector<SingleDepthHashCellStructure*> getAllCells();
66
67 int countCells();
68
69
70 unsigned long hash(Depth D);
71
72
73};
74
75
76
77
78
79
80#endif
Definition sparseGrid.h:86
bool occupied(unsigned long &indexOfData, IndexDimension I)
Definition sparseGrid.h:465