WTFIT
vtkReebSpace.h
Go to the documentation of this file.
1 #ifndef _VTK_REEBSPACE_H
11 #define _VTK_REEBSPACE_H
12 
13 // wtfit code includes
14 #include <ReebSpace.h>
15 #include <Wrapper.h>
16 
17 // wtfit VTK helpers
18 #include <vtkOneSkeleton.h>
19 #include <vtkZeroSkeleton.h>
20 #include <vtkThreeSkeleton.h>
21 
22 // VTK includes -- to adapt
23 #include <vtkCellArray.h>
24 #include <vtkCellData.h>
25 #include <vtkCharArray.h>
26 #include <vtkDataArray.h>
27 #include <vtkDoubleArray.h>
28 #include <vtkFiltersCoreModule.h>
29 #include <vtkFloatArray.h>
30 #include <vtkInformation.h>
31 #include <vtkInformationVector.h>
32 #include <vtkObjectFactory.h>
33 #include <vtkPointData.h>
34 #include <vtkSmartPointer.h>
35 #include <vtkUnstructuredGrid.h>
36 #include <vtkUnstructuredGridAlgorithm.h>
37 
38 // in this example, this wrapper takes a data-set on the input and produces a
39 // data-set on the output - to adapt.
40 // see the documentation of the vtkAlgorithm class to decide from which VTK
41 // class your wrapper should inherit.
42 class VTKFILTERSCORE_EXPORT vtkReebSpace
43  : public vtkUnstructuredGridAlgorithm, public Wrapper{
44 
45  public:
46 
47  static vtkReebSpace* New();
48 
49  vtkTypeMacro(vtkReebSpace, vtkUnstructuredGridAlgorithm);
50 
51  // default wtfit setters
52  vtkSetMacro(debugLevel_, int);
53 
54  void SetThreads(){
55  if(!UseAllCores)
56  threadNumber_ = ThreadNumber;
57  else{
58  threadNumber_ = OsCall::getNumberOfCores();
59  }
60  Modified();
61  }
62 
63  void SetThreadNumber(int threadNumber){
64  ThreadNumber = threadNumber;
65  SetThreads();
66  }
67 
68  void SetUseAllCores(bool onOff){
69  UseAllCores = onOff;
70  SetThreads();
71  }
72  // end of default wtfit setters
73 
74  vtkSetMacro(Ucomponent, string);
75  vtkGetMacro(Ucomponent, string);
76 
77  vtkSetMacro(Vcomponent, string);
78  vtkGetMacro(Vcomponent, string);
79 
80  vtkGetMacro(VaryingConnectivity, bool);
81  vtkSetMacro(VaryingConnectivity, bool);
82 
83  vtkGetMacro(VaryingValues, bool);
84  vtkSetMacro(VaryingValues, bool);
85 
86  // 0-sheet options
87  vtkGetMacro(ZeroSheetId, bool);
88  vtkSetMacro(ZeroSheetId, bool);
89 
90  vtkGetMacro(ZeroSheetType, bool);
91  vtkSetMacro(ZeroSheetType, bool);
92 
93  vtkGetMacro(ZeroSheetValue, bool);
94  vtkSetMacro(ZeroSheetValue, bool);
95 
96  vtkGetMacro(ZeroSheetVertexId, bool);
97  vtkSetMacro(ZeroSheetVertexId, bool);
98 
99 
100  // 1-sheet options
101  vtkGetMacro(OneSheetId, bool);
102  vtkSetMacro(OneSheetId, bool);
103 
104  vtkGetMacro(OneSheetType, bool);
105  vtkSetMacro(OneSheetType, bool);
106 
107  vtkGetMacro(OneSheetValue, bool);
108  vtkSetMacro(OneSheetValue, bool);
109 
110  vtkGetMacro(OneSheetVertexId, bool);
111  vtkSetMacro(OneSheetVertexId, bool);
112 
113  vtkGetMacro(OneSheetEdgeId, bool);
114  vtkSetMacro(OneSheetEdgeId, bool);
115 
116  // 2-sheet options
117  vtkGetMacro(TwoSheets, bool);
118  vtkSetMacro(TwoSheets, bool);
119 
120  vtkGetMacro(TwoSheetCaseId, bool);
121  vtkSetMacro(TwoSheetCaseId, bool);
122 
123  vtkGetMacro(TwoSheetValue, bool);
124  vtkSetMacro(TwoSheetValue, bool);
125 
126  vtkGetMacro(TwoSheetParameterization, bool);
127  vtkSetMacro(TwoSheetParameterization, bool);
128 
129  vtkGetMacro(TwoSheetId, bool);
130  vtkSetMacro(TwoSheetId, bool);
131 
132  vtkGetMacro(TwoSheetEdgeId, bool);
133  vtkSetMacro(TwoSheetEdgeId, bool);
134 
135  vtkGetMacro(TwoSheetTetId, bool);
136  vtkSetMacro(TwoSheetTetId, bool);
137 
138  vtkGetMacro(TwoSheetEdgeType, bool);
139  vtkSetMacro(TwoSheetEdgeType, bool);
140 
141  vtkGetMacro(ThreeSheetTetNumber, bool);
142  vtkSetMacro(ThreeSheetTetNumber, bool);
143 
144  vtkGetMacro(ThreeSheetVertexNumber, bool);
145  vtkSetMacro(ThreeSheetVertexNumber, bool);
146 
147  vtkGetMacro(ThreeSheetExpansion, bool);
148  vtkSetMacro(ThreeSheetExpansion, bool);
149 
150  vtkGetMacro(ThreeSheetDomainVolume, bool);
151  vtkSetMacro(ThreeSheetDomainVolume, bool);
152 
153  vtkGetMacro(ThreeSheetRangeArea, bool);
154  vtkSetMacro(ThreeSheetRangeArea, bool);
155 
156  vtkGetMacro(ThreeSheetHyperVolume, bool);
157  vtkSetMacro(ThreeSheetHyperVolume, bool);
158 
159  vtkGetMacro(SimplificationThreshold, double);
160  vtkSetMacro(SimplificationThreshold, double);
161 
162  vtkGetMacro(SimplificationCriterion, int);
163  vtkSetMacro(SimplificationCriterion, int);
164 
165  protected:
166 
167  vtkReebSpace();
168 
169  ~vtkReebSpace();
170 
171  virtual int FillOutputPortInformation(int port, vtkInformation *info){
172 
173  if(port == 0){
174  // 0-sheets, corners of jacobi set segments
175  info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkUnstructuredGrid");
176  }
177  else if(port == 1){
178  // 1-sheets, jacobi sets
179  info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkUnstructuredGrid");
180  }
181  else if(port == 2){
182  // 2-sheets, fiber surfaces of jacobi sets
183  info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkUnstructuredGrid");
184  }
185  else if(port == 3){
186  // 3-sheets, pre-images of reeb space 2-sheets
187  info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkUnstructuredGrid");
188  }
189 
190  return 1;
191  }
192 
193  int RequestData(vtkInformation *request,
194  vtkInformationVector **inputVector, vtkInformationVector *outputVector);
195 
196  private:
197 
198  bool UseAllCores;
199  int ThreadNumber;
200 
201  bool VaryingConnectivity, VaryingValues;
202 
203  bool ZeroSheetValue, ZeroSheetVertexId, ZeroSheetType,
204  ZeroSheetId;
205  bool OneSheetValue, OneSheetVertexId, OneSheetType,
206  OneSheetId, OneSheetEdgeId;
207  bool TwoSheets,
208  TwoSheetCaseId, TwoSheetValue,
209  TwoSheetParameterization,
210  TwoSheetId, TwoSheetEdgeId, TwoSheetTetId,
211  TwoSheetEdgeType;
212  bool ThreeSheetVertexNumber, ThreeSheetTetNumber,
213  ThreeSheetExpansion,
214  ThreeSheetDomainVolume, ThreeSheetRangeArea,
215  ThreeSheetHyperVolume;
216 
217  bool perturbated_;
218  int SimplificationCriterion;
219  double SimplificationThreshold;
220  string Ucomponent, Vcomponent;
221 
222  // connectivity preprocessing
223  // jacobi set stuff
224  vector<pair<int, int> >
225  edgeList_;
226  vector<vector<int> > edgeStars_;
227  vector<vector<pair<int, int> > >
228  edgeFanLinkEdgeList_;
229  vector<vector<long long int> >
230  edgeFans_;
231  vector<vector<int> > tetNeighbors_;
232  vector<vector<int> > vertexStars_;
233 
234  vector<int> sosOffsets_;
235  // reeb space traversal stuff
236  vector<vector<int> > vertexEdgeList_;
237 
238  // core data-structure
239  ReebSpace reebSpace_;
240 
241  // template base call
242  template <class dataTypeU, class dataTypeV> int baseCall(
243  vtkUnstructuredGrid *input,
244  vtkDataArray *uField,
245  vtkDataArray *vField);
246 
247  template <class dataTypeU, class dataTypeV> int preProcess(
248  vtkUnstructuredGrid *input,
249  vtkDataArray *uField,
250  vtkDataArray *vField);
251 
252  // base code features
253  int doIt(vtkUnstructuredGrid *input,
254  vtkUnstructuredGrid *sheet0, vtkUnstructuredGrid *sheet1,
255  vtkUnstructuredGrid *sheet2, vtkUnstructuredGrid *sheet3);
256 
257  bool needsToAbort();
258 
259  int updateProgress(const float &progress);
260 
261 };
262 
263 #endif // _VTK_REEBSPACE_H
virtual bool needsToAbort()=0
void SetThreadNumber(int threadNumber)
Definition: vtkReebSpace.h:63
ReebSpace processing package.
Definition: ReebSpace.h:33
virtual int updateProgress(const float &progress)=0
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Definition: vtkReebSpace.h:171
Wrapper class to wrap wtfit code.
Definition: Wrapper.h:15
static int getNumberOfCores()
Definition: Os.h:127
void SetThreads()
Definition: vtkReebSpace.h:54
VTK wrapper for the reebSpace package.
Definition: vtkReebSpace.h:42
void SetUseAllCores(bool onOff)
Definition: vtkReebSpace.h:68