API Reference

H2Trees.AggregateMode β€” Type
AggregateMode <: FarMulMode

This mode uses AggregatePlan and DisaggregateTranslatePlan to perform the farmultiplication.

source
H2Trees.AllTranslations β€” Type
struct AllTranslations <: AbstractTranslationTrait

Represents the translation trait where all translations that occur are unique and are stored individually.

source
H2Trees.ChildIterator β€” Type
ChildIterator{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.
source
H2Trees.DepthFirstIterator β€” Type
DepthFirstIterator{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.

source
H2Trees.DirectionInvariance β€” Type
struct 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.

source
H2Trees.DirectionInvariancePerLevel β€” Type
struct 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.

source
H2Trees.ParentUpwardsIterator β€” Type
ParentUpwardsIterator{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.
source
H2Trees.LevelIterator β€” Method
LevelIterator(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.

source
H2Trees.NearNodeIterator β€” Method
NearNodeIterator(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 the trialtree from which to start the search.
  • isnear: A function that returns true if two nodes are near each other. Defaults to 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.

source
H2Trees.NearNodeIterator β€” Method
NearNodeIterator(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 returns true if two nodes are near each other. Defaults to 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.

source
H2Trees.NodeFilterIterator β€” Method
NodeFilterIterator(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 over
  • trialtree: The tree to which the trialnode belongs to
  • trialnode::Int: The node to start from
  • filter: 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

source
H2Trees.NodeFilterIterator β€” Method
NodeFilterIterator(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 over
  • node::Int: The node to start from
  • filter: 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

source
H2Trees.SameLevelIterator β€” Method
SameLevelIterator(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.

source
H2Trees.WellSeparatedIterator β€” Method
WellSeparatedIterator(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 tree
  • trialtree: the trial tree
  • trialnode: the node in the trial tree for which the translations happen
  • iswellseparated: a function that returns true if two nodes are well-separated and false otherwise

Returns

An iterator that yields the nodes in the testtree that are well-separated from the specified trialnode in the trialtree.

source
H2Trees.WellSeparatedIterator β€” Method
WellSeparatedIterator(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 occur
  • node: the node for which the translations happen
  • iswellseparated: a function that returns true if two nodes are well-separated and false otherwise

Returns

An iterator that yields the nodes that are well-separated from the specified node in the tree.

source
H2Trees.WellSeparatedIterator β€” Method
WellSeparatedIterator(; 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 the isnear criterion.
  • iswellseparated: a function that takes a tree as input and returns another function. This returned function is then used to evaluate the iswellseparated criterion.

Returns

A WellSeparatedIteratorFunctor that returns a WellSeparatedIterator if provided with a tree.

Throws

  • error: if both isnear and iswellseparated are provided, or if neither is provided.
source
H2Trees.boundingbox β€” Method
boundingbox(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.

source
H2Trees.cornerpoints β€” Method
cornerpoints(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.
source
H2Trees.findleafnode β€” Method
findleafnode(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, or 0 if not found.
source
H2Trees.leaves β€” Function
leaves(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.

source
H2Trees.leveltolevelid β€” Method
leveltolevelid(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.

source
H2Trees.minimumlevel β€” Method
minimumlevel(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.

source
H2Trees.parentcenterminuschildcenter β€” Method
parentcenterminuschildcenter(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.
source
H2Trees.translations β€” Method
function translations(tree, translatingplan::AbstractPlan, translationtrait)

Compute the translations of the tree based on the given translating plan and translation trait.

Arguments

  • tree: The tree
  • translatingplan::AbstractPlan: The plan describing the translations in the tree
  • translationtrait: The trait describing the translations

Returns

A tuple containing two vectors:

  • The first vector contains NamedTuples with fields receivingnode, translatingnode, and translationID. The translationID is the id of the translation in the translation directions.
  • The second vector contains the translation directions.
source
H2Trees.values β€” Method
values(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.

source
H2Trees.TwoNTree β€” Method
TwoNTree(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.

source
H2Trees.TwoNTree β€” Method
TwoNTree(testspace::BEAST.Space, trialspace::BEAST.Space, minhalfsize; kwargs...)

Construct a block tree with two TwoNTrees 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.

source
H2Trees.traceball β€” Method
traceball(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: Tree
  • node: Cluster to plot.
  • kwargs: keyword arguments passed to PlotlyJS
source
H2Trees.traceball β€” Method
traceball(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 to PlotlyJS
source
H2Trees.tracecube β€” Method
tracecube(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: tree
  • node::Int: Cluster to plot
  • kwargs: keyword arguments passed to PlotlyJS
source
H2Trees.tracecube β€” Method
tracecube(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 to PlotlyJS
source