mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
162 lines
5.8 KiB
C++
162 lines
5.8 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2025 Equinor ASA
|
|
//
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
//
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
// for more details.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#include "RimSingleJob.h"
|
|
|
|
#include "RimJobWellSettings.h"
|
|
|
|
#include "cafPdmPtrField.h"
|
|
#include "cafSignal.h"
|
|
|
|
#include <string>
|
|
|
|
class RimEclipseCase;
|
|
class RimWellPath;
|
|
class RifOpmFlowDeckFile;
|
|
class RimEclipseCaseEnsemble;
|
|
class RimSummaryEnsemble;
|
|
class RimKeywordWconprod;
|
|
class RimKeywordWconinje;
|
|
class RimOpmFlowJobSettings;
|
|
|
|
//==================================================================================================
|
|
///
|
|
///
|
|
//==================================================================================================
|
|
class RimOpmFlowJob : public RimSingleJob
|
|
{
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
enum class DateAppendType
|
|
{
|
|
ADD_DAYS,
|
|
ADD_MONTHS
|
|
};
|
|
|
|
caf::Signal<bool> jobCompleted;
|
|
caf::Signal<double> progressUpdate;
|
|
|
|
public:
|
|
RimOpmFlowJob();
|
|
~RimOpmFlowJob() override;
|
|
|
|
void setWorkingDirectory( QString workDir );
|
|
void setEclipseCase( RimEclipseCase* eCase );
|
|
void setInputDataFile( QString filename );
|
|
void setJobSettings( RimOpmFlowJobSettings* jobSettings );
|
|
void setJobWellSettings( RimJobWellSettings* jobWellSettings );
|
|
void setIsChildJob( bool isChildJob );
|
|
|
|
void initAfterCopy();
|
|
|
|
void setAutoLoadResults( bool autoLoad );
|
|
|
|
QString deckName();
|
|
QString mainWorkingDirectory() const;
|
|
|
|
static QString jobInputFileKey();
|
|
|
|
protected:
|
|
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
|
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
|
void initAfterRead() override;
|
|
|
|
bool matchesKeyValue( const QString& key, const QString& value ) const override;
|
|
void processLogOutput( const QString& logLine ) override;
|
|
|
|
QStringList command() override;
|
|
std::map<QString, QString> environment() override;
|
|
QString workingDirectory() const override;
|
|
bool onPrepare() override;
|
|
bool onRun() override;
|
|
void onCompleted( bool success ) override;
|
|
void onProgress( double percentageDone ) override;
|
|
|
|
bool openDeckFile();
|
|
void closeDeckFile();
|
|
bool copyUnrstFileToWorkDir();
|
|
|
|
void loadResults();
|
|
|
|
private:
|
|
RimEclipseCase* findExistingCase( QString filename );
|
|
QString deckExtension() const;
|
|
QString baseDeckName();
|
|
QString restartDeckName();
|
|
QString inputDeckName() const;
|
|
|
|
std::vector<QDateTime> datesInFileDeck();
|
|
std::vector<QString> wellgroupsInFileDeck();
|
|
|
|
std::vector<QString> dateStrings();
|
|
std::vector<QDateTime> dateTimes();
|
|
std::vector<QDateTime> addedDateTimes();
|
|
|
|
int mergeBasicWellSettings();
|
|
int mergeMswData( int mergePosition );
|
|
void selectOpenWellPosition();
|
|
void resetEnsembleRunId();
|
|
|
|
private:
|
|
caf::PdmField<caf::FilePath> m_deckFileName;
|
|
caf::PdmField<caf::FilePath> m_workDir;
|
|
caf::PdmField<int> m_openWellDeckPosition;
|
|
|
|
caf::PdmField<bool> m_pauseBeforeRun;
|
|
caf::PdmField<bool> m_addToEnsemble;
|
|
caf::PdmField<int> m_currentRunId;
|
|
caf::PdmField<bool> m_useRestart;
|
|
caf::PdmField<bool> m_isChildJob;
|
|
|
|
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
|
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
|
|
caf::PdmPtrField<RimEclipseCaseEnsemble*> m_gridEnsemble;
|
|
caf::PdmPtrField<RimSummaryEnsemble*> m_summaryEnsemble;
|
|
|
|
caf::PdmField<int> m_openTimeStep;
|
|
caf::PdmField<bool> m_endTimeStepEnabled;
|
|
caf::PdmField<int> m_endTimeStep;
|
|
caf::PdmField<bool> m_addNewWell;
|
|
caf::PdmField<caf::AppEnum<RimJobWellSettings::WellOpenType>> m_wellOpenType;
|
|
caf::PdmField<bool> m_includeMSWData;
|
|
caf::PdmField<QString> m_wellGroupName;
|
|
|
|
caf::PdmField<bool> m_appendNewDates;
|
|
caf::PdmField<int> m_newDatesInterval;
|
|
caf::PdmField<int> m_numberOfNewDates;
|
|
caf::PdmField<caf::AppEnum<DateAppendType>> m_dateAppendType;
|
|
|
|
caf::PdmChildField<RimKeywordWconprod*> m_wconprodKeyword;
|
|
caf::PdmChildField<RimKeywordWconinje*> m_wconinjeKeyword;
|
|
caf::PdmChildField<RimOpmFlowJobSettings*> m_jobSettings;
|
|
|
|
caf::PdmField<bool> m_autoLoadResults;
|
|
|
|
caf::PdmField<QString> m_wellOpenKeyword;
|
|
|
|
std::unique_ptr<RifOpmFlowDeckFile> m_deckFile;
|
|
bool m_fileDeckHasDates;
|
|
bool m_fileDeckIsRestart;
|
|
int m_startStepForProgress;
|
|
};
|