DeleteSetOfPoints function working
[engrid.git] / tvtkoperation.h
blobee7c7430e8e514eadfb467eb1437986317c742a1
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008,2009 Oliver Gloth +
7 // + +
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. +
12 // + +
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. +
17 // + +
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/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #ifndef tvtkoperation_H
24 #define tvtkoperation_H
27 template <class T>
28 class TVtkOperation;
30 #include "operation.h"
32 template <class T>
33 class TVtkOperation : public Operation
36 protected: // attributes
38 T *vtk_filter;
40 public: // methods
42 TVtkOperation();
43 virtual ~TVtkOperation();
44 T* getFilter() { return vtk_filter; };
46 protected: // methods
48 virtual void operate();
53 template <class T>
54 TVtkOperation<T>::TVtkOperation()
56 vtk_filter = T::New();
59 template <class T>
60 TVtkOperation<T>::~TVtkOperation()
62 vtk_filter->Delete();
65 template <class T>
66 void TVtkOperation<T>::operate()
68 vtkSmartPointer<vtkUnstructuredGrid> ug = vtkSmartPointer<vtkUnstructuredGrid>::New();
69 ug->DeepCopy(grid);
70 vtk_filter->SetInput(ug);
71 vtk_filter->Update();
72 grid->DeepCopy(vtk_filter->GetOutput());
76 #endif