mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added IdenticalGridCaseGroup, now displayed in tree view
p4#: 20518
This commit is contained in:
parent
8f50b90216
commit
3490d07dd1
@ -74,6 +74,7 @@ list( APPEND CPP_SOURCES
|
||||
ProjectDataModel/RimLegendConfig.cpp
|
||||
ProjectDataModel/RimProject.cpp
|
||||
ProjectDataModel/RimReservoir.cpp
|
||||
ProjectDataModel/RimIdenticalGridCaseGroup.cpp
|
||||
ProjectDataModel/RimInputProperty.cpp
|
||||
ProjectDataModel/RimInputPropertyCollection.cpp
|
||||
ProjectDataModel/RimInputReservoir.cpp
|
||||
|
@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RIStdInclude.h"
|
||||
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimReservoir.h"
|
||||
#include "RimReservoirView.h"
|
||||
#include "RigEclipseCase.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimIdenticalGridCaseGroup, "RimIdenticalGridCaseGroup");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIdenticalGridCaseGroup::RimIdenticalGridCaseGroup()
|
||||
{
|
||||
CAF_PDM_InitObject("Identical Grids", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&reservoirs, "Reservoirs", "", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIdenticalGridCaseGroup::~RimIdenticalGridCaseGroup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIdenticalGridCaseGroup::addCase(RimReservoir* reservoir)
|
||||
{
|
||||
CVF_ASSERT(reservoir);
|
||||
|
||||
if (!reservoir) return;
|
||||
|
||||
RigMainGrid* incomingMainGrid = reservoir->reservoirData()->mainGrid();
|
||||
|
||||
if (m_mainGrid.isNull())
|
||||
{
|
||||
m_mainGrid = incomingMainGrid;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_mainGrid.p() != incomingMainGrid)
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
reservoirs.push_back(reservoir);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigMainGrid* RimIdenticalGridCaseGroup::mainGrid()
|
||||
{
|
||||
if (m_mainGrid.notNull()) return m_mainGrid.p();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
51
ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h
Normal file
51
ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h
Normal file
@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimReservoir;
|
||||
class RigMainGrid;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimIdenticalGridCaseGroup : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimIdenticalGridCaseGroup();
|
||||
virtual ~RimIdenticalGridCaseGroup();
|
||||
|
||||
void addCase(RimReservoir* reservoir);
|
||||
|
||||
caf::PdmPointersField<RimReservoir*> reservoirs;
|
||||
|
||||
RigMainGrid* mainGrid();
|
||||
|
||||
private:
|
||||
cvf::ref<RigMainGrid> m_mainGrid;
|
||||
|
||||
};
|
@ -21,7 +21,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RIApplication.h"
|
||||
#include "RIVersionInfo.h"
|
||||
#include "RimScriptCollection.h"
|
||||
|
||||
#include "RigGridCollection.h"
|
||||
#include "RigEclipseCase.h"
|
||||
|
||||
@ -36,6 +36,8 @@ RimProject::RimProject(void)
|
||||
m_projectFileVersionString.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&reservoirs, "Reservoirs", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&caseGroups, "CaseGroups", "", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&scriptCollection, "ScriptCollection", "Scripts", ":/Default.png", "", "");
|
||||
|
||||
scriptCollection = new RimScriptCollection();
|
||||
@ -69,6 +71,7 @@ void RimProject::close()
|
||||
}
|
||||
|
||||
reservoirs.deleteAllChildObjects();
|
||||
caseGroups.deleteAllChildObjects();
|
||||
|
||||
fileName = "";
|
||||
}
|
||||
@ -129,24 +132,26 @@ QString RimProject::projectFileVersionString() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::registerEclipseCase(RigEclipseCase* eclipseCase)
|
||||
void RimProject::registerEclipseCase(RimReservoir* rimReservoir)
|
||||
{
|
||||
CVF_ASSERT(eclipseCase);
|
||||
CVF_ASSERT(rimReservoir);
|
||||
|
||||
RigMainGrid* equalGrid = m_gridCollection->findEqualGrid(eclipseCase->mainGrid());
|
||||
RigEclipseCase* rigEclipseCase = rimReservoir->reservoirData();
|
||||
|
||||
RigMainGrid* equalGrid = m_gridCollection->findEqualGrid(rigEclipseCase->mainGrid());
|
||||
|
||||
if (equalGrid)
|
||||
{
|
||||
// Replace the grid with an already registered grid
|
||||
eclipseCase->setMainGrid(equalGrid);
|
||||
rigEclipseCase->setMainGrid(equalGrid);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is the first insertion of this grid, compute cached data
|
||||
eclipseCase->mainGrid()->computeCachedData();
|
||||
rigEclipseCase->mainGrid()->computeCachedData();
|
||||
|
||||
std::vector<RigGridBase*> grids;
|
||||
eclipseCase->allGrids(&grids);
|
||||
rigEclipseCase->allGrids(&grids);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < grids.size(); i++)
|
||||
@ -155,5 +160,28 @@ void RimProject::registerEclipseCase(RigEclipseCase* eclipseCase)
|
||||
}
|
||||
}
|
||||
|
||||
m_gridCollection->addCase(eclipseCase);
|
||||
m_gridCollection->addCase(rigEclipseCase);
|
||||
|
||||
|
||||
// Insert in identical grid group
|
||||
bool foundGroup = false;
|
||||
|
||||
for (size_t i = 0; i < caseGroups.size(); i++)
|
||||
{
|
||||
RimIdenticalGridCaseGroup* cg = caseGroups()[i];
|
||||
|
||||
if (cg->mainGrid() == equalGrid)
|
||||
{
|
||||
cg->addCase(rimReservoir);
|
||||
foundGroup = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundGroup)
|
||||
{
|
||||
RimIdenticalGridCaseGroup* group = new RimIdenticalGridCaseGroup;
|
||||
group->addCase(rimReservoir);
|
||||
|
||||
caseGroups().push_back(group);
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,10 @@
|
||||
|
||||
#include "cafPdmDocument.h"
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
|
||||
class RimReservoir;
|
||||
class RigGridCollection;
|
||||
class RigEclipseCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -34,8 +34,9 @@ class RimProject : public caf::PdmDocument
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
caf::PdmPointersField<RimReservoir*> reservoirs;
|
||||
caf::PdmField<RimScriptCollection*> scriptCollection;
|
||||
caf::PdmPointersField<RimReservoir*> reservoirs;
|
||||
caf::PdmPointersField<RimIdenticalGridCaseGroup*> caseGroups;
|
||||
caf::PdmField<RimScriptCollection*> scriptCollection;
|
||||
|
||||
void setUserScriptPath(const QString& path);
|
||||
//void updateProjectScriptPath();
|
||||
@ -47,7 +48,7 @@ public:
|
||||
|
||||
void close();
|
||||
|
||||
void registerEclipseCase(RigEclipseCase* eclipseCase);
|
||||
void registerEclipseCase(RimReservoir* rimReservoir);
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
|
@ -247,7 +247,8 @@ void RimReservoir::registerEclipseCase()
|
||||
CVF_ASSERT(proj);
|
||||
if (proj)
|
||||
{
|
||||
proj->registerEclipseCase(m_rigEclipseCase.p());
|
||||
|
||||
proj->registerEclipseCase(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user