Skip to content

Scripting: geomechanical cell result (replaces #14952) - #14985

Merged
magnesj merged 7 commits into
devfrom
pr-14952-result-definition-interface
Oct 21, 2026
Merged

magnesj merged 7 commits into
devfrom
pr-14952-result-definition-interface

Conversation

@magnesj

@magnesj magnesj commented Oct 20, 2026

Copy link
Copy Markdown
Member

This PR supersedes/replaces #14952, including all of its original commits plus the following additions:

  • Introduce RimResultDefinitionInterface to replace the duplicated dynamic_cast logic for RimEclipseResultDefinition and RimGeoMechResultDefinition in RiaGrpcPdmObjectService.cpp.
  • Add a Python scripting example for setting a geomechanical cell result (set_geomech_cell_result.py).
  • Address review comments from Scripting: geomechanical cell result #14952:
    • Move the setUiReadOnly call for m_timeLapseBaseTimestep into updateUiFieldsFromActiveResult() so it stays in sync whenever results change (including from scripting), not only on project load.
    • Replace the hasattr(self, "eclipse_case") check in rips/view.py's case() with separate per-subclass implementations (EclipseView/GeoMechView), using normal polymorphic dispatch instead of an attribute probe.

Closes #14952

@magnesj
magnesj force-pushed the pr-14952-result-definition-interface branch from 5b22519 to b34fffd Compare October 20, 2026 07:03
@magnesj
magnesj requested a review from kriben October 20, 2026 07:05
@magnesj magnesj self-assigned this Oct 20, 2026

@kriben kriben 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.

LGTM! Needs a mypy fix, though.

hnil and others added 7 commits October 20, 2026 20:03
The cell result of a geomechanical view could not be read or set from
Python. Make RimGeoMechResultDefinition (position, field and component)
and the view's cell result scriptable, as for grid views:

    cr = geomech_view.cell_result()
    cr.result_position_type = "ELEMENT_NODAL"
    cr.result_field_name = "SE"
    cr.result_component_name = "S1"
    cr.update()

On update the UI fields are synced and the result loaded, as for the
grid result definition. rips View.case() now also works for
geomechanical views, so View.export_snapshot() does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace separate dynamic_casts for RimEclipseResultDefinition and
RimGeoMechResultDefinition in RiaGrpcPdmObjectService with a single
cast to a shared RimResultDefinitionInterface, implemented by both
classes. This removes the TODO about needing a more general interface
for updating UI fields after a scripted result change.
Demonstrates the new scriptable fields on RimGeoMechResultDefinition
(ResultPositionType, ResultFieldName, ResultComponentName) by applying
a stress tensor component to the first view of the first GeoMech case.
…mActiveResult, use per-subclass case() methods instead of attribute check
@magnesj
magnesj force-pushed the pr-14952-result-definition-interface branch from 13fa47a to 7f10509 Compare October 20, 2026 18:05
@magnesj
magnesj merged commit 848c239 into dev Oct 21, 2026
24 checks passed
@magnesj
magnesj deleted the pr-14952-result-definition-interface branch October 21, 2026 04:49
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.

3 participants