2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2010 enGits GmbH +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #include "cellneighbouriterator.h"
25 CellNeighbourIterator::CellNeighbourIterator()
31 void CellNeighbourIterator::operate()
36 pair
[0].item2
= start
;
37 if (_cells
[pair
[0].item2
] < 0) {
38 pair
[0].item2
= cells
[0];
40 pair
[0].terminate
= false;
41 mark2
.fill(false, cells
.size());
43 while (pair
.size() > 0) {
44 mark1
.fill(false, cells
.size());
50 for (int i
= 0; i
< pair
.size(); ++i
) {
51 if (!pair
[i
].terminate
) {
52 mark1
[_cells
[pair
[i
].item2
]] = true;
55 for (int i
= 0; i
< pair
.size(); ++i
) {
56 if (pair
[i
].terminate
) {
57 mark1
[_cells
[pair
[i
].item2
]] = false;
62 for (int i
= 0; i
< cells
.size(); ++i
) {
71 for (int i
= 0; i
< cells
.size(); ++i
) {
79 for (int i
= 0; i
< item
.size(); ++i
) {
80 mark2
[_cells
[item
[i
]]] = true;
84 for (int i
= 0; i
< item
.size(); ++i
) {
85 for (int j
= 0; j
< c2c
[_cells
[item
[i
]]].size(); ++j
) {
86 if (c2c
[_cells
[item
[i
]]][j
] >= 0) {
87 if (!mark2
[c2c
[_cells
[item
[i
]]][j
]]) {
95 for (int i
= 0; i
< item
.size(); ++i
) {
96 for (int j
= 0; j
< c2c
[_cells
[item
[i
]]].size(); ++j
) {
97 if (c2c
[_cells
[item
[i
]]][j
] >= 0) {
98 if (!mark2
[c2c
[_cells
[item
[i
]]][j
]]) {
99 pair
[N
].item1
= item
[i
];
100 pair
[N
].item2
= cells
[c2c
[_cells
[item
[i
]]][j
]];
101 pair
[N
].terminate
= false;