Skip to content
Open
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
6 changes: 3 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ If the current branch was cut from a feature branch (not from `main`), open the

When opening or merging a PR, add a summary entry to `MIGRATION_LOG.md` under `## Done` (newest first).

Before opening a PR, check [TODO.md](TODO.md) for related open items to update or remove. Also check and update [docs/logic_flows.md](docs/logic_flows.md) if any execution paths changed.
Before opening a PR, check [TODO.md](TODO.md) for related open items to update or remove. Also check and update [docs/logic_flows/](docs/logic_flows/) if any execution paths changed (edit_session.md for edit flows, picking.md for pick flows, etc.).

## Current Architecture

Expand All @@ -148,7 +148,7 @@ Before opening a PR, check [TODO.md](TODO.md) for related open items to update o

### ParaView Backend Path

- `paraview_backend.py`: owns ParaView sources/displays, pipeline nodes, filters, coloring, display controls, picking, selection overlays, saving/export. `set_edit_target_dataset()` builds four remap caches at session begin (`_edit_source_dataset`, `_edit_source_point_indexes`, `_edit_target_cell_map`, `_edit_point_id_map`) so picks avoid per-pick Fetch/rebuild — see `docs/logic_flows.md §5b`.
- `paraview_backend.py`: owns ParaView sources/displays, pipeline nodes, filters, coloring, display controls, picking, selection overlays, saving/export. At edit session begin, `export_active_dataset_for_editing()` creates a real pipeline node (kind="edit") that reads the same backing data as the original node, so pick cell IDs directly index `working_dataset` with no remapping — see [docs/logic_flows/edit_session.md](docs/logic_flows/edit_session.md).
- `paraview_runtime.py`: synchronizes backend state into Trame state, handles render pushes, edit-session overlay sync. Forwards event normalization calls to `paraview_event_utils.py`.
- `paraview_event_utils.py`: pure helpers for normalizing ParaView picking event payloads (`normalize_edit_selection_ids`, `summarize_edit_event`, coordinate mapping). No Trame dependency.
- `paraview_controllers.py`: user actions from the UI: pipeline actions, filters, edit sessions, selection, field creation, display/color controls.
Expand Down Expand Up @@ -263,7 +263,7 @@ conda run -n coral-paraview pytest -q tests/ --ignore-glob=tests/test_e2e*.py

## Debugging Notes

- `docs/logic_flows.md` has detailed flow diagrams.
- [docs/logic_flows/](docs/logic_flows/) has detailed flow diagrams split by domain (`edit_session.md`, `picking.md`, `color.md`, etc.).
- If `pytest` or `python` resolves to the wrong environment (ParaView unavailable): a stale virtualenv may be active and its `PATH` entry wins. Run `deactivate` if a venv is active (`deactivate` is only defined while a venv is sourced — if not found, no venv is active), then `conda activate coral-paraview`.
- E2E test meshes live in `test_data/`; use them instead of writing into `data/` unless needed.
- `tests/test_e2e_edit_selection_playwright.py` has helpers for normalized box drags and switch state checks.
Expand Down
29 changes: 28 additions & 1 deletion MIGRATION_LOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
# CODEX_LOG
# MIGRATION_LOG

## Goal

Evolve the current VTK/trame viewer toward a ParaView-backed application while keeping the existing project aesthetic. The VTK→ParaView migration is complete. For current architecture see [CLAUDE.md](CLAUDE.md); for active work see [TODO.md](TODO.md).

## Done

- Edit pipeline node for zero-remap picks (Step 2, issue #34, branch `perf/step2-edit-node`):
- replaced the per-pick remap-cache approach (Step 1, commit `298a3df`) with a real
pipeline node (kind="edit") that reads the same backing data as the original node,
so pick cell IDs directly index `working_dataset` with no coordinate-based remapping
- a dedicated reader proxy approach (originally planned for Step 2) was explored but
dismissed: it caused regressions in coloring, LUT, and representation handling because
those code paths all expect a regular pipeline node; a real node fits the existing
architecture with zero property overrides and no special-casing
- removed all four remap-cache fields (`_edit_source_dataset`, `_edit_source_point_indexes`,
`_edit_target_cell_map`, `_edit_point_id_map`) and five remap methods
- edit node label "✏ Editing: {original}", icon `mdi-pencil-outline`, visible in pipeline panel
- root readers reuse the same backing file (no write); filter nodes write a temp VTU
- `can_edit_active_node()` replaces the expensive export probe with a cheap `GetDataInformation` call
- surface picks skip a redundant `Fetch(source)` during an active session (use `working_dataset` directly)
- cached surface-pick geometry at session begin (B5, B5b): `set_edit_target_dataset` builds
`_edit_source_point_indexes` (O(n_points) coordinate index) and `_edit_boundary_elements`
(O(n_cells×faces) boundary map) once;
- the pipeline node model is also a better foundation for future improvements: real-time
display updates when cell values change (update the edit node in place), and server-side
field-value mutations via ParaView proxies to preserve MPI distribution without collapsing
all ranks through `Fetch()`
- `docs/logic_flows/` (split from monolithic `docs/logic_flows.md`), `CLAUDE.md`, and `TODO.md` updated

- Eliminate per-pick Fetch and map rebuild with edit session remap cache (Step 1, issue #34, commit `298a3df`):
- pre-built four coordinate-based maps at session begin to avoid O(n) rebuild on every pick
- subsequently superseded by Step 2 above (edit node approach makes remapping unnecessary)

- UI restructure, centralized notifications, save dialog, and categorical LUT fixes (PR #32):
- moved edit-panel controls into the right inspector Edit tab; added `docs/ui_structure.md`
- replaced 9 scattered alert state pairs with a single `VSnackbar` driven by `notifications.py`
Expand Down
5 changes: 0 additions & 5 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

## Priorita alta

- **Performance selezione su dataset grandi** — bottleneck documentati in
`docs/logic_flows.md` §5a e §6. Piano a step progressivi in [issue #34](https://github.com/2listic/coral-visualizer/issues/34); ogni step
è indipendente e lascia i test esistenti verdi. Step 1 può essere fatto direttamente
su `paraview_backend.py` senza refactor preventivo.

- Separare `paraview_backend.py` in servizi di dominio più piccoli (3900 righe).
Iniziare da moduli con dipendenze unidirezionali (`backend/display.py`,
`backend/coloring.py`, `backend/pipeline.py`) — più self-contained e a minor rischio
Expand Down
Loading