bempp.api.utils.octree
¶
Implementation of an octree in Python.
Module Contents¶
Classes¶
Data structure for handling Octrees. |
Functions¶
|
Find unique elements. |
|
Check if 0 <= n1, n2, n3 < bound. |
|
Encode an integer tuple (i1, i2, i3) via Morton encoding. |
|
Decode a Morton index. |
|
Return a list of neighbors of a given node. |
|
Dilate an integer for the Morton encoding. |
|
Undo dilation. |
- class bempp.api.utils.octree.Octree(lbound, ubound, maximum_level, vertices)¶
Bases:
object
Data structure for handling Octrees.
- property diameter¶
Return diameter of the Octree in each dimension.
- property lower_bound¶
Return lower bound of Octree in each dimension.
- property upper_bound¶
Return upper bound of Octree in each dimension.
- property maximum_level¶
Return the maximum level.
- property vertices¶
Return the vertices.
- property non_empty_leaf_nodes¶
Return the non-empty leaf nodes.
- property sorted_indices¶
Return the indices sorted by leaf node.
- property leaf_nodes_ptr¶
Return the index pointers for the leaf node elements.
Returns an array index_ptr, such that the indices from the jth non-empty leaf node can be obtained by self.sorted_indices[index_ptr[j]:index_ptr[j+1]] and the associated node index through self._non_empty_leaf_nodes[j].
- property non_empty_nodes_by_level¶
Return the non-empty nodes by level.
- property non_empty_nodes_ptr¶
Return the index pointers for non-empty nodes by level.
Returns an array index_ptr, such that the non-empty nodes of the jth level are given by self.non_empty_nodes_by_level[index_ptr[j]:index_ptr[j+1]].
- property near_field_nodes¶
Return near field nodes.
- property near_field_nodes_ptr¶
Return an index ptr to the near field nodes.
Returns an array index_ptr, such that self.near_field_nodes[index_ptr[j]:index_ptr[j+1]] contains the near field nodes for all nodes in level j. There are 27 entries for each near field node. The sequence of nodes is the same as for the array non_empty_nodes_by_level.
- parent(node_index)¶
Return the parent index of a node.
- children(node_index)¶
Return an iterator over the child indices.
- nodes_per_side(level)¶
Return number of nodes along each dimension.
- nodes_per_level(level)¶
Return the number of nodes in a given level.
- leaf_containing_point(point)¶
Return the Morton index of a node containing the point.
- node_bounds(morton_index, level)¶
Return the lower/upper bound of a node by Morton index.
The method returns a tuple (lbound, ubound) which define the lower and upper corners of a node given by its Morton index.
- neighbors(node_index, level)¶
Return a list of indices of the neighbors of a node.
- node_diameter(level)¶
Return node diameter in a given level.
- _assign_nodes(vertices)¶
Compute leaf-nodes and parents.
- _compute_nearfields()¶
Compute near fields of all non empty nodes.
Each node can have at most 27 near field nodes (including the node itself). If a near field node does not exist or is empty then the value -1 is stored, otherwise the node number.
- _compute_interaction_list()¶
Compute the interaction list for each non empty node.
- bempp.api.utils.octree._make_unique(ar)¶
Find unique elements.
An implementation of Numpy unique for Numba.
- bempp.api.utils.octree._in_range(n1, n2, n3, bound)¶
Check if 0 <= n1, n2, n3 < bound.
- bempp.api.utils.octree.morton(indices)¶
Encode an integer tuple (i1, i2, i3) via Morton encoding.
- bempp.api.utils.octree.de_morton(index)¶
Decode a Morton index.
- bempp.api.utils.octree._neighbors(node_index, level)¶
Return a list of neighbors of a given node.
- bempp.api.utils.octree._dilate(number)¶
Dilate an integer for the Morton encoding.
- bempp.api.utils.octree._contract(number)¶
Undo dilation.