Files
ResInsight/ApplicationLibCode/ProjectDataModel/RimCaseCollection.cpp
T

85 lines
3.1 KiB
C++
Raw Normal View History

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
//
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.
//
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.
//
// 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"
#include "RimIdenticalGridCaseGroup.h"
2026-02-13 08:28:34 +01:00
#include "RimReservoirGridEnsemble.h"
2013-02-21 15:37:51 +01:00
#include "cafPdmFieldReorderCapability.h"
CAF_PDM_SOURCE_INIT( RimCaseCollection, "RimCaseCollection" );
2013-02-21 15:37:51 +01:00
//--------------------------------------------------------------------------------------------------
///
2013-02-21 15:37:51 +01:00
//--------------------------------------------------------------------------------------------------
RimCaseCollection::RimCaseCollection()
{
CAF_PDM_InitObject( "Derived Statistics" );
2013-02-21 15:37:51 +01:00
CAF_PDM_InitFieldNoDefault( &reservoirs, "Reservoirs", "Reservoirs ChildArrayField" );
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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIdenticalGridCaseGroup* RimCaseCollection::parentCaseGroup()
{
return dynamic_cast<RimIdenticalGridCaseGroup*>( parentField()->ownerObject() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2026-02-13 08:28:34 +01:00
RimReservoirGridEnsemble* RimCaseCollection::parentGridEnsemble()
{
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 ) )
{
2026-02-13 08:28:34 +01:00
return caseGroup;
}
2026-02-13 08:28:34 +01:00
return dynamic_cast<RimReservoirGridEnsemble*>( owner );
}