Repository navigation
fix: display vtkIdTypeArray/long array variables correctly in client mode - #262
Merged
Merged
Conversation
ansBAkula
approved these changes
Dec 2, 2026
ansBAkula
left a comment
Collaborator
There was a problem hiding this comment.
@LKasianAnsys Is this visual difference between client and server modes expected?
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 forGlobalNodeId,PedigreeNodeId,GlobalElementIdandPedigreeElementId.TandObjectIdwere 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 serializesvtkIdTypeArray,vtkLongArrayandvtkUnsignedLongArrayarrays, 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, avtkTypeInt32Array, andT, avtkTypeFloat64Array.Tis 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 becauselongis 4 bytes on Windows.vtkIdTypeis 8 bytes on every 64-bit server, so this case also appears on Windows. This PR addsvtkIdTypeArrayto 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,vtkLongArrayandvtkUnsignedLongArrayarrays) are converted tovtkTypeInt64Array/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
ValueErrorthat names each array. Visor does not copy or convert the caller's data. The newVisorSceneBase.check_dataset()hook does this check; it does nothing in SERVER and PARAVIEW modes.Order of the check:
add_dataset,update,startand_start_asyncrun the check before they change the scene. A rejected dataset leaves the current scene as it was, andstartdoes 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_datasetinVisorLocalSceneand the attribute-array normalization.