Skip to content

tetrahedralize splits a grid with hidden or refined cells differently (6 tetrahedra a hexahedron, not 5) #403

Closed

Description

@berkgeveci

tetrahedralize of a structured grid splits each hexahedron into 5 tetrahedra, alternating by the box's offset parity (_refine.py, _parity_tets). With any hidden or refined cell it first calls visible(), which extracts the other cells into unstructured hexahedra. Those are then split into 6 (_cone_tets): different diagonals, 20% more tetrahedra, and the parity ignored.

g = td.uniform_grid((5, 5, 5))
td.tetrahedralize(g).num_cells            # 320: 5 per hexahedron
marks = np.zeros(g.num_cells, np.uint8); marks[0] = td.Ghosts.REFINEDCELL
g.ghosts = td.Ghosts(cells=tack.array(marks, tack.u8))
td.tetrahedralize(g).num_cells            # 378: 6 per hexahedron, from 63

So an AMR hierarchy's boxes (everything below the finest level has refined cells) are split one way and its finest boxes another. Neighbouring boxes no longer split their shared faces alike. The output also depends on whether a box happens to have a masked cell.

Proposal. Leave masked cells out in place: give them no pieces in the count pass, and keep the structured 5-way split. The other algorithms that already compact masked cells do this through ghosts.without_hidden in _keep_cells.

Found while surveying ghost-driven slow paths for #316 (#401).

Activity

  1. added 2 commits that reference this issue on Nov 11, 2026
    ecaa6ff
    d25c29c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions