2019-06-25 17:49:38 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2019-07-30 10:36:06 +02:00
|
|
|
// Copyright (C) 2019- Equinor ASA
|
2019-06-25 17:49:38 +02:00
|
|
|
//
|
|
|
|
|
// 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.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#include "RicfExportFlowCharacteristics.h"
|
|
|
|
|
|
2026-09-16 16:05:54 +02:00
|
|
|
#include "RicfCommandForwarding.h"
|
2019-06-25 17:49:38 +02:00
|
|
|
|
|
|
|
|
#include "RimEclipseResultCase.h"
|
2026-09-16 16:05:54 +02:00
|
|
|
#include "RimcEclipseCase.h"
|
2019-06-25 17:49:38 +02:00
|
|
|
|
2020-08-21 11:13:07 +02:00
|
|
|
#include "cafPdmFieldScriptingCapability.h"
|
2020-03-10 14:11:22 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
CAF_PDM_SOURCE_INIT( RicfExportFlowCharacteristics, "exportFlowCharacteristics" );
|
2019-06-25 17:49:38 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RicfExportFlowCharacteristics::RicfExportFlowCharacteristics()
|
|
|
|
|
{
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" );
|
|
|
|
|
CAF_PDM_InitScriptableField( &m_selectedTimeSteps, "timeSteps", std::vector<int>(), "Selected Time Steps" );
|
|
|
|
|
CAF_PDM_InitScriptableField( &m_injectors, "injectors", std::vector<QString>(), "Injectors" );
|
|
|
|
|
CAF_PDM_InitScriptableField( &m_producers, "producers", std::vector<QString>(), "Producers" );
|
|
|
|
|
CAF_PDM_InitScriptableField( &m_fileName, "fileName", QString(), "Export File Name" );
|
|
|
|
|
CAF_PDM_InitScriptableField( &m_minCommunication, "minimumCommunication", 0.0, "Minimum Communication" );
|
|
|
|
|
CAF_PDM_InitScriptableField( &m_maxPvFraction, "aquiferCellThreshold", 0.1, "Aquifer Cell Threshold" );
|
2019-06-25 17:49:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-03-10 14:11:22 +01:00
|
|
|
caf::PdmScriptResponse RicfExportFlowCharacteristics::execute()
|
2019-06-25 17:49:38 +02:00
|
|
|
{
|
2026-09-16 16:05:54 +02:00
|
|
|
const QString commandName = classKeyword();
|
|
|
|
|
|
|
|
|
|
auto rimCase = RicfForwarding::findCase( m_caseId() );
|
|
|
|
|
if ( !rimCase ) return RicfForwarding::errorResponse( rimCase.error(), commandName );
|
2019-06-25 17:49:38 +02:00
|
|
|
|
2026-09-16 16:05:54 +02:00
|
|
|
auto* eclipseCase = dynamic_cast<RimEclipseResultCase*>( rimCase.value() );
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( !eclipseCase )
|
2019-06-25 17:49:38 +02:00
|
|
|
{
|
2026-09-16 16:05:54 +02:00
|
|
|
return RicfForwarding::errorResponse( QString( "Case with ID %1 is not an Eclipse result case" ).arg( m_caseId() ), commandName );
|
2019-06-25 17:49:38 +02:00
|
|
|
}
|
|
|
|
|
|
2026-09-16 16:05:54 +02:00
|
|
|
RimEclipseResultCase_exportFlowCharacteristics method( eclipseCase );
|
|
|
|
|
method.setTimeSteps( m_selectedTimeSteps() );
|
|
|
|
|
method.setInjectors( m_injectors() );
|
|
|
|
|
method.setProducers( m_producers() );
|
|
|
|
|
method.setFileName( m_fileName() );
|
|
|
|
|
method.setMinimumCommunication( m_minCommunication() );
|
|
|
|
|
method.setAquiferCellThreshold( m_maxPvFraction() );
|
2019-06-25 17:49:38 +02:00
|
|
|
|
2026-09-16 16:05:54 +02:00
|
|
|
return RicfForwarding::toScriptResponse( method.execute(), commandName );
|
2019-06-25 17:49:38 +02:00
|
|
|
}
|