diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 8902977fa5..dedf4dd2ba 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -54,6 +54,7 @@ list( APPEND CPP_SOURCES ) list( APPEND CPP_SOURCES + ProjectDataModel/RimCaseCollection.cpp ProjectDataModel/RimCellFilter.cpp ProjectDataModel/RimCellPropertyFilter.cpp ProjectDataModel/RimCellPropertyFilterCollection.cpp diff --git a/ApplicationCode/ProjectDataModel/RimCaseCollection.cpp b/ApplicationCode/ProjectDataModel/RimCaseCollection.cpp new file mode 100644 index 0000000000..8001c8bffe --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimCaseCollection.cpp @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RIStdInclude.h" + + +#include "RimCaseCollection.h" + +#include "RimReservoirView.h" + +CAF_PDM_SOURCE_INIT(RimCaseCollection, "RimCaseCollection"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimCaseCollection::RimCaseCollection() +{ + CAF_PDM_InitObject("Derived Statistics", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&reservoirs, "Reservoirs", "", "", "", ""); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimCaseCollection::~RimCaseCollection() +{ + +} diff --git a/ApplicationCode/ProjectDataModel/RimCaseCollection.h b/ApplicationCode/ProjectDataModel/RimCaseCollection.h new file mode 100644 index 0000000000..137435fc32 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimCaseCollection.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cvfBase.h" +#include "cvfObject.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" + +#include "RimStatisticalCalculation.h" + + + +//================================================================================================== +// +// +// +//================================================================================================== +class RimCaseCollection : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimCaseCollection(); + virtual ~RimCaseCollection(); + + caf::PdmPointersField reservoirs; + +private: + +}; diff --git a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp index 1acf612561..d206de060b 100644 --- a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp +++ b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp @@ -1,4 +1,5 @@ ///////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2011-2012 Statoil ASA, Ceetron AS // @@ -38,10 +39,10 @@ RimIdenticalGridCaseGroup::RimIdenticalGridCaseGroup() CAF_PDM_InitField(&name, "UserDescription", QString("Identical Grid Case Group"), "Name", "", "", ""); - CAF_PDM_InitFieldNoDefault(&reservoirs, "Reservoirs", "", "", "", ""); - - CAF_PDM_InitFieldNoDefault(&statisticalReservoirCollection, "StatisticalReservoirCollection", "StatisticalReservoirCollection", "", "", ""); + CAF_PDM_InitFieldNoDefault(&caseCollection, "CaseCollection", "Cases", "", "", ""); + CAF_PDM_InitFieldNoDefault(&statisticalReservoirCollection, "StatisticalReservoirCollection", "Derived Statistics", "", "", ""); + caseCollection = new RimCaseCollection; statisticalReservoirCollection = new RimStatisticalCollection; } @@ -69,16 +70,10 @@ void RimIdenticalGridCaseGroup::addCase(RimReservoir* reservoir) { m_mainGrid = incomingMainGrid; } - else - { - if (m_mainGrid.p() != incomingMainGrid) - { - CVF_ASSERT(false); - return; - } - } - reservoirs.push_back(reservoir); + CVF_ASSERT(m_mainGrid.p() == incomingMainGrid); + + caseCollection()->reservoirs().push_back(reservoir); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h index a0db771b7b..909ad78283 100644 --- a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h +++ b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h @@ -24,6 +24,7 @@ #include "cafPdmObject.h" #include "RimStatisticalCollection.h" +#include "RimCaseCollection.h" class RimReservoir; class RigMainGrid; @@ -45,7 +46,7 @@ public: void addCase(RimReservoir* reservoir); - caf::PdmPointersField reservoirs; + caf::PdmField caseCollection; caf::PdmField statisticalReservoirCollection; RigMainGrid* mainGrid(); diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index 670ad8f481..06747c47e8 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -201,9 +201,9 @@ void RimProject::removeEclipseCaseFromAllGroups(RimReservoir* reservoir) { RimIdenticalGridCaseGroup* cg = caseGroups()[i]; - cg->reservoirs().removeChildObject(reservoir); + cg->caseCollection()->reservoirs().removeChildObject(reservoir); - if (cg->reservoirs().size() == 0) + if (cg->caseCollection()->reservoirs().size() == 0) { emptyCaseGroups.push_back(cg); }