mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
Introduce RimReservoirGridEnsemble and RimReservoirGridEnsembleBase to manage ensembles of grid-only Eclipse cases. Enable detection of identical grids for shared operations and statistics. Integrate grid ensembles into project structure, UI, and menu system. Refactor statistics and view handling to support both case groups and grid ensembles via a common interface. Add deferred grid loading, robust case referencing, and migration for well data source fields. New features and menu items allow creation and management of grid ensembles from file sets, enabling new workflows for grid-only ensemble analysis.
105 lines
3.9 KiB
C++
105 lines
3.9 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2017 Statoil 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.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "RicfComputeCaseGroupStatistics.h"
|
|
|
|
#include "Rim3dView.h"
|
|
#include "RimCaseCollection.h"
|
|
#include "RimEclipseCase.h"
|
|
#include "RimEclipseCaseCollection.h"
|
|
#include "RimEclipseStatisticsCase.h"
|
|
#include "RimIdenticalGridCaseGroup.h"
|
|
#include "RimOilField.h"
|
|
#include "RimProject.h"
|
|
|
|
#include "RiaLogging.h"
|
|
|
|
#include "cafPdmFieldScriptingCapability.h"
|
|
|
|
CAF_PDM_SOURCE_INIT( RicfComputeCaseGroupStatistics, "computeCaseGroupStatistics" );
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RicfComputeCaseGroupStatistics::RicfComputeCaseGroupStatistics()
|
|
{
|
|
CAF_PDM_InitScriptableField( &m_groupId, "caseGroupId", -1, "Case Group ID" );
|
|
CAF_PDM_InitScriptableField( &m_caseIds, "caseIds", std::vector<int>(), "Case IDs" );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
caf::PdmScriptResponse RicfComputeCaseGroupStatistics::execute()
|
|
{
|
|
caf::PdmScriptResponse response;
|
|
|
|
std::vector<int> caseIds = m_caseIds.v();
|
|
|
|
if ( m_groupId() >= 0 )
|
|
{
|
|
for ( RimIdenticalGridCaseGroup* group : RimProject::current()->activeOilField()->analysisModels()->caseGroups )
|
|
{
|
|
for ( RimEclipseCase* c : group->statisticsCaseCollection()->reservoirs )
|
|
{
|
|
caseIds.push_back( c->caseId() );
|
|
}
|
|
}
|
|
}
|
|
|
|
for ( int caseId : caseIds )
|
|
{
|
|
bool foundCase = false;
|
|
for ( RimIdenticalGridCaseGroup* group : RimProject::current()->activeOilField()->analysisModels()->caseGroups )
|
|
{
|
|
for ( RimEclipseCase* c : group->statisticsCaseCollection()->reservoirs )
|
|
{
|
|
if ( c->caseId() == caseId )
|
|
{
|
|
RimEclipseStatisticsCase* statsCase = dynamic_cast<RimEclipseStatisticsCase*>( c );
|
|
if ( statsCase )
|
|
{
|
|
statsCase->computeStatisticsAndUpdateViews();
|
|
}
|
|
else
|
|
{
|
|
QString warning = QString( "computeCaseGroupStatistics: Found case with ID %1, but it is not a "
|
|
"statistics case, cannot compute statistics." )
|
|
.arg( caseId );
|
|
RiaLogging::warning( warning );
|
|
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warning );
|
|
}
|
|
foundCase = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ( foundCase ) break;
|
|
}
|
|
|
|
if ( !foundCase )
|
|
{
|
|
QString warning = QString( "computeCaseGroupStatistics: Could not find statistics case with ID %1." ).arg( caseId );
|
|
|
|
RiaLogging::warning( warning );
|
|
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warning );
|
|
}
|
|
}
|
|
return response;
|
|
}
|