Orion Events: Preserve event comments

This commit is contained in:
Kristian Bendiksen committed 2026-08-20 11:02:55 +02:00
1 parent c41e74b706
commit 61f615ac4c
6 files changed
+188 -10

No files matched your search

@@ -37,6 +37,7 @@
#include <QLocale>
#include <QProcessEnvironment>
#include <QStringList>
#include <algorithm>
#include <map>
@@ -235,9 +236,50 @@ QString RicScheduleDataGenerator::generateDateSection( const RimWellEventTimelin
}
}
auto appendEventComments = [&]( const QString& keywordName )
{
for ( const auto* event : events )
{
if ( event->comment().isEmpty() ) continue;
bool isRelevant = false;
if ( event->eventType() == RimWellEvent::EventType::PERF )
{
isRelevant = keywordName == "COMPDAT";
}
else if ( event->eventType() == RimWellEvent::EventType::TUBING )
{
isRelevant = keywordName == "WELSEGS";
}
else if ( event->eventType() == RimWellEvent::EventType::VALVE )
{
isRelevant = keywordName == "WSEGVALV" || keywordName == "WSEGAICD";
}
else if ( event->eventType() == RimWellEvent::EventType::SCHEDULE_KEYWORD )
{
const auto* keywordEvent = dynamic_cast<const RimKeywordEvent*>( event );
isRelevant = keywordEvent && keywordEvent->keywordName().compare( keywordName, Qt::CaseInsensitive ) == 0;
}
else
{
auto eventKeyword = RifEventKeywordFormatter::buildWellEvent( event, event->wellName() );
isRelevant = eventKeyword && QString::fromStdString( eventKeyword->name() ).compare( keywordName, Qt::CaseInsensitive ) == 0;
}
if ( !isRelevant ) continue;
for ( QString line : event->comment().split( '\n' ) )
{
line.remove( '\r' );
result += line.isEmpty() ? "--\n" : QString( "-- %1\n" ).arg( line );
}
}
};
auto appendKeywordText = [&]( const Opm::DeckKeyword& kw )
{
if ( kw.size() == 0 && !kw.isDataKeyword() ) return;
appendEventComments( QString::fromStdString( kw.name() ) );
result += serializeKeyword( kw );
result += "\n";
};
@@ -53,6 +53,7 @@ RimWellEvent::RimWellEvent()
CAF_PDM_InitField( &m_eventDate, "EventDate", QDateTime(), "Event Date" );
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "Well Path" );
CAF_PDM_InitScriptableField( &m_comment, "Comment", QString(), "Comment" );
}
//--------------------------------------------------------------------------------------------------
@@ -106,6 +107,22 @@ QString RimWellEvent::wellName() const
return QString();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellEvent::comment() const
{
return m_comment();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellEvent::setComment( const QString& comment )
{
m_comment = comment;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -113,6 +130,7 @@ void RimWellEvent::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& u
{
uiOrdering.add( &m_wellPath );
uiOrdering.add( &m_eventDate );
uiOrdering.add( &m_comment );
}
//--------------------------------------------------------------------------------------------------
@@ -60,6 +60,9 @@ public:
void setWellPath( RimWellPath* wellPath );
QString wellName() const; // Convenience method to get well name
QString comment() const;
void setComment( const QString& comment );
virtual EventType eventType() const = 0;
virtual QString generateScheduleKeyword( const QString& wellName ) const = 0;
@@ -70,6 +73,7 @@ protected:
protected:
caf::PdmField<QDateTime> m_eventDate;
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmField<QString> m_comment;
};
namespace caf