#1112, #1106 Added and removed fields to make the allocation plot have the needed data to do its calculation. Refacord the CenterLine calculation interface yet again to make it usable.

This commit is contained in:
Jacob Støren
2017-01-23 11:10:09 +01:00
parent b4308a857c
commit 825c505443
9 changed files with 148 additions and 106 deletions

View File

@@ -262,6 +262,20 @@ void RigEclipseCaseData::setWellResults(const cvf::Collection<RigSingleWellResul
computeWellCellsPrGrid();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigSingleWellResultsData* RigEclipseCaseData::findWellResult(QString wellName) const
{
for (size_t wIdx = 0; wIdx < m_wellResults.size(); ++wIdx)
{
if (m_wellResults[wIdx]->m_wellName == wellName) return m_wellResults[wIdx].p();
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -82,7 +82,8 @@ public:
void setWellResults(const cvf::Collection<RigSingleWellResultsData>& data);
const cvf::Collection<RigSingleWellResultsData>& wellResults() { return m_wellResults; }
const RigSingleWellResultsData* findWellResult(QString wellName) const;
const cvf::UByteArray* wellCellsInGrid(size_t gridIndex);
const cvf::UIntArray* gridCellToResultWellIndex(size_t gridIndex);

View File

@@ -38,39 +38,7 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline(Ri
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds)
{
bool isAutoDetectBranches = false;
RigEclipseCaseData* eclipseCaseData = NULL;
RigSingleWellResultsData* wellResults = NULL;
{
CVF_ASSERT(rimWell);
RimEclipseView* eclipseView;
rimWell->firstAncestorOrThisOfType(eclipseView);
CVF_ASSERT(eclipseView);
isAutoDetectBranches = eclipseView->wellCollection()->isAutoDetectingBranches();
eclipseCaseData = eclipseView->eclipseCase()->reservoirData();
wellResults = rimWell->wellResults();
}
// Make sure we have computed the static representation of the well
if (wellResults->m_staticWellCells.m_wellResultBranches.size() == 0)
{
wellResults->computeStaticWellCellPath();
}
const RigWellResultFrame& staticWellFrame = wellResults->m_staticWellCells;
bool isMultiSegmentWell = wellResults->isMultiSegmentWell();
bool useAllCellCenters = rimWell->isUsingCellCenterForPipe();
calculateWellPipeCenterlineFromWellFrame(staticWellFrame,
eclipseCaseData,
isMultiSegmentWell,
isAutoDetectBranches,
useAllCellCenters,
pipeBranchesCLCoords,
pipeBranchesCellIds);
return;
calculateWellPipeDynamicCenterline(rimWell, -1, pipeBranchesCLCoords, pipeBranchesCellIds);
}
@@ -82,31 +50,23 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeDynamicCenterline(R
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds)
{
bool isAutoDetectBranches = false;
RigEclipseCaseData* eclipseCaseData = NULL;
RigSingleWellResultsData* wellResults = NULL;
CVF_ASSERT(rimWell);
{
CVF_ASSERT(rimWell);
RimEclipseView* eclipseView;
rimWell->firstAncestorOrThisOfType(eclipseView);
CVF_ASSERT(eclipseView);
RigSingleWellResultsData* wellResults = rimWell->wellResults();
isAutoDetectBranches = eclipseView->wellCollection()->isAutoDetectingBranches();
eclipseCaseData = eclipseView->eclipseCase()->reservoirData();
wellResults = rimWell->wellResults();
RimEclipseView* eclipseView;
rimWell->firstAncestorOrThisOfType(eclipseView);
if ( !wellResults || !wellResults->hasWellResult(timeStepIndex) ) return;
}
CVF_ASSERT(eclipseView);
const RigWellResultFrame& wellFrame = wellResults->wellResultFrame(timeStepIndex);
bool isMultiSegmentWell = wellResults->isMultiSegmentWell();
bool useAllCellCenters = rimWell->isUsingCellCenterForPipe();
RigEclipseCaseData* eclipseCaseData = eclipseView->eclipseCase()->reservoirData();
bool isAutoDetectBranches = eclipseView->wellCollection()->isAutoDetectingBranches();
calculateWellPipeCenterlineFromWellFrame(wellFrame,
eclipseCaseData,
isMultiSegmentWell,
bool useAllCellCenters = rimWell->isUsingCellCenterForPipe();
calculateWellPipeCenterlineFromWellFrame(eclipseCaseData,
wellResults,
static_cast<int>(timeStepIndex),
isAutoDetectBranches,
useAllCellCenters,
pipeBranchesCLCoords,
@@ -118,14 +78,37 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeDynamicCenterline(R
/// The returned CellIds is one less than the number of centerline points,
/// and are describing the lines between the points, starting with the first line
//--------------------------------------------------------------------------------------------------
void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(const RigWellResultFrame &wellFrame,
const RigEclipseCaseData* eclipseCaseData,
bool isMultiSegmentWell,
void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(const RigEclipseCaseData* eclipseCaseData,
const RigSingleWellResultsData* wellResults,
int timeStepIndex,
bool isAutoDetectBranches,
bool useAllCellCenters,
std::vector<std::vector<cvf::Vec3d>> &pipeBranchesCLCoords,
std::vector<std::vector<RigWellResultPoint>> &pipeBranchesCellIds)
{
if ( !wellResults) return;
if ( timeStepIndex >= 0 && !wellResults->hasWellResult(timeStepIndex) ) return;
const RigWellResultFrame* wellFramePtr = nullptr;
if (timeStepIndex < 0)
{
// Make sure we have computed the static representation of the well
if (wellResults->m_staticWellCells.m_wellResultBranches.size() == 0)
{
wellResults->computeStaticWellCellPath();
}
wellFramePtr = &wellResults->m_staticWellCells;
}
else
{
wellFramePtr = &(wellResults->wellResultFrame(timeStepIndex));
}
const RigWellResultFrame& wellFrame = *wellFramePtr;
bool isMultiSegmentWell = wellResults->isMultiSegmentWell();
// Initialize the return arrays
pipeBranchesCLCoords.clear();
pipeBranchesCellIds.clear();

View File

@@ -38,14 +38,14 @@ public:
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds) ;
private:
static void calculateWellPipeCenterlineFromWellFrame(const RigWellResultFrame& wellFrame,
const RigEclipseCaseData* eclipseCaseData,
bool isMultiSegmentWell,
bool isAutoDetectBranches,
static void calculateWellPipeCenterlineFromWellFrame(const RigEclipseCaseData* eclipseCaseData,
const RigSingleWellResultsData* wellResults,
int timeStepIndex,
bool isAutoDetectBranches,
bool useAllCellCenters,
std::vector<std::vector<cvf::Vec3d>> & pipeBranchesCLCoords,
std::vector<std::vector<RigWellResultPoint>> & pipeBranchesCellIds);
std::vector<std::vector<cvf::Vec3d>> &pipeBranchesCLCoords,
std::vector<std::vector<RigWellResultPoint>> &pipeBranchesCellIds);
private:
static bool hasAnyResultCells(const std::vector<RigWellResultBranch> &resBranches);
static bool hasAnyValidDataCells(const RigWellResultBranch& branch);

View File

@@ -121,7 +121,7 @@ bool operator== (const RigWellResultPoint& p1, const RigWellResultPoint& p2)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigSingleWellResultsData::computeStaticWellCellPath()
void RigSingleWellResultsData::computeStaticWellCellPath() const
{
if (m_wellCellsTimeSteps.size() == 0) return;
@@ -133,7 +133,7 @@ void RigSingleWellResultsData::computeStaticWellCellPath()
for (size_t bIdx = 0; bIdx < m_wellCellsTimeSteps[0].m_wellResultBranches.size(); ++bIdx)
{
int branchErtId = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_ertBranchId;
std::vector<RigWellResultPoint>& frameCells = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_branchResultPoints;
const std::vector<RigWellResultPoint>& frameCells = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_branchResultPoints;
std::list< RigWellResultPoint >& branch = staticWellBranches[branchErtId];
@@ -152,7 +152,7 @@ void RigSingleWellResultsData::computeStaticWellCellPath()
for (size_t bIdx = 0; bIdx < m_wellCellsTimeSteps[tIdx].m_wellResultBranches.size(); ++bIdx)
{
int branchId = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_ertBranchId;
std::vector<RigWellResultPoint>& resBranch = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_branchResultPoints;
const std::vector<RigWellResultPoint>& resBranch = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_branchResultPoints;
std::list< RigWellResultPoint >& stBranch = staticWellBranches[branchId];
std::list< RigWellResultPoint >::iterator sEndIt;

View File

@@ -127,7 +127,7 @@ public:
const RigWellResultFrame& wellResultFrame(size_t resultTimeStepIndex) const;
void computeStaticWellCellPath();
void computeStaticWellCellPath() const ;
void computeMappingFromResultTimeIndicesToWellTimeIndices(const std::vector<QDateTime>& resultTimes);
@@ -137,6 +137,6 @@ public:
std::vector<size_t> m_resultTimeStepIndexToWellTimeStepIndex; // Well result timesteps may differ from result timesteps
std::vector< RigWellResultFrame > m_wellCellsTimeSteps;
RigWellResultFrame m_staticWellCells;
mutable RigWellResultFrame m_staticWellCells;
};