fix: nodal coordinates export - #3
jacksongomesdasilva merged 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the boundary-information export so that nodal coordinates are exported per time step (using nodal coordinate grid functions) rather than using static raw geometry points, keeping coordinates aligned with other time-dependent boundary properties.
Changes:
- Switched nodal coordinate export from
GetRawPoints()to time-step-aware"Coordinate : Nodal : X/Y/Z"grid functions. - Updated the inline comment to reflect time-step-based coordinates.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
scripts/script_export_boundary_information.py:71
number_of_nodesis taken fromgeometry.GetNumberOfNodes()(notime_step), but the coordinate arrays are fetched per time step. If the node count ever differs per time step (or if the coordinate grid functions return a different-length array), thereshape((number_of_nodes, 3))will raise at runtime or silently misalign IDs/coordinates. Prefer deriving the count from the coordinate arrays (and optionally validating lengths) and avoid the redundant reshape.
number_of_nodes = geometry.GetNumberOfNodes()
x = geometry.GetGridFunction("Coordinate : Nodal : X").GetArray(time_step=time_step)
y = geometry.GetGridFunction("Coordinate : Nodal : Y").GetArray(time_step=time_step)
z = geometry.GetGridFunction("Coordinate : Nodal : Z").GetArray(time_step=time_step)
position_array = numpy.column_stack((x, y, z)).reshape((number_of_nodes, 3))
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
scripts/script_export_boundary_information.py:71
write_node_gf_for_timestepnow unconditionally reads the "Coordinate : Nodal : X/Y/Z" grid functions. If a geometry doesn’t provide these grid functions, this will raise at runtime (even though the UI selection only filters/export grid functions that exist). Consider guarding withHasGridFunction(...)and falling back to raw points (previous behavior) or emitting a clear error.
number_of_nodes = geometry.GetNumberOfNodes(time_step)
x = geometry.GetGridFunction("Coordinate : Nodal : X").GetArray(time_step=time_step)
y = geometry.GetGridFunction("Coordinate : Nodal : Y").GetArray(time_step=time_step)
z = geometry.GetGridFunction("Coordinate : Nodal : Z").GetArray(time_step=time_step)
position_array = numpy.column_stack((x, y, z)).reshape((number_of_nodes, 3))
Exports nodal coordinates at each time step instead of static raw points, keeping coordinates consistent with the exported boundary properties.