VTK  9.0.3
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 
78 
80 
83  bool HasTree();
85 
89  bool HasTree(unsigned int icursor);
90 
92 
96  vtkHyperTree* GetTree(unsigned int icursor);
98 
103  vtkIdType GetVertexId(unsigned int icursor);
104 
110 
115  vtkIdType GetGlobalNodeIndex(unsigned int icursor);
116 
121  unsigned int icursor, unsigned int& level, bool& leaf, vtkIdType& id);
122 
127  unsigned char GetDimension();
128 
133  unsigned char GetNumberOfChildren();
134 
139 
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 
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
void GetBounds(double bounds[6])
JB Coordonnees de la boite englobante En light, information non disponible sur les voisins.
vtkSmartPointer< vtkHyperTreeGridNonOrientedGeometryCursor > CentralCursor
JB.
vtkIdType GetGlobalNodeIndex(unsigned int icursor)
JB Return the global index (relative to the grid) of the neighboor icursor current vertex in the tree...
vtkHyperTree * GetTree()
Set the hyper tree to which the cursor is pointing.
void SubdivideLeaf()
JB Fait chier normalement on devrait passer par GetEntry.
bool IsLeaf()
Is the cursor pointing to a leaf?
void SetMask(unsigned int icursor, bool state)
~vtkHyperTreeGridNonOrientedSuperCursorLight() override
Destructor.
vtkHyperTreeGridNonOrientedSuperCursorLight()
JB Peut etre reporter les services GetCursor present dans la version non Light ?
bool IsRoot()
Is the cursor at tree root?
void GetPoint(double point[3])
JB Coordonnees du centre de la maille En light, information non disponible sur les voisins.
unsigned char GetDimension()
Return the dimension of the tree.
vtkIdType GetGlobalNodeIndex()
Return the global index (relative to the grid) of the current vertex in the tree.
vtkIdType GetVertexId(unsigned int icursor)
unsigned int FirstCurrentNeighboorReferenceEntry
JB La derniere reference valide pour decrire tous les voisins.
unsigned char GetNumberOfChildren()
Return the number of children for each node (non-vertex leaf) of the tree.
unsigned int GetIndicePreviousEntry(unsigned int icursor)
JB La valeur precedente.
void ToParent()
Move the cursor to the parent of the current vertex.
unsigned int GetLevel(unsigned int icursor)
vtkHyperTreeGrid * Grid
JB Reference sur l'hyper tree grid parcouru actuellement.
vtkHyperTreeGrid * GetGrid()
Set the hyper tree grid to which the cursor is pointing.
virtual void Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)=0
Initialize cursor at root of given tree index in grid.
vtkIdType GetVertexId()
Return the index of the current vertex in the tree.
void ToRoot()
Move the cursor to the root vertex.
vtkHyperTree * GetTree(unsigned int icursor)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool IsMasked()
Determine whether blanking mask is empty or not.
void SetGlobalIndexFromLocal(vtkIdType index)
JB.
unsigned int GetLevel()
Get the level of the tree vertex pointed by the cursor.
virtual vtkHyperTreeGridNonOrientedSuperCursorLight * Clone()
Create a copy of ‘this’.
void SetMask(bool state)
Set the blanking mask is empty or not.
vtkHyperTree * GetInformation(unsigned int icursor, unsigned int &level, bool &leaf, vtkIdType &id)
JB.
bool HasTree()
Return if a Tree pointing exist.
void SetGlobalIndexStart(vtkIdType index)
JB.
bool HasTree(unsigned int icursor)
JB Return if a Tree pointing exist.
unsigned int CurrentFirstNonValidEntryByLevel
JB Hyper tree grid to which the cursor is attached.
void ToChild(unsigned char)
Move the cursor to child ‘child’ of the current vertex.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
A data object structured as a tree.
Definition: vtkHyperTree.h:179
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
@ point
Definition: vtkX3D.h:242
@ level
Definition: vtkX3D.h:401
@ index
Definition: vtkX3D.h:252
int vtkIdType
Definition: vtkType.h:338