Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions changelog.d/vtk-algorithm-cache-observers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Fixed

- 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
`DeleteEvent` observer 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, call `Modified()`, as VTK's own
filters need.
9 changes: 9 additions & 0 deletions changelog.d/vtk-algorithms-summaries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Added

- `Statistics`, `Entropy` and `Integrate`, VTK algorithms of `td.statistics`,
`td.entropy` and `td.integrate` that reduce all their input (every dataset of a
partitioned dataset or a tree, on every MPI rank) to one answer, as VTK's
`vtkDescriptiveStatistics` and `vtkIntegrateAttributes` do. `Statistics` and
`Entropy` give a `vtkTable`, a row per field and a vector field's components one
by one; `Integrate` gives `vtkIntegrateAttributes`' one vertex at the centroid,
each field's integral on it and the measure as `Length`, `Area` or `Volume`.
21 changes: 18 additions & 3 deletions docs/visualization/vtk.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ and what the algorithm supplies itself (the device, a locator, the
communicator): `Contour(field="p", value=0.5, merge_points=False)`.

Every algorithm of the [reference](../vis-guide/reference/algorithms.md) has
one, named as the Tack function in CamelCase, but for the summaries (to come)
and the finite-volume operators that take values on faces (`net_flux`,
`divergence`, `perot`), which VTK keeps nowhere. "Fields" means the input's
one, named as the Tack function in CamelCase, but for the finite-volume
operators that take values on faces (`net_flux`, `divergence`, `perot`), which
VTK keeps nowhere. "Fields" means the input's
type, shallow-copied, with the new arrays added; "faces" means every face as a
polygon (a 2D mesh's edges as lines), or every edge as a line, the new values
their cell data.
Expand All @@ -203,6 +203,8 @@ their cell data.
| Fields from fields | `Gradients`, `FlowQuantities`, `Project`, `ValuesAtCenters`, `Interpolate`, `Magnitude`, `Dot`, `Cross`, `Composite`, `LogValues` | fields |
| | `Convert` | the input's structure |
| Finite volumes | `Jump`, `UpwindFlux` | faces |
| Summaries | `Statistics`, `Entropy` | `vtkTable`, a row per field (and component) |
| | `Integrate` | `vtkUnstructuredGrid` of one vertex, as `vtkIntegrateAttributes` |
| Probing, sampling and particles | `Probe` (the source on port 1), `SphInterpolate` (the particles on port 1) | the input's structure, with the source's fields |
| | `Voxelize` | `vtkImageData` (the `grid` parameter's) |
| | `Streamlines`, `Advect` (seeds on port 1, or `seeds=`) | `vtkUnstructuredGrid` |
Expand Down Expand Up @@ -286,6 +288,19 @@ empty, and the algorithm's `error` attribute keeps the exception for Python
callers. `error` is `None` after a run that succeeded, so a script checks it
after `Update()` or a pipeline call.

The summaries reduce all their input to one answer, as VTK's
`vtkDescriptiveStatistics` and `vtkIntegrateAttributes` do: every dataset of a
partitioned dataset or a tree, on every MPI rank, and every rank gets the
answer. A point that pieces share counts once where its copies' owner is
marked: run `GhostCells` or `GenerateGlobalIds` first (pieces cut without
either, such as `vtkExtractVOI`'s, count it in each). `Statistics` and
`Entropy` take `fields` (by default every field) and give a row per field, a
vector field's components one by one; the statistics keep Tack's names
(`kurtosis` is not the excess). `Integrate` puts its one point at the input's
centroid, each field's integral on it, and the measure as `Length`, `Area` or
`Volume`; integrals are by quadrature through each cell's map, so curved and
higher-order cells exactly.

## Write your own VTK algorithm

Subclass `TackAlgorithm` and give it `compute(data)`, a Tack dataset from a
Expand Down
Loading
Loading