Skip to content

fix: display vtkIdTypeArray/long array variables correctly in client mode - #262

Merged
LKasianAnsys merged 3 commits into
mainfrom
fix/64-bit-data-in-client-mode
Dec 2, 2026
Merged

LKasianAnsys merged 3 commits into
mainfrom
fix/64-bit-data-in-client-mode

Conversation

@LKasianAnsys

@LKasianAnsys LKasianAnsys commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Resolves #250

Summary

Some colour variables showed different values in CLIENT mode than in SERVER and PARAVIEW modes. For tests/files/many_blocks/many_blocks.vtm, SERVER and PARAVIEW modes matched each other and the ParaView desktop application. CLIENT mode showed different values for GlobalNodeId, PedigreeNodeId, GlobalElementId and PedigreeElementId. T and ObjectId were correct. This behaviour was reproduced as far back as August 2025 in the old internal repo, so it is not a new issue.

Root Cause

The colour variables that displayed incorrectly were of type vtkIdTypeArray, whose element width depends on the platform: 64-bit on the server, but 32-bit in the browser client (VTK.wasm, wasm32). When VTK serializes vtkIdTypeArray, vtkLongArray and vtkUnsignedLongArray arrays, it doesn't record the element width, so the client reads the server's 8-byte values as 4-byte values. This is upstream of VISOR; this PR is a workaround until it is reported and fixed upstream.

(The two many_blocks variables that were displaying correctly were ObjectId, a vtkTypeInt32Array, and T, a vtkTypeFloat64Array. T is also 64-bit, but its width is fixed, so the client read it correctly.)

This is the same upstream defect worked around in #169 for vtkLongArray / vtkUnsignedLongArray. #169 was specific to Linux/macOS because long is 4 bytes on Windows. vtkIdType is 8 bytes on every 64-bit server, so this case also appears on Windows. This PR adds vtkIdTypeArray to the same conversion, applies it to point and cell data for every file format (not only VTKHDF), and closes #169's known gap for in-memory datasets in CLIENT mode.

Changes

File inputs: For datasets provided to VISOR as a file path, we add a workaround so that point and cell data arrays of these three classes ( vtkIdTypeArray, vtkLongArray and vtkUnsignedLongArray arrays) are converted to vtkTypeInt64Array / vtkTypeUInt64Array, which have a fixed width. Topology is not touched, except for VTKHDF files, where it was already converted before this change (that was added in PR #169; see that PR's description for more context on that change).

In-memory inputs: For in-memory datasets provided to VISOR as a Python object, in CLIENT mode we reject any datasets that holds one of these arrays. The alternative would be to convert the affected datasets on the in-memory datasets, but here we follow the decision made in PR #169 that no user-held object is mutated. Therefore, in CLIENT mode, a dataset holding one of these arrays is rejected with a ValueError that names each array. Visor does not copy or convert the caller's data. The new VisorSceneBase.check_dataset() hook does this check; it does nothing in SERVER and PARAVIEW modes.

Order of the check: add_dataset, update, start and _start_async run the check before they change the scene. A rejected dataset leaves the current scene as it was, and start does not start the server.

Removals

Since this is a workaround for an upstream issue, when the root cause is fixed upstream we can remove the workaround in VISOR. For removal, the conditions in #169 still apply. Also remove check_dataset in VisorLocalScene and the attribute-array normalization.

@github-actions github-actions Bot added test Work associated with testing fixed bug Something isn't working labels Nov 27, 2026
@LKasianAnsys LKasianAnsys self-assigned this Nov 27, 2026

@ansBAkula ansBAkula left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LKasianAnsys Is this visual difference between client and server modes expected?

bitmap

@LKasianAnsys

Copy link
Copy Markdown
Collaborator Author

@ansBAkula Yes good check. The part selection highlight is currently different between CLIENT and SERVER modes; that's something we should address. Added a user story (#270) to capture that.

@LKasianAnsys
LKasianAnsys merged commit e75f37b into main Dec 2, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fixed test Work associated with testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Color by variable shows different values in SERVER and CLIENT mode.

3 participants