Fix Well Allocation Plot depth axis zoom

This commit is contained in:
Gaute Lindkvist
2019-11-29 13:53:02 +01:00
parent 1b345fa20f
commit 8e94caceed
2 changed files with 52 additions and 54 deletions

View File

@@ -308,23 +308,60 @@ void RimWellAllocationPlot::updateFromWell()
std::vector<QString> tracerNames = wfCalculator->tracerNames();
for ( const QString& tracerName : tracerNames )
{
const std::vector<double>* accFlow = nullptr;
std::vector<double> curveDepthValues = depthValues;
std::vector<double> accFlow;
if ( depthType == RiaDefines::CONNECTION_NUMBER )
{
accFlow = &( m_flowType == ACCUMULATED
? wfCalculator->accumulatedTracerFlowPrConnection( tracerName, brIdx )
: wfCalculator->tracerFlowPrConnection( tracerName, brIdx ) );
accFlow = ( m_flowType == ACCUMULATED
? wfCalculator->accumulatedTracerFlowPrConnection( tracerName, brIdx )
: wfCalculator->tracerFlowPrConnection( tracerName, brIdx ) );
// Insert the first depth position again, to add a <maxdepth, 0.0> value pair
curveDepthValues.insert( curveDepthValues.begin(), curveDepthValues[0] );
accFlow.insert( accFlow.begin(), 0.0 );
if ( brIdx == 0 && !accFlow.empty() ) // Add fictitious point to 0 for first branch
{
accFlow.push_back( accFlow.back() );
curveDepthValues.push_back( 0.0 );
}
}
else if ( depthType == RiaDefines::PSEUDO_LENGTH || depthType == RiaDefines::TRUE_VERTICAL_DEPTH )
{
accFlow = &( m_flowType == ACCUMULATED
? wfCalculator->accumulatedTracerFlowPrPseudoLength( tracerName, brIdx )
: wfCalculator->tracerFlowPrPseudoLength( tracerName, brIdx ) );
accFlow = ( m_flowType == ACCUMULATED
? wfCalculator->accumulatedTracerFlowPrPseudoLength( tracerName, brIdx )
: wfCalculator->tracerFlowPrPseudoLength( tracerName, brIdx ) );
// Insert the first depth position again, to add a <maxdepth, 0.0> value pair
curveDepthValues.insert( curveDepthValues.begin(), curveDepthValues[0] );
accFlow.insert( accFlow.begin(), 0.0 );
if ( brIdx == 0 && branchCount > 1 )
{
// Add a dummy negative depth value to make the contribution
// from other branches connected to well head visible
auto minmax_it = std::minmax_element( curveDepthValues.begin(), curveDepthValues.end() );
double availableMinDepth = *( minmax_it.first );
double availableMaxDepth = *( minmax_it.second );
double depthSpan = 0.1 * cvf::Math::abs( availableMinDepth - availableMaxDepth );
// Round off value to floored decade
double logDecValue = log10( depthSpan );
logDecValue = cvf::Math::floor( logDecValue );
depthSpan = pow( 10.0, logDecValue );
double dummyNegativeDepthValue = curveDepthValues.back() - depthSpan;
curveDepthValues.push_back( dummyNegativeDepthValue );
accFlow.push_back( accFlow.back() );
}
}
if ( accFlow )
if ( !accFlow.empty() )
{
addStackedCurve( tracerName, depthType, depthValues, *accFlow, plotTrack );
addStackedCurve( tracerName, depthType, curveDepthValues, accFlow, plotTrack );
// TODO: THIs is the data to be plotted...
}
}

View File

@@ -243,8 +243,6 @@ void RimWellFlowRateCurve::updateStackedPlotData()
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfTypeAsserted( wellLogTrack );
bool isFirstTrack = ( wellLogTrack == wellLogPlot->plotByIndex( 0 ) );
RimWellLogPlot::DepthTypeEnum depthType = wellLogPlot->depthType();
RiaDefines::DepthUnitType displayUnit = wellLogPlot->depthUnit();
if ( depthType == RiaDefines::CONNECTION_NUMBER )
@@ -255,7 +253,10 @@ void RimWellFlowRateCurve::updateStackedPlotData()
std::vector<double> depthValues;
std::vector<double> stackedValues;
std::vector<std::pair<size_t, size_t>> polyLineStartStopIndices;
double zPos = -10000.0 + 100 * groupId(); // Z-position of curve, to draw them in correct order
// Z-position of curve, to draw them in correct order
double zPos = -10000.0 + 100.0 * static_cast<double>( groupId() );
// Starting way behind the grid (z == 0) at -10000 giving room for 100 groups with 100 curves each before getting above the grid
{
std::map<int, std::vector<RimWellFlowRateCurve*>> stackedCurveGroups = wellLogTrack->visibleStackedCurves();
@@ -268,6 +269,8 @@ void RimWellFlowRateCurve::updateStackedPlotData()
}
std::vector<double> allDepthValues = curveData()->depths( depthType );
if ( allDepthValues.empty() ) return;
std::vector<double> allStackedValues( allDepthValues.size() );
for ( RimWellFlowRateCurve* stCurve : stackedCurves )
@@ -294,48 +297,6 @@ void RimWellFlowRateCurve::updateStackedPlotData()
polyLineStartStopIndices = tempCurveData.polylineStartStopIndices();
}
// Insert the first depth position again, to add a <maxdepth, 0.0> value pair
if ( depthValues.size() ) // Should we really do this for all curve variants ?
{
depthValues.insert( depthValues.begin(), depthValues[0] );
stackedValues.insert( stackedValues.begin(), 0.0 );
polyLineStartStopIndices.front().second += 1;
if ( wellLogPlot->plotCount() > 1 && isFirstTrack )
{
// Add a dummy negative depth value to make the contribution
// from other branches connected to well head visible
double availableMinDepth;
double availableMaxDepth;
wellLogPlot->availableDepthRange( &availableMinDepth, &availableMaxDepth );
double depthSpan = 0.1 * cvf::Math::abs( availableMinDepth - availableMaxDepth );
// Round off value to floored decade
double logDecValue = log10( depthSpan );
logDecValue = cvf::Math::floor( logDecValue );
depthSpan = pow( 10.0, logDecValue );
double dummyNegativeDepthValue = depthValues.back() - depthSpan;
depthValues.push_back( dummyNegativeDepthValue );
stackedValues.push_back( stackedValues.back() );
polyLineStartStopIndices.front().second += 1;
}
}
// Add a dummy point for the zeroth connection to make the "end" distribution show better.
if ( isFirstTrack && isUsingConnectionNumberDepthType() )
{
stackedValues.push_back( stackedValues.back() );
depthValues.push_back( 0.0 );
polyLineStartStopIndices.front().second += 1;
}
auto minmax_it = std::minmax_element( stackedValues.begin(), stackedValues.end() );
this->setOverrideCurveDataXRange( *( minmax_it.first ), *( minmax_it.second ) );