mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-27 05:37:21 -05:00
#14063 Well Event: Group records of same keyword across wells
The schedule generator previously concatenated full keyword blocks (`KEYWORD ... /\n/\n`) — one per well — producing verbose output where each WELSPECS / COMPDAT / WCONHIST / WELSEGS / COMPSEGS / etc. block appeared once per contributing well. Eclipse keywords are designed to hold multiple records under a single header; the per-well repetition is syntactically valid but bloats the file and obscures intent. Switch `RicScheduleDataGenerator` to accumulate `std::map<QString, Opm::DeckKeyword>` instead of raw concatenated text. Each per-well helper now returns an `Opm::DeckKeyword`, and a new `mergeKeyword` primitive appends its records into the accumulator entry, creating the entry from the helper's keyword on first encounter. At emission time each accumulated keyword is serialised once. To support this, `RifEventKeywordFormatter` is split: each `format*` QString function now wraps a corresponding `build*` function that returns `std::optional<Opm::DeckKeyword>`. `RimWellEventKeyword` and `RimKeywordEvent` expose a parallel `generateDeckKeyword` accessor. The text-scraping `extractKeywordName` helper becomes dead code and is removed.
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "FileInterface/RifEventKeywordFormatter.h"
|
||||
|
||||
#include "opm/input/eclipse/Deck/DeckKeyword.hpp"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
@@ -133,6 +135,14 @@ QString RimKeywordEvent::generateScheduleKeyword( const QString& wellName ) cons
|
||||
return RifEventKeywordFormatter::formatKeyword( m_keywordName(), items() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::optional<Opm::DeckKeyword> RimKeywordEvent::generateDeckKeyword( const QString& wellName ) const
|
||||
{
|
||||
return RifEventKeywordFormatter::buildKeyword( m_keywordName(), items() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -22,8 +22,14 @@
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
class DeckKeyword;
|
||||
} // namespace Opm
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
/// Schedule-level keyword event - represents a schedule keyword with arbitrary keyword items
|
||||
@@ -51,8 +57,9 @@ public:
|
||||
std::vector<class RimWellEventKeywordItem*> items() const;
|
||||
|
||||
// Override from RimWellEvent
|
||||
EventType eventType() const override { return EventType::SCHEDULE_KEYWORD; }
|
||||
QString generateScheduleKeyword( const QString& wellName ) const override;
|
||||
EventType eventType() const override { return EventType::SCHEDULE_KEYWORD; }
|
||||
QString generateScheduleKeyword( const QString& wellName ) const override;
|
||||
std::optional<Opm::DeckKeyword> generateDeckKeyword( const QString& wellName ) const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "FileInterface/RifEventKeywordFormatter.h"
|
||||
|
||||
#include "opm/input/eclipse/Deck/DeckKeyword.hpp"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
@@ -133,6 +135,14 @@ QString RimWellEventKeyword::generateScheduleKeyword( const QString& wellName )
|
||||
return RifEventKeywordFormatter::formatKeyword( m_keywordName(), items() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::optional<Opm::DeckKeyword> RimWellEventKeyword::generateDeckKeyword( const QString& wellName ) const
|
||||
{
|
||||
return RifEventKeywordFormatter::buildKeyword( m_keywordName(), items() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -22,8 +22,14 @@
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
class DeckKeyword;
|
||||
} // namespace Opm
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
/// Well keyword event - represents a schedule keyword with arbitrary keyword items
|
||||
@@ -50,8 +56,9 @@ public:
|
||||
std::vector<class RimWellEventKeywordItem*> items() const;
|
||||
|
||||
// Override from RimWellEvent
|
||||
EventType eventType() const override { return EventType::KEYWORD; }
|
||||
QString generateScheduleKeyword( const QString& wellName ) const override;
|
||||
EventType eventType() const override { return EventType::KEYWORD; }
|
||||
QString generateScheduleKeyword( const QString& wellName ) const override;
|
||||
std::optional<Opm::DeckKeyword> generateDeckKeyword( const QString& wellName ) const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
Reference in New Issue
Block a user