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 "celllayeriterator.h"
25 void CellLayerIterator::operate()
27 QVector
<vtkIdType
> surf_cells
, surf_nodes
;
28 QVector
<int> _surf_nodes
;
30 custom_iteration
= true;
31 getAllCells(cells
, m_Grid
);
34 getSurfaceCells(m_BoundaryCodes
, surf_cells
, m_Grid
);
35 getNodesFromCells(surf_cells
, surf_nodes
, m_Grid
);
36 createNodeMapping(surf_nodes
, _surf_nodes
, m_Grid
);
39 item
.resize(surf_cells
.size());
40 pair
.resize(surf_cells
.size());
41 for (int i_scell
= 0; i_scell
< surf_cells
.size(); ++i_scell
) {
42 vtkIdType id_cell1
= surf_cells
[i_scell
];
43 pair
[i_scell
].item1
= id_cell1
;
44 EG_GETPTS(pts
, id_cell1
, m_Grid
);
47 foreach (int i_cells_a
, n2c
[_nodes
[pts
[0]]]) {
48 vtkIdType id_cell_a
= cells
[i_cells_a
];
49 if (!isSurface(id_cell_a
, m_Grid
)) {
51 for (int i
= 1; i
< Npts
; ++i
) {
54 foreach (int i_cells_b
, n2c
[_nodes
[pts
[i
]]]) {
55 vtkIdType id_cell_b
= cells
[i_cells_b
];
56 if (id_cell_a
== id_cell_b
) {
65 pair
[i_scell
].item2
= id_cell_a
;
66 pair
[i_scell
].terminate
= false;
76 mark2
.fill(false, cells
.size());
80 while (pair
.size() > 0) {
81 mark1
.fill(false, cells
.size());
83 for (int i
= 0; i
< pair
.size(); ++i
) {
84 if (!pair
[i
].terminate
) {
85 mark1
[_cells
[pair
[i
].item2
]] = true;
88 for (int i
= 0; i
< pair
.size(); ++i
) {
89 if (pair
[i
].terminate
) {
90 mark1
[_cells
[pair
[i
].item2
]] = false;
95 for (int i
= 0; i
< cells
.size(); ++i
) {
104 for (int i
= 0; i
< cells
.size(); ++i
) {
112 for (int i
= 0; i
< item
.size(); ++i
) {
113 mark2
[_cells
[item
[i
]]] = true;
117 for (int i
= 0; i
< item
.size(); ++i
) {
118 for (int j
= 0; j
< c2c
[_cells
[item
[i
]]].size(); ++j
) {
119 if (c2c
[_cells
[item
[i
]]][j
] >= 0) {
120 if (!mark2
[c2c
[_cells
[item
[i
]]][j
]]) {
128 for (int i
= 0; i
< item
.size(); ++i
) {
129 for (int j
= 0; j
< c2c
[_cells
[item
[i
]]].size(); ++j
) {
130 if (c2c
[_cells
[item
[i
]]][j
] >= 0) {
131 if (!mark2
[c2c
[_cells
[item
[i
]]][j
]]) {
132 pair
[N
].item1
= item
[i
];
133 pair
[N
].item2
= cells
[c2c
[_cells
[item
[i
]]][j
]];
134 pair
[N
].terminate
= false;