41 unsigned long oid =
id;
46 unsigned long omask = (1ul <<
dim) - 1ul;
48 unsigned long i = 0ul;
50 zmort.
id |= (((oid & omask) << 1ul) + (p & 1ul)) << (i * zmort.
dim);
67 unsigned long oid =
id >> d;
68 unsigned long pos = 0;
72 pos |= (oid & 1ul) << i;
86 inline ZMORT set(
unsigned long d,
unsigned long p) {
87 unsigned long oid =
id >> d;
88 unsigned long omask = (1ul <<
dim) - 2ul;
91 ZMORT zmort(
id & ((1ul << d) - 1),
dim);
93 zmort.
id |= ((p & 1ul) + (oid & omask)) << i;
102 inline operator unsigned long()
const {
n-dimensional Z-Mort ordering
Definition: zmort.h:18
unsigned long operator()(unsigned long d)
Get positions of a Z-Mort index on the d-th dimension.
Definition: zmort.h:66
unsigned long id
Z-Mort index of this struct.
Definition: zmort.h:19
unsigned long dim
Number of dimensions.
Definition: zmort.h:20
ZMORT()
Default to 0-d.
Definition: zmort.h:23
ZMORT operator[](unsigned long p)
Continuously construct a Z-Mort index.
Definition: zmort.h:40
ZMORT set(unsigned long d, unsigned long p)
Set positions of a Z-Mort index on the d-th dimension.
Definition: zmort.h:86
ZMORT(unsigned long id, unsigned long dim)
Initialize using z-mort id and the number of dimensions.
Definition: zmort.h:26