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 #ifndef __vtkEgGridFilter_h
22 #define __vtkEgGridFilter_h
24 class vtkEgGridFilter
;
26 #include <vtkUnstructuredGridAlgorithm.h>
27 #include <vtkUnstructuredGrid.h>
28 #include <vtkIntArray.h>
29 #include <vtkLongArray.h>
30 #include <vtkDoubleArray.h>
31 #include <vtkCellData.h>
32 #include <vtkCellType.h>
33 #include <vtkCellLinks.h>
34 #include <vtkObjectFactory.h>
39 #include "egvtkobject.h"
41 class vtkEgGridFilter
: public vtkUnstructuredGridAlgorithm
, public EgVtkObject
44 protected: // attributes
46 QSet
<int> m_BoundaryCodes
;
47 vtkUnstructuredGrid
*m_Input
;
48 vtkUnstructuredGrid
*m_Output
;
49 vtkUnstructuredGrid
*m_LastOutput
;
50 unsigned long m_LastRun
;
57 virtual int FillInputPortInformation(int, vtkInformation
* info
);
58 virtual int FillOutputPortInformation(int, vtkInformation
* info
);
59 virtual int RequestData(vtkInformation
*, vtkInformationVector
** inputVector
, vtkInformationVector
* outputVector
);
61 virtual void ExecuteEg() = 0;
64 * Extract boundary elements and nodes with a given set of boundary conditions
65 * @param cells On return, this will contain the indexes of the extracted boundary elements.
66 * @param modes On return, this will contain the indexes of the extracted boundary nodes.
67 * @param grid The grid to operate on.
68 * @param bc_c A Qt container with the boundary conditions to extract.
70 void ExtractBoundary(QVector
<vtkIdType
> &cells
, QVector
<vtkIdType
> &nodes
, QSet
<int> &bc_c
, vtkUnstructuredGrid
*grid
);
75 void SetBoundaryCodes(const C
& bc
);
76 virtual void Update() { vtkAlgorithm::Update(); ExecuteEg(); }
81 void vtkEgGridFilter::SetBoundaryCodes(const C
&bc_c
)
86 foreach (int bc
, bc_c
) {
90 if (m_BoundaryCodes
.size() != bc_set
.size()) {
93 QSet
<int> bc_inters
= m_BoundaryCodes
.intersect(bc_set
);
94 if (bc_inters
.size() != bc_set
.size()) {
99 m_BoundaryCodes
= bc_set
;