Well Event: generate_schedule takes an Eclipse case object directly

Replace the integer eclipse_case_id parameter on
RimcWellEventTimeline_generateSchedule with a
caf::PdmPtrField<RimEclipseCase*>. The execute() method no longer needs
to walk the project tree and look up the case by ID — the gRPC layer
resolves the object pointer for us.

generate_schedule_text passes the Eclipse case object through to the
underlying generate_schedule call, matching how add_perf_event /
add_well_keyword_event already take a WellPath object rather than an
ID.
This commit is contained in:
Kristian Bendiksen committed 2026-05-28 08:21:17 +02:00
1 parent 80417b9947
commit c74ed10157
3 files changed
+10 -26

No files matched your search

@@ -21,7 +21,6 @@
#include "CompletionExportCommands/RicScheduleDataGenerator.h"
#include "RimEclipseCase.h"
#include "RimKeywordEvent.h"
#include "RimProject.h"
#include "RimWellEventControl.h"
#include "RimWellEventKeyword.h"
#include "RimWellEventPerf.h"
@@ -30,7 +29,6 @@
#include "RimWellEventTubing.h"
#include "RimWellEventValve.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimcDataContainerString.h"
#include "cafAppEnum.h"
@@ -569,7 +567,7 @@ RimcWellEventTimeline_generateSchedule::RimcWellEventTimeline_generateSchedule(
{
CAF_PDM_InitObject( "Generate Schedule", "", "", "Generate Eclipse schedule text for all wells in the collection" );
CAF_PDM_InitScriptableField( &m_eclipseCaseId, "EclipseCaseId", -1, "", "", "", "Eclipse Case ID" );
CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "", "", "", "Eclipse Case" );
CAF_PDM_InitScriptableField( &m_includeWelsegs, "IncludeWelsegs", true, "", "", "", "Include WELSEGS keyword in the exported schedule" );
CAF_PDM_InitScriptableField( &m_includeCompsegs, "IncludeCompsegs", true, "", "", "", "Include COMPSEGS keyword in the exported schedule" );
}
@@ -581,24 +579,10 @@ std::expected<caf::PdmObjectHandle*, QString> RimcWellEventTimeline_generateSche
{
auto timeline = self<RimWellEventTimeline>();
// Get the parent well path collection
RimWellPathCollection* wellPathCollection = timeline->firstAncestorOrThisOfType<RimWellPathCollection>();
if ( !wellPathCollection )
{
return std::unexpected( QString( "Could not find parent well path collection" ) );
}
// Find the Eclipse case by ID
RimProject* project = wellPathCollection->firstAncestorOrThisOfType<RimProject>();
if ( !project )
{
return std::unexpected( QString( "Could not find project" ) );
}
RimEclipseCase* eclipseCase = project->eclipseCaseFromCaseId( m_eclipseCaseId() );
RimEclipseCase* eclipseCase = m_eclipseCase();
if ( !eclipseCase )
{
return std::unexpected( QString( "Eclipse case with ID %1 not found" ).arg( m_eclipseCaseId() ) );
return std::unexpected( QString( "Eclipse case is required" ) );
}
// Get the last applied timestamp (from set_timestamp call)
@@ -225,7 +225,7 @@ public:
QString classKeywordReturnedType() const override;
private:
caf::PdmField<int> m_eclipseCaseId;
caf::PdmField<bool> m_includeWelsegs;
caf::PdmField<bool> m_includeCompsegs;
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
caf::PdmField<bool> m_includeWelsegs;
caf::PdmField<bool> m_includeCompsegs;
};
+4 -4
View File
@@ -10,7 +10,7 @@ from typing import Any, Dict
from datetime import date, datetime
from .pdmobject import add_method
from .resinsight_classes import Case
from .resinsight_classes import EclipseCase
from .generated.generated_classes import (
KeywordEvent,
WellEventKeyword,
@@ -283,7 +283,7 @@ def add_keyword_event(
@add_method(WellEventTimeline)
def generate_schedule_text(
self: WellEventTimeline,
eclipse_case: Case,
eclipse_case: EclipseCase,
include_welsegs: bool = True,
include_compsegs: bool = True,
) -> str:
@@ -297,7 +297,7 @@ def generate_schedule_text(
text directly instead of a DataContainerString.
Arguments:
eclipse_case (Case): Eclipse case to use for schedule generation.
eclipse_case (EclipseCase): Eclipse case to use for schedule generation.
include_welsegs (bool): When False, omit the WELSEGS keyword from the
output. Other multi-segment-well keywords (COMPSEGS, WSEGVALV,
WSEGAICD) are not affected. Defaults to True.
@@ -342,7 +342,7 @@ def generate_schedule_text(
```
"""
container = self.generate_schedule(
eclipse_case_id=eclipse_case.id,
eclipse_case=eclipse_case,
include_welsegs=include_welsegs,
include_compsegs=include_compsegs,
)