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 "celllayeriterator.h"
23 void CellLayerIterator::operate()
25 QVector
<vtkIdType
> surf_cells
, surf_nodes
;
26 QVector
<int> _surf_nodes
;
28 custom_iteration
= true;
29 getAllCells(cells
, m_Grid
);
32 getSurfaceCells(m_BoundaryCodes
, surf_cells
, m_Grid
);
33 getNodesFromCells(surf_cells
, surf_nodes
, m_Grid
);
34 createNodeMapping(surf_nodes
, _surf_nodes
, m_Grid
);
37 item
.resize(surf_cells
.size());
38 pair
.resize(surf_cells
.size());
39 for (int i_scell
= 0; i_scell
< surf_cells
.size(); ++i_scell
) {
40 vtkIdType id_cell1
= surf_cells
[i_scell
];
41 pair
[i_scell
].item1
= id_cell1
;
42 EG_GET_CELL(id_cell1
, m_Grid
);
45 foreach (int i_cells_a
, n2c
[_nodes
[pts
[0]]]) {
46 vtkIdType id_cell_a
= cells
[i_cells_a
];
47 if (!isSurface(id_cell_a
, m_Grid
)) {
49 for (int i
= 1; i
< num_pts
; ++i
) {
52 foreach (int i_cells_b
, n2c
[_nodes
[pts
[i
]]]) {
53 vtkIdType id_cell_b
= cells
[i_cells_b
];
54 if (id_cell_a
== id_cell_b
) {
63 pair
[i_scell
].item2
= id_cell_a
;
64 pair
[i_scell
].terminate
= false;
74 mark2
.fill(false, cells
.size());
78 while (pair
.size() > 0) {
79 mark1
.fill(false, cells
.size());
81 for (int i
= 0; i
< pair
.size(); ++i
) {
82 if (!pair
[i
].terminate
) {
83 mark1
[_cells
[pair
[i
].item2
]] = true;
86 for (int i
= 0; i
< pair
.size(); ++i
) {
87 if (pair
[i
].terminate
) {
88 mark1
[_cells
[pair
[i
].item2
]] = false;
93 for (int i
= 0; i
< cells
.size(); ++i
) {
102 for (int i
= 0; i
< cells
.size(); ++i
) {
110 for (int i
= 0; i
< item
.size(); ++i
) {
111 mark2
[_cells
[item
[i
]]] = true;
115 for (int i
= 0; i
< item
.size(); ++i
) {
116 for (int j
= 0; j
< c2c
[_cells
[item
[i
]]].size(); ++j
) {
117 if (c2c
[_cells
[item
[i
]]][j
] >= 0) {
118 if (!mark2
[c2c
[_cells
[item
[i
]]][j
]]) {
126 for (int i
= 0; i
< item
.size(); ++i
) {
127 for (int j
= 0; j
< c2c
[_cells
[item
[i
]]].size(); ++j
) {
128 if (c2c
[_cells
[item
[i
]]][j
] >= 0) {
129 if (!mark2
[c2c
[_cells
[item
[i
]]][j
]]) {
130 pair
[N
].item1
= item
[i
];
131 pair
[N
].item2
= cells
[c2c
[_cells
[item
[i
]]][j
]];
132 pair
[N
].terminate
= false;