:py:mod:`bempp.api.utils.octree` ================================ .. py:module:: bempp.api.utils.octree .. autoapi-nested-parse:: Implementation of an octree in Python. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: bempp.api.utils.octree.Octree Functions ~~~~~~~~~ .. autoapisummary:: bempp.api.utils.octree._make_unique bempp.api.utils.octree._in_range bempp.api.utils.octree.morton bempp.api.utils.octree.de_morton bempp.api.utils.octree._neighbors bempp.api.utils.octree._dilate bempp.api.utils.octree._contract .. py:class:: Octree(lbound, ubound, maximum_level, vertices) Bases: :py:obj:`object` Data structure for handling Octrees. .. py:property:: diameter Return diameter of the Octree in each dimension. .. py:property:: lower_bound Return lower bound of Octree in each dimension. .. py:property:: upper_bound Return upper bound of Octree in each dimension. .. py:property:: maximum_level Return the maximum level. .. py:property:: vertices Return the vertices. .. py:property:: non_empty_leaf_nodes Return the non-empty leaf nodes. .. py:property:: sorted_indices Return the indices sorted by leaf node. .. py: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]. .. py:property:: non_empty_nodes_by_level Return the non-empty nodes by level. .. py: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]]. .. py:property:: near_field_nodes Return near field nodes. .. py: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. .. py:method:: parent(node_index) Return the parent index of a node. .. py:method:: children(node_index) Return an iterator over the child indices. .. py:method:: nodes_per_side(level) Return number of nodes along each dimension. .. py:method:: nodes_per_level(level) Return the number of nodes in a given level. .. py:method:: leaf_containing_point(point) Return the Morton index of a node containing the point. .. py:method:: 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. .. py:method:: neighbors(node_index, level) Return a list of indices of the neighbors of a node. .. py:method:: node_diameter(level) Return node diameter in a given level. .. py:method:: _assign_nodes(vertices) Compute leaf-nodes and parents. .. py:method:: _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. .. py:method:: _compute_interaction_list() Compute the interaction list for each non empty node. .. py:function:: _make_unique(ar) Find unique elements. An implementation of Numpy unique for Numba. .. py:function:: _in_range(n1, n2, n3, bound) Check if 0 <= n1, n2, n3 < bound. .. py:function:: morton(indices) Encode an integer tuple (i1, i2, i3) via Morton encoding. .. py:function:: de_morton(index) Decode a Morton index. .. py:function:: _neighbors(node_index, level) Return a list of neighbors of a given node. .. py:function:: _dilate(number) Dilate an integer for the Morton encoding. .. py:function:: _contract(number) Undo dilation.