1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #include "cellneighbouriterator.h"
23 CellNeighbourIterator::CellNeighbourIterator()
29 void CellNeighbourIterator::operate()
34 pair
[0].item2
= start
;
35 if (_cells
[pair
[0].item2
] < 0) {
36 pair
[0].item2
= cells
[0];
38 pair
[0].terminate
= false;
39 mark2
.fill(false, cells
.size());
41 while (pair
.size() > 0) {
42 mark1
.fill(false, cells
.size());
48 for (int i
= 0; i
< pair
.size(); ++i
) {
49 if (!pair
[i
].terminate
) {
50 mark1
[_cells
[pair
[i
].item2
]] = true;
55 for (int i
= 0; i
< cells
.size(); ++i
) {
64 for (int i
= 0; i
< cells
.size(); ++i
) {
72 for (int i
= 0; i
< item
.size(); ++i
) {
73 mark2
[_cells
[item
[i
]]] = true;
77 for (int i
= 0; i
< item
.size(); ++i
) {
78 for (int j
= 0; j
< c2c
[_cells
[item
[i
]]].size(); ++j
) {
79 if (c2c
[_cells
[item
[i
]]][j
] >= 0) {
80 if (!mark2
[c2c
[_cells
[item
[i
]]][j
]]) {
88 for (int i
= 0; i
< item
.size(); ++i
) {
89 for (int j
= 0; j
< c2c
[_cells
[item
[i
]]].size(); ++j
) {
90 if (c2c
[_cells
[item
[i
]]][j
] >= 0) {
91 if (!mark2
[c2c
[_cells
[item
[i
]]][j
]]) {
92 pair
[N
].item1
= item
[i
];
93 pair
[N
].item2
= cells
[c2c
[_cells
[item
[i
]]][j
]];
94 pair
[N
].terminate
= false;