mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Producer/Injector Connectivity Table (#9928)
- Crated new RimMatrixPlotWidget to show table data - Create RimWellConnectivityTable for showing Producer/Injector connectivity table data - Rename RimWellAllocationOverTimeCollection to RigWellAllocationOverTime for well allocation over time data storage - Created heatmap color palette - Move utils from RimWellAllocationOverTimePlot to RiaQDateTimeTools - Create RimFlowDiagnosticsTools for producer/injector well utility functions --------- Co-authored-by: jorgenherje <jorgenherje@users.noreply.github.com>
This commit is contained in:
@@ -531,6 +531,24 @@ const caf::ColorTable& RiaColorTables::correlationPaletteColors()
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::heatMapPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{ cvf::Color3ub::DARK_BLUE,
|
||||
cvf::Color3ub( 0, 0, 240 ), // Medium Blue
|
||||
cvf::Color3ub( 0, 102, 204 ), // Transition Medium Blue to Cyan
|
||||
cvf::Color3ub::CYAN,
|
||||
cvf::Color3ub( 75, 255, 47 ), // Green/Yellow more green
|
||||
cvf::Color3ub::DARK_ORANGE,
|
||||
cvf::Color3ub::YELLOW };
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable( colors );
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
static const caf::ColorTable& wellPathsPaletteColors();
|
||||
static const caf::ColorTable& waterAndRockPaletteColors();
|
||||
static const caf::ColorTable& correlationPaletteColors();
|
||||
static const caf::ColorTable& heatMapPaletteColors();
|
||||
|
||||
static cvf::Color3f undefinedCellColor();
|
||||
|
||||
|
||||
@@ -499,3 +499,68 @@ QList<caf::PdmOptionItemInfo> RiaQDateTimeTools::createOptionItems( const std::v
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QDateTime> RiaQDateTimeTools::createEvenlyDistributedDates( const std::vector<QDateTime>& inputDates, int numDates )
|
||||
{
|
||||
std::set<QDateTime> outputDates;
|
||||
if ( inputDates.empty() || numDates <= 0 )
|
||||
{
|
||||
return {};
|
||||
}
|
||||
if ( static_cast<size_t>( numDates ) > inputDates.size() )
|
||||
{
|
||||
outputDates = std::set( inputDates.begin(), inputDates.end() );
|
||||
return outputDates;
|
||||
}
|
||||
if ( numDates == 1 )
|
||||
{
|
||||
outputDates = { inputDates.front() };
|
||||
return outputDates;
|
||||
}
|
||||
|
||||
// Find the minimum and maximum dates in the input vector
|
||||
QDateTime minDate = *std::min_element( inputDates.begin(), inputDates.end() );
|
||||
QDateTime maxDate = *std::max_element( inputDates.begin(), inputDates.end() );
|
||||
|
||||
// Calculate the time step between each selected date
|
||||
qint64 timeStep = ( maxDate.toMSecsSinceEpoch() - minDate.toMSecsSinceEpoch() ) / ( static_cast<qint64>( numDates ) - 1 );
|
||||
|
||||
// Find the index of the input date that is closest to each new date
|
||||
for ( int i = 0; i < numDates; ++i )
|
||||
{
|
||||
qint64 targetTime = minDate.toMSecsSinceEpoch() + i * timeStep;
|
||||
int closestIndex = 0;
|
||||
qint64 closestTimeDiff = std::numeric_limits<qint64>::max();
|
||||
for ( size_t j = 0; j < inputDates.size(); ++j )
|
||||
{
|
||||
qint64 timeDiff = std::abs( inputDates[j].toMSecsSinceEpoch() - targetTime );
|
||||
if ( timeDiff < closestTimeDiff )
|
||||
{
|
||||
closestIndex = j;
|
||||
closestTimeDiff = timeDiff;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the closest date to the output vector
|
||||
outputDates.insert( inputDates[closestIndex] );
|
||||
}
|
||||
|
||||
return outputDates;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QDateTime> RiaQDateTimeTools::getTimeStepsWithinSelectedRange( const std::vector<QDateTime>& timeSteps,
|
||||
const QDateTime& fromTimeStep,
|
||||
const QDateTime& toTimeStep )
|
||||
{
|
||||
std::vector<QDateTime> selectedTimeSteps;
|
||||
auto isTimeStepInSelectedRange = [&]( const QDateTime& timeStep ) -> bool { return fromTimeStep <= timeStep && timeStep <= toTimeStep; };
|
||||
std::copy_if( timeSteps.begin(), timeSteps.end(), std::back_inserter( selectedTimeSteps ), isTimeStepInSelectedRange );
|
||||
|
||||
return selectedTimeSteps;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -93,6 +94,10 @@ public:
|
||||
|
||||
static QList<caf::PdmOptionItemInfo> createOptionItems( const std::vector<time_t>& timeSteps );
|
||||
|
||||
static std::set<QDateTime> createEvenlyDistributedDates( const std::vector<QDateTime>& inputDates, int numDates );
|
||||
static std::vector<QDateTime>
|
||||
getTimeStepsWithinSelectedRange( const std::vector<QDateTime>& timeSteps, const QDateTime& fromTimeStep, const QDateTime& toTimeStep );
|
||||
|
||||
private:
|
||||
static const DateTimeSpan TIMESPAN_DAY;
|
||||
static const DateTimeSpan TIMESPAN_WEEK;
|
||||
|
||||
Reference in New Issue
Block a user