Fix of GH#43 Assertion Fail for localGridIndex

The grid number associated with an ert grid was an ID and not an index.
In addition: Fixed unrobustness handling wells with no data.
Now the /Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID file loads( Have tested only two timesteps ).
p4#: 22321
This commit is contained in:
Jacob Støren
2013-09-05 13:03:53 +02:00
parent 3cf18d91fd
commit 97bb848b1d
7 changed files with 49 additions and 10 deletions

View File

@@ -26,6 +26,9 @@ RigMainGrid::RigMainGrid(void)
m_displayModelOffset = cvf::Vec3d::ZERO;
m_gridIndex = 0;
m_gridId = 0;
m_gridIdToIndexMapping.push_back(0);
m_flipXAxis = false;
m_flipYAxis = false;
}
@@ -40,8 +43,19 @@ RigMainGrid::~RigMainGrid(void)
//--------------------------------------------------------------------------------------------------
void RigMainGrid::addLocalGrid(RigLocalGrid* localGrid)
{
CVF_ASSERT(localGrid && localGrid->gridId() != cvf::UNDEFINED_INT); // The grid ID must be set.
CVF_ASSERT(localGrid->gridId() >= 0); // We cant handle negative ID's if they exist.
m_localGrids.push_back(localGrid);
localGrid->setGridIndex(m_localGrids.size()); // Maingrid itself has grid index 0
if (m_gridIdToIndexMapping.size() <= localGrid->gridId())
{
m_gridIdToIndexMapping.resize(localGrid->gridId() + 1, cvf::UNDEFINED_SIZE_T);
}
m_gridIdToIndexMapping[localGrid->gridId()] = localGrid->gridIndex();
}
//--------------------------------------------------------------------------------------------------
@@ -156,3 +170,12 @@ void RigMainGrid::setFlipAxis(bool flipXAxis, bool flipYAxis)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGridBase* RigMainGrid::gridById(int localGridId)
{
CVF_ASSERT (localGridId >= 0 && localGridId < m_gridIdToIndexMapping.size());
return this->gridByIndex(m_gridIdToIndexMapping[localGridId]);
}