Skip to content

ports P0d, part 1: cvc::contour_stack, its formats on each app, contours.* and pycvc - #1156

Merged
transfix merged 3 commits into
masterfrom
p0d/shared-types
Nov 12, 2026
Merged

transfix merged 3 commits into
masterfrom
p0d/shared-types

Conversation

@transfix

@transfix transfix commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Part 1 of phase P0d in docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md (§3, §7): cvc::contour_stack, the contours the tiler (P3b) and volume_grid (P10) will share. Part 2, cvc::point_classes, follows in its own PR.

What lands

  • The type (inc/cvc/geometry/contours.h):

    • slices keyed by z index, with a spacing and origin, or a slice's own plane (a Tiling series spaced unevenly);
    • closed polygons per component, and components with a colour and a visibility;
    • contour_problems();
    • parameter tables for contour_component and contour_read_params (cvc::param_table, P0b).
  • Formats, each app's own. contour_handlers(app) is a file_handler_registry (P0a: the file handler tables are each app's own (volume, geometry, model, image) [4.0, breaking] #1119) kept in app.slot<T>() (P0a: the action-intrinsic providers are each app's own; cvc::app::slot<T>() [4.0, breaking] #1137), so app.h doesn't change.

    Ext Format Read Write
    .ser Reconstruct series and its section files yes yes
    .config the Tiling program's config and its .pts files yes yes
    .contour ctr2suf yes yes
    .pcd VolumeGridRover's point cloud no yes
    .cvcc libcvc's own JSON yes yes
  • Reconstruct transforms are inverted properly. Reconstruct stores the polynomial from series coordinates to the section's own, so a trace's world coordinates are its inverse, as PyReconstruct reads them.

    • Affine transforms are inverted exactly; polynomial ones by Newton's method.
    • ContourTiler's reader was right only for a translation, and its y used the already-transformed x.
    • The differences from the legacy readers and writers are listed in docs/PORT_SHARED_TYPES.md.
  • No new process-wide state.

    • The Reconstruct XML goes through src/cvc/utility/xml_lite, a small stateless reader. boost::property_tree's XML parser keeps function-local statics (xmlattr<>()::s, rapidxml's nullstr()::zero) that aren't on the scan's allowlist.
    • The name filters use boost::regex, whose statics are already allowlisted, rather than libstdc++'s std::regex.
    • tools/singleton_scan/allowlist.txt is unchanged.
  • DSL intrinsics.

    • contours.info, and params.* with the tables contours.read (read_contours' parameters) and contours.component.
    • No intrinsic reads or writes files (Joe, 2026-11-12; commits 00d51f6, 0543916): the DSL deals with data on the state tree. A stack reaches the tree, and leaves it for a file, through read_contours / write_contours, pycvc, a node's request or the CLI. A test checks that contours.read, contours.write and contours.formats stay unbound.
    • register_contour_intrinsics(env, ictx, app) binds them in one environment.
    • install_contour_intrinsics(app) adds them as the app's own keyed action-intrinsic provider (cvc.contours).
  • pycvc (pycvc_contours.i): contour_stack, and read_contours / write_contours, which release the GIL. Both tables go through PYCVC_PARAM_TABLE.

Tests

  • contour_stack_test: in CVC_PORT_TESTS, so the ports (wasm-mt, node) lane runs it, and in SAN_CXX_TESTS. It covers:
    • the model;
    • T8: both tables to the state tree and back, defaults seeded, properties written, bad values reported;
    • T9: every format round-trips; the hand-made legacy samples in src/cvc/tests/data/contours read; a corpus of truncated and garbage files raises naming the file;
    • T6: two apps keep their own handlers; two threads with different parameters read what each reads alone; A then B equals B then A;
    • the intrinsics in an environment, and from an Ariadne document through the app's provider (and not in another app's);
    • xml_lite on its own.
  • T11: test_pycvc_contours.py, in ctest and SAN_PY_TESTS. It builds a stack, round-trips every format, checks keywords and the state round trip and the errors, and runs another Python thread during a read.
  • CI changes: the ports lane's path filter gains src/cvc/utility. ci.yml stays CRLF; it has 4 changed lines.

Checked locally (Windows, MSVC 19.44, Release):

  • contour_stack_test: 22/22;
  • pycvc_contours, pycvc_params and pycvc_jobs pass;
  • param_table_test, result_job_test and job_intrinsics_test pass.

Not checked locally: the wasm-mt build under node, Linux/macOS, and the writable-data scan. CI checks them.

Names follow §9 item 4 (still open).

…urs.* and pycvc

The contours the tiler (P3b) and volume_grid (P10) share
(docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md §3, P0d):

- inc/cvc/geometry/contours.h: slices by z index (a spacing and origin, or a slice's own plane),
  closed polygons per component, components with a colour and a visibility; contour_problems();
  parameter tables for contour_component and contour_read_params.
- Readers and writers are each app's own (contour_handlers(app), a file_handler_registry in
  app.slot<T>()): Reconstruct .ser with its sections, the Tiling .config + .pts, ctr2suf
  .contour, VolumeGridRover's .pcd (written only) and a .cvcc JSON file. Reconstruct traces are
  mapped through the inverse of their section transform, exactly for affine ones and by Newton's
  method otherwise (the legacy reader was right only for a translation).
- src/cvc/utility/xml_lite: a small stateless XML reader. boost::property_tree's XML parser keeps
  function-local statics the writable-data scan would flag; the name filters use boost::regex,
  whose statics are already allowlisted, rather than std::regex.
- contours.read / write / info / formats and params.* with the tables "contours.read" and
  "contours.component": register_contour_intrinsics(env, ictx, app) for one environment, and
  install_contour_intrinsics(app) as the app's own keyed action-intrinsic provider.
- pycvc: contour_stack, read_contours / write_contours (the GIL released), both tables through
  PYCVC_PARAM_TABLE.
- Tests: contour_stack_test (in CVC_PORT_TESTS and the sanitizer lanes): the model, T8, T9 with
  legacy samples and a bad-file corpus, T6 (two apps, two threads, order), the DSL and an Ariadne
  document through the provider. test_pycvc_contours.py (T11). docs/PORT_SHARED_TYPES.md.
Joe (2026-11-12): the intrinsics deal with data on the state tree; writing it to files is left to
the rest of libcvc (write_contours, pycvc, a node's request, the CLI). So contours.write goes,
and contours.formats lists only the extensions contours.read reads. A test checks that
contours.write stays unbound, and that the stack contours.read puts on the tree is the one
write_contours writes. The docs and the roadmap's §1.6 row say so.
…on the tree

Joe (2026-11-12): drop the read intrinsics too. No contours intrinsic touches files: a stack
reaches the state tree, and leaves it for a file, through read_contours / write_contours, pycvc,
a node's request or the CLI. contours.* is now contours.info, with params.* and the tables
"contours.read" (read_contours' parameters) and "contours.component". The tests put stacks on
the tree from C++ (contour_stack_value, or the stack itself) and check that contours.read,
contours.write and contours.formats stay unbound.
@transfix
transfix enabled auto-merge (squash) November 12, 2026 08:23
@transfix
transfix disabled auto-merge November 12, 2026 08:42
@transfix
transfix enabled auto-merge (squash) November 12, 2026 09:56
@transfix
transfix merged commit ab4058f into master Nov 12, 2026
33 of 34 checks passed
@transfix
transfix deleted the p0d/shared-types branch November 12, 2026 16:06
transfix added a commit that referenced this pull request Nov 12, 2026
ci.yml's sanitizer test list keeps this branch's stream_test, net_ws_client_test and ariadne_host_test and master's contour_stack_test. The allowlist ratchet (#1152) passes: against master the list only loses the open-url clock's line.
transfix added a commit that referenced this pull request Nov 13, 2026
package-linux / libcvc-release-grpc failed only in tools/singleton_scan, on
cvc::ocean::sea_surface::source's thread_local. The run tested a merge with master b745ea6,
from before #1181 (29ff406) took that thread_local out, and a rerun would test the same
merge. Master since then: #1156, #1153, #1166, #1181, #1165. No conflicts.
transfix added a commit that referenced this pull request Nov 14, 2026
…nt-classes.* and pycvc (#1160)

* ports P0d, part 1: cvc::contour_stack, its formats on each app, contours.* and pycvc

The contours the tiler (P3b) and volume_grid (P10) share
(docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md §3, P0d):

- inc/cvc/geometry/contours.h: slices by z index (a spacing and origin, or a slice's own plane),
  closed polygons per component, components with a colour and a visibility; contour_problems();
  parameter tables for contour_component and contour_read_params.
- Readers and writers are each app's own (contour_handlers(app), a file_handler_registry in
  app.slot<T>()): Reconstruct .ser with its sections, the Tiling .config + .pts, ctr2suf
  .contour, VolumeGridRover's .pcd (written only) and a .cvcc JSON file. Reconstruct traces are
  mapped through the inverse of their section transform, exactly for affine ones and by Newton's
  method otherwise (the legacy reader was right only for a translation).
- src/cvc/utility/xml_lite: a small stateless XML reader. boost::property_tree's XML parser keeps
  function-local statics the writable-data scan would flag; the name filters use boost::regex,
  whose statics are already allowlisted, rather than std::regex.
- contours.read / write / info / formats and params.* with the tables "contours.read" and
  "contours.component": register_contour_intrinsics(env, ictx, app) for one environment, and
  install_contour_intrinsics(app) as the app's own keyed action-intrinsic provider.
- pycvc: contour_stack, read_contours / write_contours (the GIL released), both tables through
  PYCVC_PARAM_TABLE.
- Tests: contour_stack_test (in CVC_PORT_TESTS and the sanitizer lanes): the model, T8, T9 with
  legacy samples and a bad-file corpus, T6 (two apps, two threads, order), the DSL and an Ariadne
  document through the provider. test_pycvc_contours.py (T11). docs/PORT_SHARED_TYPES.md.

* ports P0d, part 2: cvc::point_classes, .vgr and .pts on each app, point-classes.* and pycvc

The seeds GenSeg (P5) grows from and the points volume_grid (P8) marks
(docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md §4, §5, P0d). On part 1 (#1156), whose xml_lite
the .vgr reader uses.

- inc/cvc/volume/point_classes.h: classes of voxel points (i j k), each with a name, colour,
  display radius, variable and timestep, known by name, variable and timestep together; add,
  remove, set_class; new classes take a fixed palette's colours (the legacy used srand(time));
  point_class_problems(pc, dims); tables for point_class's metadata and point_class_read_params
  (dims, bbox, variable, timestep).
- Formats each app's own (point_class_handlers(app), in app.slot<T>()): VolumeGridRover's .vgr
  read and written (its reader was stubbed out in the Qt6 migration; a radius attribute added),
  and its .pts point list read, with object coordinates turned into voxels as the legacy did when
  the volume's dims and box are given.
- point-classes.read / write / add / remove / points / info / formats and params.* (tables
  "point-classes.read", "point-classes.class"). Edits return a new data object and never change
  their input. register_point_class_intrinsics(env, ictx, app) and
  install_point_class_intrinsics(app), a keyed per-app provider.
- pycvc: point_classes, point_class and point_class_read_params with their tables, points() and
  points_array() (an (n, 3) int32 numpy copy), read/write with the GIL released; IntVector.
- Tests: point_classes_test (CVC_PORT_TESTS, sanitizer lanes): the model, T8, T9 with legacy
  samples and a bad-file corpus, T6, the DSL, an Ariadne document through the provider.
  test_pycvc_point_classes.py (T11). docs/PORT_SHARED_TYPES.md gains the section.

* contours: no contours.write; the DSL deals with stacks on the state tree

Joe (2026-11-12): the intrinsics deal with data on the state tree; writing it to files is left to
the rest of libcvc (write_contours, pycvc, a node's request, the CLI). So contours.write goes,
and contours.formats lists only the extensions contours.read reads. A test checks that
contours.write stays unbound, and that the stack contours.read puts on the tree is the one
write_contours writes. The docs and the roadmap's §1.6 row say so.

* point classes: no point-classes.write; the DSL deals with them on the state tree

As for contours (Joe, 2026-11-12): point-classes.write goes, and point-classes.formats lists only
what point-classes.read reads. Writing classes from the tree to a file is write_point_classes',
pycvc's or a node request's. A test checks point-classes.write stays unbound and reads back what
write_point_classes wrote from the tree; the docs and the roadmap's §1.6 row say so.

* contours: no contours.read or contours.formats either; the DSL works on the tree

Joe (2026-11-12): drop the read intrinsics too. No contours intrinsic touches files: a stack
reaches the state tree, and leaves it for a file, through read_contours / write_contours, pycvc,
a node's request or the CLI. contours.* is now contours.info, with params.* and the tables
"contours.read" (read_contours' parameters) and "contours.component". The tests put stacks on
the tree from C++ (contour_stack_value, or the stack itself) and check that contours.read,
contours.write and contours.formats stay unbound.

* point classes: no point-classes.read or point-classes.formats either

As for contours (Joe, 2026-11-12): no point-classes intrinsic touches files. Classes reach the
state tree, and leave it for a file, through read_point_classes / write_point_classes, pycvc or a
node's request. point-classes.* keeps add, remove, points and info, with params.* and the tables
"point-classes.read" (read_point_classes' parameters) and "point-classes.class". The tests put
classes on the tree from C++ and check that point-classes.read, .write and .formats stay unbound.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant