If no views are created for RimReservoird, delete the current RigEclipseCase.

Then all data will be read from file as if the case was opened as a stand alone case.
p4#: 20876
This commit is contained in:
Magne Sjaastad
2013-03-13 11:42:26 +01:00
parent 449b22c681
commit 4358d87c09
2 changed files with 28 additions and 0 deletions

View File

@@ -98,6 +98,13 @@ RimReservoir::~RimReservoir()
//--------------------------------------------------------------------------------------------------
RimReservoirView* RimReservoir::createAndAddReservoirView()
{
// If parent is collection, and number of views is zero, make sure rig is set to NULL to initiate normal case loading
if (parentCaseCollection() != NULL && reservoirViews().size() == 0)
{
CVF_ASSERT(m_rigEclipseCase->refCount() == 1);
m_rigEclipseCase = NULL;
}
RimReservoirView* riv = new RimReservoirView();
riv->setEclipseCase(this);
@@ -253,3 +260,20 @@ void RimReservoir::computeCachedData()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCaseCollection* RimReservoir::parentCaseCollection()
{
std::vector<RimCaseCollection*> parentObjects;
this->parentObjectsOfType(parentObjects);
if (parentObjects.size() > 0)
{
return parentObjects[0];
}
return NULL;
}

View File

@@ -29,6 +29,7 @@ class QString;
class RigEclipseCase;
class RigGridBase;
class RimReservoirView;
class RimCaseCollection;
//==================================================================================================
//
@@ -72,6 +73,9 @@ protected:
void computeCachedData();
private:
RimCaseCollection* parentCaseCollection();
protected:
cvf::ref<RigEclipseCase> m_rigEclipseCase;
};