Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bill Lorensen
VTK
Commits
94b3cf69
Commit
94b3cf69
authored
Apr 20, 2012
by
Charles Law
Browse files
Tab fix asdfasdfasdf
Change-Id: If0c0031d30f2b4a96d3e085861ed515110664b33
parent
4ebd4cf0
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Common/DataModel/vtkHyperTreeGrid.cxx
View file @
94b3cf69
This diff is collapsed.
Click to expand it.
Common/DataModel/vtkHyperTreeGrid.h
View file @
94b3cf69
...
...
@@ -121,6 +121,7 @@
#include
"vtkDataSet.h"
class
vtkHyperTreeLightWeightCursor
;
class
vtkHyperTreeSuperCursor
;
class
vtkHyperTreeCursor
;
class
vtkHyperTreeInternal
;
...
...
@@ -135,7 +136,9 @@ class vtkVoxel;
class
vtkCellLinks
;
// Used to advance the super cursor; One Entry per cursor node.
// Private.
class
vtkSuperCursorEntry
{
public:
...
...
@@ -152,14 +155,14 @@ public:
static
vtkInformationIntegerKey
*
DIMENSION
();
static
vtkInformationDoubleVectorKey
*
SIZES
();
static
vtkHyperTreeGrid
*
New
();
vtkTypeMacro
(
vtkHyperTreeGrid
,
vtkDataSet
);
void
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
);
// Description:
// Return what type of dataset this is.
int
GetDataObjectType
();
// Description:
// Copy the geometric and topological structure of an input rectilinear grid
// object.
...
...
@@ -175,7 +178,7 @@ public:
// 3D:octree (8 children))
// \post valid_result: result>=1 && result<=3
int
GetDimension
();
// Description:
// Set the dimension of the tree with `dim'. See GetDimension() for details.
// \pre valid_dim: dim>=1 && dim<=3
...
...
@@ -194,11 +197,11 @@ public:
// grid cell iterator.
// \post positive_result: result>=0
vtkIdType
GetNumberOfCells
();
// Description:
// Get the number of leaves in the tree grid.
int
GetNumberOfLeaves
();
// Description:
// Return the number of points in the dual grid or grid.
// This call should be avoided for the normal grid.
...
...
@@ -254,7 +257,7 @@ public:
// THIS METHOD IS THREAD SAFE IF FIRST CALLED FROM A SINGLE THREAD AND
// THE DATASET IS NOT MODIFIED
virtual
void
GetPoint
(
vtkIdType
id
,
double
x
[
3
]);
// Description:
// This method should be avoided in favor of cell/point iterators.
// Random access to cells requires that connectivity arrays are created explicitly.
...
...
@@ -334,22 +337,22 @@ public:
vtkGenericCell
*
gencell
,
vtkIdType
cellId
,
double
tol2
,
int
&
subId
,
double
pcoords
[
3
],
double
*
weights
);
// Description:
// Restore data object to initial state,
// THIS METHOD IS NOT THREAD SAFE.
void
Initialize
();
// Description:
// Convenience method returns largest cell size in dataset. This is generally
// used to allocate memory for supporting data structures.
// This is the number of points of a cell.
// THIS METHOD IS THREAD SAFE
virtual
int
GetMaxCellSize
();
// Description:
// Shallow and Deep copy.
void
ShallowCopy
(
vtkDataObject
*
src
);
void
ShallowCopy
(
vtkDataObject
*
src
);
void
DeepCopy
(
vtkDataObject
*
src
);
// Description:
...
...
@@ -371,6 +374,26 @@ public:
// IS THREAD SAFE.
unsigned
long
GetActualMemorySize
();
// Description:
// Initialize a super cursor to point to one of the root trees
// in the grid. The super cursor points to a node in a tre and
// also keeps pointers to the nodes 26 neighbors.
void
InitializeSuperCursor
(
vtkHyperTreeSuperCursor
*
superCursor
,
int
i
,
int
j
,
int
k
);
// Description:
// Generate the table before calling InitializeSuperCursorChild.
void
GenerateSuperCursorTraversalTable
();
// Description:
// Initializa a cursor to point to a child of an existing super cursor.
// This will not work inplace.
void
InitializeSuperCursorChild
(
vtkHyperTreeSuperCursor
*
parent
,
vtkHyperTreeSuperCursor
*
child
,
int
childIdx
);
// Description:
// The number of children each node can have.
vtkGetMacro
(
NumberOfChildren
,
int
);
protected:
// Constructor with default bounds (0,1, 0,1, 0,1).
vtkHyperTreeGrid
();
...
...
@@ -389,6 +412,7 @@ protected:
vtkDataArray
*
ZCoordinates
;
vtkHyperTreeInternal
**
CellTree
;
vtkIdType
*
CellTreeLeafIdOffsets
;
//BTX
friend
class
vtkHyperTreeLightWeightCursor
;
...
...
@@ -407,20 +431,18 @@ protected:
vtkPoints
*
CornerPoints
;
vtkIdTypeArray
*
LeafCornerIds
;
int
UpdateCellTreeLeafIdOffsets
();
void
DeleteInternalArrays
();
void
TraverseDualRecursively
(
vtkHyperTreeLightWeightCursor
*
,
double
*
,
double
*
,
void
TraverseDualRecursively
(
vtkHyperTreeSuperCursor
*
,
int
);
void
TraverseGridRecursively
(
vtkHyperTreeLightWeightCursor
*
,
unsigned
char
*
,
double
*
,
double
*
);
void
TraverseGridRecursively
(
vtkHyperTreeSuperCursor
*
,
unsigned
char
*
);
void
EvaluateDualCorner
(
vtkHyperTreeLightWeightCursor
*
);
vtkIdType
EvaluateGridCorner
(
int
,
vtkHyperTree
LightWeight
Cursor
*
,
unsigned
char
*
,
vtkHyperTree
Super
Cursor
*
,
unsigned
char
*
,
int
*
);
// Generalizing for 27 tree. I cannot use 3 bits to encode the child to move to.
...
...
@@ -428,7 +450,6 @@ protected:
// Output: root, child
// It is easier to abstract dimensions when we use a single array.
vtkSuperCursorEntry
SuperCursorTraversalTable
[
729
];
// 27*27
void
GenerateSuperCursorTraversalTable
();
// for the GetCell method
vtkLine
*
Line
;
...
...
@@ -440,8 +461,8 @@ protected:
vtkCellLinks
*
Links
;
void
BuildLinks
();
vtkIdType
RecursiveFindPoint
(
double
x
[
3
],
vtkHyperTreeLightWeightCursor
*
cursor
,
vtkIdType
RecursiveFindPoint
(
double
x
[
3
],
vtkHyperTreeLightWeightCursor
*
cursor
,
double
*
origin
,
double
*
size
);
// This toggles the data set API between the leaf cells and
...
...
@@ -458,27 +479,49 @@ private:
class
VTK_EXPORT
vtkHyperTreeLightWeightCursor
{
public:
public:
vtkHyperTreeLightWeightCursor
();
~
vtkHyperTreeLightWeightCursor
();
void
Initialize
(
vtkHyperTreeGrid
*
,
int
*
,
int
,
int
,
int
,
int
);
void
Clear
();
void
Initialize
(
vtkHyperTreeGrid
*
,
vtkIdType
*
,
int
,
int
,
int
,
int
);
void
ToRoot
();
void
ToChild
(
int
);
unsigned
short
GetIsLeaf
();
vtkHyperTreeInternal
*
GetTree
()
{
return
this
->
Tree
;
}
int
GetLeafIndex
()
{
return
this
->
Index
;
}
// Only valid for leaves.
int
GetGlobalLeafIndex
()
{
return
this
->
Offset
+
this
->
Index
;
}
int
GetOffset
()
{
return
this
->
Offset
;
}
vtkIdType
GetOffset
()
{
return
this
->
Offset
;
}
unsigned
short
GetLevel
()
{
return
this
->
Level
;
}
private:
vtkHyperTreeInternal
*
Tree
;
int
Index
;
int
Offset
;
vtkIdType
Offset
;
unsigned
short
IsLeaf
;
unsigned
short
Level
;
};
// Public structure filters use to move around the tree.
// The super cursor keeps neighbor cells so filters can
// easily access neighbor to leaves. The super cursor
// The super cursor is static. Methods in vtkHyperTreeGrid
// initialize and compute children for moving toward leaves.
class
vtkHyperTreeSuperCursor
{
public:
vtkHyperTreeLightWeightCursor
Cursors
[
27
];
int
NumberOfCursors
;
int
MiddleCursorId
;
double
Origin
[
3
];
double
Size
[
3
];
vtkHyperTreeLightWeightCursor
*
GetCursor
(
int
idx
)
{
return
this
->
Cursors
+
this
->
MiddleCursorId
+
idx
;}
};
//ETX
#endif
Filters/HyperTree/CMakeLists.txt
View file @
94b3cf69
set
(
Module_SRCS
vtkClipHyperOctree.cxx
vtkHyperTreeGridGeometry.cxx
vtkHyperTreeGridAxisCut.cxx
vtkHyperOctreeClipCutPointsGrabber.cxx
vtkHyperOctreeContourFilter.cxx
vtkHyperOctreeCutter.cxx
...
...
Filters/HyperTree/vtkHyperTreeGridAxisCut.cxx
0 → 100644
View file @
94b3cf69
/*=========================================================================
Program: Visualization Toolkit
Module: vtkHyperTreeGridAxisCut.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include
"vtkHyperTreeGridAxisCut.h"
#include
"vtkCellArray.h"
#include
"vtkCellData.h"
#include
"vtkInformation.h"
#include
"vtkInformationVector.h"
#include
"vtkObjectFactory.h"
#include
"vtkCellData.h"
#include
"vtkHyperTreeGrid.h"
#include
"vtkPolyData.h"
vtkStandardNewMacro
(
vtkHyperTreeGridAxisCut
);
vtkHyperTreeGridAxisCut
::
vtkHyperTreeGridAxisCut
()
{
this
->
Points
=
0
;
this
->
Cells
=
0
;
this
->
Input
=
0
;
this
->
Output
=
0
;
this
->
PlanePosition
=
0.0
;
this
->
PlaneNormalAxis
=
0
;
}
//-----------------------------------------------------------------------------
void
vtkHyperTreeGridAxisCut
::
ProcessTrees
()
{
// TODO: MTime on generation of this table.
this
->
Input
->
GenerateSuperCursorTraversalTable
();
// Primal corner points
this
->
Points
=
vtkPoints
::
New
();
this
->
Cells
=
vtkCellArray
::
New
();
// Iterate over all hyper trees
int
*
gridSize
=
this
->
Input
->
GetGridSize
();
for
(
int
i
=
0
;
i
<
gridSize
[
0
];
++
i
)
{
for
(
int
j
=
0
;
j
<
gridSize
[
1
];
++
j
)
{
for
(
int
k
=
0
;
k
<
gridSize
[
2
];
++
k
)
{
// Storage for super cursors
vtkHyperTreeSuperCursor
superCursor
;
// Initialize center cursor
this
->
Input
->
InitializeSuperCursor
(
&
superCursor
,
i
,
j
,
k
);
// Traverse and populate dual recursively
this
->
RecursiveProcessTree
(
&
superCursor
);
}
// k
}
// j
}
// i
if
(
this
->
Input
->
GetDimension
()
==
1
)
{
this
->
Output
->
SetLines
(
this
->
Cells
);
}
else
{
this
->
Output
->
SetPolys
(
this
->
Cells
);
}
this
->
Output
->
SetPoints
(
this
->
Points
);
this
->
Points
->
Delete
();
this
->
Points
=
0
;
this
->
Cells
->
Delete
();
this
->
Cells
=
0
;
}
//----------------------------------------------------------------------------
void
vtkHyperTreeGridAxisCut
::
AddFace
(
vtkIdType
inId
,
double
*
origin
,
double
*
size
,
double
offset0
,
int
axis0
,
int
axis1
,
int
axis2
)
{
vtkIdType
ids
[
4
];
double
pt
[
3
];
pt
[
0
]
=
origin
[
0
];
pt
[
1
]
=
origin
[
1
];
pt
[
2
]
=
origin
[
2
];
pt
[
axis0
]
+=
size
[
axis0
]
*
offset0
;
ids
[
0
]
=
this
->
Points
->
InsertNextPoint
(
pt
);
pt
[
axis1
]
+=
size
[
axis1
];
ids
[
1
]
=
this
->
Points
->
InsertNextPoint
(
pt
);
pt
[
axis2
]
+=
size
[
axis2
];
ids
[
2
]
=
this
->
Points
->
InsertNextPoint
(
pt
);
pt
[
axis1
]
=
origin
[
axis1
];
ids
[
3
]
=
this
->
Points
->
InsertNextPoint
(
pt
);
vtkIdType
outId
=
this
->
Cells
->
InsertNextCell
(
4
,
ids
);
this
->
Output
->
GetCellData
()
->
CopyData
(
this
->
Input
->
GetCellData
(),
inId
,
outId
);
}
//----------------------------------------------------------------------------
void
vtkHyperTreeGridAxisCut
::
RecursiveProcessTree
(
vtkHyperTreeSuperCursor
*
superCursor
)
{
// Terminate if the node does not touch the plane.
if
(
superCursor
->
Origin
[
this
->
PlaneNormalAxis
]
>
this
->
PlanePosition
||
superCursor
->
Origin
[
this
->
PlaneNormalAxis
]
+
superCursor
->
Size
[
this
->
PlaneNormalAxis
]
<
this
->
PlanePosition
)
{
return
;
}
// If we are at a leaf, create the outer surfaces.
if
(
superCursor
->
GetCursor
(
0
)
->
GetIsLeaf
()
)
{
vtkIdType
inId
=
superCursor
->
GetCursor
(
0
)
->
GetGlobalLeafIndex
();
double
k
=
this
->
PlanePosition
-
superCursor
->
Origin
[
this
->
PlaneNormalAxis
];
k
=
k
/
superCursor
->
Size
[
this
->
PlaneNormalAxis
];
int
axis1
,
axis2
;
switch
(
this
->
PlaneNormalAxis
)
{
case
0
:
axis1
=
1
;
axis2
=
2
;
break
;
case
1
:
axis1
=
0
;
axis2
=
2
;
break
;
case
2
:
axis1
=
0
;
axis2
=
1
;
break
;
default:
vtkErrorMacro
(
"Bad Axis."
);
return
;
}
this
->
AddFace
(
inId
,
superCursor
->
Origin
,
superCursor
->
Size
,
k
,
this
->
PlaneNormalAxis
,
axis1
,
axis2
);
return
;
}
// Not a leaf. Recurse children to leaves.
vtkHyperTreeSuperCursor
newSuperCursor
;
int
numChildren
=
this
->
Input
->
GetNumberOfChildren
();
int
child
;
for
(
child
=
0
;
child
<
numChildren
;
++
child
)
{
vtkHyperTreeSuperCursor
newSuperCursor
;
this
->
Input
->
InitializeSuperCursorChild
(
superCursor
,
&
newSuperCursor
,
child
);
this
->
RecursiveProcessTree
(
&
newSuperCursor
);
}
}
//-----------------------------------------------------------------------------
int
vtkHyperTreeGridAxisCut
::
FillInputPortInformation
(
int
,
vtkInformation
*
info
)
{
info
->
Set
(
vtkAlgorithm
::
INPUT_REQUIRED_DATA_TYPE
(),
"vtkHyperTreeGrid"
);
return
1
;
}
//----------------------------------------------------------------------------
int
vtkHyperTreeGridAxisCut
::
RequestData
(
vtkInformation
*
vtkNotUsed
(
request
),
vtkInformationVector
**
inputVector
,
vtkInformationVector
*
outputVector
)
{
// get the info objects
vtkInformation
*
inInfo
=
inputVector
[
0
]
->
GetInformationObject
(
0
);
vtkInformation
*
outInfo
=
outputVector
->
GetInformationObject
(
0
);
// Initialize
this
->
Input
=
vtkHyperTreeGrid
::
SafeDownCast
(
inInfo
->
Get
(
vtkDataObject
::
DATA_OBJECT
()));
this
->
Output
=
vtkPolyData
::
SafeDownCast
(
outInfo
->
Get
(
vtkDataObject
::
DATA_OBJECT
()));
vtkCellData
*
outCD
=
this
->
Output
->
GetCellData
();
vtkCellData
*
inCD
=
this
->
Input
->
GetCellData
();
if
(
this
->
Input
->
GetDimension
()
!=
3
)
{
vtkErrorMacro
(
"Axis cut only works with 3D trees."
);
return
0
;
}
outCD
->
CopyAllocate
(
inCD
);
this
->
ProcessTrees
();
this
->
Input
=
0
;
this
->
Output
=
0
;
this
->
UpdateProgress
(
1.0
);
return
1
;
}
void
vtkHyperTreeGridAxisCut
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
{
this
->
Superclass
::
PrintSelf
(
os
,
indent
);
os
<<
indent
<<
"Plane Normal Axis : "
<<
this
->
PlaneNormalAxis
<<
endl
;
os
<<
indent
<<
"Plane Position : "
<<
this
->
PlanePosition
<<
endl
;
}
Filters/HyperTree/vtkHyperTreeGridAxisCut.h
0 → 100644
View file @
94b3cf69
/*=========================================================================
Program: Visualization Toolkit
Module: vtkHyperTreeGridAxisCut.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkHyperTreeGridAxisCut - Axis aligned cut
// .SECTION Description
// Cut along an axis aligned plane. Only works for 3D grids.
// Produces disjoint (no point sharing) quads for now.
#ifndef __vtkHyperTreeGridAxisCut_h
#define __vtkHyperTreeGridAxisCut_h
#include
"vtkFiltersHyperTreeModule.h"
// For export macro
#include
"vtkPolyDataAlgorithm.h"
#include
"vtkHyperTreeGrid.h"
class
vtkPoints
;
class
vtkCellArray
;
class
VTKFILTERSHYPERTREE_EXPORT
vtkHyperTreeGridAxisCut
:
public
vtkPolyDataAlgorithm
{
public:
static
vtkHyperTreeGridAxisCut
*
New
();
vtkTypeMacro
(
vtkHyperTreeGridAxisCut
,
vtkPolyDataAlgorithm
);
void
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
);
// Description:
// Normal axis: 0=X, 1=Y, 2=Z
// Position of plane: Axis constant.
vtkSetMacro
(
PlaneNormalAxis
,
int
);
vtkGetMacro
(
PlaneNormalAxis
,
int
);
vtkSetMacro
(
PlanePosition
,
double
);
vtkGetMacro
(
PlanePosition
,
double
);
protected:
vtkHyperTreeGridAxisCut
();
~
vtkHyperTreeGridAxisCut
()
{};
int
PlaneNormalAxis
;
double
PlanePosition
;
virtual
int
RequestData
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
);
virtual
int
FillInputPortInformation
(
int
port
,
vtkInformation
*
info
);
void
ProcessTrees
();
void
RecursiveProcessTree
(
vtkHyperTreeSuperCursor
*
superCursor
);
vtkHyperTreeGrid
*
Input
;
vtkPolyData
*
Output
;
vtkPoints
*
Points
;
vtkCellArray
*
Cells
;
void
AddFace
(
vtkIdType
inId
,
double
*
origin
,
double
*
size
,
double
offset0
,
int
axis0
,
int
axis1
,
int
axis2
);
private:
vtkHyperTreeGridAxisCut
(
const
vtkHyperTreeGridAxisCut
&
);
// Not implemented.
void
operator
=
(
const
vtkHyperTreeGridAxisCut
&
);
// Not implemented.
};
#endif
Filters/HyperTree/vtkHyperTreeGridGeometry.cxx
View file @
94b3cf69
...
...
@@ -111,7 +111,7 @@ void vtkHyperTreeGridGeometry::RecursiveProcessTree( vtkHyperTreeSuperCursor* su
// Terminate if the middle cells is not on the boundary.
// Only 3d cells have internal faces to skip.
int
dim
=
this
->
Input
->
GetDimension
();
if
(
dim
==
3
&&
if
(
dim
==
3
&&
superCursor
->
GetCursor
(
-
1
)
->
GetTree
()
&&
superCursor
->
GetCursor
(
1
)
->
GetTree
()
&&
superCursor
->
GetCursor
(
-
3
)
->
GetTree
()
&&
...
...
Filters/Sources/CMakeLists.txt
View file @
94b3cf69
...
...
@@ -9,9 +9,10 @@ set(Module_SRCS
vtkEllipticalButtonSource.cxx
vtkFrustumSource.cxx
vtkGlyphSource2D.cxx
vtkHyperTreeFractalSource.cxx
vtkHyperOctreeFractalSource.cxx
vtkLineSource.cxx
vtkOutlineCornerFilter.cxx
#
vtkOutlineCornerFilter.cxx
vtkOutlineCornerSource.cxx
vtkOutlineSource.cxx
vtkParametricFunctionSource.cxx
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment