mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
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:
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user