2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2013 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 "correctsurfaceorientation.h"
25 void CorrectSurfaceOrientation::pass1()
27 for (int i
= 0; i
< pair
.size(); ++i
) {
28 pair
[i
].terminate
= false;
29 if (pair
[i
].item1
>= 0) {
30 vtkIdType Npts1
, *pts1
;
31 vtkIdType Npts2
, *pts2
;
32 m_Grid
->GetCellPoints(pair
[i
].item1
, Npts1
, pts1
);
33 m_Grid
->GetCellPoints(pair
[i
].item2
, Npts2
, pts2
);
35 for (int j1
= 0; j1
< Npts1
; ++j1
) {
36 for (int j2
= 0; j2
< Npts2
; ++j2
) {
37 vtkIdType node_11
= pts1
[j1
];
38 vtkIdType node_21
= pts2
[j2
];
39 vtkIdType node_12
, node_22
;
40 if (j1
< Npts1
- 1) node_12
= pts1
[j1
+ 1];
41 else node_12
= pts1
[0];
42 if (j2
< Npts2
- 1) node_22
= pts2
[j2
+ 1];
43 else node_22
= pts2
[0];
44 if ((node_11
== node_22
) && (node_12
== node_21
)) {
51 QVector
<vtkIdType
> nodes(Npts2
);
52 for (vtkIdType j
= 0; j
< Npts2
; ++j
) nodes
[j
] = pts2
[j
];
53 for (vtkIdType j
= 0; j
< Npts2
; ++j
) pts2
[Npts2
- j
- 1] = nodes
[j
];