2013-02-21 15:37:51 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2014-09-23 15:04:57 +02:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2013-02-21 15:37:51 +01: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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2013-02-21 15:37:51 +01:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2013-02-21 15:37:51 +01:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#include "RimCaseCollection.h"
|
|
|
|
|
|
2015-05-15 09:16:33 +02:00
|
|
|
#include "RimEclipseCase.h"
|
2013-03-19 12:47:38 +01:00
|
|
|
#include "RimIdenticalGridCaseGroup.h"
|
2026-02-13 08:28:34 +01:00
|
|
|
#include "RimReservoirGridEnsemble.h"
|
2013-02-21 15:37:51 +01:00
|
|
|
|
2026-09-11 15:52:48 +02:00
|
|
|
#include "cafPdmFieldReorderCapability.h"
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
CAF_PDM_SOURCE_INIT( RimCaseCollection, "RimCaseCollection" );
|
2013-02-21 15:37:51 +01:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2013-02-21 15:37:51 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimCaseCollection::RimCaseCollection()
|
|
|
|
|
{
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitObject( "Derived Statistics" );
|
2013-02-21 15:37:51 +01:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &reservoirs, "Reservoirs", "Reservoirs ChildArrayField" );
|
2026-09-11 15:52:48 +02:00
|
|
|
caf::PdmFieldReorderCapability::addToField( &reservoirs );
|
2013-02-21 15:37:51 +01:00
|
|
|
}
|
|
|
|
|
|
2025-03-26 21:50:39 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimCase*> RimCaseCollection::cases() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimCase*> caseVector;
|
|
|
|
|
|
|
|
|
|
for ( auto rimCase : reservoirs )
|
|
|
|
|
{
|
|
|
|
|
caseVector.push_back( rimCase );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return caseVector;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-19 12:47:38 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2013-03-19 12:47:38 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimIdenticalGridCaseGroup* RimCaseCollection::parentCaseGroup()
|
|
|
|
|
{
|
2023-08-04 09:04:14 +02:00
|
|
|
return dynamic_cast<RimIdenticalGridCaseGroup*>( parentField()->ownerObject() );
|
2013-03-19 12:47:38 +01:00
|
|
|
}
|
2013-04-12 12:03:04 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2013-04-12 12:03:04 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2026-02-13 08:28:34 +01:00
|
|
|
RimReservoirGridEnsemble* RimCaseCollection::parentGridEnsemble()
|
2013-04-12 12:03:04 +02:00
|
|
|
{
|
2026-02-13 08:28:34 +01:00
|
|
|
return dynamic_cast<RimReservoirGridEnsemble*>( parentField()->ownerObject() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimReservoirGridEnsembleBase* RimCaseCollection::parentGridEnsembleBase()
|
|
|
|
|
{
|
|
|
|
|
auto* owner = parentField()->ownerObject();
|
|
|
|
|
|
|
|
|
|
if ( auto* caseGroup = dynamic_cast<RimIdenticalGridCaseGroup*>( owner ) )
|
2013-04-12 12:03:04 +02:00
|
|
|
{
|
2026-02-13 08:28:34 +01:00
|
|
|
return caseGroup;
|
2013-04-12 12:03:04 +02:00
|
|
|
}
|
2026-02-13 08:28:34 +01:00
|
|
|
return dynamic_cast<RimReservoirGridEnsemble*>( owner );
|
2013-04-12 12:03:04 +02:00
|
|
|
}
|