Salome HOME
Porting to Mandrake 10.1 and new products:
[modules/kernel.git] / src / VTKFilter / SALOME_ExtractUnstructuredGrid.h
1 //  VISU CONVERTOR :
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //  File   : SALOME_ExtractUnstructuredGrid.hxx
24 //  Author : Alexey PETROV
25 //  Module : VISU
26
27 #ifndef SALOME_ExtractUnstructuredGrid_HeaderFile
28 #define SALOME_ExtractUnstructuredGrid_HeaderFile
29
30 #include <vtkUnstructuredGridToUnstructuredGridFilter.h>
31
32 #include <set>
33 #include <map>
34 #include <vector>
35
36 class SALOME_ExtractUnstructuredGrid : public vtkUnstructuredGridToUnstructuredGridFilter{
37 public:
38   vtkTypeMacro(SALOME_ExtractUnstructuredGrid,vtkUnstructuredGridToUnstructuredGridFilter);
39
40   // Description:
41   // Construct with all types of clipping turned off.
42   static SALOME_ExtractUnstructuredGrid *New();
43
44   enum EExtraction{ eCells, ePoints};
45   void SetModeOfExtraction(EExtraction theExtractionMode);
46   EExtraction GetModeOfExtraction(){ return myExtractionMode;}
47
48   enum EChanging{ ePassAll, eAdding, eRemoving};
49   void SetModeOfChanging(EChanging theChangeMode);
50   EChanging GetModeOfChanging(){ return myChangeMode;}
51
52   // Remove the cell from the output
53   void RegisterCell(vtkIdType theCellId);
54   int IsCellsRegistered() { return !myCellIds.empty();}
55   void ClearRegisteredCells() { 
56     myCellIds.clear();
57     Modified();
58   }
59   
60   // Remove every cells with the type from the output
61   void RegisterCellsWithType(vtkIdType theCellType);
62   int IsCellsWithTypeRegistered() { return !myCellTypes.empty();}
63   void ClearRegisteredCellsWithType();
64
65   // Do the filter do some real work
66   int IsChanging() { return IsCellsRegistered() || IsCellsWithTypeRegistered();}
67
68   // Do it keep the mapping between input's and output's UnstructuredGrid
69   void SetStoreMapping(int theStoreMapping);
70   int GetStoreMapping(){ return myStoreMapping;}
71
72   vtkIdType GetInputId(int theOutId) const;
73   vtkIdType GetOutputId(int theInId) const;
74
75   typedef std::vector<vtkIdType> TVectorId;
76   typedef std::map<vtkIdType,vtkIdType> TMapId;
77
78 protected:
79   SALOME_ExtractUnstructuredGrid();
80   ~SALOME_ExtractUnstructuredGrid();
81
82   void Execute();
83
84   EExtraction myExtractionMode;
85   
86   EChanging myChangeMode;
87   typedef std::set<vtkIdType> TSetId;
88   TSetId myCellIds;
89   TSetId myCellTypes;
90
91   bool myStoreMapping;
92   TVectorId myOut2InId;
93   TMapId myIn2OutId;
94
95 private:
96   SALOME_ExtractUnstructuredGrid(const SALOME_ExtractUnstructuredGrid&);  // Not implemented.
97   void operator=(const SALOME_ExtractUnstructuredGrid&);  // Not implemented.
98 };
99
100
101 #endif
102
103