Repository navigation
The headline: Tack's filters run inside VTK. Nearly every tack.dataset
filter is a VTK algorithm (tack.interop.vtk.algorithms), its
arguments the algorithm's parameters, taking trees of datasets, AMR
hierarchies and pieces over MPI ranks, and running on the device its
device names. Datasets cross between VTK and Tack without a copy
(copy=False): on the CPU, on Metal, and on CUDA, HIP and Level Zero with a
VTK that holds device arrays. Examples 47-53 are VTK pipelines with Tack's
filters in them, on real Exodus, OpenFOAM and AMR files. Higher orders:
bases of any order on every shape from segments to wedges, Bernstein and
serendipity spaces, HDiv and HCurl at order 1, curved geometries, and
contour, slice, clip, threshold, advection and integration of them, cut at
the field's roots; VTK's Lagrange, Bezier and quadratic cells, its
vtkCellGrid and more of MFEM, both ways, with galleries in the
Visualization Guide. Advection gains an adaptive RK45, a path length, a
terminal speed and a walk through face neighbours; tack.algorithms gains
segmented reductions and scans, the same bits on every backend. The
documentation site is rewritten around Tack's four layers, the repository
is now github.com/Kitware/tack, and tack-core is on PyPI
(pip install 'tack-core[cpu]'), with tack-vis installed from this
repository at the release tag.
Nine changes break code written for 0.6; they lead the Changed section. The
ones most programs meet: data.fields is a Fields mapping that refuses an
ambiguous name, project into Constant averages over each cell rather
than its corners, extract_surface keeps only the points its faces use, the
VTK algorithms of points, lines and surfaces give vtkPolyData, and a
kernel over cells that reads their faces or edges asks for them with
incidence=.
Validated on Linux (CPU; CUDA on an RTX 6000 Ada; HIP on two MI210s; Level
Zero on an Intel Max 1100) and macOS (CPU and Metal on an M1 Max), with
debug mode, both id widths of the dataset tests and MPI, against VTK 9.7.1,
VTK master and VTK builds holding CUDA, HIP and Level Zero arrays, together
with tack-examples' ports of production datasets. A targeted round after
the last fixes reran what they touched on every machine, and the disk cache
now settles: a second and third run of the quick tests add no entries.
Added
- Segmented operations in
tack.algorithms:segment_reduce(sum, min, max, mean),
segment_scan(inclusive and exclusive sums, running min and max),
segment_broadcastandsegment_ids, over flat values and CSR offsets,
empty segments kept -- each cell's points, each point's cells, sparse rows.
A segment of up to 256 elements is one thread's; a longer one goes by
chunks of 256, a segment over several chunks combined a level up, so one
enormous segment is a few launches, not one thread's walk. On an M1 Max's
GPU a 10M-element segment reduces in 4 ms (a thread per segment: 1.2 s), a
skewed mix of 1M short segments and one of 5M in 3.7 ms (590 ms), and 2.5M
segments of about 4 in 0.66 ms (0.59). No atomics in the arithmetic, so
float sums are the same bits on every backend;ordered=Truesums each
segment in element order, asreduce_by_keydoes. Empty segments take
empty=(0, NaN for a mean, or the type's extremes for min and max), or
keep their output withempty="keep"; vectors reduce componentwise; debug
mode checks the offsets. advect(..., neighbors=True)andstreamlines(..., neighbors=True): a stage
whose particle has left the cell it was last found in tries that cell's face
neighbours before the locator's bins, taking one, as the last cell is taken,
only where it holds the point well inside, so the paths are the bins' bit
for bit. On the CPU, streamlines on the aneurysm (8.7M tetrahedra) took 1.45
to 2.04x less time (20,000 seeds: 1116 to 546 ms) and on the ONERA M6 (46.9M
cells) 1.63 to 1.90x (16,384 seeds: 2067 to 1086 ms). About one location in
seven missed the last cell, and 43-49% (aneurysm) and 78% (M6) of the misses
were in a face neighbour. The neighbours are a table of six ids a cell
(CellLocator.cell_neighbors()), built from the faces on first use and kept
with the locator: 0.9 s and 210 MB on the aneurysm, 4.1 s and 1.1 GB on the
M6, so the walk is off by default. Pyramids, polyhedra and surfaces search
the bins as before.- Tack's filters as VTK algorithms,
tack.interop.vtk.algorithms:
VTKPythonAlgorithmBasesubclasses that sit in a VTK pipeline beside VTK's
own,(reader >> Contour(field="pressure", value=0.5))().Contour,
SlicePlane,Clip,Threshold,ExtractSurface,Tetrahedralize,
SurfaceNormals,ConnectedComponentsandStreamlinesmake a dataset;
Gradients,ElevationandCellQualityadd arrays to a shallow copy of
their input;GhostCells,GenerateGlobalIdsandMergePiecestake every
piece of avtkPartitionedDataSettogether, and the others run each piece.
Parameters are properties; an exception is VTK's error and is kept as the
algorithm'serror. CPU only for now. vtk_to_dataset(..., copy=False)anddataset_to_vtk(..., copy=False)share
memory on the CPU instead of copying: points, point and cell data, cell
types, offsets and connectivity (ids in VTK's width), ghost marks and global
ids, wherever the values are one contiguous block of the type Tack keeps
(anything that must change, such as a type, an origin, strips or polyhedra,
is copied). Shared VTK arrays become read-only Tack arrays that keep VTK's
alive, and the other way.dtype=Nonekeeps each floating-point array in
its own type. The algorithms convert this way, so a pipeline copies nothing.- Examples 47-49: a VTK pipeline with Tack's filters in it, from a VTK reader
to VTK rendering; pieces of avtkPartitionedDataSetthrough ghost cells,
contours andMergePieces; streamlines. integrator="rk45"onadvectandstreamlines: steps that adapt to the
flow, as VTK'svtkStreamTracerwith its RK45 (Cash-Karp,vtkRungeKutta45)
and its rules.step_sizeis the first step; a step whose error estimate
passestolerance(a distance, 1e-6 by default) is tried again smaller, its
first stage kept; each step taken proposes the next, betweenmin_stepand
max_step(a fiftieth ofstep_sizeand twice it by default, VTK's
ratios), in either step unit. A particle's step goes with it between a GPU's
launches (bit for bit with one launch) and from piece to piece. On a swirl
at VTK's settings, Tack's RK45 takes about half of fixed RK4's points (42-44
a path, VTK 42) and lies within 2-3e-5 of the path, VTK's within 1-2e-5.max_lengthonadvectandstreamlines, with any integrator: a path that
has gone that far stops (TERMINATE); in the length unit its last step
lands on it.- The VTK comparison harness (
benchmarks/vtk_compare) times point gradients
againstvtkGradientFilter, and the performance page says what its dashes
are: comparisons not made, not failures (VTK's Viskores filters have no cell
gradient, volume or centers; the Linux run timed VTK against Tack's CPU
alone). - Bases of any order on segments, quads, pixels, hexahedra and voxels
(tack.dataset.bases):H1(data, order=p, basis=...)from order 3 and
L2(data, order=p, basis=...)from order 2 (or on Gauss-Legendre nodes from
order 1), on Gauss-Lobatto nodes (the default, MFEM's forH1),
equispaced ones (VTK's Lagrange cells) or, forL2, Gauss-Legendre ones
(MFEM's default forL2).H1holdsp - 1values per edge,(p - 1)^2
per quad face and(p - 1)^dper cell after the points, each cell reading
a shared edge in order from its lower point id and a face in the frame of
its own row, so cells turned every way share them;L2keeps each cell's
(p + 1)^dvalues.interpolate,project,probe,gradientsand
curved geometry of any order work on them; polynomials of degreepcome
back exactly. subdivide(data, level): curved or high-order cells as linear sub-cells on
each cell's lattice oflevelsteps, fields at the lattice points (VTK's
vtkCellGridToUnstructuredGrid). A lattice point shared by cells is one
point, evaluated once, by the first cell holding it.- The MFEM interop takes
H1from order 3 andL2from order 2 on quads and
hexahedra, and curved meshes of any order on them: on Gauss-Lobatto,
Gauss-Legendre and closed uniform nodes the values are copied in Tack's
numbering, on any other basis (Bernstein) evaluated at Tack's nodes,
exactly either way.mfem_grid_function(data, field, mesh)gives a field
back as an MFEMGridFunction, the same DOFs in MFEM's numbering. - VTK's Lagrange cells:
vtk_to_datasetreads a grid of
VTK_LAGRANGE_CURVE,_QUADRILATERALor_HEXAHEDRONcells of one order
pas linear cells on their corners with the geometry and point data in
H1(order=p, basis="equispaced"), VTK's nodes;dataset_to_vtk(..., higher_order=True)writes a high-order or curved dataset of those shapes as
Lagrange cells of its largest order, each shared node one point, which VTK
evaluates as Tack does. contour,sliceandslice_planetakesubdivision=: on the tensor
shapes, a field above order 1 or a curved geometry is cut on linear
sub-cells, by default as many lattice steps as the largest order of the
field and geometry, and only the cells whose field's Bernstein
coefficients can hold the value are refined. The surface has no cracks;
its error falls as the square of the step.subdivision=1cuts the cells
linearized at their corners;tolerance=(in the field's unit, a distance
for slices) chooses the fewest steps whose estimated error is within it,
from the Bernstein coefficients' distance from the corners' interpolation.subdivide, andcontourandsliceon sub-cells, keep ghost marks: a
sub-cell takes its parent's, and a lattice point is marked ascarrymarks
the points it makes, so each piece's cut of a high-order field is its share
of the whole's. A shared lattice point has the same bits in every piece
holding it: an edge or face point is computed from that entity's own
values in a frame its corners' positions fix, and anything else in the cell
every piece chooses alike (the lowest global id, or the first centroid by
position). Pieces' surfaces merge withmerge_piecesinto the whole's.advectandstreamlinesthrough curved cells (anH1geometry above
order 1) and with a velocity of any order, or inL2, on hexahedra,
voxels, quads, pixels and the order-2 tetrahedra, wedges and triangles.
The search from the points reads a curved cell and a high-order field
through its shape group's own view, so it inverts a curved cell by its own
map and evaluates the field asprobedoes: the paths are an RK4 over
probed velocities to 1e-12.probeon a curved geometry searches from the
points too, with the same answers as from the cells. Advection refused
both before. A mesh of one shape compiles its kernels in seconds; a curved
mesh of several shapes takes minutes on its first call.L2(..., layout=): how a tensor basis' values are stored,"blocks"(each
cell's together: MFEM's and VTK cell grids' layout) or"cells"
(cell-fastest, so neighbouring GPU threads read neighbouring values).
"auto", the default, is"cells"for a tensor basis of order 3 or more on
a GPU and"blocks"elsewhere: on an RTX 4060 Ti cell-fastest reads 2.3x and
writes 3.6x faster at order 6, on the CPU blocks reads 1.5-1.8x and writes
about 2x faster.to_devicetransposes when the layout changes; the MFEM
interop reads and writes either;space.blocks(values)and
space.indices()read a field per cell whatever its layout.
TACK_L2_LAYOUT=cells(orblocks) overrides"auto"for a whole run.H1andL2of any order on triangles and tetrahedra, with equispaced nodes
(basis="equispaced", VTK's and gmsh's Lagrange simplices): values shared by
entity as on the tensor shapes (p - 1per edge,(p - 1)(p - 2) / 2per
triangle face,(p - 1)(p - 2)(p - 3) / 6per tetrahedron), a triangle
face's placed through its orientation in each cell.interpolate,probe,
gradientsandcarrytake them; polynomials of the order are reproduced
exactly.contour,sliceandsubdivideof fields above order 1 on triangles and
tetrahedra, on Freudenthal's sub-simplices of the cells' lattice: a lattice
point shared by cells is computed once, and in every piece holding it to the
same bits, so surfaces close and pieces agree.- Curved triangles and tetrahedra of any order: a geometry in
H1of order 3
and up (equispaced) on simplices, located as it is (its Bernstein control
points bound it, Newton inverts its map) byprobe, the cell locator and
advection, and subdivided bysubdivide,contourandslice(order 2's
curved simplices too), each shared lattice point from its edge's or face's
own nodes. - VTK's Lagrange triangles and tetrahedra, both ways
(dataset_to_vtk(..., higher_order=True),vtk_to_dataset), and MFEM's
triangles and tetrahedra of any order: closed-uniform values copied, MFEM's
default bases evaluated at Tack's equispaced nodes, exactly; curved MFEM
simplex meshes come across as curved geometry. - Wedges of any order (equispaced):
H1andL2, curved wedge geometry,
subdivision forcontour,sliceandsubdivide(Freudenthal's triangles
in layers), VTK's Lagrange wedges both ways, and MFEM's wedges. clipandthresholdof a curved geometry or a field above order 1, on
every shapecontoursubdivides: the cells whose field's Bernstein bound
lies wholly on the kept side stay as they are (curved, their fields of any
order), and only the others are cut, on linear sub-cells of their lattice
(subdivision=,tolerance=, ascontourtakes them). The whole part owns
the corners on the seam and the cut part's copies areDUPLICATEPOINT, so
reductions over the two count each point once, with or without ghost layers.- Exact crossings:
contour,slice,slice_planeandclipof a field above
order 1 or a curved geometry put each crossing of a sub-cell's edge where the
field itself takes the value along it (a fixed number of Illinois steps from
the lattice values), and carry the geometry and every field there, so the
vertices lie on the true surface whatever the subdivision. A crossing on an
edge or face comes from that entity's own values in a frame its corners fix,
so neighbouring cells and pieces put it at the same bits.exact=Falsekeeps
the crossing between the lattice values. - Bernstein spaces:
H1(data, order=p, basis="bernstein")andL2(..., basis="bernstein")on segments, quads, pixels, hexahedra, voxels, triangles,
tetrahedra and wedges, and a curved geometry in Bernstein form. The values are
the Bernstein polynomials' coefficients (control points, for a geometry),
which bound the cell's field or geometry.interpolateandprojectfill
them from values at the equispaced nodes. Each edge's and face's coefficients
are formed in a frame its corners' positions fix, so pieces sharing it agree
to the bit. Every filter sees the same polynomials as the equispaced Lagrange
space of the order. - VTK's Bezier cells (curves, quadrilaterals, hexahedra, triangles, tetrahedra,
wedges), both ways, as Bernstein spaces:vtk_to_datasetreads them,
refusing rational weights other than 1, anddataset_to_vtk(..., higher_order="bezier")writes them.higher_order=Truechooses Bezier cells
for a dataset with Bernstein spaces. H1of order 2 on segments.- Element-to-DOF tables:
H1(data, order=p, dofs=table)numbers a space's values
by an explicit table, a row per cell giving each node's value index, as MFEM
and VTK's cell grids store them, instead of by entity. A cell's corners must be
its points; the other nodes may be numbered freely (VTK's layout, every node a
point, included). Every filter reads it, a curved geometry may be numbered so,
and filters' outputs number by entity again. - Serendipity:
H1(data, order=2, basis="serendipity")on quads, pixels,
hexahedra, voxels and wedges (the full order-2 space on triangles and
tetrahedra): the corners' and edges' values alone, the quad faces' centres and
the cells' insides determined from them. Every filter reads it as the full
order-2 space, with no kernels of its own; a geometry may be serendipity too. - VTK's classic quadratic cells, both ways:
vtk_to_datasetreads
VTK_QUADRATIC_QUAD,_HEXAHEDRONand_WEDGE(quad8, hex20, wedge15) into
serendipity,VTK_QUADRATIC_TRIANGLEand_TETRAinto the full order-2 space;
dataset_to_vtk(..., higher_order="quadratic")writes them (Truechooses them
for a dataset with serendipity fields). interpolate(andnode_views) on a curved geometry of another order, on
hexahedra, quads and the other tensor cells: anH1field of order 3 on an
order-2 geometry, say. Each edge's and quad face's nodes are on the
geometry's trace there, read from that entity's own geometry values in a frame
its corners fix, so every piece holding it gets the same bits. It was
refused; curved simplices and wedges of another order still are.mfem_to_dataset(..., dofs="table")andmfem_field(..., dofs="table")keep
a curved geometry andH1fields of order 2 and up numbered as MFEM numbers
them: the values as they are, in a space numbered by MFEM's element-to-DOF
table (H1(..., dofs=table)), on every basis whose values are copied.- A gallery in the Visualization Guide: contour, slice, clip, threshold,
surfaces with feature edges, cell quality, gradients, probe, subdivide,
pieces with ghost cells, streamlines, glyphs and pathlines on polyhedra,
tetrahedra, an order-4 field on straight hexahedra, an order-3 field on
curved ones and a mixed mesh, each picture a script indocs/gallery/(Tack makes what is
drawn, VTK draws linear polygons and lines), rebuilt by
docs/gallery/build.py. extract_edges(..., subdivision=n): each edge asnline cells through points
on a curved geometry's trace, so a mesh's outline shows its cells as they are.tubes(lines, radius, sides=12, radius_by=None): polylines or line cells as
tubes of quads with outward normals, the frame carried along each line so it
does not twist (VTK's vtkTubeFilter);glyphs(data, vectors, scale=1.0, scale_by=None, resolution=8): an arrow at each point along a vector field, as
closed triangle surfaces wound outward (vtkGlyph3D with its arrow). Both carry
the input's fields.gradients(data, field, at=L2(...)): the gradient at each cell's nodes of an
L2space, exact there, so a high-order field's gradient keeps its order's
detail, which averaging to the points loses.surface_normals(..., weights="area"): point normals with each cell's normal
weighted by its area, so a cut surface's slivers do not swing them.streamlinesandadvecttaketerminal_speed(in the velocity's unit, or a
quantity),vtkStreamTracer's TerminalSpeed: a path ends at its first point
where the speed is at or below it, the seed included, and the particle is
TERMINATEandSLOW_SPEED(a newParticleStatusbit, 256). It holds over
pieces and launches asmax_lengthdoes. Without it a path in a field that
is near zero but not zero (the carotid's outside its vessel) wandered on to
its length or step limit. VTK also drops a step whose two ends' average
speed is at or below the limit, so it may end a path one point sooner.integrate(data, fields=None): a dataset's measure and its fields' integrals
(Integrals), as VTK's vtkIntegrateAttributes, by Gauss quadrature in each
cell's reference element through its own map (collapsed onto simplices and
wedges;integrate.quadrature), so curved cells and fields of any order
integrate exactly to rounding; owned cells only, and over a
PartitionedDataSetevery piece on every rank; the cells of the mesh's
dimension only, as VTK's (a volume leaves out its surfaces, lines and
vertices). Polyhedra take cell data.warpby a displacement of higher order than the geometry (a finite-element
solution, as MFEM's examples displace their meshes) lifts the geometry into
its space, so the output is curved; a 2-vector displacement (a 2D problem's)
moves x and y.- The MFEM interop reads meshes whose nodes are in MFEM's older collections
("Linear", "Quadratic", "QuadraticPos", "Cubic", asescher-p3.mesh), and
periodic meshes, whose nodes MFEM keeps per element, with anL2geometry. - An MFEM gallery in the Visualization Guide: seven of MFEM's examples (Poisson
on the curved Escher knot and Fichera corner, elasticity warped and in DG,
adaptive refinement, the curved sphere, DG advection on a periodic mesh),
solved with PyMFEM, imported withtack.interop.mfemand drawn from Tack's
filters (docs/gallery/mfem_examples.py). vtk_to_datasetreads avtkCellGrid(VTK's discontinuous-Galerkin cells, as
vtkCellGridReaderreads.dgfiles): its cells on the shape attribute's
corners,C1attributes copied (shared asH1, per cell asL2),constant
ones asConstant, and every otherHGRADor Bezier basis resampled by VTK's
evaluator onto Tack's equispaced space of its order, exact where the spaces
agree.HCURL,HDIVand pyramids' rational bases are left out with a
warning, curved pyramids refused. It needs a VTK newer than 9.7.1, with
vtkCellAttribute's cell-type accessors and the evaluator's interpolate-only
mode.test_vtk_cell_grid.pyholds every.dgfile of VTK's test data to
VTK's evaluator, cell centres, probe, ranges, linear cells and transform (it
skips without them).dataset_to_vtk(data, cell_grid=True)writes avtkCellGrid: each shape's
cells a DG cell type (vtkDGCell.SetCellSpec), the geometry its shape
attribute, order 1 in VTK's complete basisC(shared forH1, per cell for
L2), higher orders in its arbitrary-order basisA(VTK'sAnodes are
Tack's equispaced nodes in Tack's order, which the tests show on hexahedra,
quads, tetrahedra and wedges),Constantfields asconstant. Reading takes
each type's corners from its cell spec and orders types by the specs'
offsets, so a grid round-trips.vtk_to_datasetreads every VTK higher-order cell Tack has a shape for, of any
shapes, dimensions and orders in one grid (Lagrange, Bezier, quadratic,
biquadratic, triquadratic, quadratic-linear, the 7-node triangle and cubic
lines, with linear cells beside them): each type's nodes matched to Tack's by
VTK's parametric coordinates and copied, and where Tack's cell has nodes a
VTK cell lacks, VTK's own interpolation functions give them, exactly.
test_vtk_higher_order.pyholds VTK's higher-order test files and one cell of
each type to VTK's interpolation, derivatives, contours, slices, clips,
boundaries and edges (it skips without VTK's test data).- A field's nodes on a curved simplex or wedge geometry of another order (an
order-4 field on quadratic tetrahedra, VTK's quadratic cells among them) are
placed where the geometry puts them: on edges and quad faces its trace there,
as on hexahedra since #217, and on triangle faces its trace in the face's
canonical frame (its corners by position) evaluated in the geometry's
Lagrange or Bernstein basis (views._CurvedTriangleNodePosition), so every
piece holding a face gets the same bits. They were refused. dataset_to_vtk(copy=False)andvtk_to_dataset(copy=False)share Metal arrays
with VTK, with any VTK: on Apple silicon a Metal buffer is host memory, so VTK
holds views of the buffers themselves (after one wait), and with Metal the
default device they come back as the same buffers. VTK's own memory is wrapped
in place where it lies on whole pages and copied to Metal otherwise, so the
dataset is on Metal throughout. Metal'swrap_ptr(and
tack.array_from_ptr(..., device="metal")) takes a NumPy array of host memory
for this.converttakes aFieldand gives it in another unit, a new field in the
same space, scaled and offset on the device, as a dataset's named field
converts; before, a field converted only inside a dataset.tack.set_default_float(tack.f64)andtack.get_default_float(): the
float type of arrays nothing else types (constructors without adtype,
Python floats,vec/mattypes without a component type, implicit
arrays) and oftack.dataset's constructors, sources and readers. f32
unless set; kernels' precision still follows their arrays.- Every
H1,L2andConstantfield view on cells with a reference element
numbers its own nodes:NODESper cell, nodekatnode_parametric(k),
its valuedof(c, k)stored atdof_index(c, k). One kernel computes a
field at another's nodes on every shape, space, order and basis
(Work at a field's nodes).
Order 1 had nodof_indexand no node count of its own; a loop over the
shape'sNUM_QUADRATIC, the quadratic element's nodes, wrote nothing on
segments, whose order-2 view numbers its nodes in a tensor basis. - A dataset's fields may share a name in different spaces, as VTK's point and
cell arrays do:data.fields["p", td.Constant](a kind of space, or the
space itself) picks one; algorithms take("p", td.H1)wherever they take a
field's name, andfields="p"on a filter keeps every field of that name.
data.fields.named(name)anddata.fields.entries()list them. vtk_to_dataset(grid, polyhedral="split"): a VTK grid mixing polyhedra with
shaped cells as aPartitionedDataSetof two pieces over the same points --
the shaped cells anUnstructuredTopology, the polyhedra a
PolyhedralTopology-- sharing positions and point fields, each point owned
by one piece (the other marks itDUPLICATEPOINT), global ids the grid's
point and cell ids. A CFD mesh of 20.9M hexahedra, 67K wedges and 508K
polyhedra reads in 4.6 s and 14.7 GB (copy=False), where reading every cell
as a polyhedron did not finish in 64 GB.vtk_to_datasetfinds tetrahedra, hexahedra, wedges and pyramids that are
inside out (corners in the reverse of VTK's order, as some converters write
prisms: negative volumes, inward faces) on every read -- a kernel screens
every cell, the volume decides -- and warns, namingorient=True, which now
turns them outward too. A tangled cell, negative at some corners but not
inside out, is left. Polyhedra are checked by their volumes (cell_geometry)
once their faces are matched: a region of them wound inward together passes
the matching, and, in a split read, nothing compares them with the shaped
piece; they are named in a warning, andorient=Trueturns them outward.
VTK's ownconcavePolyhedron.vtuis such a polyhedron (exact signed volume
-11). A CFD mesh's 66,606 inside-out wedges took 0.3 s to find
among 21M cells. Wedges are the common case: VTK's documentation gave their
corner order the reverse of its code until March 2026, and writers that
followed it wrote them inside out.- Implicit arrays read one value from the host, as a stored
Arraydoes:
values[k](a Python number, or a NumPy array of a vector's components;
negativekfrom the end) andlen(values), sodata.geometry.values[0]works
on images and rectilinear grids. Each read is one launch; iterating raises, as
on anArray. Underneath, a@tack.funcmay now have a host implementation
(@name.host), which Python calls while kernels inline the device body. - A finite-volume guide covering cell/face associations, orientation, integrated
flux balances and Perot velocity reconstruction, with a checked example on
shaped and polyhedral meshes in the documentation validation suite. project(..., average="nodes"): intoConstant(or order-0L2), the mean
of the source's own values in each cell (itsNODES), as
vtkPointDataToCellData and Viskores' CellAverage take it, for every VTK
cell type and order.- Write a Filter (Visualization Guide) rewrites a sixth built-in,
contourof
a triangle mesh: points made on edges (Interpolate), lines inside cells
(Pieces), held totd.contourevery part. Its section takescarryapart:
each map, each kind of entity's keyword, and what goes with each (point and
cell fields, the geometry, sets, ghost marks, global ids, the frame), which
the guide covered only in a table. merge_pointstakes polyhedral, polygonal and polyline topologies. A
polyhedral mesh's faces are matched again on the merged points, so the copies
of a face that pieces each stored once, with one cell, become one face with
both: OpenFOAM's processor pieces put together without merging (an AhmedML
volume: 1,561,917 copied points of 24,358,265, 1,494,132 faces stored twice)
merge in 13 s into the mesh their solver ran on, whose boundary is the walls
and the far field (40,700 faces not at rest, not 3,028,964) and whose body is
one piece, not 116. Copies wound the same way, or a face with two cells on a
side, are refused.CellLocatorlocates in polyhedra that are not star-shaped from the mean of
their points, as snappyHexMesh's concave cells at walls are: each one's cell
point moves into its kernel, where it sees all of its faces, given as
weights on its points so linear fields stay exact
(CellLocator.moved_cell_points).probe,advectandstreamlinesuse
it. On an AhmedML volume (21.5M cells read as polyhedra), 119 of the 131
cells the locator refused have a kernel.vtk_to_dataset(grid, merge_points=True)(or a tolerance) merges an
unstructured grid's coincident points before reading it, as a mesh written
per processor needs: the polyhedra's faces are matched once, and with
polyhedral="split"every point is owned by one piece. Merging the pieces
afterwards could leave a point owned twice or by no piece.generate_global_idsof a filter's outputs from pieces without ghost
cells (which lost their marks, so reductions refuse them) matches every
point and cell and marks the owners, sostatisticsandentropythen give
the whole's answer; the refusal names it. Such outputs keep their cells'
marks from their source cells.world_gradient(cells, u, c, pc), the device functiongradientsuses:
a field's gradient in the world at a parametric point, for kernels that
need it wheregradientsdoes not put it.world_hessian(cells, u, c, pc): a field's second derivatives in the world
at a parametric point of a solid cell, for kernels. By the chain rule
through the geometry: the field view's newparametric_hessianless the
geometry's newgeometry_curvaturealong the world gradient (zero where the
map is affine), taken to world axes by the inverse Jacobian. Analytic from
the shapes' newshape_hessianandquadratic_hessianat orders 1 and 2,
and from the bases at any order on tensor shapes, simplices and wedges
(Lagrange and Bernstein), a wedge's from its triangle factor's second
derivatives and its segment factor's.world_jet(cells, u, c, pc): a scalar field's value, world gradient and
world Hessian together (on surfaces,world_gradient's in-plane gradient
and a zero Hessian), from the field views' newparametric_jet, which
reads each of the cell's values once. Each read of anH1value of order 3
or more resolves where its node is stored, about two thousand lines of
generated CUDA, so a kernel that needs several of the three compiles that
once.HDiv(Raviart-Thomas) andHCurl(Nedelec, first kind): at order 1 on
hexahedra, voxels and tetrahedra, and of any order on hexahedra and voxels,
where the values on shared faces and edges are kept in the face's or edge's
own frame, so cells that number their corners differently agree.
HDivholds one value per face, its integrated flux along the face's
stored normal (the convention of oriented face values,upwind_fluxand
net_flux);HCurlone value per edge, its tangential integral from the
low point id to the high one. A field view'sparametric_value(c, pc)is
the field in the reference cell, andhdiv_valueandhcurl_valuemap it
into the world through the contravariant and covariant Piola maps (the
contravariant by |det J|, so inside-out cells agree with their neighbors);
hcurl_curlgives anHCurlfield's curl andhdiv_divanHDivfield's
divergence.H1.quadratic_count(shape): the nodes a view of anH1space of order 1
or 2 reads on a shape's cells as the shape's own functions, for kernels
that loop over them.td.edge_crossing(level, a, b, va, vb, xa, xb), the rule every built-in cut
places a crossing by, for filters of one's own: the ends in the order to
interpolate from (the end first by position) and the weight, or the end
itself when the crossing is that point.advect(..., step_unit="length"), asstreamlinestakes it:step_sizean
arc length along the path rather than a time, over pieces too.UnstructuredTopology.cell_points(), each cell's points sorted and unique, as
polyhedral and polyline topologies give them.ghost_cellstakes polyhedral pieces (OpenFOAM's processor pieces read as
polyhedra): each ghost is sent with its faces wound out of it and the
piece's faces are matched again, so a face a ghost shares with the piece's
own cell is one face;update_ghostsandgenerate_global_idsrun on
them. The split reading's two pieces are ghosted together once the shaped
piece is made polyhedral (as_polyhedra), and then reduce exactly.extract_surfaceof aPartitionedDataSetgives the whole's surface, a
piece each: pieces without ghost cells take the faces between them for
boundary, so the faces of every piece's surface are matched over the pieces
by their points and those two pieces hold are left out; the surface's points
are owned once. On pieces with ghost cells it is each piece's own surface.tack.interop.vtk.algorithms.Probe,td.probeas a VTK algorithm in the
manner ofvtkProbeFilter: the source's fields (input port 1,
SetSourceConnection/SetSourceData) at the input's points, on the input's
structure, withvalid.- A
deviceparameter on every Tack VTK algorithm: the filter runs there, its
input moved there once (and kept, so the filters after it find it there).
By default a filter runs where its input's memory is, which for a reader's
output is the host. vtk_to_dataset(..., copy=False)anddataset_to_vtk(..., copy=False)
share GPU memory too. A VTK grid whose points, cells or data arrays are
Viskores arrays on a GPU (asarray_to_vtkmakes, in a VTK with DLPack and
Viskores' arrays) becomes a dataset on that device sharing them, whatever
the default device, its other arrays copied there; a dataset on a GPU
becomes a VTK grid of Viskores arrays over its points, field values,
offsets and connectivity. They were copied to the host before, so a
pipeline of VTK and Tack filters on a GPU now hands its data across
without leaving the device.- Tack's VTK algorithms (
tack.interop.vtk.algorithms) take trees of datasets,
avtkMultiBlockDataSetor avtkPartitionedDataSetCollection, as Exodus,
IOSS, CGNS, EnSight and OpenFOAM readers give, and give a tree of the same
shape with its blocks' names and data assembly. Each partitioned dataset in
the tree, avtkMultiPieceDataSetblock too, is filtered whole, so
GhostCellsandGenerateGlobalIdssee all its pieces. - Every argument of a wrapped Tack filter is a parameter of its VTK algorithm,
with the filter's default (Contour(merge_points=False),Streamlines(integrator="rk45", max_length=...)); a required one left unset is named. A class wraps a
tack.datasetfunction by naming it (FUNCTION). - Fields are chosen as VTK's filters choose them: by name, by name and where VTK
keeps it (("p", "cells"), for a point and a cell array of one name), or with
SetInputArrayToProcess. VTK's implicit functions (vtkPlane,vtkSphere,
vtkBox,vtkCylinder,vtkPlanes,vtkImplicitBoolean) work where Tack's
do, such asClip'sby. - Tack's VTK algorithms work over MPI ranks: the filters whose answer needs every
piece (GhostCells,GenerateGlobalIds,MergePieces, and the reductions)
take the other ranks' pieces, the ranks taken from VTK's global controller as
VTK's parallel filters take them (its communicator made mpi4py's by
vtkMPI4PyCommunicator;pvbatchsets one), or given asworld=(an mpi4py
communicator or aWorld), as with VTK's wheels, which have no MPI.
tack.interop.vtk.world()gives VTK's processes as atack.communication.World. - A VTK algorithm (
tack.interop.vtk.algorithms) for everytack.datasetfilter
but the summaries and the finite-volume operators that take values on faces,
named as the filter in CamelCase:ExtractCells,ExtractGeometry,
ExtractExtent,Mask,Slice,BoundaryFaces,ExtractEdges,
FeatureEdges,Tubes,Glyphs,CheckWinding,MergePoints,Triangulate,
AsPolyhedra,AsPolygons,Shrink,Subdivide,Transform(also of a
vtkTransformorvtkMatrix4x4),Warp,Cylindrical,Spherical,
CellGeometry,FaceGeometry,CellCenters,FaceCenters,EdgeLengths,
ImplicitValues,CellIds,PointIds,FlowQuantities,Project,
ValuesAtCenters,Interpolate,Magnitude,Dot,Cross,Composite,
LogValues,Convert,Jump,UpwindFlux,Voxelize,Advect,
ExtractPoints,ThresholdPoints,MaskPoints,PointNormals,Outliers,
VoxelDownsample,Deposit,SphDensity,SphInterpolate,HaloCatalog,
Split,GhostPointsandRemoveGhosts. Values on faces or edges come out as
the faces' polygons or the edges' lines with the values as cell data; a grid a
filter samples onto (Voxelize,Deposit) may be avtkImageData. ExtractSurface,ConnectedComponents,StreamlinesandAdvecttake the
pieces of avtkPartitionedDataSettogether, as their Tack filters do: the
surface leaves out faces the pieces share, regions join across pieces, and
particles go from piece to piece (and rank to rank). They ran piece by piece.StreamlinesandAdvecttake their seeds from the points of the data on
input port 1 (SetSourceConnection), asvtkStreamTracerdoes, whenseeds
is not given;SphInterpolatetakes its particles there, as
vtkSPHInterpolatordoes.Statistics,EntropyandIntegrate, VTK algorithms oftd.statistics,
td.entropyandtd.integratethat reduce all their input (every dataset of a
partitioned dataset or a tree, on every MPI rank) to one answer, as VTK's
vtkDescriptiveStatisticsandvtkIntegrateAttributesdo.Statisticsand
Entropygive avtkTable, a row per field and a vector field's components one
by one;IntegrategivesvtkIntegrateAttributes' one vertex at the centroid,
each field's integral on it and the measure asLength,AreaorVolume.- The VTK algorithms take an AMR hierarchy (
vtkOverlappingAMR) whole, as one
AMRDataSet, where the Tack filter takes one:Probe(as its source),
Statistics,Entropy,Integrate,VoxelizeandGhostCells, and the new
AverageDown(td.average_down, its input left as it was). A region that a
finer box covers, and a point that a sibling box holds, counts once.
GhostCellsandAverageDowngive avtkOverlappingAMRof the input's boxes,
and the next AMR filter takes the hierarchy as it was made, ghost layers too.
The others run box by box, as Tack's filters do on AMR, each level's boxes as
pieces and the cells finer boxes cover left out: a field filter gives the
hierarchy with its fields, one that makes a dataset a
vtkPartitionedDataSetCollectionwith a partitioned dataset per level.
GenerateGlobalIds,StreamlinesandAdvectrefuse a hierarchy. Over MPI
ranks each rank holds its own blocks, as VTK spreads a hierarchy. vtk_to_dataset(..., world=): the ranks avtkOverlappingAMR's blocks are
spread over, aWorldor an mpi4py communicator, by default VTK's (world()).RunningStatistics,TimeDerivative,Advection,Pathlinesand
Streaklines, VTK algorithms of Tack's temporal filters, in two modes. In
situ, each execution takes the step the input holds and gives the output at
it, stamped with its time; the same step again is not taken twice, and a step
back in time, a parameter changed or VTK'sNO_PRIOR_TEMPORAL_ACCESSreset
starts over. Driving, the filter asks its input for the steps it needs, one
per pass and never one it has taken: the statistics, particles and paths over
every step (or those intime_range) in one output with no time (time in the
data:stepandtimeon the particles,timeon the paths' points), and
streaklines and derivatives at the time requested, going on from the steps
taken. A filter drives where its input has time steps and the pipeline can go
back in time;mode=chooses.ContourandThresholdtake a vector field'scomponent(the first by
default, as VTK's filters;Thresholdalso"magnitude"), as a view of the
vector's values: they refused a vector field. Found running VTK's Python tests
on Tack (multipleComponentContour.py).transform(..., vectors=, normals=): fields that turn with the map, its linear
part applied to a vector (a velocity, a displacement) and its inverse transpose
to a normal, made unit length again so it stays normal to the moved surface.Field(space, values, unit, gradient=): a field's world gradient where
something other than its basis gives it, such as a solver's own
reconstruction, as a field on the same topology (3 values each for a scalar,
3k row by row for a vector of k).world_gradient,world_jetand
gradientsread it, soflow_quantitiesand every kernel built on them use
the solver's derivatives; the Hessian it does not determine is NaN.- Examples 50-53 in
packages/tack-vis/examples/: VTK pipelines on real files
from VTK's test data, each from a reader to a rendered picture (--png) and
checked against VTK's filters. 50 is an Exodus file's collection
(disk_out_ref.ex2, IOSS): an isosurface, streamlines as tubes, the surface.
51 is an OpenFOAM case's multiblock (squareBend): gradients, vorticity, a
slice, integrals over the inlet and outlet. 52 is an OpenFOAM time series (the
cavity) throughPathlines, driving and in situ. 53 is an Enzo AMR file:
statistics and the mass over the hierarchy, a slice of each level. The files
are fetched once by their SHA-512 (_vtk_data.py,vtk_data.sha512) or read
fromTACK_VTK_DATA; each takes--archfor the device. The VTK examples
(47-53) draw their pictures with VTK's views and representations
(vtkViewsScivis) where the VTK has them, VTK master, and with actors and
mappers on VTK 9.7.1, chosen at run time (_scene.py). - The VTK guide lists every algorithm with VTK's filter that does the same work,
and has a section each on pieces and trees, MPI ranks, GPUs, summaries, AMR
hierarchies and time. - A field argument may be an object whose
on(data)gives theFieldondata,
as a field expression is. Over aPartitionedDataSet,statistics,entropy
andintegratecall it once a piece, so an expression reduces over pieces as a
name does. - Fields evaluated where they are read: a space may declare itself
evaluated
(its view computes the field byvalueandcorner_value; it stores no values),
continuous(its crossings are shared between cells, asH1's are), its
default_subdivisionand itsintegration_order, and giverebindand
stored.contour,subdivide,clipandthresholdread such a field
through its view (thresholdby its values at the lattice points, not as cell
data), filters make it again on their output,integrateintegrates
it by quadrature to its order, andstatistics,entropy,owned_valuesand
dataset_to_vtkread its stored values.Spacedeclares each, with its
default. - A publish workflow for tack-core (
.github/workflows/publish.yml). On a
release tag it checks the tag is the version, builds the wheel and the sdist,
twine checks them, installs tack-core alone from each, and uploads to PyPI
with trusted publishing after thepypienvironment's approval. Run by hand,
it uploads to TestPyPI, the dry run.RELEASING.mdhas the one-time setup and
a release's steps. tack-vis is not published; it is installed from the
repository at the release tag.
Changed
- Breaking:
clipandthresholdof a curved geometry or a field above
order 1 returnPartitionedDataSet([whole, part]), the cells kept whole and
the cut part, where both went by the cells' corner values alone (andclip
made curved cells straight). Straight cells with order-1 fields, and
thresholdby a cell field, still give oneDataSet. - Breaking: the cuts above (with
exact=True, the default) move their
vertices onto the field's roots: positions and carried values differ from the
lattice values' interpolation (by about the square of the steps); the cells are
the same. - Breaking: an array is made only of a type its device supports:
tack.emptyand every constructor, copy andto_deviceon it,
array_from_ptrand DLPack imports raiseTypeErrorfor anf64array on
Metal (or on a Level Zero device withoutf64), where before the array was
made and the first kernel given it raised. - Breaking:
data.fieldsis aFieldsmapping, not adict. A name two
fields share is refused rather than read as one of them (KeyError, from
getandpoptoo); its keys are the names, and(name, space)for a
shared name, sodict(data.fields)keeps every field. A field of another
topology is refused as it is put in, not when an algorithm reads it. - Breaking:
vtk_to_datasetreads a point array and a cell array of one
name as two fields of that name, no longer renaming the cell one to
"<name> (cells)"with a warning;dataset_to_vtkwrites both under the
name. Writing two point (or two cell) fields of one name is refused. - Breaking:
projectintoConstant(or order-0L2) gives each cell
the source's average over it, its integral divided by the cell's measure,
by quadrature through the cell's own map, where it took the mean of the
cell's corner values. The two agree for a linear field on a tetrahedron, a
triangle or an image's (or rectilinear grid's) boxes, which still take the
corners' mean; they differ on pyramids (the apex weighs a quarter of a
linear field's average, not a fifth), on distorted cells, and for fields of
higher order, whose nodes other than the corners the corner mean never
read. Polyhedra, polygons and polylines average a point field over the
pieces they are cut into.average="nodes"gives VTK's mean. - Breaking:
extract_surfaceputs a surface on the points its faces use,
renumbered in order, as VTK's geometry filter does, not on all the input's
points. A surface's point statistics are now the surface's, and the surface
of pieces matches 1.24M points on the AhmedML mesh, not 45.6M. A 2D mesh
passed through keeps its points if its cells use them all. The fresh
boundary's renumbering is kept with it, so a repeated call still costs only
the carry. - Breaking: the VTK algorithms of points, lines and surfaces give
vtkPolyData,
as VTK's filters do, where they gave avtkUnstructuredGrid:Contour,
Slice,SlicePlane,ExtractSurface,BoundaryFaces,ExtractEdges,
FeatureEdges,SurfaceNormals,Tubes,Glyphs,Triangulate,
AsPolygons, the face filters,Streamlines,Advect, the temporal particle
filters and the point-cloud filters. They now feedvtkPolyDataMapperand VTK's
polygonal filters (vtkCleanPolyData,vtkStripper,vtkDecimatePro), which
refused them.ClipandMergePointsgivevtkPolyDatafor avtkPolyData
input, asvtkClipPolyDataandvtkCleanPolyData, and the filters that keep
their input's kind (Warp,Transform,Probe, ...) keep a polygonal one. The
cells go into the polydata's vertices, lines and polygons, shared where they are
all of one kind. Found running VTK's Python tests on Tack. - Breaking: a kernel over shape-based cells that reads their faces or
edges (face_id,face_side,face_orientation,face_position,
edge_id,edge_sign) asks for them:
for_each(kernel, data, "cells", ..., incidence="faces"), or"edges", or
both, anddomain_view(domain, group, incidence=...)the same. They are
derived if they are not yet. A cell view had them whenever the faces or
edges had been derived, by this filter or any before it, so the same kernel
over the same cells compiled again once another filter had derived them,
and the disk cache kept gaining entries from one run of a program to the
next as the order of its filters changed (about 25 a pass of the quick
tests, fromcontour,projectandsubdivide). A view now has only what
it asks for; a curved geometry still reads the incidence it needs. - Averages over each point's cells --
gradients(at="points"), the
cell-to-pointprojectandsurface_normals-- are segmented means over
the point links (segment_reduce(..., op="mean", empty="keep")), the values
read through the links, not gathered. A point of up to 256 cells sums them
in the links' order as before, so ordinary meshes give the same bits; a
point of more is summed by chunks, where one thread walked its links. At
the apex of 403,200 tetrahedra on an M1 Max's GPU: point gradients 294 to
5.7 ms, cell to point 271 to 3.4. On the CPU, where one core walks such a
point quickly, about the same (5M tetrahedra 14.8 to 14.1 ms; the apex 1.7
to 2.4). tack.interop.vtkis a package (its names unchanged), withalgorithms
beside it.- A device without f64 (Metal, a Level Zero device without fp64) refuses a
kernel that computes anything in f64 -- atack.f64cast, an f64 constant,
local or parameter, from the kernel or a function it inlines -- with a
TypeErrornaming the cause, once its types are known and before code is
generated (refuse_f64). Metal's code generator refused only f64 casts,
with aNotImplementedError. A CPU posing as such a device, as the dataset
device tests make one, refuses them too, so those tests find on the CPU what
only Metal's compiler found before (subdivision'stack.f64casts, on the
higher-order branch). - Contours and slices of order-2 fields on hexahedra and quads, which were
refused, are cut on sub-cells; of a curved geometry on them, which were
linearized at the corners, likewise (subdivision=1for the corners). - Subdividing a scalar field in a tensor basis (contour and slice above order
2,subdivide) reads each cell's values once, not once a lattice point: an
order-6H1field'sdof_indexfor every node at every point was most of
the time. 32^3 hexahedra, an order-6 contour: Metal 457 to 122 ms, the CPU
278 to 166 ms; order 3, Metal 31 to 27 ms. The values are the same, to the
bit. - Locating a point in a curved cell (the cell locator,
probe, advection on a
curved geometry) reads the cell's nodes once, not twice at each Newton
step throughdof_index: an order-3 curved probe of 100k points on 16^3
hexahedra, Metal 177 to 73 ms, the CPU 52 to 28.5 ms. The same cells and
coordinates, to the bit. - The MFEM interop copies a positive basis' coefficients (
H1Pos, andL2
withBasisType.Positive) into Tack's Bernstein space of that order, on
quads, hexahedra, triangles, tetrahedra and wedges, permuted as nodal values
are; they were evaluated at Gauss-Lobatto (or equispaced) nodes.
mfem_grid_functiongives a Bernstein field back in MFEM's positive basis. - The CPU backend keeps far less memory per compiled kernel: compiled code shares
JIT engines (32 modules to one) instead of an engine each, the LLVM module is
dropped once its code is made, and a compiled variant keeps only the launch
bounds of its IR, not the body. A small kernel's variant went from about
965 KB to 75 KB, a high-order contour and clip from 51 MB to about 21 MB, and
the quick test tier's workers peak at 1.5 GB instead of 4.9. transformkeeps an image an image: the affine map is folded into its origin
and direction (UniformCoordinates, any invertible direction, a shear too),
in double precision, and no position is stored; VTK receives avtkImageData
with that direction matrix. A singular map still gives stored positions.vtk_to_datasetconverting tof32without anoriginchooses one where
the data are more than 100 times farther from zero than they are wide: the
lower corner of VTK's bounds, rounded down, the same for a composite's
pieces. Far points kept 0.2 m steps on a survey's coordinates; they keep
their precision.point_cloudchooses its origin forf64positions by the
same rule (automatic_origin): a small cloud about zero got (-1, -1, -1),
coarsening its values.contourgives no surface, lines or vertices in a cell with a NaN among its
values: the surface stops at the cells holding numbers. A NaN was below
every level, and a crossing on an edge to one lay at the edge's finite end,
a point not in the data; VTK's lies at NaN.clipscans its five kinds of counts one at a time through one buffer and
lets the cells' counts and offsets go before merging points;contourlets
its cells' counts and offsets, and the per-corner arrays it copied when
dropping repeated triangles, go before its merge. Clip's peak on 5M
tetrahedra fell from 609 to 304 MiB of arrays, contour's on Damavand from
3.47 to 3.19 GiB; the outputs are the same.extract_extentof a flat image or rectilinear grid (a 2D grid in Tack)
takes VTK's extent and rates in three axes, as VTK gives a flat image's
((i0, i1, 0, 0, k0, k1)), the flat axis's ignored; it took one pair per
axis the grid has only.PointLocator.nearest, and with itoutliers,point_normalsand
ghost_pointsbyk, take any number of neighbours: up to 32 are kept in
private arrays as before, more in the output's rows.kwas at most 32
(PyVista'spoint_cloud_neighbors.pyasks for 40).H1andL2without abasistake the mesh's own family above order 2:
equispaced where the mesh has triangles, tetrahedra or wedges (the one family
they have), Gauss-Lobatto otherwise. The default was refused on simplices.extract_edgesof anL2geometry draws each cell's own edges on points of
their own along the cell's map (subdivisionsegments each): its cells need not
meet. It was refused.integratetakes point data on polyhedra, polygons and polylines, exactly:
the values are linear on their sub-tetrahedra, triangles and segments. It
took cell data alone.- A curved
L2geometry on triangles, tetrahedra and wedges (a mesh displaced
by a DG field, a periodic mesh of order 2 or more) maps, measures and inverts
its cells as itsH1twin (_L2SimplexGeometry,_L2WedgeGeometry, over
the_SimplexGeometryand_WedgeGeometrytheH1ones now share). It was
refused. subdivide, and the cuts that subdivide (contour,slice,clip,
threshold), take meshes of several families of one dimension (hexahedra,
wedges and tetrahedra, as MFEM's mixed Fichera corner): each family is refined
alone and the parts joined at the lattice points they share. Their cuts'
crossings are placed linearly on the sub-cells (exact crossings stay a
one-family feature). They were refused.vtk_to_dataset(dtype=None)with a default device withoutf64(Metal)
reads floating-point arrays asf32, which such a device's arrays take,
where it kept VTK's doubles there before.- Reorganize the Visualization Guide around a gradual data-model explanation
and complete workflows, with representation chapters for point clouds,
pieces, AMR and octrees, and optional advanced theory, layouts and references.
Preserve runnable examples and existing page addresses.
Open the model with an overview relating mesh and particle representations
to FE/DG, FV, SPH and planned native FD support. - The CUDA, HIP, OpenCL and Metal code generators find the types of the
variables anifdeclares in one walk of its branches. Kernels with many
nested branches, which inlined device functions produce, generated their
source in time that grew with the number of variables times the branches'
size at every level: a spread of tack-vis algorithms' 105 kernels now
generate in a third of the time, to the same source. - A polyhedron with no kernel (tangled or inside out, a face whose
fan folds, no volume) no longer makesCellLocator, and with itprobeand
advection, refuse the whole mesh: it holds no points, with a warning. A point
inside it is found in a neighbour it overlaps, or nowhere; a particle reaching
it stops. The AhmedML volume has 12, wall cells at the nose's corners. contourandslicemake a crossing that lies within half an ulp of a
point (relative to its edge's largest coordinate) that point, as they did
when the point's value is the level, so every edge's crossing there is one
point. A plane a hair from mesh points, such as a symmetry plane's points
at y = 1e-45, had put several points at one position, and on pieces with
ghost cellsgenerate_global_idsof such slices failed. Slivers whose
points all lie that close to one point have no area and are dropped:
Viskores' wedge gyroid gives 49 triangles, where Viskores gives 52.thresholdandthreshold_pointskeep a value exactly when it lies in
[lower, upper]as given: on an f32 field the bounds are rounded inward to
f32, since the nearest f32 of a bound may lie just outside it (f32(-0.1) is
-0.10000000149), which kept values VTK, comparing in double, leaves out (one
cell of the AhmedML mesh's 18,027,253). f64 and integer fields are unchanged.- A
PolygonalTopologymatches its edges when something first needs them
(faces(), the facet arrays,num_faces), not when it is made, and refuses
an edge of three or more polygons, or an inconsistent winding, there. Its
polygons work without the matching: areas, centres, integrals, probes,
quality and writing take any loops. - Advection tries the polyhedron a particle was last found in before the
bins, as it tries solid cells with a reference element: taken where one of
its sub-tetrahedra holds the point well inside, so the paths are the same
bit for bit. On the AhmedML mesh's 21.5M polyhedra, 2,000 streamlines take
0.66 s on the CPU (0.76 before) and 3.0 s on Metal (6.0). - The documentation site is rewritten and reorganized by Tack's four layers,
built bottom-up: Core (GPU computing in Python), Communication (distributed
parallelism), Data (the data model) and Visualization (analysis and
algorithms), after a front page (What Tack is, use cases, install). Each
layer opens with a start page and builds without depending on the layers
above. The reference is gathered by layer with a new glossary that gives VTK,
ParaView and Viskores counterparts, and the design notes form an addendum.
Every example on the new pages runs in the docs check. The writing kit
(style guide, term list, page checker) is indocs/_writing/. - The documentation site's navigation has five tabs, as NumPy's has a few: Get
started (what Tack is, use cases, install), Guide (Core, Communication, Data
and Visualization as groups of its sidebar), Reference, Developer's guide and
Design notes. Pages have breadcrumbs and previous and next links; the header is
plain, the headings dark, the fonts the system's. - The documentation's first pages, after an editorial review: the home page
starts with four paths (write GPU code, analyze a dataset, connect a
simulation's data, scale across devices or ranks) and is a third shorter;
the Data, Communication and Visualization introductions are short, their
longer examples left to the chapters that teach them; Visualization starts
with a Tack-only example; pages open in their own words, not a set formula
(the style guide's first rule, whichcheck_page.pynow checks); and the
Visualization pages show their results, with a new picture of contour, clip
and threshold of one ball (docs/gallery/extract.py) and the gallery's
images beside probing, streamlines, pathlines, pieces and higher-order cuts. - A topology's cell locator serves a geometry of the same positions: where it
does not serve a dataset,probeand advection compare the positions on the
device and, if they are equal, keep its bins (the search made again from the
new positions).Pathlines,StreaklinesandAdvectionkeep a copy of the
previous step, whose positions are the step's, and built every mesh's
locator twice: half of a step's time on the dam break's adaptive meshes
(1.36 s to about 0.6 for 100 particles over 30 meshes). A simulation that
hands over new arrays of unchanged positions each step no longer rebuilds
them either. - The repository moved to Kitware's GitHub organization: it is
https://github.com/Kitware/tack, and the documentation is at
https://kitware.github.io/tack/. The packages' metadata, the READMEs and
the documentation link there; GitHub redirects the repository's old
address, but not the documentation's. - Tack's VTK algorithms (
tack.interop.vtk.algorithms) keep one Tack dataset
per VTK dataset, by its address, modification time and time step, dropped
when the VTK dataset is deleted. Filters that read one input, or one filter
run again after a parameter changed, share it and what it derives from its
topology (locators, faces, point links), which every run rebuilt before: a
secondStreamlineson 2.6M tetrahedra took 13-86 ms against 380-540. A
field filter's (Gradients,Elevation,CellQuality) output keeps its
input's topology, so the filter after it does too. - The VTK interop shares GPU memory with any VTK that holds device arrays, not
only one built with Viskores: VTK'svtkDeviceDataArray(CUDA and Level Zero,
needing only the driver) serves as well. Nothing in the interop changed; its
device tests now run wherever such a VTK is found. tack.interop.vtk.init_level_zero()works with a VTK that has its own Level
Zero context, without Viskores; its error message and docs no longer say
Viskores on Kokkos' SYCL backend is required.- Handing an unstructured grid between VTK and Tack costs less:
vtk_to_datasetfinds the cell types a grid holds without sorting them
(np.uniquewas 8 ms for 1.3M cells), anddataset_to_vtksets the cells
without VTK's scan of every type for a polyhedron (4 ms). Together most of
what a GPU pipeline spent between its filters. - Every source file opens with an SPDX copyright and license header, as in
ParaView and VTK (tools/spdx_headers.py, checked in CI's lint job).
tack.dataset's clip case tables now credit their authors: they are VisIt's
(Lawrence Livermore National Security, BSD-3-Clause), which VTK keeps in
vtkTableBasedClipCases.hand Viskores copied, not Viskores' own. - CUDA writes the multiply-add contractions the language contract permits as
explicit fused multiply-adds and compiles with--fmad=false. NVRTC's own
fusion depended on the code around an expression, so two kernels inlining
the same function could differ in the last bit (streamlines with and without
the locator's previous-cell try, on curved wedges). - Template methods take only the synthetic parameters (a template's arrays and
runtime scalars) they read, themselves or through the methods they call. Every
method took its whole tree's, and each inlined call copied them all: a view
holding other views carried theirs into every call. - A template's methods are resolved when the kernel reaches them, not all of
them for every kernel. A method the kernel never calls costs nothing and is
not required to resolve. world_gradientandworld_jetask the field's view, whose default
(on every field view whose basis gives the derivatives) differentiates its basis as
before. A space that computes its values can give its own.- The temporal VTK algorithms (
RunningStatistics,TimeDerivative,
Advection,Pathlines,Streaklines) take avtkMultiBlockDataSetor a
vtkPartitionedDataSetCollection, which they refused, in both modes: each
partitioned dataset and each block that is one dataset has a Tack filter of its
own, and the output is a tree of the same shape, at the step's time (the
tree's, or its datasets'). The OpenFOAM, IOSS and CGNS readers give trees. integratetakes a mapping of names to fields (names orFields), each
integral under its name, asstatisticsandentropytake aField.- Filters carry a field's given gradient with it, so
gradientsof a filter's
output reads the gradient the field was given, not one from its basis.
A field whose gradient a filter cannot carry is left out with it. cell_geometry,face_geometryandsurface_normalskeep what they compute
with the mesh: computed once a mesh, shared by every dataset on the same
geometry, and made again when the geometry changes (another geometry, or
positions Tack has written).extract_surfaceof the same mesh gives the same
surface geometry, so the surface's normals are computed once over many steps
that change only fields.- CI's wheel job also builds tack-core's sdist, checks both with
twine check,
and installs tack-core alone, from the wheel and from the sdist
(tools/check_core_install.py). Asking fortack.datasetwithout tack-vis
names the command that installs it from the repository. - tack-core is on PyPI: the install docs, the READMEs (tack-core's is its PyPI
page) and the messages for a missing backend givepip install "tack-core[...]"instead of an install from a clone, and tack-vis's install
from the repository at the release tag (docs/install.md). A clone'suv syncstays, for working on Tack.
Fixed
contour,sliceandclipinterpolate each crossing from its edge's end
first by position (x, then y, then z; the lower id only between coincident
points), not from its lower point id. Ids are a piece's own, so two pieces
holding an edge could interpolate its crossing from opposite ends: with an
f32 field the copies differed in their last bits (up to 4e-8 on a wavelet),
andmerge_piecesof ghosted unstructured pieces' isosurfaces failed
("marked duplicates but no piece holds them unmarked") for want of a
tolerance. Every piece now computes a shared crossing, and the values
carried there, to the same bits, from the same end ghost marks already
give it its owner by; within one mesh, as before, every cell sharing an
edge agrees. Output points and their order are unchanged; their last bits
may differ from before.- Gradients in f32 on thin cells. A cell's Jacobian summed its corners'
absolute positions, and its field's parametric derivative its values: on a
cell 250 times longer than thick, near coordinates of 1 and a pressure of
1e5, those sums lost the short edge and the small differences to rounding.
The ONERA M6's boundary-layer wedges' f32 pressure gradients were off by
more than 0.1% in 6,569,170 cells (14%), by more than 100% in 380, the worst
93 times. Both are now formed from differences from the first corner and
value (the shapes' gradients sum to zero, so the result is the same),
exact in f32: 31 cells off by more than 0.1%, the worst 0.32%, as in f64
(1 cell, 0.33%), at the same cost; on Metal, which has no f64, 26 cells,
0.37%. Cell quality's Jacobian measures and order-2 geometry follow the
same rule; locating points already did. - Points in curved cells are located in the cells as they are. The cell
locator bounded and inverted every cell by its corners, whatever the
geometry's order, so a point where a curved cell bulges past its corners
(at order 2 as well) was missed or found in the wrong cell. A cell is now
bounded by the box of its Bernstein control points, which hold it, and
inverted by Newton's method on its own map. - Filters that keep whole cells (
extract_cells,threshold,split,
remove_ghosts, and any filter written withcarryand aSameor
Takecell map) keep anH1field above order 1, and a curved
geometry, at its order and nodes. They carried the corner values only, so
a filter's piece of a curved or high-order mesh came out straight and
linear. Each output cell's nodes are its source cell's, to the bit. CellLocator.cell_bins(),leaves()andcell_neighbors()build their
tables on the dataset's device. Called directly on a dataset on a GPU (not
throughfind,probeor advection, which set the device), they allocated
on the default device and their first kernel refused arrays on two devices.- An RK45 particle at a wall the flow turns back from ends there
(SPATIAL_BOUNDS), asvtkStreamTracer's RK45 ends it out of its domain.
Its stage points swung past the wall at every step size, or its stages'
directions cancelled, so each step's bisection pushed it out by about an
ulp, still inside, and it crawled until its steps ran out: 86 of 20,000
aneurysm paths, on every device, and on a GPU those few threads set every
launch's length (20,000 seeds took 6.4 s on CUDA, 14 s on HIP and 44 s on
Level Zero, against 1.4-2.9 s on the CPU). A push out that moves the
particle less thanmin_stepnow ends it; on the aneurysm 2 paths still
run to the step limit, and the CPU run takes 1.4 s instead of 2.3 s. Euler
and RK4 are unchanged. interpolateplaces a shared node on a quad face, and an order-3 or higher
node on an edge, in a frame the entity's corners' positions fix (an edge from
its first point by position, a face from its first corner toward the first
of that corner's neighbours), not in its stored point order, which follows a
piece's point ids. Pieces holding a face computed its nodes from different
corners, so a curved geometry or field interpolated on each piece differed
from the whole's in the last bits there (up to 2e-7 in f32). Values may
differ from before in their last bits.- A filter carrying an
L2field of a tensor basis kept its order but not its
nodes, so a Gauss-Legendre field came out labelled Gauss-Lobatto, another
basis, and read wrongly. interpolateon a curved geometry numbered otherwise than the target space
(by a table) placed nodes at the wrong positions.- Order-2 Bezier cells read from VTK took the order-2 Lagrange view's node
numbering for a Bernstein space's. - An order-2
H1field on a geometry curved to order 3 or more had its edge and
face nodes at the mean of their corners, off the curved cells; they are now
on the geometry's traces. Node views of a curved geometry and anL2field of
another order no longer fail to build (both definedORDER). contourwithsubdivision=on polyhedra, polygons or polylines sent them to
the sub-cell path, which failed; they are cut as they are, asclipand
thresholdcut them.as_polygonsof a polygonal dataset failed; it comes back as it is.ghost_cellsandmerge_piecesmade a curved geometry straight with no word
(they move positions at the points); they refuse it.cell_qualityscores a degenerate cell (an edge of no length, or no area or
volume) 0 in its scaled Jacobian and Jacobian ratio, as Verdict does for
triangles, quads and tetrahedra; it gave the largest float, of either sign.cell_qualitymeasures a polygonal topology's triangles and quads as those
shapes, not by fans from their centers (an equilateral triangle scored 0.577
beside a pentagon), and a polygon's fan triangles' condition number is
Verdict's triangle's; it was twice that.contourandsliceof a 2D mesh match its cells' sides by their points
instead of through the topology's faces, so a surface with an edge of three
or more cells (PyVista's action figure, room and sextant) gets its lines,
meeting there, where they refused the whole mesh. The topology keeps the
matched sides for the next call.contourof a 2D mesh finds each side's crossings from its two points, not
from the side's first cell, so a crossing every line needs is always made.face_geometry,upwind_flux,net_flux,divergence,perotand
surface_normalstake a surface with lines among its polygons (EnSight's
and VTK's surfaces carry them), the lines having no edges of the
surface's: zero flux and a zero normal.net_flux,divergenceand
perotof a mesh of vertices are zero. Both failed inside the kernels
(no @tack.func method 'side_position','num_faces').outliers' docstring no longer says its statistical test is VTK's: it marks
points far above the mean distance only, as PCL;vtkStatisticalOutlierRemoval
also removes those far below it.proberounds an integer field evaluated in a cell to the nearest integer,
halves away from zero, as VTK's probe does; it truncated (au8field of 0
and 1 probed three quarters of the way came out 0).shrinkkeeps integer point fields, each cell's corners copied as they are;
it failed on them.projectfrom order-1H1into order-1L2, a copy,
takes integers.dataset_to_vtkmakes normals VTK's active normals, which its renderers and
filters read: a 3-vector point field namedNormalsornormals, and a
3-vector cell field namedNormals,Normals (cells)orcell_normals. A
surface's normals carried through a Tack filter (a clip of a VTK surface
with normals) came back as a plain array, and VTK drew the surface flat.vtk_to_datasetreads avtkBitArrayas one u8 value (0 or 1) per point or
cell; it came as its packed bytes, eight values to one, and conversion
failed (kitchen.vtk'shpor).vtk_to_datasetreads hexahedra with corners repeated as finite-element
files write other shapes (Tecplot's bricks, degenerate Exodus and Patran
hexahedra) as those shapes: wedges, pyramids and tetrahedra. As hexahedra,
each one's collapsed face, an edge, was claimed by every cell around it, and
every face-based algorithm refused the mesh.vtk_to_datasetreads a polydata's poly vertices (a vert cell of several
points, asvtkTableToPolyDataandvtkParticleReadermake) as one vertex
per point, each taking the poly vertex's cell data, as strips become
triangles; they were refused. A VTK cell type Tack has no shape for is
refused as such, naming the higher-order cells that convert only when the
type is one.vtk_to_datasetrefuses VTK cells it reads neither as shapes nor as
higher-order spaces (biquadratic and triquadratic cells, quadratic
pyramids), naming them by VTK's class names; they came across as cells no
algorithm took, every one failing with "are not linear shapes".warptakes a direction orscale_bygiven as values on points when the
geometry is order-1H1, assurface_normalsgives its normals; it
refused them as "not in the geometry's space".cell_geometryof a curved geometry (H1above order 1, a curvedL2one)
measured each cell by its corners; it measures it by quadrature through its
map (a sphere's area was 3-6% short).jumpof a field of order 2 or more took each side's value from the face's
corner values (traces) and their linear mean; it evaluates each side's own
basis at the face's center (DG jumps against MFEM's to 1e-16).mfem_to_datasetof a 2D curved mesh refused its two-component nodes; they
get z = 0.- An
L2geometry above order 1 (a mesh displaced by a DG field, a periodic
mesh of order 2) was read as order-1 corners, each cell's first values, so
probes, centres and everything else were wrong. On tensor shapes it is now a
curved geometry (views._L2TensorGeometry, either layout); on simplices and
wedges it is refused. subdivide(and the cuts that subdivide) of anL2geometry shared lattice
points through the topology, so on a periodic mesh, whose seam's cells share
points but sit apart, sub-cells stretched across the mesh; each cell's lattice
points are now its own.contourof a high-order field on a mesh subdivision does not take (cells of
two families, as MFEM's mixed Fichera corner; pyramids) is refused with that
reason; the message spoke of corner values.vtk_to_datasetof a grid of VTK cell types Tack has no shape for (the
biquadratic quad, among others) built a topology it could not read, with no
word; they are read (above) or refused, naming the types. Pyramids above
order 1 and quadratic polygons are refused.- A serendipity field of integers truncated its face centres (computed in its
own type); they are computed in floating point, as its basis is evaluated. - A curved cell is inverted to rounding: two Newton steps past VTK's stopping
rule (CURVED_NEWTON_POLISH). Probes of MFEM's curved meshes agreed with MFEM
to 3e-9; now to 1e-15. extract_edges(..., subdivision=)placed a curved edge's points at f32
fractions of it ((k + 0.0) / level), about 1e-8 off the curve in f64.- Filters no longer store an image's or a rectilinear grid's positions, or
an implicit field's values, to read them once:point_elevation,
implicit_values(soslice,clip,extract_geometryand
extract_pointsby an implicit function),carryof taken and
interpolated points (threshold,clip,extract_cells,mask, ...),
warp,transform,cylindrical/spherical,glyphs,tubes,
feature_edges,composite, the 1D and 2D contours, clipping polyhedra,
advection andvoxelizepass them to their kernels as they are. A 256³
image's positions are 200 MB;warpwithoutscale_byalso no longer
stores an array of ones. On that imagepoint_elevation,implicit_values
andwarprun 2-5 times faster. - Reading polyhedra from VTK, and any cells with
vtk_to_dataset(..., polyhedral=True), is about ten times faster:
PolyhedralTopology.from_cell_facesmatches the faces cells share in
whole-array steps instead of a Python loop over them, and the reader takes a
cell type's faces from its class once rather than callingGetCellper cell
(512,000 polyhedra: 7.2 s to 0.7 s). The topology is the same, array for array. - Triangle strips read about four times faster: their cell data is copied to
the triangles by a NumPy gather per array, not avtkIdListfilled one id
at a time (2M triangles: 319 ms to 74 ms). generate_global_idsover aPartitionedDataSetwith a polyhedral piece:
it read faces'rows, which a polyhedral topology's faces (of any size) do
not have. It now takes their boundary points from the face lists.- Reading hexahedra no longer sorts every hexahedron's corners to look for
collapsed ones (Tecplot's bricks, degenerate Exodus hexahedra): only those
with a collapsed edge are sorted, about 1.2 s and 2.6 GB less on 21M
hexahedra. L2.indices()andL2.blocks(values)refuse cells holding different numbers
of values (a mixed mesh, an order per cell), namingspace.offsets. They cut
the values into rows of the average size, so a tetrahedron and a hexahedron
at order 1 read as two cells of 6 values each, raising only when the total did
not divide evenly.- Reading as polyhedra (
polyhedral=True) is about four times faster again:
triangles and quads are matched by their sorted points packed into two
64-bit keys and Tack's parallel radix sort, wherenp.lexsorttook 68 s on
128M quads, and their face lists are built by columns, a few million cells at
a time, with 32-bit point ids where they fit. 21M hexahedra, 67K wedges and
508K polyhedra: 27 s and 19 GB, withorient=Truefor its wedges, which also
no longer falls back to the cell-by-cell walk when the shaped cells were what
disagreed. - A
vtkCharArraycomes across asu8where the platform'scharis unsigned (Linux on Arm) and asi8elsewhere; it was always read asi8, which turned values above 127 negative on Arm. generate_global_idsmatches every point, not only boundary points, when
pieces have ghost cells but no point marks.- Lines cut from surfaces interpolate each crossing from its side's end first
by position, not from its lower point id, so pieces sharing a side compute
it to the same bits. - Streamlines, advection and probes over pieces bounded each piece by its
positions' box taken on the host on every call: a second of each call over
the AhmedML mesh's 21M-cell piece, half the split reading's streamline time.
The box is now the piece's locator's, found once when the locator is made;
the split reading's 2,000 streamlines take 0.75 s, as the whole reading's
do, where they took 1.71. - Point gradients (
gradients(..., at="points")) were NaN at a corner where a
cell's Jacobian is singular, as where two of a hexahedron's faces meet flat
(17 points of the AhmedML mesh). Such a cell has no gradient there -- it
grows without bound toward the corner -- and is now left out of that point's
average, the others' mean taken; VTK leaves its inverse Jacobian unset there,
and Viskores counts the cell but adds nothing. - A CPU device without f64 (the tests' stand-in for Metal) loaded kernels a
CPU with f64 had stored in the disk cache, and so ran an f64 kernel Metal
refuses; its cache target now says it has no f64. Point gradients at
singular corners are also run on it in the tests, which is where #268's f64
cast would have been caught. - Filters over pieces whose points are marked copies stalled now and then: the
check whether any mark has a bit (ghosts._has, on everycarry) raised one
atomic flag for every marked element, so the CPU kept it serial (0.14 s over
the AhmedML mesh's 22.8M points) and its rechecks fanned it out at 1-1.2 s.
It is now a flag per chunk of the marks, without atomics: a slice of the
polyhedra piece takes 0.012 s every call, where it took 0.15 s with spikes
of 1.2. contourof a polyhedral mesh raised where the iso-surface met an edge
three or more times: a point within half an ulp of the level is a vertex
on some of its edges and not others, so several faces trace one iso-edge.
The AhmedML mesh's Q = 1, 2 and 5 contours (2.0M, 1.5M and 0.8M polygons)
are made now; only their faces are refused.- Advection stopped a particle at zero velocity wherever its speed was below
3.5e-4 in the data's unit (a squared speed at the float's machine epsilon),
so every streamline of the SciVis 2021 mantle (1e-9 m/s) ended at its seed.
Zero velocity is now a squared speed at or below 1e-37; slower flows stop by
terminal_speed, as vtkStreamTracer's do. The mantle's 500 streamlines are
VTK's (300,500 points, lengths within 1.3e-5). - A step leaving the mesh is bisected to the boundary, and the bisection's
bracket was absolute (ten machine epsilons): on long steps in f32 (an ulp of
50 is 3.8e-6) it never got that small, and the particle bisected forever.
The bisection is now bounded at 64 halvings. - AMR hierarchies of thousands of boxes took minutes or more: making an
AMRDataSetcompared every box with every other in Python, and
ghost_cellsandaverage_downbuilt their sources box by box and filled
through a plan with a pair for every two boxes that touch (AMR-Wind's 6,436
boxes: 326,480 launches a fill). The marks are computed a level at a time,
boxes that meet are found by a sort and sweep, the sources by kernels over a
level's boxes at once, and a fill runs once per device's boxes. On AMR-Wind's
levels 0 and 1 (6,436 boxes, CPU, VTK master), making the dataset from VTK's
went from 129 s to 3.2,ghost_cellsfrom more than 40 minutes to 7.6 s,
andaverage_downfrom not finishing to 2.9 s, with every value the same to
the bit; all five levels (15,598 boxes, 183M cells) take 8.2, 30 and 11 s. vtk_to_datasetof avtkOverlappingAMRgives every box the hierarchy's
origin, not one chosen from the box's own bounds, and places each box as it
converts it.average_downof an image box weighs its cells by the product of its spacing,
every cell alike, not by each cell's measure from its corners, which could
differ in the last bits.ghost_cellsof anAMRDataSetlooks for sources only in each grown box's
shell (its ghost cells, and its own points on its boundary), not in every
cell and point it holds, places each box's values on the device, and looks
each box's device up once: on AMR-Wind's levels 0 and 1 (6,436 boxes) it
went from 7.6 s to 3.6, with every value the same to the bit, and on all
five levels (15,598 boxes, 183M cells) it takes 20 s,average_down9.- A filter's output from pieces without ghost cells (
splitwithout ghost
layers, the split reading of shaped cells and polyhedra) refused every
reduction, though only the points it makes on shared edges and faces have no
owner: each cell it made from one input cell keeps that cell's. The loss is now
recorded per kind, sointegrate(a contour's area) and statistics of cell
fields work on such outputs, and point reductions still refuse.
extract_surface's cells, faces the pieces share, lose their marks too.
Setting a dataset'sghoststoNoneclears the record, as other marks did. integrateandcell_geometrymeasure a non-planar polygon as its fan of
triangles from its points' mean, Tack's model of a polygon and the area VTK
reports, and a quad as its bilinear patch (by 4 x 4 Gauss points, within
rounding unless it is twisted far out of plane), not either as its
projection onto its Newell normal, which is smaller. Tack's contours of
hexahedra are polygons, and a wrinkled one measured 1% small (the dam
break's free surface; the Ford DrivAer's wake 7.5e-4). Both are signed by
the normal, so a planar polygon whose mean lies outside it, or a planar quad
that is not convex, still measures exactly. VTK measures a quad as its
projection.- A particle whose step leaves the mesh is pushed just outside it (an Euler
step from the last point inside by the bisection's bracket, grown until no
cell holds it), not by the distance to the boundary again, which Viskores'
SmallStepdoes and Tack did, counting the distance once in the particle's
time and path length. On one mesh it lengthened only a path's last segment;
between pieces without ghost cells the path went on from there: on the Ford
DrivAer's split pieces 59 of 200 streamlines ran pastmax_length(by up to
0.31 m over 23 hand-offs) and one was pushed out of the mesh across a thin
layer, 0.48 m into its 13.84. - RK45's end at a wall, a push out that moves the particle less than
min_step, measured the push after it was taken (always 0), so every RK45
push out that stayed in the mesh ended the particle; it measures the move. - Over pieces without ghost cells, a particle pushed out of one piece into a
sliver no piece holds -- pieces whose shared faces are not one surface, a
hexahedron's bilinear face against a polyhedron's fanned one in a
polyhedral="split"reading -- goes on from where the push would have ended
going the way to the boundary again, if a piece holds that, with the move in
its time, length and stretch; it stopped there, outside. dataset_to_vtk(..., copy=False)of a dataset made by
vtk_to_dataset(..., copy=False)from GPU arrays hands VTK back the arrays
it shared, which DLPack cannot (they are read-only to Tack): a filter that
keeps its input's points, asProbedoes, failed.vtk_to_dataset(..., copy=False)makes a dataset from a host grid on the CPU
whatever the default device: with a GPU the default (as
tack.interop.vtk.init_level_zero()makes Level Zero), what it copied beside
the shared arrays -- implicit cell types and offsets, converted values -- was
made on the GPU, so filters gave empty outputs or refused arrays on two devices.- A VTK algorithm whose filter raised kept the exception with its traceback,
whose frames held the algorithm and VTK's pipeline information in a cycle;
Python's collector crashed freeing it. The exception is kept without its
traceback, printed as VTK printed it. - A filter over pieces (
GenerateGlobalIds,GhostCells,MergePieces) on a
multiblock'svtkMultiPieceDataSetblock ran on each piece alone, and gave
empty pieces. MergePiecesover MPI ranks gave the ranks other than the root nothing to
convert, and failed there; they get an empty dataset of the output's type.- Python crashed in its garbage collector when it freed, in a reference cycle (a
traceback's frames, say), a VTK dataset one of Tack's VTK algorithms had read: the
DeleteEventobserver that dropped the dataset's cache entry, referenced only by
the dataset, was cleared as garbage before the deletion called it (a VTK bug, in
9.7.1 and master). The cache entry is now an attribute of the dataset's Python
wrapper, which VTK keeps while the dataset lives and frees with it: no observer.
An entry is converted again when the dataset's modification time or time step
changes; after changing a dataset in place, callModified(), as VTK's own
filters need. - A
vtkOverlappingAMRgiven to a VTK algorithm gave an empty hierarchy, with no
error: VTK makes a hierarchy a partitioned collection, which they filtered as a
tree into an output of the hierarchy's type that could not hold it. vtk_to_datasetof avtkOverlappingAMRspread over MPI ranks marked each
rank's boxes as if its own were the whole hierarchy; it now converts in VTK's
world unless given one.Advection(andPathlines,Streaklines) over pieces on MPI ranks waited
forever where a rank had no particles, released particles at other steps, or
saw its particles stop at another substep: the probes are collective, and a
rank skipped them. Every rank now takes part in each.- The VTK algorithms that add fields (
Elevation,Gradients,Project, ... and
RunningStatistics,TimeDerivative) on VTK's higher-order cells wrote Tack's
values straight into VTK's point data: an order-2 field's in Tack's node order,
not VTK's (Elevationcame out scrambled, and itsGradientswrong), and values
on Tack's points, the corners, for every VTK point, edge middles included (a
1193-point grid got an array of 1193 tuples of 1227 components). Each VTK point
now takes its node's value: the field put into the space the import made
(project, exact for anH1field of that order or below and for values on the
corners), its nodes matched to VTK's points as the import matched them. An
integer field on the points is refused there, having no value at an edge's
middle. Found running VTK'squadraticQuadDeriv.pyon Tack. - The VTK algorithms' outputs had no active attributes: Tack keeps no roles, so the
arrays it carried came back plain, and mappers colored by nothing, glyphs and
lighting found no vectors or normals (VTK's tests rendered white). An output now
keeps its input's active scalars, vectors, normals, texture coordinates and
tensors where it carries arrays of those names (Probeits source's), as VTK's
filters pass them;ElevationandImplicitValuesmake their array the active
scalars,SurfaceNormals,PointNormalsandTubestheirs the active normals
(a tube took the lines' carriedNormalsbefore, and was lit wrongly). Found
running VTK's Python tests on Tack. triangulatecut a polygon into a fan from its first corner, which covers a
concave polygon twice in part and leaves part uncovered (a U-shaped polygon of
area 6 gave triangles of area 9). It now cuts ears in the polygon's plane, as
VTK'svtkTriangleFilter:n - 2triangles that cover the polygon once, each
wound as it is. Found running VTK's Python tests on Tack (the concave polygons of
vtkDiscreteFlyingEdges2DandvtkImageToPolyDataFilter).- The VTK algorithm
Transformcarried the input's vectors and normals as they
were, so after a rotation they pointed the old way (and normals lit a moved
surface wrongly). It now transforms the input's active vectors and normals, on
points and cells, as VTK'svtkTransformFilterdoes, unlessvectorsor
normalssay otherwise. Found running VTK's Python tests on Tack. - Slicing or contouring serendipity cells (quad8, hex20, wedge15) that carry a
64-bit integer point field failed: the field's full values asked a device for
what a backend has. Found running VTK'scutter.pyon Tack (cuttertest.vtu's
node numbers). extract_extentof a flat curvilinear grid refused VTK's three-axis extent and
rates (VTK always writes three; a grid's flat axis is the one whose pair is
(0, 0)). Found running VTK'sNetCDFCF2DBounds.pyon Tack.- A template method may pass one template it holds to a method of another
(self.values.scaled(self.mesh, i)): the callee is resolved when that call is
reached. It raised aKeyErrorfor the callee's resolved name. vtk_to_datasetmarks a cellHIDDENCELLwhere one of its points is
HIDDENPOINT: VTK sees a cell only where it and all its points are visible (a
structured grid blanked by points), and Tack's filters, which leave out hidden
cells, contoured and cut through blanked points. The point marks are kept.- The VTK algorithm
ConnectedComponentsrefused its own output onvtkPolyData
(it gave an unstructured grid where it promised its input's type): its arrays go
onto a copy of the input, as VTK'svtkConnectivityFilterkeeps it. projectof a polygon (polyhedron, polyline) with no points gaveinf, having
read past the cell: it isNaN, the cell having no value. These three found
running VTK's Python tests on Tack.vtk_to_datasetof a grid of VTK's higher-order cells keeps a point array and a
cell array of one name as two fields, as on linear cells; the cell array
replaced the point array (CylinderQuadratic.vtk'svelocityandpressure).
Found bytest_vtk_higher_order.pywithTACK_VTK_DATA, which CI does not
set; it failed since fields by name and space (0.7). That test also compared
Tack's measure of a bent quad, a fan from its mean since 0.7, with VTK's two
triangles; it now measures both surfaces withvtkCellSizeFilter.- A VTK algorithm given a tree with a partitioned dataset of no partitions on
any rank (the node and side sets an IOSS reader leaves unread) gives it an
empty one without running the filter.StreamlinesandAdvectfailed on
them ("a rank with no pieces has no piece to start its seeds from"). - Box by box over an AMR hierarchy, the VTK algorithms that give
vtkPolyData
(SlicePlane,Contour, ...) give it for each box too, where they gave
vtkUnstructuredGrid. dataset_to_vtkgives an image, rectilinear or structured grid that is part of
a larger one (StructuredTopology.offset, assplitmakes it) its extent
there, its points where they were. Every piece's extent started at 0, so
pieces handed to VTK did not tile their whole, andGhostCellsrefused them.MergePiecesof polygonal pieces (a contour's, a surface's) givesvtkPolyData;
since #353 it declared avtkPolyDataoutput, made an unstructured grid and
failed, which broke example 48. Examples 47 and 49 read and wrote the
polydata outputs as unstructured grids, and failed too.- Over MPI,
tack.communication.sort_by_keyand the matching behind
generate_global_ids,ghost_cellsandmerge_pieceshung when one rank held
every block and the others none: that rank took a shortcut without messages
and the others waited in an exchange. Every rank now takes the same path. - Over MPI, the algorithms over pieces take ranks that hold no pieces, as a reader
that gives some ranks nothing makes them. Each rank must make the same calls
that communicate, so a rank must not decide from its own pieces alone what the
others decide from theirs:probeof aPartitionedDataSetor an AMR hierarchy,streamlinesand
advectover pieces,voxelizeof pieces or a hierarchy, andAdvection
(and the path filters) over pieces refused or failed on a rank without
pieces ("needs pieces on this rank to start from", "a rank with no pieces has
no piece to start its seeds from"), leaving the others waiting. Such a rank
now takes part through a piece of nothing (_stand_in): its points and seeds
go to the pieces that hold them, and the answers come back.update_ghosts,extract_surfaceof pieces, AMRghost_cellsand
average_down,integrateover pieces, and the VTKStatistics,Entropy
andIntegratealgorithms chose their fields (or a shortcut) from this rank's
pieces; a rank without any now gets the others' choice.merge_piecesonto a root rank without pieces refused; the merge is made on
the first rank that has pieces and moved to the root.test_empty_ranks.pyruns every algorithm over pieces, AMR hierarchies,
octrees, advection and the VTK algorithms over pieces on 3 ranks, with the
pieces on one, two or none of them, against the same pieces in one process.
- Debug mode on HIP: the bounds check helper
__tack_in_bounds__is
__noinline__. hipRTC (ROCm 7.1.1) at-O2and above miscompiled it
inlined, and fivetest_high_order.pycases reported in-bounds accesses out
of bounds, with 0.5f's bits in an index's high half. CUDA's stays inline. - Level Zero: every kernel requires sub-groups of 16
(intel_reqd_sub_group_size(16)), so IGC never compiles one SIMD32. On a
Max 1100 (IGC 2.7.11, compute runtime 25.05) IGC's SIMD32 code for five
tack-vis kernels was wrong: crossings of high-order contours and slices
(in f32, and with 64-bit ids), a simplex subdivision's lattice points, and
AMRghost_cells' marks. Their SIMD16 code, fully optimized, is right.
Compute runtime 26.40 does not fix it. - Examples 50-53 on Level Zero make their device in VTK's Level Zero context
(init_level_zero()) where VTK has one, else Tack's own: under a VTK that
holds Level Zero memory, their outputs went back to VTK from Tack's own
context and were refused. The examples test skips 42 and 43, which need
that context, under a VTK without one, as it skips a missing optional module. - A VTK with DLPack but without the device's memory (VTK master's nightly
wheels, whose Viskores runs on the CPU alone yet lists CUDA and ROCm among
dlpack_support.supported_device_types()) no longer fails every VTK
algorithm on a GPU as it hands its output back: the interop shares one value
once per device (_vtk_holds, by memory domain, VTK's error for a refusal not
shown), and copies to the host where VTK cannot hold the memory.