API Reference
H2Trees.AbstractTranslationTrait
H2Trees.AggregateMode
H2Trees.AggregateTranslateMode
H2Trees.AllTranslations
H2Trees.BlockTree
H2Trees.BoundingBallTree
H2Trees.ChildIterator
H2Trees.DepthFirstIterator
H2Trees.DirectionInvariance
H2Trees.DirectionInvariancePerLevel
H2Trees.ParentUpwardsIterator
H2Trees.QuadPointsTree
H2Trees.SimpleHybridTree
H2Trees.TwoNTree
H2Trees.TwoNTree
H2Trees.TwoNTree
H2Trees.FarNodeIterator
H2Trees.LevelIterator
H2Trees.NearNodeIterator
H2Trees.NearNodeIterator
H2Trees.NodeFilterIterator
H2Trees.NodeFilterIterator
H2Trees.SameLevelIterator
H2Trees.TranslatingNodesIterator
H2Trees.WellSeparatedIterator
H2Trees.WellSeparatedIterator
H2Trees.WellSeparatedIterator
H2Trees.boundingbox
H2Trees.cornerpoints
H2Trees.findleafnode
H2Trees.isnear
H2Trees.iswellseparated
H2Trees.leaves
H2Trees.leveltolevelid
H2Trees.minimumlevel
H2Trees.parentcenterminuschildcenter
H2Trees.traceball
H2Trees.traceball
H2Trees.tracecube
H2Trees.tracecube
H2Trees.translations
H2Trees.values
H2Trees.AbstractTranslationTrait
β Typeabstract type AbstractTranslationTrait
Abstract type for translation traits.
H2Trees.AggregateMode
β TypeAggregateMode <: FarMulMode
This mode uses AggregatePlan
and DisaggregateTranslatePlan
to perform the farmultiplication.
H2Trees.AggregateTranslateMode
β TypeAggregateTranslateMode <: FarMulMode
This mode uses AggregateTranslatePlan
and DisaggregatePlan
to perform the farmultiplication.
H2Trees.AllTranslations
β Typestruct AllTranslations <: AbstractTranslationTrait
Represents the translation trait where all translations that occur are unique and are stored individually.
H2Trees.BlockTree
β TypeBlockTree
H2Trees.BoundingBallTree
β TypeBoundingBallTree
H2Trees.ChildIterator
β TypeChildIterator{T,N<:Integer}
An iterator over the children of a node in a tree.
Fields
tree::T
: The tree.node::N
: The node whose children are being iterated over.
H2Trees.DepthFirstIterator
β TypeDepthFirstIterator{T,N<:Integer}
Traverses the tree in a depth first manner. If no node is specified the tree is traversed from the root node.
Fields
tree::T
: The tree.node::Int
: The node from which the tree is traversed.
Methods
DepthFirstIterator(tree, node)
Creates a new DepthFirstIterator
instance, traversing the tree from the specified node
.
DepthFirstIterator(tree)
Creates a new DepthFirstIterator
instance, traversing the tree from the root node.
H2Trees.DirectionInvariance
β Typestruct DirectionInvariance <: AbstractTranslationTrait
Represents the translation trait where the direction of translation is invariant, i.e., translations in different directions are identical. Therefore, only one version of the translation is stored.
H2Trees.DirectionInvariancePerLevel
β Typestruct DirectionInvariancePerLevel <: AbstractTranslationTrait
Represents the translation trait where translations on the same level with the same length and direction are identical. Therefore, only one version of the translation is stored.
H2Trees.ParentUpwardsIterator
β TypeParentUpwardsIterator{T,N<:Int}
ParentUpwardsIterator is an iterator that iterates over all parent nodes of a given node in a tree until the root is reached. The last node is the node 0.
Fields
tree::T
: The tree.node::Int
: The node over which parents is iterated.
H2Trees.QuadPointsTree
β TypeQuadPointsTree
H2Trees.SimpleHybridTree
β TypeSimpleHybridTree
H2Trees.TwoNTree
β TypeTwoNTree
H2Trees.FarNodeIterator
β MethodSee NearNodeIterator.
H2Trees.LevelIterator
β MethodLevelIterator(tree, level::Int)
Return an iterator over the nodes at the specified level
in the tree
.
Arguments
tree
: The tree object.level
: The level at which to iterate.
Returns
An iterator over the nodes at the specified level.
H2Trees.NearNodeIterator
β MethodNearNodeIterator(testtree, trialtree, trialnode::Int; isnear=isnear)
Returns an iterator over the nodes in the testtree
that are at the same level as the specified node
in the trialtree
and are near to node
. Two nodes are near if the function isnear(testtree, trialtree, testnode, trialnode)
evaluates to true.
Arguments
testtree
: The tree to search for near nodes.trialtree
: The tree that contains the node to find near nodes for.trialnode::Int
: The node in thetrialtree
from which to start the search.isnear
: A function that returnstrue
if two nodes are near each other. Defaults toisnear
.
Returns
An iterator over the nodes in the testtree
that are at the same level as the specified node
in the trialtree
and are near to node
.
H2Trees.NearNodeIterator
β MethodNearNodeIterator(tree, node::Int; isnear=isnear)
Returns an iterator over the nodes in the tree that are at the same level as the specified node
and are near to node
. Two nodes are near if the function isnear(tree, nodea, nodeb)
evaluates to true.
Arguments
tree
: The tree to search for near nodes.node::Int
: The node from which to start the search.isnear
: A function that returnstrue
if two nodes are near each other. Defaults toisnear
.
Returns
An iterator over the nodes in the tree that are at the same level as the specified node
and are near to node
.
H2Trees.NodeFilterIterator
β MethodNodeFilterIterator(testtree, trialtree, trialnode::Int, filter)
Returns an iterator over nodes at the same level as trialnode
in trialtree
, for which the function filter(testtree, trialtree, testnode, trialnode)
return true.
In the case of a tree with the trait isBlockTree
, it is assumed that trialnode
is belonging to the trialtree
.
Arguments
testtree
: The tree to iterate overtrialtree
: The tree to which thetrialnode
belongs totrialnode::Int
: The node to start fromfilter
: A function that takes a test tree, a trial tree, a test node, and a trial node and returns a boolean
Returns
An iterator over nodes at the same level as trialnode
that pass the filter
H2Trees.NodeFilterIterator
β MethodNodeFilterIterator(tree, node::Int, filter)
Returns an iterator that returns nodes at the same level as node
, for which the function filter(tree, nodea, nodeb)
or the function filter(testtree, trialtree, testnode, trialnode)
return true. In the case of a tree with the trait isBlockTree
it is assumed that node is belonging to the trialtree
.
Arguments
tree
: The tree to iterate overnode::Int
: The node to start fromfilter
: A function that takes a tree and two nodes and returns a boolean
Returns
An iterator over nodes at the same level as node
that pass the filter
H2Trees.SameLevelIterator
β MethodSameLevelIterator(tree, node::Int)
Returns an iterator over the nodes at the same level as node
in the tree
.
Arguments
tree
: The tree structure.node
: The node for which to find the same level nodes.
Returns
An iterator over the nodes at the same level as node
.
H2Trees.TranslatingNodesIterator
β FunctionTranslatingNodesIterator
This is a wrapper for the `WellSeparatedIterator`.
H2Trees.WellSeparatedIterator
β MethodWellSeparatedIterator(testtree, trialtree, trialnode::Int; iswellseparated=iswellseparated)
Constructs an iterator to identify which translations should occur and which should not. This determination is based on the concept of well-separated nodes. Two nodes are considered well-separated if their parents are near each other and the nodes themselves are far apart. This assumes that child clusters are completely inside their parent clusters.
Arguments
testtree
: the test treetrialtree
: the trial treetrialnode
: the node in the trial tree for which the translations happeniswellseparated
: a function that returnstrue
if two nodes are well-separated andfalse
otherwise
Returns
An iterator that yields the nodes in the testtree
that are well-separated from the specified trialnode
in the trialtree
.
H2Trees.WellSeparatedIterator
β MethodWellSeparatedIterator(tree, node::Int; iswellseparated=iswellseparated)
Constructs an iterator to identify which translations should occur and which should not. This determination is based on the concept of well-separated nodes. Two nodes are considered well-separated if their parents are near each other and the nodes themselves are far apart. This assumes that child clusters are completely inside their parent clusters.
Arguments
tree
: the tree in which the translations occurnode
: the node for which the translations happeniswellseparated
: a function that returnstrue
if two nodes are well-separated andfalse
otherwise
Returns
An iterator that yields the nodes that are well-separated from the specified node
in the tree
.
H2Trees.WellSeparatedIterator
β MethodWellSeparatedIterator(; isnear=nothing, iswellseparated=nothing)
Constructs a functor that returns a WellSeparatedIterator
if provided a tree. Two nodes are considered well-separated if their parents are near each other and the nodes themselves are far apart. This assumes that child clusters are completely inside their parent clusters.
Arguments
isnear
: a function that takes a tree as input and returns another function. This returned function is then used to evaluate theisnear
criterion.iswellseparated
: a function that takes a tree as input and returns another function. This returned function is then used to evaluate theiswellseparated
criterion.
Returns
A WellSeparatedIteratorFunctor
that returns a WellSeparatedIterator
if provided with a tree.
Throws
error
: if bothisnear
andiswellseparated
are provided, or if neither is provided.
H2Trees.boundingbox
β Methodboundingbox(points::Vector{SVector{D, T}})
Returns halfsize and center of bounding box of points. The halfsize is the half of the length of the edge of the bounding box.
H2Trees.cornerpoints
β Methodcornerpoints(tree::TwoNTree{N,D,T}, node::Int, i)
Return the corner point of a given node in an N-dimensional TwoNTree.
Arguments
tree::TwoNTree{N,D,T}
: The tree.node::Int
: The index of the node.i
: The corner point index (1 til 2^N).
Returns
- The corner point coordinates as a
SVector
.
H2Trees.findleafnode
β Methodfindleafnode(tree, value::Int)
Find the leaf node in the given tree
that contains the specified value
.
Arguments
tree
: The tree to search in.value
: The value to search for.
Returns
- The leaf node that contains the
value
, or0
if not found.
H2Trees.isnear
β Methodisnear
H2Trees.iswellseparated
β Methodiswellseparated
H2Trees.leaves
β Functionleaves(tree, node::Int)
Returns an iterator over the leaf nodes in the tree, starting from the specified node
. If no node is specified the tree is traversed from the root node.
Arguments
tree
: The tree to search for leaf nodes.node::Int
: The node from which to start the search.
Returns
An iterator over the leaf nodes in the tree.
H2Trees.leveltolevelid
β Methodleveltolevelid(tree, level::Int)
Converts a level in the tree to its corresponding level ID. This is relevant since the first level might not be level 1.
Arguments
tree
: The tree object.level
: The level to convert.
Returns
The level ID corresponding to the given level.
H2Trees.minimumlevel
β Methodminimumlevel(tree)
Get the minimum level of a tree, which is the level of the root node. This is not necessarily the level 1.
Arguments
tree
: The tree.
Returns
The minimum level of the tree.
H2Trees.parentcenterminuschildcenter
β Methodparentcenterminuschildcenter(tree::TwoNTree{N,D,T}, child::Int) where {D,T}
Calculate the difference r_p-r_c
between the center of the parent r_p
and the center of the child node r_c
.
Arguments
tree::TwoNTree{N,D,T}
child::Int
: The index of the child node.
Returns
SVector{N,T}
: The difference between the center of the parent node and the center of the child node.
H2Trees.translations
β Methodfunction translations(tree, translatingplan::AbstractPlan, translationtrait)
Compute the translations of the tree based on the given translating plan and translation trait.
Arguments
tree
: The treetranslatingplan::AbstractPlan
: The plan describing the translations in the treetranslationtrait
: The trait describing the translations
Returns
A tuple containing two vectors:
- The first vector contains
NamedTuple
s with fieldsreceivingnode
,translatingnode
, andtranslationID
. ThetranslationID
is the id of the translation in the translation directions. - The second vector contains the translation directions.
H2Trees.values
β Methodvalues(tree, node::Int)
Returns the values stored in the given node
of the tree
. If the node
is a leaf node, it returns the values directly. Otherwise, it recursively collects the values from all the leaf nodes in the subtree rooted at the given node
.
Arguments
tree
: The H2 tree.node::Int
: The index of the node.
Returns
An array of values stored in the given node
or its subtree.
H2Trees.TwoNTree
β MethodTwoNTree(space::BEAST.Space, minhalfsize; kwargs...)
Construct a TwoNTree from a given BEAST.Space
.
Arguments
space::BEAST.Space
: The input space.minhalfsize
: The minimum half-size of the tree.kwargs...
: Additional keyword arguments.
Returns
A TwoNTree.
H2Trees.TwoNTree
β MethodTwoNTree(testspace::BEAST.Space, trialspace::BEAST.Space, minhalfsize; kwargs...)
Construct a block tree with two TwoNTree
s from two given spaces: a test space and a trial space.
Arguments
testspace::BEAST.Space
: The test space.trialspace::BEAST.Space
: The trial space.minhalfsize
: The minimum half-size of the tree.kwargs...
: Additional keyword arguments.
Returns
A TwoNTree.
H2Trees.traceball
β Methodtraceball(center::H2ClusterTree, radius; n=30, kwargs...) where
Returns a trace, which can be used to plot a bounding ball of a BoundingBallTree
in PlotlyJS
. All 'kwargs' are passed to PlotlyJS.scatter
or PlotlyJS.surface
, respectively.
Arguments:
tree::H2ClusterTree
: Treenode
: Cluster to plot.kwargs
: keyword arguments passed toPlotlyJS
H2Trees.traceball
β Methodtraceball(center::SVector{D,T}, radius; n=30, kwargs...) where {D,T}
Returns a trace, which can be used to plot a bounding ball in PlotlyJS. All 'kwargs' are passed to PlotlyJS.scatter
or PlotlyJS.surface
, respectively.
Arguments:
center
: Center of the bounding ball.radius
: Radius of bounding ball.kwargs
: keyword arguments passed toPlotlyJS
H2Trees.tracecube
β Methodtracecube(tree::H2ClusterTree, node::Int; kwargs...)
Returns a trace, which can be used to plot a cluster of a TwoNTree
in PlotlyJS
. All 'kwargs' are passed to PlotlyJS.scatter
or PlotlyJS.scatter3d
, respectively.
Arguments:
tree::H2ClusterTree
: treenode::Int
: Cluster to plotkwargs
: keyword arguments passed toPlotlyJS
H2Trees.tracecube
β Methodtracecube(center::SVector{D, T}, halfsize; kwargs...)
Returns a trace, which can be used to plot a bounding box in PlotlyJS. All 'kwargs' are passed to PlotlyJS.scatter
or PlotlyJS.scatter3d
, respectively.
Arguments:
center
: Center of the bounding box.halfsize
: Halfsize of the bounding box, which is half of the length of the edge of the bounding box.kwargs
: keyword arguments passed toPlotlyJS