2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008,2009 Oliver Gloth +
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 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
27 // + This file is part of enGrid. +
29 // + Copyright 2008 Oliver Gloth +
31 // + enGrid is free software: you can redistribute it and/or modify +
32 // + it under the terms of the GNU General Public License as published by +
33 // + the Free Software Foundation, either version 3 of the License, or +
34 // + (at your option) any later version. +
36 // + enGrid is distributed in the hope that it will be useful, +
37 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
38 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
39 // + GNU General Public License for more details. +
41 // + You should have received a copy of the GNU General Public License +
42 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
44 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46 #include "celllayeriterator.h"
48 void CellLayerIterator::operate()
50 QVector
<vtkIdType
> surf_cells
, surf_nodes
;
51 QVector
<int> _surf_nodes
;
53 custom_iteration
= true;
54 getAllCells(cells
, grid
);
57 getSurfaceCells(boundary_codes
, surf_cells
, grid
);
58 getNodesFromCells(surf_cells
, surf_nodes
, grid
);
59 createNodeMapping(surf_nodes
, _surf_nodes
, grid
);
62 item
.resize(surf_cells
.size());
63 pair
.resize(surf_cells
.size());
64 for (int i_scell
= 0; i_scell
< surf_cells
.size(); ++i_scell
) {
65 vtkIdType id_cell1
= surf_cells
[i_scell
];
66 pair
[i_scell
].item1
= id_cell1
;
67 EG_GETPTS(pts
, id_cell1
, grid
);
70 foreach (int i_cells_a
, n2c
[_nodes
[pts
[0]]]) {
71 vtkIdType id_cell_a
= cells
[i_cells_a
];
72 if (!isSurface(id_cell_a
, grid
)) {
74 for (int i
= 1; i
< Npts
; ++i
) {
77 foreach (int i_cells_b
, n2c
[_nodes
[pts
[i
]]]) {
78 vtkIdType id_cell_b
= cells
[i_cells_b
];
79 if (id_cell_a
== id_cell_b
) {
88 pair
[i_scell
].item2
= id_cell_a
;
89 pair
[i_scell
].terminate
= false;
99 mark2
.fill(false, cells
.size());
103 while (pair
.size() > 0) {
104 mark1
.fill(false, cells
.size());
106 for (int i
= 0; i
< pair
.size(); ++i
) {
107 if (!pair
[i
].terminate
) {
108 mark1
[_cells
[pair
[i
].item2
]] = true;
111 for (int i
= 0; i
< pair
.size(); ++i
) {
112 if (pair
[i
].terminate
) {
113 mark1
[_cells
[pair
[i
].item2
]] = false;
118 for (int i
= 0; i
< cells
.size(); ++i
) {
127 for (int i
= 0; i
< cells
.size(); ++i
) {
135 for (int i
= 0; i
< item
.size(); ++i
) {
136 mark2
[_cells
[item
[i
]]] = true;
140 for (int i
= 0; i
< item
.size(); ++i
) {
141 for (int j
= 0; j
< c2c
[_cells
[item
[i
]]].size(); ++j
) {
142 if (c2c
[_cells
[item
[i
]]][j
] >= 0) {
143 if (!mark2
[c2c
[_cells
[item
[i
]]][j
]]) {
151 for (int i
= 0; i
< item
.size(); ++i
) {
152 for (int j
= 0; j
< c2c
[_cells
[item
[i
]]].size(); ++j
) {
153 if (c2c
[_cells
[item
[i
]]][j
] >= 0) {
154 if (!mark2
[c2c
[_cells
[item
[i
]]][j
]]) {
155 pair
[N
].item1
= item
[i
];
156 pair
[N
].item2
= cells
[c2c
[_cells
[item
[i
]]][j
]];
157 pair
[N
].terminate
= false;