2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008 Oliver Gloth +
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 "vtkEgBoundaryCodesFilter.h"
25 #include <vtkObjectFactory.h>
26 #include <vtkInformation.h>
27 #include <vtkDataObject.h>
28 #include <vtkPolyData.h>
29 #include <vtkUnstructuredGrid.h>
30 #include <vtkSmartPointer.h>
31 #include <vtkCellData.h>
32 #include <vtkIntArray.h>
34 vtkStandardNewMacro(vtkEgBoundaryCodesFilter
);
36 void vtkEgBoundaryCodesFilter::ExecuteEg()
38 // the coordinates of the nodes
39 allocateGrid(output
, input
->GetNumberOfCells(), input
->GetNumberOfPoints());
40 for (vtkIdType vertId
= 0; vertId
< input
->GetNumberOfPoints(); ++vertId
) {
42 input
->GetPoints()->GetPoint(vertId
,x
);
43 output
->GetPoints()->SetPoint(vertId
,x
);
44 copyNodeData(input
, vertId
, output
, vertId
);
47 EG_VTKDCC(vtkIntArray
,cell_code
,input
,"cell_code");
50 for (vtkIdType cellId
= 0; cellId
< input
->GetNumberOfCells(); ++cellId
) {
54 if (!cell_code
|| !BoundaryCodes
) {
56 } else if (BoundaryCodes
->contains(cell_code
->GetValue(cellId
))) {
57 if (input
->GetCellType(cellId
) == VTK_TRIANGLE
) add
= true;
58 if (input
->GetCellType(cellId
) == VTK_QUAD
) add
= true;
61 input
->GetCellPoints(cellId
,npts
,pts
);
62 vtkIdType newCell
= output
->InsertNextCell(input
->GetCellType(cellId
),npts
,pts
);
63 copyCellData(input
, cellId
, output
, newCell
);