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 "correctsurfaceorientation.h"
23 void CorrectSurfaceOrientation::pass1()
25 for (int i
= 0; i
< pair
.size(); ++i
) {
26 pair
[i
].terminate
= false;
27 if (pair
[i
].item1
>= 0) {
28 vtkIdType Npts1
, *pts1
;
29 vtkIdType Npts2
, *pts2
;
30 m_Grid
->GetCellPoints(pair
[i
].item1
, Npts1
, pts1
);
31 m_Grid
->GetCellPoints(pair
[i
].item2
, Npts2
, pts2
);
33 for (int j1
= 0; j1
< Npts1
; ++j1
) {
34 for (int j2
= 0; j2
< Npts2
; ++j2
) {
35 vtkIdType node_11
= pts1
[j1
];
36 vtkIdType node_21
= pts2
[j2
];
37 vtkIdType node_12
, node_22
;
38 if (j1
< Npts1
- 1) node_12
= pts1
[j1
+ 1];
39 else node_12
= pts1
[0];
40 if (j2
< Npts2
- 1) node_22
= pts2
[j2
+ 1];
41 else node_22
= pts2
[0];
42 if ((node_11
== node_22
) && (node_12
== node_21
)) {
49 QVector
<vtkIdType
> nodes(Npts2
);
50 for (vtkIdType j
= 0; j
< Npts2
; ++j
) nodes
[j
] = pts2
[j
];
51 for (vtkIdType j
= 0; j
< Npts2
; ++j
) pts2
[Npts2
- j
- 1] = nodes
[j
];