morphogen.mesh.octree¶
Balanced octrees of a box, refined where a level set needs it, and their conforming tetrahedralization.
The box is split into root cells (about size wide); a cell whose lines do not resolve
the level set (the test of morphogen.mesh.exact.adaptive_mesh() on its 27 lines of
three points: edges, middle lines of its faces and axes) is split into eight, down to the
smallest size. The octree is then balanced: two leaves that touch (by a face, an edge or a
corner, across the periodic faces too) differ by one level at most. Its tetrahedra are cones
from the centres of the leaves over their faces, each face (or quarter of a face, where the
leaf across it is finer) a fan from its centre over its corners and the nodes in the middle
of its sides: the same triangles on both sides of every face, so the mesh is conforming, and
on opposite faces of the box along the periodic axes, which match. Every tetrahedron joins
the centre of a leaf to a quarter of one of its faces at least: their shapes are bounded.
- morphogen.mesh.octree.LATTICE = array([[0, 0, 0], [0, 0, 1], [0, 0, 2], [0, 1, 0], [0, 1, 1], [0, 1, 2], [0, 2, 0], [0, 2, 1], [0, 2, 2], [1, 0, 0], [1, 0, 1], [1, 0, 2], [1, 1, 0], [1, 1, 1], [1, 1, 2], [1, 2, 0], [1, 2, 1], [1, 2, 2], [2, 0, 0], [2, 0, 1], [2, 0, 2], [2, 1, 0], [2, 1, 1], [2, 1, 2], [2, 2, 0], [2, 2, 1], [2, 2, 2]])¶
The 27 points of a cell, in half cells from its lower corner (index
9 a + 3 b + c)
- morphogen.mesh.octree.CHILDREN = array([[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1]])¶
The eight children of a cell
- morphogen.mesh.octree.NEIGHBOURS = array([[-1, -1, -1], [-1, -1, 0], [-1, -1, 1], [-1, 0, -1], [-1, 0, 0], [-1, 0, 1], [-1, 1, -1], [-1, 1, 0], [-1, 1, 1], [ 0, -1, -1], [ 0, -1, 0], [ 0, -1, 1], [ 0, 0, -1], [ 0, 0, 1], [ 0, 1, -1], [ 0, 1, 0], [ 0, 1, 1], [ 1, -1, -1], [ 1, -1, 0], [ 1, -1, 1], [ 1, 0, -1], [ 1, 0, 0], [ 1, 0, 1], [ 1, 1, -1], [ 1, 1, 0], [ 1, 1, 1]])¶
The 26 neighbours of a cell
- morphogen.mesh.octree.SEGMENTS = array([[ 0, 1], [ 0, 2], [ 0, 3], [ 0, 4], [ 0, 6], [ 0, 8], [ 0, 9], [ 0, 10], [ 0, 12], [ 0, 13], [ 0, 18], [ 0, 20], [ 0, 24], [ 0, 26], [ 1, 2], [ 1, 3], [ 1, 4], [ 1, 5], [ 1, 9], [ 1, 10], [ 1, 11], [ 1, 12], [ 1, 13], [ 1, 14], [ 2, 4], [ 2, 5], [ 2, 6], [ 2, 8], [ 2, 10], [ 2, 11], [ 2, 13], [ 2, 14], [ 2, 18], [ 2, 20], [ 2, 24], [ 2, 26], [ 3, 4], [ 3, 6], [ 3, 7], [ 3, 9], [ 3, 10], [ 3, 12], [ 3, 13], [ 3, 15], [ 3, 16], [ 4, 5], [ 4, 6], [ 4, 7], [ 4, 8], [ 4, 9], [ 4, 10], [ 4, 11], [ 4, 12], [ 4, 13], [ 4, 14], [ 4, 15], [ 4, 16], [ 4, 17], [ 5, 7], [ 5, 8], [ 5, 10], [ 5, 11], [ 5, 13], [ 5, 14], [ 5, 16], [ 5, 17], [ 6, 7], [ 6, 8], [ 6, 12], [ 6, 13], [ 6, 15], [ 6, 16], [ 6, 18], [ 6, 20], [ 6, 24], [ 6, 26], [ 7, 8], [ 7, 12], [ 7, 13], [ 7, 14], [ 7, 15], [ 7, 16], [ 7, 17], [ 8, 13], [ 8, 14], [ 8, 16], [ 8, 17], [ 8, 18], [ 8, 20], [ 8, 24], [ 8, 26], [ 9, 10], [ 9, 12], [ 9, 13], [ 9, 18], [ 9, 19], [ 9, 21], [ 9, 22], [10, 11], [10, 12], [10, 13], [10, 14], [10, 18], [10, 19], [10, 20], [10, 21], [10, 22], [10, 23], [11, 13], [11, 14], [11, 19], [11, 20], [11, 22], [11, 23], [12, 13], [12, 15], [12, 16], [12, 18], [12, 19], [12, 21], [12, 22], [12, 24], [12, 25], [13, 14], [13, 15], [13, 16], [13, 17], [13, 18], [13, 19], [13, 20], [13, 21], [13, 22], [13, 23], [13, 24], [13, 25], [13, 26], [14, 16], [14, 17], [14, 19], [14, 20], [14, 22], [14, 23], [14, 25], [14, 26], [15, 16], [15, 21], [15, 22], [15, 24], [15, 25], [16, 17], [16, 21], [16, 22], [16, 23], [16, 24], [16, 25], [16, 26], [17, 22], [17, 23], [17, 25], [17, 26], [18, 19], [18, 20], [18, 21], [18, 22], [18, 24], [18, 26], [19, 20], [19, 21], [19, 22], [19, 23], [20, 22], [20, 23], [20, 24], [20, 26], [21, 22], [21, 24], [21, 25], [22, 23], [22, 24], [22, 25], [22, 26], [23, 25], [23, 26], [24, 25], [24, 26], [25, 26]])¶
The 186 segments of
LATTICEthat may be edges of tetrahedra (_segments())
- class morphogen.mesh.octree.Octree(lower, upper, n, axes, maxlevel: int)[source]¶
Bases:
objectLeaves
(level, i, j, k)of an octree overnroot cells along each axis of the box[lower, upper](a leaf of levellis2^ltimes smaller than a root cell), periodic alongaxes, at mostmaxleveldeep.- wrap(level, ijk) tuple[ndarray, ndarray][source]¶
Cell indices wrapped along the periodic axes, and whether they lie in the box.
- refine(test) list[int][source]¶
Split the leaves for which
test(points)(of their 27 points(k, 27, 3), and their sides(k, 3)) is true, then their children, down tomaxlevel; returns the number of leaves split at each level.