C# Class SIMDPrototyping.Trees.SingleArray.Tree

Show file Open project: RossNordby/scratchpad Class Usage Examples

Public Methods

Method Description
Add ( int leafId, BoundingBox &box ) : void
AddGlobal ( int leafId, BoundingBox &leafBounds ) : void

Tests every possible insertion path to find the one which minimizes the tree's heuristic cost.

AgglomerativeRefine ( int nodeIndex, QuickList &spareNodes, bool &nodesInvalidated ) : void

Collects a limited set of subtrees hanging from the specified node and performs a local treelet rebuild using a bottom-up agglomerative approach.

BinnedRefine ( int nodeIndex, QuickList &subtreeReferences, int maximumSubtrees, QuickList &treeletInternalNodes, QuickList &spareNodes, BinnedResources &resources, bool &nodesInvalidated ) : void
BottomUpAgglomerativeRefine ( ) : void

Executes one pass of bottom-up refinement.

BottomUpBinnedRefine ( int maximumSubtrees ) : void

Executes one pass of bottom-up refinement.

BuildVolumeHeuristic ( int leafIds, BoundingBox leafBounds, int start, int length = -1 ) : void
CollectSubtrees ( int nodeIndex, int maximumSubtrees, SubtreeHeapEntry entries, QuickList &subtrees, QuickList &internalNodes, float &treeletCost ) : void
CollectSubtreesDirect ( int nodeIndex, int maximumSubtrees, QuickList &subtrees, QuickQueue &internalNodes, float &treeletCost ) : void
ComputeMaximumDepth ( ) : int
CreateBinnedResources ( BufferPool bufferPool, int maximumSubtreeCount, int &buffer, MemoryRegion &region, BinnedResources &resources ) : void
CreateOptimized ( ) : Tree

Creates a cache optimized copy of the tree that uses the minimum amount of memory possible.

CreateOptimized ( Leaf optimizedLeavesArray, Node optimizedNodesArray ) : void

Creates a cache optimized version of the tree in the given leaves and nodes arrays.

GetCacheOptimizeTuning ( int maximumSubtrees, float costChange, float cacheOptimizeAggressivenessScale ) : int
GetRefineTuning ( int frameIndex, int refinementCandidatesCount, float refineAggressivenessScale, float costChange, int threadCount, int &targetRefinementCount, int &refinementPeriod, int &refinementOffset ) : void
GetRefitAndMarkTuning ( int &maximumSubtrees, int &estimatedRefinementCandidateCount, int &leafCountThreshold ) : void
MeasureCacheQuality ( ) : float
MeasureCacheQuality ( int nodeIndex ) : float
MeasureCostMetric ( ) : float
MeasureNodeOccupancy ( int &nodeCount, int &childCount ) : void
PartialRefine ( int offset, int skip, QuickList &spareNodes, int maximumSubtrees, QuickList &treeletInternalNodes, BinnedResources &binnedResources, bool &nodesInvalidated ) : void
RecursiveRefine ( int maximumSubtrees, int treeSizeSeed, QuickList &treeletInternalNodes, QuickList &spareNodes, BinnedResources &binnedResources, bool &nodesInvalidated ) : void
Refit ( ) : void
RefitAndRefine ( int frameIndex, IParallelLooper looper, RefitAndRefineMultithreadedContext context, float refineAggressivenessScale = 1, float cacheOptimizeAggressivenessScale = 1 ) : int
RefitAndRefine ( int frameIndex, float refineAggressivenessScale = 1, float cacheOptimizeAggressivenessScale = 1 ) : int
RefitNonrecursive2 ( ) : void
RefitNonrecursive22 ( ) : void
RemoveAt ( int leafIndex ) : LeafMove
RemoveUnusedInternalNodes ( QuickList &spareNodes ) : void
SweepBuild ( int leafIds, BoundingBox leafBounds, int start, int length = -1, BufferPool intPool = null, BufferPool floatPool = null ) : void
TopDownAgglomerativeRefine ( ) : void
TopDownBinnedRefine ( int maximumSubtrees ) : void
Validate ( ) : void

Private Methods

Method Description
BuildStagingChild ( int parent, int indexInParent, TempNode tempNodes, int tempNodeIndex, int collapseCount, Node stagingNodes, int &stagingNodeCount, float &treeletCost ) : int
CheckForRefinementOverlaps ( int nodeIndex, QuickList &refinementTargets ) : void
CollapseTree ( int depthRemaining, TempNode tempNodes, int tempNodeIndex, int nodeChildren, int &childCount, BoundingBox nodeBounds, int leafCounts ) : void
CollectNodesForMultithreadedRefit ( int threadCount, QuickList &refitAndMarkTargets, int refinementLeafCountThreshold, QuickList &refinementCandidates ) : void
CollectNodesForMultithreadedRefit ( int nodeIndex, int multithreadingLeafCountThreshold, QuickList &refitAndMarkTargets, int refinementLeafCountThreshold, QuickList &refinementCandidates ) : void
CollectSubtreesForNodeDirect ( int nodeIndex, int remainingDepth, QuickList &subtrees, QuickQueue &internalNodes, float &treeletCost ) : void
ComputeBestCostChange ( int nodeIndex, BoundingBox &newLeafBounds, Path &candidate, Path &best ) : void
ComputeBoundsMetric ( BoundingBox &boundingBox ) : float
ComputeMaximumDepth ( Node node, int currentDepth ) : int
CreateStagingNodeBinned ( BinnedResources &resources, int start, int count, int &stagingNodeCount, float &childTreeletsCost ) : int
CreateSweepBuilderNode ( int parentIndex, int indexInParent, SweepResources &leaves, int start, int count ) : int
FindPartition ( SweepResources &leaves, int start, int count, int &splitIndex, BoundingBox &a, BoundingBox &b, int &leafCountA, int &leafCountB ) : void
FindPartitionBinned ( BinnedResources &resources, int start, int count, int &splitIndex, BoundingBox &a, BoundingBox &b, int &leafCountA, int &leafCountB ) : void
FindPartitionForAxis ( BoundingBox boundingBoxes, BoundingBox aMerged, float centroids, int indexMap, int count, int &splitIndex, float &cost, BoundingBox &a, BoundingBox &b, int &leafCountA, int &leafCountB ) : void
GetChoiceList ( List choices ) : string
GetLeafBoundingBox ( int leafIndex, BoundingBox &boundingBox ) : void
GetVolumeSplitIndex ( int leafIds, BoundingBox leafBounds, int start, int length ) : int
InsertLeafIntoEmptySlot ( int leafId, BoundingBox &leafBox, int nodeIndex, int childIndex, Node node, bool &leavesInvalidated ) : void
MeasureCacheQuality ( int nodeIndex, int &foundNodes, float &nodeScore, int &scorableNodeCount ) : void
MeasureNodeOccupancy ( Node node, int &nodeCount, int &childCount ) : void
MergeLeafNodes ( int newLeafId, BoundingBox &newLeafBounds, int parentIndex, int indexInParent, BoundingBox &merged, bool &nodesInvalidated, bool &leavesInvalidated ) : void
OptimizeBFS ( Node optimizedNodes, Leaf optimizedLeaves, int &optimizedNodeCount, int &optimizedLeafCount ) : void
OptimizeDFS ( int optimizedParentIndex, int nodeIndex, Node optimizedNodes, Leaf optimizedLeaves, int &optimizedNodeCount, int &optimizedLeafCount ) : int
OptimizeGroupDFS ( Node optimizedNodes, Leaf optimizedLeaves, int &optimizedNodeCount, int &optimizedLeafCount ) : void
OptimizeGroupDFS ( int optimizedNodeIndex, int optimizedParentNodeIndex, int nodeIndex, Node optimizedNodes, Leaf optimizedLeaves, int &optimizedNodeCount, int &optimizedLeafCount ) : void
PartialRefine ( int index, int depth, int offset, int skip, QuickList &subtreeReferences, QuickList &treeletInternalNodes, QuickList &spareNodes, int maximumSubtrees, BinnedResources &binnedResources, bool &nodesInvalidated ) : void
RecursiveRefine ( int nodeIndex, int maximumSubtrees, int &treeSizeSeed, QuickList &treeletInternalNodes, QuickList &spareNodes, BinnedResources &binnedResources, bool &nodesInvalidated ) : void
Refit ( int nodeIndex, BoundingBox &boundingBox ) : void
Refit2 ( int nodeIndex, BoundingBox &boundingBox ) : void
Refit4 ( int nodeIndex, BoundingBox &boundingBox ) : void
RefitAndMark ( int leafCountThreshold, QuickList &refinementCandidates ) : float
RefitAndMark ( int index, int leafCountThreshold, QuickList &refinementCandidates, BoundingBox &boundingBox ) : float
RefitAndMeasure ( int nodeIndex, BoundingBox &boundingBox ) : float
RefitCached ( int nodeIndex, BoundingBox &boundingBox ) : void
RefitForRemoval ( Node node ) : void
RefitSwitch4 ( int nodeIndex, BoundingBox &boundingBox ) : void
ReifyChildren ( int internalNodeIndex, Node stagingNodes, QuickList &subtrees, QuickList &treeletInternalNodes, int &nextInternalNodeIndexToUse, QuickList &spareNodes, bool &nodesInvalidated ) : void
ReifyStagingNode ( int parent, int indexInParent, Node stagingNodes, int stagingNodeIndex, QuickList &subtrees, QuickList &treeletInternalNodes, int &nextInternalNodeIndexToUse, QuickList &spareNodes, bool &nodesInvalidated ) : int
ReifyStagingNodes ( int treeletRootIndex, Node stagingNodes, QuickList &subtrees, QuickList &treeletInternalNodes, int &nextInternalNodeIndexToUse, QuickList &spareNodes, bool &nodesInvalidated ) : void
RemoveNodeAt ( int nodeIndex ) : void
SetLeafBoundingBox ( int leafIndex, BoundingBox &boundingBox ) : void
Split ( int leafIds, BoundingBox leafBounds, int start, int length, int recursionRemaining, Queue subnodes ) : void
Split ( int leafIds, BoundingBox leafBounds, int start, int length, int recursionRemaining, int starts, int min, int max ) : void
SplitLeavesIntoChildren ( int depthRemaining, SweepResources &leaves, int start, int count, int nodeIndex ) : void
SplitSubtreesIntoChildrenBinned ( int depthRemaining, BinnedResources &resources, int start, int count, int stagingNodeIndex, int &stagingNodesCount, float &childrenTreeletsCost ) : void
SwapPaths ( Path &candidate, Path &best, float newCostIncrease, int childIndex ) : void
TopDownAgglomerativeRefine ( int nodeIndex, QuickList &spareNodes ) : void
TopDownBinnedRefine ( int nodeIndex, int maximumSubtrees, QuickList &subtreeReferences, QuickList &treeletInternalNodes, QuickList &spareNodes, BinnedResources &resources ) : void
TryToBottomUpAgglomerativeRefine ( int refinementFlags, int nodeIndex, QuickList &spareInternalNodes ) : void
TryToBottomUpBinnedRefine ( int refinementFlags, int nodeIndex, int maximumSubtrees, QuickList &subtreeReferences, QuickList &treeletInternalNodes, BinnedResources &resources, QuickList &spareInternalNodes ) : void
UpdateLeafBoundingBox ( int leafIndex, BoundingBox &boundingBox ) : void
Validate ( int nodeIndex, int expectedParentIndex, int expectedIndexInParent, BoundingBox &expectedBoundingBox, int &foundLeafCount ) : void
ValidateLeafNodeIndices ( ) : void
ValidateLeaves ( ) : void
ValidateRefineFlags ( int index ) : void
ValidateStaging ( Node stagingNodes, QuickList &subtreeNodePointers, int treeletParent, int treeletIndexInParent ) : void
ValidateStaging ( Node stagingNodes, int stagingNodeIndex, QuickList &subtreeNodePointers, QuickList &collectedSubtreeReferences, QuickList &internalReferences, int &foundSubtrees, int &foundLeafCount ) : void
VolumeHeuristicAddNode ( int parentNodeIndex, int indexInParent, int leafIds, BoundingBox leafBounds, int start, int length, BoundingBox &mergedBoundingBox, int &nodeIndex ) : void

Method Details

Add() public method

public Add ( int leafId, BoundingBox &box ) : void
leafId int
box BoundingBox
return void

AddGlobal() public method

Tests every possible insertion path to find the one which minimizes the tree's heuristic cost.
public AddGlobal ( int leafId, BoundingBox &leafBounds ) : void
leafId int
leafBounds BoundingBox
return void

AgglomerativeRefine() public method

Collects a limited set of subtrees hanging from the specified node and performs a local treelet rebuild using a bottom-up agglomerative approach.
public AgglomerativeRefine ( int nodeIndex, QuickList &spareNodes, bool &nodesInvalidated ) : void
nodeIndex int Root of the refinement treelet.
spareNodes QuickList
nodesInvalidated bool True if the refinement process invalidated node pointers, false otherwise.
return void

BinnedRefine() public method

public BinnedRefine ( int nodeIndex, QuickList &subtreeReferences, int maximumSubtrees, QuickList &treeletInternalNodes, QuickList &spareNodes, BinnedResources &resources, bool &nodesInvalidated ) : void
nodeIndex int
subtreeReferences QuickList
maximumSubtrees int
treeletInternalNodes QuickList
spareNodes QuickList
resources BinnedResources
nodesInvalidated bool
return void

BottomUpAgglomerativeRefine() public method

Executes one pass of bottom-up refinement.
public BottomUpAgglomerativeRefine ( ) : void
return void

BottomUpBinnedRefine() public method

Executes one pass of bottom-up refinement.
public BottomUpBinnedRefine ( int maximumSubtrees ) : void
maximumSubtrees int
return void

BuildVolumeHeuristic() public method

public BuildVolumeHeuristic ( int leafIds, BoundingBox leafBounds, int start, int length = -1 ) : void
leafIds int
leafBounds BoundingBox
start int
length int
return void

CollectSubtrees() public method

public CollectSubtrees ( int nodeIndex, int maximumSubtrees, SubtreeHeapEntry entries, QuickList &subtrees, QuickList &internalNodes, float &treeletCost ) : void
nodeIndex int
maximumSubtrees int
entries SubtreeHeapEntry
subtrees QuickList
internalNodes QuickList
treeletCost float
return void

CollectSubtreesDirect() public method

public CollectSubtreesDirect ( int nodeIndex, int maximumSubtrees, QuickList &subtrees, QuickQueue &internalNodes, float &treeletCost ) : void
nodeIndex int
maximumSubtrees int
subtrees QuickList
internalNodes QuickQueue
treeletCost float
return void

ComputeMaximumDepth() public method

public ComputeMaximumDepth ( ) : int
return int

CreateBinnedResources() public static method

public static CreateBinnedResources ( BufferPool bufferPool, int maximumSubtreeCount, int &buffer, MemoryRegion &region, BinnedResources &resources ) : void
bufferPool BufferPool
maximumSubtreeCount int
buffer int
region MemoryRegion
resources BinnedResources
return void

CreateOptimized() public method

Creates a cache optimized copy of the tree that uses the minimum amount of memory possible.
public CreateOptimized ( ) : Tree
return Tree

CreateOptimized() public method

Creates a cache optimized version of the tree in the given leaves and nodes arrays.
public CreateOptimized ( Leaf optimizedLeavesArray, Node optimizedNodesArray ) : void
optimizedLeavesArray Leaf Array to fill with optimized leaves.
optimizedNodesArray Node Array to fill with optimized nodes.
return void

GetCacheOptimizeTuning() public method

public GetCacheOptimizeTuning ( int maximumSubtrees, float costChange, float cacheOptimizeAggressivenessScale ) : int
maximumSubtrees int
costChange float
cacheOptimizeAggressivenessScale float
return int

GetRefineTuning() public method

public GetRefineTuning ( int frameIndex, int refinementCandidatesCount, float refineAggressivenessScale, float costChange, int threadCount, int &targetRefinementCount, int &refinementPeriod, int &refinementOffset ) : void
frameIndex int
refinementCandidatesCount int
refineAggressivenessScale float
costChange float
threadCount int
targetRefinementCount int
refinementPeriod int
refinementOffset int
return void

GetRefitAndMarkTuning() public method

public GetRefitAndMarkTuning ( int &maximumSubtrees, int &estimatedRefinementCandidateCount, int &leafCountThreshold ) : void
maximumSubtrees int
estimatedRefinementCandidateCount int
leafCountThreshold int
return void

MeasureCacheQuality() public method

public MeasureCacheQuality ( ) : float
return float

MeasureCacheQuality() public method

public MeasureCacheQuality ( int nodeIndex ) : float
nodeIndex int
return float

MeasureCostMetric() public method

public MeasureCostMetric ( ) : float
return float

MeasureNodeOccupancy() public method

public MeasureNodeOccupancy ( int &nodeCount, int &childCount ) : void
nodeCount int
childCount int
return void

PartialRefine() public method

public PartialRefine ( int offset, int skip, QuickList &spareNodes, int maximumSubtrees, QuickList &treeletInternalNodes, BinnedResources &binnedResources, bool &nodesInvalidated ) : void
offset int
skip int
spareNodes QuickList
maximumSubtrees int
treeletInternalNodes QuickList
binnedResources BinnedResources
nodesInvalidated bool
return void

RecursiveRefine() public method

public RecursiveRefine ( int maximumSubtrees, int treeSizeSeed, QuickList &treeletInternalNodes, QuickList &spareNodes, BinnedResources &binnedResources, bool &nodesInvalidated ) : void
maximumSubtrees int
treeSizeSeed int
treeletInternalNodes QuickList
spareNodes QuickList
binnedResources BinnedResources
nodesInvalidated bool
return void

Refit() public method

public Refit ( ) : void
return void

RefitAndRefine() public method

public RefitAndRefine ( int frameIndex, IParallelLooper looper, RefitAndRefineMultithreadedContext context, float refineAggressivenessScale = 1, float cacheOptimizeAggressivenessScale = 1 ) : int
frameIndex int
looper IParallelLooper
context RefitAndRefineMultithreadedContext
refineAggressivenessScale float
cacheOptimizeAggressivenessScale float
return int

RefitAndRefine() public method

public RefitAndRefine ( int frameIndex, float refineAggressivenessScale = 1, float cacheOptimizeAggressivenessScale = 1 ) : int
frameIndex int
refineAggressivenessScale float
cacheOptimizeAggressivenessScale float
return int

RefitNonrecursive2() public method

public RefitNonrecursive2 ( ) : void
return void

RefitNonrecursive22() public method

public RefitNonrecursive22 ( ) : void
return void

RemoveAt() public method

public RemoveAt ( int leafIndex ) : LeafMove
leafIndex int
return LeafMove

RemoveUnusedInternalNodes() public method

public RemoveUnusedInternalNodes ( QuickList &spareNodes ) : void
spareNodes QuickList
return void

SweepBuild() public method

public SweepBuild ( int leafIds, BoundingBox leafBounds, int start, int length = -1, BufferPool intPool = null, BufferPool floatPool = null ) : void
leafIds int
leafBounds BoundingBox
start int
length int
intPool BufferPool
floatPool BufferPool
return void

TopDownAgglomerativeRefine() public method

public TopDownAgglomerativeRefine ( ) : void
return void

TopDownBinnedRefine() public method

public TopDownBinnedRefine ( int maximumSubtrees ) : void
maximumSubtrees int
return void

Validate() public method

public Validate ( ) : void
return void