Regridding
The equations of patchwork.mesh.regrid, declared on the code that implements them and checked by the tests.
cluster
functionsourceCover the tagged cells with boxes (the Berger-Rigoutsos algorithm).
- efficiency
- signature
- inflection
- Assumes
- cut at an empty row or column nearest the middle, else at the strongest inflection (sides of at least 4 cells), else in the middle of the longest side
- every part shrinks to its tagged cells; boxes shorter than
min_sizeare widened into free allowed cells - the boxes are disjoint and cover every allowed tagged cell
- References
curve_ranks
functionsourceThe rank of each box: the boxes of all levels along a space-filling curve, cut into size runs.
- morton
- hilbert
- ranks
- Assumes
- the patches of all refined levels on one curve, a coarse patch before the finer ones at the same corner, so that a patch and the patches over it tend to share a rank
- the cost of a box is its cells, or its weight (
box_costs); the load a rank already has (the base level) counts - a patch stays on one rank
- References
gradient_tags
functionsourceTag the cells across which field name changes by more than threshold.
- cells
- nodes
- Assumes
- the change per cell of each level: tagging stops once the cells resolve the field
- only points of one patch are compared; the tags are combined over the ranks by
regrid
knapsack_ranks
functionsourceThe rank of each box: the largest cost first, each to the rank with the least so far.
- greedy
- Assumes
- the greedy (longest processing time first) solution of the knapsack-like partition: the largest cost at most 4/3 of the best possible
- no locality: neighbouring patches may land on any ranks
- References
quadtree_boxes
functionsourceThe boxes of every refined level as the blocks of a quadtree (an octree in 3D).
- blocks
- children
- Assumes
- each patch is one block of
block_sizecells of its level, aligned to multiples ofblock_size; the last block of a level may be shorter, and a block that crosses the edge of the domain or a forbidden cell is cut into rectangles of its allowed cells - a level is refined, with a margin of
nestingcells, wherever a finer block needs it, so the blocks are properly nested (a balanced tree)
- each patch is one block of
- References