MswRollUp: Added some guarding to get the Troll_MSW case through. Needs some assert disabling in RigGridBase as well, but it is not included yet

This is an intermediate commit and does not compile
p4#: 22218
This commit is contained in:
Jacob Støren
2013-08-26 14:21:21 +02:00
parent 544d98b37e
commit 42408eda74
2 changed files with 40 additions and 24 deletions

View File

@@ -1004,30 +1004,34 @@ void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid)
} }
} }
RigWellResultBranch& outletResultBranch = wellResFrame.m_wellResultBranches[currentGridBranchStartIndex + outletErtBranchIndex]; if (outletErtBranchIndex != cvf::UNDEFINED_SIZE_T) // Todo: Is this a correct guarding ? Or is it indicating an error ?
int outletErtSegmentId = well_segment_get_branch_id(outletBranchSegment);
size_t lastCellIndexForSegmentIdInOutletBranch = cvf::UNDEFINED_SIZE_T;
for (size_t outletCellIdx = 0; outletCellIdx < outletResultBranch.m_branchResultPoints.size(); outletCellIdx++)
{ {
if (outletResultBranch.m_branchResultPoints[outletCellIdx].m_ertSegmentId == outletErtSegmentId) RigWellResultBranch& outletResultBranch = wellResFrame.m_wellResultBranches[currentGridBranchStartIndex + outletErtBranchIndex];
int outletErtSegmentId = well_segment_get_branch_id(outletBranchSegment);
size_t lastCellIndexForSegmentIdInOutletBranch = cvf::UNDEFINED_SIZE_T;
for (size_t outletCellIdx = 0; outletCellIdx < outletResultBranch.m_branchResultPoints.size(); outletCellIdx++)
{ {
lastCellIndexForSegmentIdInOutletBranch = outletCellIdx; if (outletResultBranch.m_branchResultPoints[outletCellIdx].m_ertSegmentId == outletErtSegmentId)
{
lastCellIndexForSegmentIdInOutletBranch = outletCellIdx;
}
} }
}
if (lastCellIndexForSegmentIdInOutletBranch == cvf::UNDEFINED_SIZE_T) if (lastCellIndexForSegmentIdInOutletBranch == cvf::UNDEFINED_SIZE_T)
{ {
// Did not find the cell in the outlet branch based on branch id and segment id from outlet cell in leaf branch // Did not find the cell in the outlet branch based on branch id and segment id from outlet cell in leaf branch
CVF_ASSERT(0); //std::cout << "Did not find the cell in the outlet branch based on branch id and segment id from outlet cell in leaf branch" << std::endl;
} //CVF_ASSERT(0);
else }
{ else
RigWellResultPoint& outletCell = outletResultBranch.m_branchResultPoints[lastCellIndexForSegmentIdInOutletBranch]; {
RigWellResultPoint& outletCell = outletResultBranch.m_branchResultPoints[lastCellIndexForSegmentIdInOutletBranch];
wellResultLeafBranch.m_outletBranchIndex_OBSOLETE = currentGridBranchStartIndex + outletErtBranchIndex; wellResultLeafBranch.m_outletBranchIndex_OBSOLETE = currentGridBranchStartIndex + outletErtBranchIndex;
wellResultLeafBranch.m_outletBranchHeadCellIndex_OBSOLETE = lastCellIndexForSegmentIdInOutletBranch; wellResultLeafBranch.m_outletBranchHeadCellIndex_OBSOLETE = lastCellIndexForSegmentIdInOutletBranch;
}
} }
} }
@@ -1122,9 +1126,10 @@ void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid)
size_t outCellIdx = wellResFrame.m_wellResultBranches[bIdx].m_outletBranchHeadCellIndex_OBSOLETE; size_t outCellIdx = wellResFrame.m_wellResultBranches[bIdx].m_outletBranchHeadCellIndex_OBSOLETE;
const RigWellResultPoint* resPoint = wellResFrame.findResultCellFromOutletSpecification(outBranchIdx, outCellIdx); const RigWellResultPoint* resPoint = wellResFrame.findResultCellFromOutletSpecification(outBranchIdx, outCellIdx);
if (resPoint) // Todo: Is this a correct guarding or indicating an error ?
wellResFrame.m_wellResultBranches[bIdx].m_branchResultPoints.insert(wellResFrame.m_wellResultBranches[bIdx].m_branchResultPoints.begin(), *resPoint); {
wellResFrame.m_wellResultBranches[bIdx].m_branchResultPoints.insert(wellResFrame.m_wellResultBranches[bIdx].m_branchResultPoints.begin(), *resPoint);
}
} }
} }

View File

@@ -252,8 +252,19 @@ void RivWellPipesPartMgr::calculateWellPipeCenterline( std::vector< std::vector
for (size_t brIdx = 0; brIdx < resBranches.size(); brIdx++) for (size_t brIdx = 0; brIdx < resBranches.size(); brIdx++)
{ {
if (resBranches[brIdx].m_branchResultPoints.size() == 0)
continue; // Skip empty branches. Do not know why they exist, but they make problems. // Skip empty branches. Do not know why they exist, but they make problems.
bool hasValidData = false;
for (size_t cIdx = 0; cIdx < resBranches[brIdx].m_branchResultPoints.size(); ++cIdx)
{
if (resBranches[brIdx].m_branchResultPoints[cIdx].isValid())
{
hasValidData = true;
break;
}
}
if (!hasValidData) continue;
prevWellResPoint = NULL; prevWellResPoint = NULL;