VTK  9.0.1
vtkHyperTreeGridNonOrientedSuperCursorLight.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHyperTreeGridNonOrientedSuperCursorLight.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright Nonice for more information.
13 
14 =========================================================================*/
38 #ifndef vtkHyperTreeGridNonOrientedSuperCursorLight_h
39 #define vtkHyperTreeGridNonOrientedSuperCursorLight_h
40 
41 #include "vtkCommonDataModelModule.h" // For export macro
42 #include "vtkObject.h"
43 #include "vtkSmartPointer.h" // Used internally
44 
45 #include "vtkHyperTreeGridLevelEntry.h" // Used internally
46 
47 #include <cassert> // Used internally
48 #include <vector> // std::vector
49 
50 class vtkHyperTree;
51 class vtkHyperTreeGrid;
53 
54 class VTKCOMMONDATAMODEL_EXPORT vtkHyperTreeGridNonOrientedSuperCursorLight : public vtkObject
55 {
56 public:
58  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
65 
70  virtual void Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false) = 0;
71 
73 
76  vtkHyperTreeGrid* GetGrid();
78 
80 
83  bool HasTree();
85 
89  bool HasTree(unsigned int icursor);
90 
92 
95  vtkHyperTree* GetTree();
96  vtkHyperTree* GetTree(unsigned int icursor);
98 
102  vtkIdType GetVertexId();
103  vtkIdType GetVertexId(unsigned int icursor);
104 
109  vtkIdType GetGlobalNodeIndex();
110 
115  vtkIdType GetGlobalNodeIndex(unsigned int icursor);
116 
120  vtkHyperTree* GetInformation(
121  unsigned int icursor, unsigned int& level, bool& leaf, vtkIdType& id);
122 
127  unsigned char GetDimension();
128 
133  unsigned char GetNumberOfChildren();
134 
138  void SetGlobalIndexStart(vtkIdType index);
139 
143  void SetGlobalIndexFromLocal(vtkIdType index);
144 
148  double* GetOrigin();
149  double* GetSize();
150 
155  void SetMask(bool state);
156  void SetMask(unsigned int icursor, bool state);
157 
161  bool IsMasked();
162  bool IsMasked(unsigned int icursor);
163 
168  void GetBounds(double bounds[6]);
169 
174  void GetPoint(double point[3]);
175 
179  bool IsLeaf();
180  bool IsLeaf(unsigned int icursor);
181 
185  void SubdivideLeaf();
186 
190  bool IsRoot();
191 
195  unsigned int GetLevel();
196  unsigned int GetLevel(unsigned int icursor);
197 
203  void ToChild(unsigned char);
204 
210  void ToRoot();
211 
217  void ToParent();
218 
222  unsigned int GetNumberOfCursors() { return this->NumberOfCursors; }
223 
228 protected:
233 
238 
243 
247  // JB vtkNew< vtkHyperTreeGridNonOrientedGeometryCursor > CentralCursor;
249 
254  std::vector<unsigned int> FirstNonValidEntryByLevel;
255  std::vector<vtkHyperTreeGridLevelEntry> Entries;
256 
262  std::vector<unsigned int> ReferenceEntries;
263 
267  unsigned int GetIndiceEntry(unsigned int icursor)
268  {
269  assert("pre: icursor != IndiceCentralCursor" && icursor != this->IndiceCentralCursor);
270  assert("pre: valid_icursor" && icursor < this->NumberOfCursors);
271  if (icursor > this->IndiceCentralCursor)
272  {
273  assert("pre: valid_icursor" &&
274  0 <= long(this->FirstCurrentNeighboorReferenceEntry + icursor) - 1 &&
275  long(this->FirstCurrentNeighboorReferenceEntry + icursor) - 1 <
276  long(this->ReferenceEntries.size()));
277  assert("pre: valid_icursor" &&
278  this->ReferenceEntries[this->FirstCurrentNeighboorReferenceEntry + icursor - 1] <
279  this->Entries.size());
280  return this->ReferenceEntries[this->FirstCurrentNeighboorReferenceEntry + icursor - 1];
281  }
282  else
283  {
284  assert("pre: valid_icursor" &&
285  this->FirstCurrentNeighboorReferenceEntry + icursor < this->ReferenceEntries.size());
286  assert("pre: valid_icursor" &&
287  this->ReferenceEntries[this->FirstCurrentNeighboorReferenceEntry + icursor] <
288  this->Entries.size());
289  return this->ReferenceEntries[this->FirstCurrentNeighboorReferenceEntry + icursor];
290  }
291  }
292 
296  unsigned int GetIndicePreviousEntry(unsigned int icursor)
297  {
298  assert("pre: icursor != IndiceCentralCursor" && icursor != IndiceCentralCursor);
299  assert("pre: valid_icursor" && icursor < this->NumberOfCursors);
300  if (icursor > this->IndiceCentralCursor)
301  {
302  assert("pre: valid_icursor" &&
303  0 <=
304  long(this->FirstCurrentNeighboorReferenceEntry - (this->NumberOfCursors - 1) + icursor) -
305  1 &&
306  long(this->FirstCurrentNeighboorReferenceEntry - (this->NumberOfCursors - 1) + icursor) -
307  1 <
308  long(this->ReferenceEntries.size()));
309  assert("pre: valid_icursor" &&
310  this->ReferenceEntries[this->FirstCurrentNeighboorReferenceEntry -
311  (this->NumberOfCursors - 1) + icursor - 1] < this->Entries.size());
312  return this->ReferenceEntries[this->FirstCurrentNeighboorReferenceEntry -
313  (this->NumberOfCursors - 1) + icursor - 1];
314  }
315  else
316  {
317  assert("pre: valid_icursor" &&
318  this->FirstCurrentNeighboorReferenceEntry - (this->NumberOfCursors - 1) + icursor <
319  this->ReferenceEntries.size());
320  assert("pre: valid_icursor" &&
321  this->ReferenceEntries[this->FirstCurrentNeighboorReferenceEntry -
322  (this->NumberOfCursors - 1) + icursor] < this->Entries.size());
323  return this->ReferenceEntries[this->FirstCurrentNeighboorReferenceEntry -
324  (this->NumberOfCursors - 1) + icursor];
325  }
326  }
327 
331  unsigned int IndiceCentralCursor;
332 
333  // Number of cursors in supercursor
334  unsigned int NumberOfCursors;
335 
336  // Super cursor traversal table to go retrieve the parent index for each cursor
337  // of the child node. There are f^d * NumberOfCursors entries in the table.
338  const unsigned int* ChildCursorToParentCursorTable;
339 
340  // Super cursor traversal table to go retrieve the child index for each cursor
341  // of the child node. There are f^d * NumberOfCursors entries in the table.
342  const unsigned int* ChildCursorToChildTable;
343 
344 private:
347  void operator=(const vtkHyperTreeGridNonOrientedSuperCursorLight&) = delete;
348 };
349 
350 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:62
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
unsigned int FirstCurrentNeighboorReferenceEntry
JB La derniere reference valide pour decrire tous les voisins.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
vtkSmartPointer< vtkHyperTreeGridNonOrientedGeometryCursor > CentralCursor
JB.
int vtkIdType
Definition: vtkType.h:338
void GetPoint(const int i, const int j, const int k, double pnt[3])
a simple class to control print indentation
Definition: vtkIndent.h:33
unsigned int GetIndicePreviousEntry(unsigned int icursor)
JB La valeur precedente.
A data object structured as a tree.
Definition: vtkHyperTree.h:178
vtkHyperTreeGrid * Grid
JB Reference sur l&#39;hyper tree grid parcouru actuellement.
unsigned int CurrentFirstNonValidEntryByLevel
JB Hyper tree grid to which the cursor is attached.
bool HasTree(const T &e)