fixed edge display for volume cells
[engrid-github.git] / src / libengrid / nodelayeriterator.cpp
blob384d7e9d71e82a4e1d878e23207fcbfb07a5f2ea
1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 // + +
3 // + This file is part of enGrid. +
4 // + +
5 // + Copyright 2008-2014 enGits GmbH +
6 // + +
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. +
11 // + +
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. +
16 // + +
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/>. +
19 // + +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #include "nodelayeriterator.h"
23 void NodeLayerIterator::operate()
25 getCells();
26 getSurfaceCells(m_BoundaryCodes, surface_cells, m_Grid);
27 getNodesFromCells(surface_cells, surf_nodes, m_Grid);
28 createNodeMapping(surf_nodes, _surf_nodes, m_Grid);
29 mark2.fill(false, nodes.size());
31 // create pairs for first layer
32 pair.resize(surf_nodes.size());
33 for (int i = 0; i < surf_nodes.size(); ++i) {
34 pair[i].item1 = -1;
35 pair[i].item2 = surf_nodes[i];
36 pair[i].terminate = false;
39 first_layer = true;
40 while (pair.size() > 0) {
41 mark1.fill(false, nodes.size());
42 pass1();
43 for (int i = 0; i < pair.size(); ++i) {
44 if (!pair[i].terminate) {
45 mark1[_nodes[pair[i].item2]] = true;
48 for (int i = 0; i < pair.size(); ++i) {
49 if (pair[i].terminate) {
50 mark1[_nodes[pair[i].item2]] = false;
54 int N = 0;
55 for (int i = 0; i < nodes.size(); ++i) {
56 if (mark1[i]) {
57 ++N;
60 item.resize(N);
63 int j = 0;
64 for (int i = 0; i < nodes.size(); ++i) {
65 if (mark1[i]) {
66 item[j] = nodes[i];
67 ++j;
71 pass2();
72 foreach (vtkIdType nodeId, item) {
73 mark2[_nodes[nodeId]] = true;
76 int N = 0;
77 for (int i = 0; i < item.size(); ++i) {
78 foreach (int j, n2n[_nodes[item[i]]]) {
79 if (!mark2[j]) {
80 ++N;
84 pair.resize(N);
85 N = 0;
86 for (int i = 0; i < item.size(); ++i) {
87 foreach (int j, n2n[_nodes[item[i]]]) {
88 if (!mark2[j]) {
89 pair[N].item1 = item[i];
90 pair[N].item2 = nodes[j];
91 pair[N].terminate = false;
92 ++N;
97 first_layer = false;