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:
@@ -32,6 +32,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryDefines.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaLasDefines.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaWellFlowDefines.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -68,6 +69,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryDefines.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaLasDefines.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaWellFlowDefines.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
27
ApplicationLibCode/Application/RiaWellFlowDefines.cpp
Normal file
27
ApplicationLibCode/Application/RiaWellFlowDefines.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaWellFlowDefines.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::reservoirTracerName()
|
||||
{
|
||||
return "Reservoir";
|
||||
}
|
26
ApplicationLibCode/Application/RiaWellFlowDefines.h
Normal file
26
ApplicationLibCode/Application/RiaWellFlowDefines.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace RiaDefines
|
||||
{
|
||||
QString reservoirTracerName();
|
||||
}; // namespace RiaDefines
|
@@ -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