bempp_octree

Module morton

Source
Expand description

Routines for working with Morton keys.

A Morton key is a 64 bit integer that uniquely encodes a node of an octree. This module defines methods for working with Morton keys. Morton keys within this library support octree data structures up to a depth of level 16, meaning we have on the deepest level indices from 0 to 65535 in each direction. An octree node has 8 children meaning per level we require 3 bits to uniquely identify a descendent. Hence, in total we require 48 bits. In addition we have reserved 15 bits for level information, which is more than required. The level information is stored in the lowest 15 bits and the index information is stored in the next 48 bits. Hence, a valid key requires 63 bits. We use bit 64 to indicate an invalid key. If bit 64 is 1 then the key is invalid. This is useful for initializing arrays of Morton keys with default values. The default value of a Morton key is an invalid key.

Structsยง