|
Peano
|
Peano space-filling curve as Peano's spacetree traversal runs through it. More...
Functions | |
| bool | _is_traversal_positive_along_axis (tuple even_flags, int axis) |
| Python counterpart of peano4.grid.PeanoCurve.isTraversePositiveAlongAxis() for a non-inverted traversal. | |
| tuple | _children_in_traversal_order (tuple directions) |
| The 3^d children of a cell in the order of peano4.utils.zfor3. | |
| tuple | _child_even_flags (tuple even_flags, tuple child) |
| Even flags of a child: the middle child along an axis inverts this axis' flag. | |
| int | _cartesian_to_peano (tuple coordinates, int size) |
| tuple | _peano_to_cartesian (int peano_index, int size, int dimensions) |
| int | Cartesian_to_Peano_2d (tuple[int, int] coordinates, int size) |
| Map Cartesian index to Peano SFC index. | |
| int | Cartesian_to_Peano_3d (tuple[int, int, int] coordinates, int size) |
| Map 3-D Cartesian index to Peano SFC index. | |
| tuple[int, int] | Peano_to_Cartesian_2d (int peano_index, int size) |
| Inverse of Cartesian_to_Peano_2d. | |
| tuple[int, int, int] | Peano_to_Cartesian_3d (int peano_index, int size) |
| Inverse of Cartesian_to_Peano_3d. | |
Peano space-filling curve as Peano's spacetree traversal runs through it.
The routines replicate the traversal order of peano4.grid.Spacetree, i.e. they do not implement an arbitrary Peano curve but exactly the one that Peano's C++ core uses. The offline load balancing hence plans along the same order in which Peano later hands out cells throughout a split.
The order is defined recursively. The root cell starts with all even flags unset. A cell runs through its \( 3^d \) children in a serpentine (boustrophedon) order: axis 0 is the fastest axis, axis d-1 the slowest one. Along each axis, the cell runs in positive direction if the number of even flags set for the other axes is even (peano4.grid.PeanoCurve.isTraversePositiveAlongAxis()), and the serpentine then alternates the direction of all faster axes (peano4.utils.zfor3). A child inherits the even flags of its parent, but the middle child along an axis inverts the flag of this axis (peano4.grid.Spacetree.refineState()).
Peano inverts the whole traversal in every other mesh sweep. The routines here describe the non-inverted traversal. The inverted one runs through the same curve backwards. The offline load balancing ignores this inversion and always plans along the non-inverted curve: A split which Peano carries out in an inverted sweep picks its cells from the other end of the curve, but it still hands over the requested number of cells.
|
protected |
Definition at line 72 of file SFC.py.
References _child_even_flags(), _children_in_traversal_order(), and _is_traversal_positive_along_axis().
Referenced by Cartesian_to_Peano_2d(), and Cartesian_to_Peano_3d().


|
protected |
Even flags of a child: the middle child along an axis inverts this axis' flag.
Definition at line 67 of file SFC.py.
Referenced by _cartesian_to_peano(), and _peano_to_cartesian().

|
protected |
The 3^d children of a cell in the order of peano4.utils.zfor3.
| directions | tuple of bool One flag per axis: True means that the traversal runs in positive direction along this axis. |
Definition at line 46 of file SFC.py.
References _children_in_traversal_order().
Referenced by _cartesian_to_peano(), _children_in_traversal_order(), and _peano_to_cartesian().


|
protected |
Python counterpart of peano4.grid.PeanoCurve.isTraversePositiveAlongAxis() for a non-inverted traversal.
Definition at line 35 of file SFC.py.
Referenced by _cartesian_to_peano(), and _peano_to_cartesian().

|
protected |
Definition at line 93 of file SFC.py.
References _child_even_flags(), _children_in_traversal_order(), and _is_traversal_positive_along_axis().
Referenced by Peano_to_Cartesian_2d(), and Peano_to_Cartesian_3d().


| int SFC.Cartesian_to_Peano_2d | ( | tuple[int, int] | coordinates, |
| int | size ) |
Map Cartesian index to Peano SFC index.
This operation accepts a Cartesian index and returns the position of this cell along Peano's traversal (see the file documentation). In the example below
we can hand in (4,2) and get a 10 back.
Args: coordinates: (x, y) index with entries in [0, size-1] size: Side length of the square grid; must be a power of 3.
Returns: Integer Peano SFC index in [0, size*size - 1].
Definition at line 120 of file SFC.py.
References _cartesian_to_peano().

| int SFC.Cartesian_to_Peano_3d | ( | tuple[int, int, int] | coordinates, |
| int | size ) |
Map 3-D Cartesian index to Peano SFC index.
Three-dimensional counterpart of Cartesian_to_Peano_2d.
Args: coordinates: (x, y, z) index with entries in [0, size-1] size: Side length of the cubic grid; must be a power of 3.
Returns: Integer Peano SFC index in [0, size**3 - 1].
Definition at line 143 of file SFC.py.
References _cartesian_to_peano().

| tuple[int, int] SFC.Peano_to_Cartesian_2d | ( | int | peano_index, |
| int | size ) |
Inverse of Cartesian_to_Peano_2d.
Args: peano_index: SFC index in [0, size*size - 1]. size: Side length of the square grid; must be a power of 3.
Returns: (x, y) Cartesian coordinates.
Definition at line 160 of file SFC.py.
References _peano_to_cartesian().
Referenced by 35_offline-load-balancing-plan-vs-run.draw(), and 35_offline-load-balancing-split-modes.read_subdomains().


| tuple[int, int, int] SFC.Peano_to_Cartesian_3d | ( | int | peano_index, |
| int | size ) |
Inverse of Cartesian_to_Peano_3d.
Args: peano_index: SFC index in [0, size**3 - 1]. size: Side length of the cubic grid; must be a power of 3.
Returns: (x, y, z) Cartesian coordinates.
Definition at line 176 of file SFC.py.
References _peano_to_cartesian().
