mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
#2176 Fix the crash due to an invalid wellhead definition from libecl. Now using first valid connection-cell as proxywellhead in calculations if needed.
This commit is contained in:
@@ -97,6 +97,39 @@ bool RigSimWellData::hasWellResult(size_t resultTimeStepIndex) const
|
||||
return wellTimeStepIndex != cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigSimWellData::hasAnyValidCells(size_t resultTimeStepIndex) const
|
||||
{
|
||||
if (resultTimeStepIndex >= m_resultTimeStepIndexToWellTimeStepIndex.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t wellTimeStepIndex = m_resultTimeStepIndexToWellTimeStepIndex[resultTimeStepIndex];
|
||||
|
||||
if( wellTimeStepIndex == cvf::UNDEFINED_SIZE_T) return false;
|
||||
|
||||
if (wellResultFrame(resultTimeStepIndex).m_wellHead.isCell()) return true;
|
||||
|
||||
const std::vector<RigWellResultBranch> &resBranches = wellResultFrame(resultTimeStepIndex).m_wellResultBranches;
|
||||
|
||||
for ( size_t i = 0 ; i < resBranches.size(); ++i )
|
||||
{
|
||||
for (size_t cIdx = 0; cIdx < resBranches[i].m_branchResultPoints.size(); ++cIdx )
|
||||
{
|
||||
if (resBranches[i].m_branchResultPoints[cIdx].isCell()) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
bool operator== (const RigWellResultPoint& p1, const RigWellResultPoint& p2)
|
||||
{
|
||||
return
|
||||
@@ -340,3 +373,18 @@ const RigWellResultPoint* RigWellResultFrame::findResultCell(size_t gridIndex, s
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigWellResultPoint RigWellResultFrame::wellHeadOrStartCell() const
|
||||
{
|
||||
if (m_wellHead.isCell()) return m_wellHead;
|
||||
|
||||
if (m_wellResultBranches.size() && m_wellResultBranches.front().m_branchResultPoints.size() )
|
||||
{
|
||||
return m_wellResultBranches.front().m_branchResultPoints.front();
|
||||
}
|
||||
|
||||
return m_wellHead; // Nothing else to do
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user