Merge branch 'dev' into system-refactor-welllogplot

This commit is contained in:
Gaute Lindkvist
2019-09-06 13:30:56 +02:00
2065 changed files with 114267 additions and 108283 deletions

View File

@@ -29,22 +29,22 @@
namespace caf
{
template<>
template <>
void caf::AppEnum<RifDataSourceForRftPlt::SourceType>::setUp()
{
addItem(RifDataSourceForRftPlt::SourceType::RFT, "RFT", "RFT Cases");
addItem(RifDataSourceForRftPlt::SourceType::GRID, "GRID", "Grid Cases");
addItem(RifDataSourceForRftPlt::SourceType::OBSERVED, "OBSERVED", "Observed Data");
addItem(RifDataSourceForRftPlt::SourceType::ENSEMBLE_RFT, "ENSEMBLE", "Ensembles with RFT Data");
addItem(RifDataSourceForRftPlt::SourceType::OBSERVED_FMU_RFT, "OBSERVED_FMU", "Observed FMU Data");
setDefault(RifDataSourceForRftPlt::SourceType::NONE);
addItem( RifDataSourceForRftPlt::SourceType::RFT, "RFT", "RFT Cases" );
addItem( RifDataSourceForRftPlt::SourceType::GRID, "GRID", "Grid Cases" );
addItem( RifDataSourceForRftPlt::SourceType::OBSERVED, "OBSERVED", "Observed Data" );
addItem( RifDataSourceForRftPlt::SourceType::ENSEMBLE_RFT, "ENSEMBLE", "Ensembles with RFT Data" );
addItem( RifDataSourceForRftPlt::SourceType::OBSERVED_FMU_RFT, "OBSERVED_FMU", "Observed FMU Data" );
setDefault( RifDataSourceForRftPlt::SourceType::NONE );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
CAF_PDM_SOURCE_INIT(RimDataSourceForRftPlt, "RftAddress");
CAF_PDM_SOURCE_INIT( RimDataSourceForRftPlt, "RftAddress" );
//--------------------------------------------------------------------------------------------------
///
@@ -57,16 +57,16 @@ RimDataSourceForRftPlt::RimDataSourceForRftPlt()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimDataSourceForRftPlt::RimDataSourceForRftPlt(const RifDataSourceForRftPlt& addr)
RimDataSourceForRftPlt::RimDataSourceForRftPlt( const RifDataSourceForRftPlt& addr )
{
InitPdmObject();
setAddress(addr);
setAddress( addr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDataSourceForRftPlt::setAddress(const RifDataSourceForRftPlt& address)
void RimDataSourceForRftPlt::setAddress( const RifDataSourceForRftPlt& address )
{
m_sourceType = address.sourceType();
m_eclCase = address.eclCase();
@@ -80,17 +80,17 @@ void RimDataSourceForRftPlt::setAddress(const RifDataSourceForRftPlt& address)
//--------------------------------------------------------------------------------------------------
RifDataSourceForRftPlt RimDataSourceForRftPlt::address() const
{
switch(m_sourceType())
switch ( m_sourceType() )
{
case RifDataSourceForRftPlt::OBSERVED:
return RifDataSourceForRftPlt(m_sourceType(), m_wellLogFile);
return RifDataSourceForRftPlt( m_sourceType(), m_wellLogFile );
case RifDataSourceForRftPlt::RFT:
case RifDataSourceForRftPlt::GRID:
return RifDataSourceForRftPlt(m_sourceType(), m_eclCase);
return RifDataSourceForRftPlt( m_sourceType(), m_eclCase );
case RifDataSourceForRftPlt::ENSEMBLE_RFT:
return RifDataSourceForRftPlt(m_sourceType(), m_ensemble);
return RifDataSourceForRftPlt( m_sourceType(), m_ensemble );
case RifDataSourceForRftPlt::OBSERVED_FMU_RFT:
return RifDataSourceForRftPlt(m_sourceType(), m_observedFmuRftData);
return RifDataSourceForRftPlt( m_sourceType(), m_observedFmuRftData );
default:
break;
}
@@ -102,17 +102,17 @@ RifDataSourceForRftPlt RimDataSourceForRftPlt::address() const
//--------------------------------------------------------------------------------------------------
void RimDataSourceForRftPlt::InitPdmObject()
{
CAF_PDM_InitFieldNoDefault(&m_sourceType, "SourceType", "Source Type", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_eclCase, "EclipseCase", "Eclipse Case", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellLogFile, "WellLogFile", "Well Log File", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_ensemble, "Ensemble", "Ensemble", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_observedFmuRftData, "ObservedFmuRftData", "Observed FMU Data", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_sourceType, "SourceType", "Source Type", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_eclCase, "EclipseCase", "Eclipse Case", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellLogFile, "WellLogFile", "Well Log File", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_observedFmuRftData, "ObservedFmuRftData", "Observed FMU Data", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimDataSourceForRftPlt& RimDataSourceForRftPlt::operator=(const RimDataSourceForRftPlt& other)
RimDataSourceForRftPlt& RimDataSourceForRftPlt::operator=( const RimDataSourceForRftPlt& other )
{
m_sourceType = other.m_sourceType();
m_eclCase = other.m_eclCase();

View File

@@ -1,48 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimViewWindow.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cafPdmPointer.h"
#include "cafPdmPtrField.h"
#include "RifDataSourceForRftPltQMetaType.h"
#include "cafAppEnum.h"
#include <QPointer>
#include <QDate>
#include <QMetaType>
#include <QPointer>
class RimObservedFmuRftData;
class RimSummaryCaseCollection;
class RimWellLogFile;
class RimEclipseCase;
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimDataSourceForRftPlt : public caf::PdmObject
{
@@ -50,12 +48,12 @@ class RimDataSourceForRftPlt : public caf::PdmObject
public:
RimDataSourceForRftPlt();
RimDataSourceForRftPlt(const RifDataSourceForRftPlt& addr);
RimDataSourceForRftPlt( const RifDataSourceForRftPlt& addr );
void setAddress(const RifDataSourceForRftPlt& address);
void setAddress( const RifDataSourceForRftPlt& address );
RifDataSourceForRftPlt address() const;
RimDataSourceForRftPlt& operator=(const RimDataSourceForRftPlt& other);
RimDataSourceForRftPlt& operator=( const RimDataSourceForRftPlt& other );
private:
void InitPdmObject();
@@ -63,6 +61,6 @@ private:
caf::PdmField<caf::AppEnum<RifDataSourceForRftPlt::SourceType>> m_sourceType;
caf::PdmPtrField<RimEclipseCase*> m_eclCase;
caf::PdmPtrField<RimWellLogFile*> m_wellLogFile;
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
caf::PdmPtrField<RimObservedFmuRftData*> m_observedFmuRftData;
};

View File

@@ -53,56 +53,57 @@
namespace caf
{
template<>
template <>
void AppEnum<RimFlowCharacteristicsPlot::TimeSelectionType>::setUp()
{
addItem(RimFlowCharacteristicsPlot::ALL_AVAILABLE, "ALL_AVAILABLE", "All With Calculated Flow Diagnostics");
addItem(RimFlowCharacteristicsPlot::SELECTED, "SELECTED", "Selected");
setDefault(RimFlowCharacteristicsPlot::SELECTED);
addItem( RimFlowCharacteristicsPlot::ALL_AVAILABLE, "ALL_AVAILABLE", "All With Calculated Flow Diagnostics" );
addItem( RimFlowCharacteristicsPlot::SELECTED, "SELECTED", "Selected" );
setDefault( RimFlowCharacteristicsPlot::SELECTED );
}
} // namespace caf
CAF_PDM_SOURCE_INIT(RimFlowCharacteristicsPlot, "FlowCharacteristicsPlot");
CAF_PDM_SOURCE_INIT( RimFlowCharacteristicsPlot, "FlowCharacteristicsPlot" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
{
CAF_PDM_InitObject("Flow Characteristics", ":/FlowCharPlot16x16.png", "", "");
CAF_PDM_InitObject( "Flow Characteristics", ":/FlowCharPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault(&m_case, "FlowCase", "Case", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution", "", "", "");
m_flowDiagSolution.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault( &m_case, "FlowCase", "Case", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution", "", "", "" );
m_flowDiagSolution.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault(&m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", "");
m_selectedTimeSteps.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_selectedTimeStepsUi, "SelectedTimeStepsUi", "", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_applyTimeSteps, "ApplyTimeSteps", "", "", "", "");
caf::PdmUiPushButtonEditor::configureEditorForField(&m_applyTimeSteps);
CAF_PDM_InitFieldNoDefault( &m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", "" );
m_selectedTimeSteps.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_selectedTimeStepsUi, "SelectedTimeStepsUi", "", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_applyTimeSteps, "ApplyTimeSteps", "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_applyTimeSteps );
CAF_PDM_InitField(&m_maxPvFraction,
"CellPVThreshold",
0.1,
"Aquifer Cell Threshold",
"",
"Exclude Aquifer Effects by adding a Cell Pore Volume Threshold as Fraction of Total Pore Volume.",
"");
CAF_PDM_InitField( &m_maxPvFraction,
"CellPVThreshold",
0.1,
"Aquifer Cell Threshold",
"",
"Exclude Aquifer Effects by adding a Cell Pore Volume Threshold as Fraction of Total Pore "
"Volume.",
"" );
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Legend", "", "", "");
CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Legend", "", "", "" );
// Region group
CAF_PDM_InitFieldNoDefault(&m_cellFilter, "CellFilter", "Cell Filter", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_cellFilterView, "CellFilterView", "View", "", "", "");
CAF_PDM_InitField(&m_tracerFilter, "TracerFilter", QString(), "Tracer Filter", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_selectedTracerNames, "SelectedTracerNames", " ", "", "", "");
m_selectedTracerNames.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_showRegion, "ShowRegion", "", "", "", "");
caf::PdmUiPushButtonEditor::configureEditorForField(&m_showRegion);
CAF_PDM_InitFieldNoDefault( &m_cellFilter, "CellFilter", "Cell Filter", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_cellFilterView, "CellFilterView", "View", "", "", "" );
CAF_PDM_InitField( &m_tracerFilter, "TracerFilter", QString(), "Tracer Filter", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_selectedTracerNames, "SelectedTracerNames", " ", "", "", "" );
m_selectedTracerNames.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &m_showRegion, "ShowRegion", "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_showRegion );
CAF_PDM_InitField(&m_minCommunication, "MinCommunication", 0.0, "Min Communication", "", "", "");
CAF_PDM_InitField(&m_maxTof, "MaxTof", 146000, "Max Time of Flight [days]", "", "", "");
CAF_PDM_InitField( &m_minCommunication, "MinCommunication", 0.0, "Min Communication", "", "", "" );
CAF_PDM_InitField( &m_maxTof, "MaxTof", 146000, "Max Time of Flight [days]", "", "", "" );
this->m_showWindow = false;
setAsPlotMdiWindow();
@@ -121,9 +122,9 @@ RimFlowCharacteristicsPlot::~RimFlowCharacteristicsPlot()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::setFromFlowSolution(RimFlowDiagSolution* flowSolution)
void RimFlowCharacteristicsPlot::setFromFlowSolution( RimFlowDiagSolution* flowSolution )
{
if (!flowSolution)
if ( !flowSolution )
{
m_case = nullptr;
m_cellFilterView = nullptr;
@@ -131,9 +132,9 @@ void RimFlowCharacteristicsPlot::setFromFlowSolution(RimFlowDiagSolution* flowSo
else
{
RimEclipseResultCase* eclCase;
flowSolution->firstAncestorOrThisOfType(eclCase);
flowSolution->firstAncestorOrThisOfType( eclCase );
m_case = eclCase;
if (!eclCase->reservoirViews.empty())
if ( !eclCase->reservoirViews.empty() )
{
m_cellFilterView = eclCase->reservoirViews()[0];
}
@@ -152,7 +153,7 @@ void RimFlowCharacteristicsPlot::setFromFlowSolution(RimFlowDiagSolution* flowSo
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::deleteViewWidget()
{
if (m_flowCharPlotWidget)
if ( m_flowCharPlotWidget )
{
m_flowCharPlotWidget->deleteLater();
m_flowCharPlotWidget = nullptr;
@@ -164,13 +165,13 @@ void RimFlowCharacteristicsPlot::deleteViewWidget()
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::updateCurrentTimeStep()
{
if (m_timeStepSelectionType() != ALL_AVAILABLE) return;
if (!m_flowDiagSolution()) return;
if ( m_timeStepSelectionType() != ALL_AVAILABLE ) return;
if ( !m_flowDiagSolution() ) return;
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps( RigFlowDiagResultAddress::PHASE_ALL );
if (m_currentlyPlottedTimeSteps == calculatedTimesteps) return;
if ( m_currentlyPlottedTimeSteps == calculatedTimesteps ) return;
this->onLoadDataAndUpdate();
}
@@ -178,7 +179,7 @@ void RimFlowCharacteristicsPlot::updateCurrentTimeStep()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::setTimeSteps(const std::vector<int>& timeSteps)
void RimFlowCharacteristicsPlot::setTimeSteps( const std::vector<int>& timeSteps )
{
m_selectedTimeSteps = timeSteps;
}
@@ -186,23 +187,23 @@ void RimFlowCharacteristicsPlot::setTimeSteps(const std::vector<int>& timeSteps)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::setInjectorsAndProducers(const std::vector<QString>& injectors,
const std::vector<QString>& producers)
void RimFlowCharacteristicsPlot::setInjectorsAndProducers( const std::vector<QString>& injectors,
const std::vector<QString>& producers )
{
std::vector<QString> allTracers;
allTracers = producers;
allTracers.insert(allTracers.end(), injectors.begin(), injectors.end());
allTracers.insert( allTracers.end(), injectors.begin(), injectors.end() );
if (producers.empty() && !injectors.empty())
if ( producers.empty() && !injectors.empty() )
{
m_cellFilter = RigFlowDiagResults::CELLS_FLOODED;
}
else if (!producers.empty() && injectors.empty())
else if ( !producers.empty() && injectors.empty() )
{
m_cellFilter = RigFlowDiagResults::CELLS_DRAINED;
}
else if (!producers.empty() && !injectors.empty())
else if ( !producers.empty() && !injectors.empty() )
{
m_cellFilter = RigFlowDiagResults::CELLS_COMMUNICATION;
}
@@ -213,7 +214,7 @@ void RimFlowCharacteristicsPlot::setInjectorsAndProducers(const std::vector<QStr
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::setMinimumCommunication(double minimumCommunication)
void RimFlowCharacteristicsPlot::setMinimumCommunication( double minimumCommunication )
{
m_minCommunication = minimumCommunication;
}
@@ -221,7 +222,7 @@ void RimFlowCharacteristicsPlot::setMinimumCommunication(double minimumCommunica
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::setAquiferCellThreshold(double aquiferCellThreshold)
void RimFlowCharacteristicsPlot::setAquiferCellThreshold( double aquiferCellThreshold )
{
m_maxPvFraction = aquiferCellThreshold;
}
@@ -229,101 +230,103 @@ void RimFlowCharacteristicsPlot::setAquiferCellThreshold(double aquiferCellThres
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly)
QList<caf::PdmOptionItemInfo>
RimFlowCharacteristicsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_case)
if ( fieldNeedingOptions == &m_case )
{
RimProject* proj = nullptr;
this->firstAncestorOrThisOfType(proj);
if (proj)
this->firstAncestorOrThisOfType( proj );
if ( proj )
{
std::vector<RimEclipseResultCase*> cases;
proj->descendantsIncludingThisOfType(cases);
for (RimEclipseResultCase* c : cases)
proj->descendantsIncludingThisOfType( cases );
for ( RimEclipseResultCase* c : cases )
{
if (c->defaultFlowDiagSolution())
if ( c->defaultFlowDiagSolution() )
{
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIconProvider()));
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
}
}
}
}
else if (fieldNeedingOptions == &m_cellFilterView)
else if ( fieldNeedingOptions == &m_cellFilterView )
{
if (m_case)
if ( m_case )
{
for (RimEclipseView* view : m_case()->reservoirViews())
for ( RimEclipseView* view : m_case()->reservoirViews() )
{
options.push_back(caf::PdmOptionItemInfo(view->name(), view, false, view->uiIconProvider()));
options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) );
}
}
}
else if (fieldNeedingOptions == &m_flowDiagSolution)
else if ( fieldNeedingOptions == &m_flowDiagSolution )
{
if (m_case)
if ( m_case )
{
std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
options.push_back(caf::PdmOptionItemInfo("None", nullptr));
for (RimFlowDiagSolution* flowSol : flowSols)
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
for ( RimFlowDiagSolution* flowSol : flowSols )
{
options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIconProvider()));
options.push_back(
caf::PdmOptionItemInfo( flowSol->userDescription(), flowSol, false, flowSol->uiIconProvider() ) );
}
}
}
else if (fieldNeedingOptions == &m_selectedTimeStepsUi)
else if ( fieldNeedingOptions == &m_selectedTimeStepsUi )
{
if (m_flowDiagSolution && m_case)
if ( m_flowDiagSolution && m_case )
{
QStringList timeStepDates = m_case->timeStepStrings();
std::vector<int> calculatedTimeSteps =
m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
for (int tsIdx = 0; tsIdx < timeStepDates.size(); ++tsIdx)
QStringList timeStepDates = m_case->timeStepStrings();
std::vector<int> calculatedTimeSteps = m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps(
RigFlowDiagResultAddress::PHASE_ALL );
for ( int tsIdx = 0; tsIdx < timeStepDates.size(); ++tsIdx )
{
auto it = std::find(calculatedTimeSteps.begin(), calculatedTimeSteps.end(), tsIdx);
auto it = std::find( calculatedTimeSteps.begin(), calculatedTimeSteps.end(), tsIdx );
QString itemText = timeStepDates[tsIdx];
if (it != calculatedTimeSteps.end())
if ( it != calculatedTimeSteps.end() )
{
itemText = itemText + " *";
}
options.push_back(caf::PdmOptionItemInfo(itemText, tsIdx));
options.push_back( caf::PdmOptionItemInfo( itemText, tsIdx ) );
}
}
}
else if (fieldNeedingOptions == &m_selectedTracerNames)
else if ( fieldNeedingOptions == &m_selectedTracerNames )
{
if (m_flowDiagSolution)
if ( m_flowDiagSolution )
{
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
std::vector<std::pair<QString, QString>> sortedTracerNames;
for (QString tracerName : tracerNames)
for ( QString tracerName : tracerNames )
{
if (!caf::Utils::isStringMatch(m_tracerFilter, tracerName)) continue;
if ( !caf::Utils::isStringMatch( m_tracerFilter, tracerName ) ) continue;
RimFlowDiagSolution::TracerStatusType tracerStatus = m_flowDiagSolution->tracerStatusOverall(tracerName);
if (tracerStatus == RimFlowDiagSolution::CLOSED) continue;
RimFlowDiagSolution::TracerStatusType tracerStatus = m_flowDiagSolution->tracerStatusOverall( tracerName );
if ( tracerStatus == RimFlowDiagSolution::CLOSED ) continue;
if (m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED)
if ( m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED )
{
if (tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::VARYING)
if ( tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::VARYING )
{
sortedTracerNames.push_back(std::make_pair(tracerName, tracerName));
sortedTracerNames.push_back( std::make_pair( tracerName, tracerName ) );
}
}
else if (m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED)
else if ( m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED )
{
if (tracerStatus == RimFlowDiagSolution::PRODUCER || tracerStatus == RimFlowDiagSolution::VARYING)
if ( tracerStatus == RimFlowDiagSolution::PRODUCER || tracerStatus == RimFlowDiagSolution::VARYING )
{
sortedTracerNames.push_back(std::make_pair(tracerName, tracerName));
sortedTracerNames.push_back( std::make_pair( tracerName, tracerName ) );
}
}
else if (m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION)
else if ( m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION )
{
QString prefix;
switch (tracerStatus)
switch ( tracerStatus )
{
case RimFlowDiagSolution::INJECTOR:
prefix = "I : ";
@@ -338,19 +341,19 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
prefix = "U : ";
break;
}
sortedTracerNames.push_back(std::make_pair(prefix + tracerName, tracerName));
sortedTracerNames.push_back( std::make_pair( prefix + tracerName, tracerName ) );
}
}
std::sort(sortedTracerNames.begin(),
sortedTracerNames.end(),
[](const std::pair<QString, QString>& a, const std::pair<QString, QString>& b) -> bool {
return a.first < b.first;
});
std::sort( sortedTracerNames.begin(),
sortedTracerNames.end(),
[]( const std::pair<QString, QString>& a, const std::pair<QString, QString>& b ) -> bool {
return a.first < b.first;
} );
for (auto& tracer : sortedTracerNames)
for ( auto& tracer : sortedTracerNames )
{
options.push_back(caf::PdmOptionItemInfo(tracer.first, tracer.second));
options.push_back( caf::PdmOptionItemInfo( tracer.first, tracer.second ) );
}
}
}
@@ -361,29 +364,29 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimFlowCharacteristicsPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
{
// Ensure a case is selected if one is available
RimProject* proj = nullptr;
this->firstAncestorOrThisOfType(proj);
if (proj)
this->firstAncestorOrThisOfType( proj );
if ( proj )
{
std::vector<RimEclipseResultCase*> cases;
proj->descendantsIncludingThisOfType(cases);
proj->descendantsIncludingThisOfType( cases );
RimEclipseResultCase* defaultCase = nullptr;
for (RimEclipseResultCase* c : cases)
for ( RimEclipseResultCase* c : cases )
{
if (c->defaultFlowDiagSolution())
if ( c->defaultFlowDiagSolution() )
{
if (!defaultCase) defaultCase = c; // Select first
if ( !defaultCase ) defaultCase = c; // Select first
}
}
if (!m_case() && defaultCase)
if ( !m_case() && defaultCase )
{
m_case = defaultCase;
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
if (!m_case()->reservoirViews.empty())
if ( !m_case()->reservoirViews.empty() )
{
m_cellFilterView = m_case()->reservoirViews()[0];
}
@@ -391,51 +394,52 @@ void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::Pdm
}
}
uiOrdering.add(&m_case);
uiOrdering.add( &m_case );
{
caf::PdmUiGroup* timeStepsGroup = uiOrdering.addNewGroup("Time Steps");
caf::PdmUiGroup* timeStepsGroup = uiOrdering.addNewGroup( "Time Steps" );
timeStepsGroup->add(&m_timeStepSelectionType);
timeStepsGroup->add( &m_timeStepSelectionType );
if (m_timeStepSelectionType == SELECTED)
if ( m_timeStepSelectionType == SELECTED )
{
timeStepsGroup->add(&m_selectedTimeStepsUi);
timeStepsGroup->add(&m_applyTimeSteps);
timeStepsGroup->add( &m_selectedTimeStepsUi );
timeStepsGroup->add( &m_applyTimeSteps );
}
}
{
caf::PdmUiGroup* regionGroup = uiOrdering.addNewGroup("Region");
regionGroup->add(&m_cellFilter);
if (m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION || m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED ||
m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED)
caf::PdmUiGroup* regionGroup = uiOrdering.addNewGroup( "Region" );
regionGroup->add( &m_cellFilter );
if ( m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION ||
m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED || m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED )
{
regionGroup->add(&m_tracerFilter);
regionGroup->add(&m_selectedTracerNames);
regionGroup->add(&m_showRegion);
regionGroup->add( &m_tracerFilter );
regionGroup->add( &m_selectedTracerNames );
regionGroup->add( &m_showRegion );
}
else if (m_cellFilter() == RigFlowDiagResults::CELLS_VISIBLE)
else if ( m_cellFilter() == RigFlowDiagResults::CELLS_VISIBLE )
{
regionGroup->add(&m_cellFilterView);
regionGroup->add( &m_cellFilterView );
}
if (m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION)
if ( m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION )
{
regionGroup->add(&m_minCommunication);
regionGroup->add( &m_minCommunication );
}
else if (m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED || m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED)
else if ( m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED ||
m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED )
{
regionGroup->add(&m_maxTof);
regionGroup->add( &m_maxTof );
}
}
{
caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup("Options");
optionsGroup->add(&m_flowDiagSolution);
caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup( "Options" );
optionsGroup->add( &m_flowDiagSolution );
optionsGroup->add(&m_showLegend);
optionsGroup->add(&m_maxPvFraction);
optionsGroup->add( &m_showLegend );
optionsGroup->add( &m_maxPvFraction );
}
uiOrdering.skipRemainingFields();
@@ -444,22 +448,22 @@ void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::Pdm
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute)
void RimFlowCharacteristicsPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if (field == &m_applyTimeSteps)
if ( field == &m_applyTimeSteps )
{
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>(attribute);
if (attrib)
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
if ( attrib )
{
attrib->m_buttonText = "Apply";
}
}
else if (field == &m_showRegion)
else if ( field == &m_showRegion )
{
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>(attribute);
if (attrib)
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
if ( attrib )
{
attrib->m_buttonText = "Show Region";
}
@@ -479,73 +483,76 @@ QWidget* RimFlowCharacteristicsPlot::viewWidget()
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::zoomAll()
{
if (m_flowCharPlotWidget) m_flowCharPlotWidget->zoomAll();
if ( m_flowCharPlotWidget ) m_flowCharPlotWidget->zoomAll();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
void RimFlowCharacteristicsPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
if (&m_case == changedField)
if ( &m_case == changedField )
{
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
m_currentlyPlottedTimeSteps.clear();
if (!m_case()->reservoirViews.empty())
if ( !m_case()->reservoirViews.empty() )
{
m_cellFilterView = m_case()->reservoirViews()[0];
}
}
else if (&m_applyTimeSteps == changedField)
else if ( &m_applyTimeSteps == changedField )
{
if (m_flowDiagSolution)
if ( m_flowDiagSolution )
{
// Compute any missing time steps from selected
for (int tsIdx : m_selectedTimeStepsUi())
for ( int tsIdx : m_selectedTimeStepsUi() )
{
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux(tsIdx);
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux( tsIdx );
}
m_selectedTimeSteps = m_selectedTimeStepsUi;
}
m_applyTimeSteps = false;
}
else if (&m_showRegion == changedField)
else if ( &m_showRegion == changedField )
{
if (m_case)
if ( m_case )
{
if (m_cellFilter() != RigFlowDiagResults::CELLS_ACTIVE)
if ( m_cellFilter() != RigFlowDiagResults::CELLS_ACTIVE )
{
RimEclipseView* view = RicSelectOrCreateViewFeatureImpl::showViewSelection(
m_case, "FlowCharacteristicsLastUsedView", "RegionView", "Show Region in View");
RimEclipseView* view =
RicSelectOrCreateViewFeatureImpl::showViewSelection( m_case,
"FlowCharacteristicsLastUsedView",
"RegionView",
"Show Region in View" );
if (view != nullptr)
if ( view != nullptr )
{
view->faultCollection()->showFaultCollection = false;
view->cellResult()->setResultType(RiaDefines::FLOW_DIAGNOSTICS);
view->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_BY_SELECTION);
view->cellResult()->setSelectedTracers(m_selectedTracerNames);
view->cellResult()->setResultType( RiaDefines::FLOW_DIAGNOSTICS );
view->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FLOW_TR_BY_SELECTION );
view->cellResult()->setSelectedTracers( m_selectedTracerNames );
if (m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION)
if ( m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION )
{
view->cellResult()->setResultVariable(RIG_FLD_COMMUNICATION_RESNAME);
view->cellResult()->setResultVariable( RIG_FLD_COMMUNICATION_RESNAME );
}
else
{
view->cellResult()->setResultVariable(RIG_FLD_TOF_RESNAME);
view->cellResult()->setResultVariable( RIG_FLD_TOF_RESNAME );
}
int timeStep = 0;
if (m_timeStepSelectionType() == ALL_AVAILABLE)
if ( m_timeStepSelectionType() == ALL_AVAILABLE )
{
if (m_flowDiagSolution)
if ( m_flowDiagSolution )
{
std::vector<int> timeSteps =
m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
if (!timeSteps.empty())
std::vector<int> timeSteps = m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps(
RigFlowDiagResultAddress::PHASE_ALL );
if ( !timeSteps.empty() )
{
timeStep = timeSteps[0];
}
@@ -553,32 +560,32 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
}
else
{
if (!m_selectedTimeStepsUi().empty())
if ( !m_selectedTimeStepsUi().empty() )
{
timeStep = m_selectedTimeStepsUi()[0];
}
}
// Ensure selected time step has computed results
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux(timeStep);
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux( timeStep );
view->setCurrentTimeStep(timeStep);
view->setCurrentTimeStep( timeStep );
for (RimEclipsePropertyFilter* f : view->eclipsePropertyFilterCollection()->propertyFilters())
for ( RimEclipsePropertyFilter* f : view->eclipsePropertyFilterCollection()->propertyFilters() )
{
f->isActive = false;
}
RicEclipsePropertyFilterFeatureImpl::addPropertyFilter(view->eclipsePropertyFilterCollection());
RicEclipsePropertyFilterFeatureImpl::addPropertyFilter( view->eclipsePropertyFilterCollection() );
view->loadDataAndUpdate();
m_case->updateConnectedEditors();
RicSelectOrCreateViewFeatureImpl::focusView(view);
RicSelectOrCreateViewFeatureImpl::focusView( view );
}
}
}
}
else if (changedField == &m_cellFilter)
else if ( changedField == &m_cellFilter )
{
m_selectedTracerNames = std::vector<QString>();
}
@@ -595,9 +602,9 @@ QImage RimFlowCharacteristicsPlot::snapshotWindowContent()
{
QImage image;
if (m_flowCharPlotWidget)
if ( m_flowCharPlotWidget )
{
QPixmap pix = QPixmap::grabWidget(m_flowCharPlotWidget);
QPixmap pix = QPixmap::grabWidget( m_flowCharPlotWidget );
image = pix.toImage();
}
@@ -611,18 +618,18 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
{
updateMdiWindowVisibility();
if (m_flowDiagSolution && m_flowCharPlotWidget)
if ( m_flowDiagSolution && m_flowCharPlotWidget )
{
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
{
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps( RigFlowDiagResultAddress::PHASE_ALL );
if (m_timeStepSelectionType == SELECTED)
if ( m_timeStepSelectionType == SELECTED )
{
for (int tsIdx : m_selectedTimeSteps())
for ( int tsIdx : m_selectedTimeSteps() )
{
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux(tsIdx);
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux( tsIdx );
}
calculatedTimesteps = m_selectedTimeSteps();
}
@@ -632,14 +639,14 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
QStringList timeStepStrings = m_case->timeStepStrings();
std::vector<double> lorenzVals(timeStepDates.size(), HUGE_VAL);
std::vector<double> lorenzVals( timeStepDates.size(), HUGE_VAL );
m_flowCharPlotWidget->removeAllCurves();
std::vector<QString> selectedTracerNames = m_selectedTracerNames();
if (m_cellFilter() == RigFlowDiagResults::CELLS_ACTIVE)
if ( m_cellFilter() == RigFlowDiagResults::CELLS_ACTIVE )
{
if (m_flowDiagSolution)
if ( m_flowDiagSolution )
{
selectedTracerNames = m_flowDiagSolution->tracerNames();
}
@@ -647,37 +654,44 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
std::map<int, RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame> timeStepToFlowResultMap;
for (int timeStepIdx : m_currentlyPlottedTimeSteps)
for ( int timeStepIdx : m_currentlyPlottedTimeSteps )
{
if (m_cellFilter() == RigFlowDiagResults::CELLS_VISIBLE)
if ( m_cellFilter() == RigFlowDiagResults::CELLS_VISIBLE )
{
cvf::UByteArray visibleCells;
m_case()->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
m_case()->eclipseCaseData()->activeCellInfo( RiaDefines::MATRIX_MODEL );
if (m_cellFilterView)
if ( m_cellFilterView )
{
m_cellFilterView()->calculateCurrentTotalCellVisibility(&visibleCells, timeStepIdx);
m_cellFilterView()->calculateCurrentTotalCellVisibility( &visibleCells, timeStepIdx );
}
RigActiveCellInfo* activeCellInfo = m_case()->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
std::vector<char> visibleActiveCells(activeCellInfo->reservoirActiveCellCount(), 0);
RigActiveCellInfo* activeCellInfo = m_case()->eclipseCaseData()->activeCellInfo(
RiaDefines::MATRIX_MODEL );
std::vector<char> visibleActiveCells( activeCellInfo->reservoirActiveCellCount(), 0 );
for (size_t i = 0; i < visibleCells.size(); ++i)
for ( size_t i = 0; i < visibleCells.size(); ++i )
{
size_t cellIndex = activeCellInfo->cellResultIndex(i);
if (cellIndex != cvf::UNDEFINED_SIZE_T)
size_t cellIndex = activeCellInfo->cellResultIndex( i );
if ( cellIndex != cvf::UNDEFINED_SIZE_T )
{
visibleActiveCells[cellIndex] = visibleCells[i];
}
}
auto flowCharResults = flowResult->flowCharacteristicsResults(timeStepIdx, visibleActiveCells, m_maxPvFraction());
auto flowCharResults = flowResult->flowCharacteristicsResults( timeStepIdx,
visibleActiveCells,
m_maxPvFraction() );
timeStepToFlowResultMap[timeStepIdx] = flowCharResults;
}
else
{
auto flowCharResults = flowResult->flowCharacteristicsResults(
timeStepIdx, m_cellFilter(), selectedTracerNames, m_maxPvFraction(), m_minCommunication(), m_maxTof());
auto flowCharResults = flowResult->flowCharacteristicsResults( timeStepIdx,
m_cellFilter(),
selectedTracerNames,
m_maxPvFraction(),
m_minCommunication(),
m_maxTof() );
timeStepToFlowResultMap[timeStepIdx] = flowCharResults;
}
lorenzVals[timeStepIdx] = timeStepToFlowResultMap[timeStepIdx].m_lorenzCoefficient;
@@ -685,21 +699,21 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
m_timeStepToFlowResultMap = timeStepToFlowResultMap;
m_flowCharPlotWidget->setLorenzCurve(timeStepStrings, timeStepDates, lorenzVals);
m_flowCharPlotWidget->setLorenzCurve( timeStepStrings, timeStepDates, lorenzVals );
for (int timeStepIdx : m_currentlyPlottedTimeSteps)
for ( int timeStepIdx : m_currentlyPlottedTimeSteps )
{
const auto& flowCharResults = timeStepToFlowResultMap[timeStepIdx];
m_flowCharPlotWidget->addFlowCapStorageCapCurve(timeStepDates[timeStepIdx],
flowCharResults.m_storageCapFlowCapCurve.first,
flowCharResults.m_storageCapFlowCapCurve.second);
m_flowCharPlotWidget->addSweepEfficiencyCurve(timeStepDates[timeStepIdx],
flowCharResults.m_dimensionlessTimeSweepEfficiencyCurve.first,
flowCharResults.m_dimensionlessTimeSweepEfficiencyCurve.second);
m_flowCharPlotWidget->addFlowCapStorageCapCurve( timeStepDates[timeStepIdx],
flowCharResults.m_storageCapFlowCapCurve.first,
flowCharResults.m_storageCapFlowCapCurve.second );
m_flowCharPlotWidget->addSweepEfficiencyCurve( timeStepDates[timeStepIdx],
flowCharResults.m_dimensionlessTimeSweepEfficiencyCurve.first,
flowCharResults.m_dimensionlessTimeSweepEfficiencyCurve.second );
}
m_flowCharPlotWidget->showLegend(m_showLegend());
m_flowCharPlotWidget->showLegend( m_showLegend() );
}
}
@@ -708,7 +722,7 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
//--------------------------------------------------------------------------------------------------
void RimFlowCharacteristicsPlot::viewGeometryUpdated()
{
if (m_cellFilter() == RigFlowDiagResults::CELLS_VISIBLE)
if ( m_cellFilter() == RigFlowDiagResults::CELLS_VISIBLE )
{
// Only need to reload data if cell filtering is based on visible cells in view.
onLoadDataAndUpdate();
@@ -718,18 +732,18 @@ void RimFlowCharacteristicsPlot::viewGeometryUpdated()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double interpolate(std::vector<double>& xData, std::vector<double>& yData, double x, bool extrapolate)
double interpolate( std::vector<double>& xData, std::vector<double>& yData, double x, bool extrapolate )
{
size_t itemCount = xData.size();
size_t index = 0;
if (x >= xData[itemCount - 2])
if ( x >= xData[itemCount - 2] )
{
index = itemCount - 2;
}
else
{
while (x > xData[index + 1])
while ( x > xData[index + 1] )
index++;
}
double xLeft = xData[index];
@@ -737,15 +751,15 @@ double interpolate(std::vector<double>& xData, std::vector<double>& yData, doubl
double xRight = xData[index + 1];
double yRight = yData[index + 1];
if (!extrapolate)
if ( !extrapolate )
{
if (x < xLeft) yRight = yLeft;
if (x > xRight) yLeft = yRight;
if ( x < xLeft ) yRight = yLeft;
if ( x > xRight ) yLeft = yRight;
}
double dydx = (yRight - yLeft) / (xRight - xLeft);
double dydx = ( yRight - yLeft ) / ( xRight - xLeft );
return yLeft + dydx * (x - xLeft);
return yLeft + dydx * ( x - xLeft );
}
//--------------------------------------------------------------------------------------------------
@@ -756,42 +770,45 @@ QString RimFlowCharacteristicsPlot::curveDataAsText() const
QString fieldSeparator = RiaApplication::instance()->preferences()->csvTextExportFieldSeparator;
QString tableText;
QTextStream stream(&tableText);
RifCsvDataTableFormatter formatter(stream, fieldSeparator);
QTextStream stream( &tableText );
RifCsvDataTableFormatter formatter( stream, fieldSeparator );
std::vector<RifEclipseOutputTableColumn> header = {
RifEclipseOutputTableColumn("Date"),
RifEclipseOutputTableColumn("StorageCapacity"),
RifEclipseOutputTableColumn("FlowCapacity"),
RifEclipseOutputTableColumn("SweepEfficiency"),
RifEclipseOutputTableColumn("DimensionlessTime"),
RifEclipseOutputTableColumn("LorentzCoefficient"),
RifEclipseOutputTableColumn( "Date" ),
RifEclipseOutputTableColumn( "StorageCapacity" ),
RifEclipseOutputTableColumn( "FlowCapacity" ),
RifEclipseOutputTableColumn( "SweepEfficiency" ),
RifEclipseOutputTableColumn( "DimensionlessTime" ),
RifEclipseOutputTableColumn( "LorentzCoefficient" ),
};
formatter.header(header);
formatter.header( header );
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
std::vector<double> storageCapacitySamplingValues = {0.08, 0.1, 0.2, 0.3, 0.4};
size_t sampleCount = storageCapacitySamplingValues.size();
for (const auto& timeIndex : m_currentlyPlottedTimeSteps)
for ( const auto& timeIndex : m_currentlyPlottedTimeSteps )
{
QString dateString = timeStepDates[timeIndex].toString("yyyy-MM-dd");
QString dateString = timeStepDates[timeIndex].toString( "yyyy-MM-dd" );
auto a = m_timeStepToFlowResultMap.find(timeIndex);
if (a != m_timeStepToFlowResultMap.end())
auto a = m_timeStepToFlowResultMap.find( timeIndex );
if ( a != m_timeStepToFlowResultMap.end() )
{
auto storageCapacityValues = a->second.m_storageCapFlowCapCurve.first;
auto flowCapacityValues = a->second.m_storageCapFlowCapCurve.second;
bool extrapolate = false;
std::vector<double> flowCapacitySamplingValues;
for (const auto storageCapacity : storageCapacitySamplingValues)
for ( const auto storageCapacity : storageCapacitySamplingValues )
{
{
double flowCapacity = interpolate(storageCapacityValues, flowCapacityValues, storageCapacity, extrapolate);
flowCapacitySamplingValues.push_back(flowCapacity);
double flowCapacity = interpolate( storageCapacityValues,
flowCapacityValues,
storageCapacity,
extrapolate );
flowCapacitySamplingValues.push_back( flowCapacity );
}
}
@@ -802,24 +819,27 @@ QString RimFlowCharacteristicsPlot::curveDataAsText() const
std::vector<double> sweepEffSamplingValues;
double range = dimensionLessTimeValues.back() - dimensionLessTimeValues[0];
double step = range / sampleCount;
for (size_t i = 0; i < sampleCount; i++)
for ( size_t i = 0; i < sampleCount; i++ )
{
double dimensionLessTimeValue = i * step;
dimensionLessTimeSamplingValues.push_back(dimensionLessTimeValue);
double sweepEffValue = interpolate(dimensionLessTimeValues, sweepEffValues, dimensionLessTimeValue, extrapolate);
sweepEffSamplingValues.push_back(sweepEffValue);
dimensionLessTimeSamplingValues.push_back( dimensionLessTimeValue );
double sweepEffValue = interpolate( dimensionLessTimeValues,
sweepEffValues,
dimensionLessTimeValue,
extrapolate );
sweepEffSamplingValues.push_back( sweepEffValue );
}
auto lorentz = a->second.m_lorenzCoefficient;
for (size_t i = 0; i < sampleCount; i++)
for ( size_t i = 0; i < sampleCount; i++ )
{
formatter.add(dateString);
formatter.add(storageCapacitySamplingValues[i]);
formatter.add(flowCapacitySamplingValues[i]);
formatter.add(sweepEffSamplingValues[i]);
formatter.add(dimensionLessTimeSamplingValues[i]);
formatter.add(lorentz);
formatter.add( dateString );
formatter.add( storageCapacitySamplingValues[i] );
formatter.add( flowCapacitySamplingValues[i] );
formatter.add( sweepEffSamplingValues[i] );
formatter.add( dimensionLessTimeSamplingValues[i] );
formatter.add( lorentz );
formatter.rowCompleted();
}
}
@@ -833,8 +853,8 @@ QString RimFlowCharacteristicsPlot::curveDataAsText() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimFlowCharacteristicsPlot::createViewWidget(QWidget* mainWindowParent)
QWidget* RimFlowCharacteristicsPlot::createViewWidget( QWidget* mainWindowParent )
{
m_flowCharPlotWidget = new RiuFlowCharacteristicsPlot(this, mainWindowParent);
m_flowCharPlotWidget = new RiuFlowCharacteristicsPlot( this, mainWindowParent );
return m_flowCharPlotWidget;
}

View File

@@ -1,24 +1,23 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimViewWindow.h"
#include "RigFlowDiagResults.h"
@@ -35,18 +34,19 @@ class RimEclipseView;
class RiuFlowCharacteristicsPlot;
namespace caf {
class PdmOptionItemInfo;
namespace caf
{
class PdmOptionItemInfo;
}
namespace cvf {
class Color3f;
namespace cvf
{
class Color3f;
}
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimFlowCharacteristicsPlot : public RimViewWindow
{
@@ -56,65 +56,68 @@ public:
RimFlowCharacteristicsPlot();
~RimFlowCharacteristicsPlot() override;
void setFromFlowSolution(RimFlowDiagSolution* flowSolution);
void updateCurrentTimeStep();
void setFromFlowSolution( RimFlowDiagSolution* flowSolution );
void updateCurrentTimeStep();
// RimViewWindow overrides
QWidget* viewWidget() override;
void zoomAll() override;
QWidget* createViewWidget(QWidget* mainWindowParent) override;
void deleteViewWidget() override;
void viewGeometryUpdated();
QWidget* viewWidget() override;
void zoomAll() override;
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;
void viewGeometryUpdated();
QString curveDataAsText() const;
QString curveDataAsText() const;
enum TimeSelectionType
enum TimeSelectionType
{
ALL_AVAILABLE,
SELECTED,
};
void setTimeSteps(const std::vector<int>& timeSteps);
void setInjectorsAndProducers(const std::vector<QString>& injectors, const std::vector<QString>& producers);
void setMinimumCommunication(double minimumCommunication);
void setAquiferCellThreshold(double aquiferCellThreshold);
void setTimeSteps( const std::vector<int>& timeSteps );
void setInjectorsAndProducers( const std::vector<QString>& injectors, const std::vector<QString>& producers );
void setMinimumCommunication( double minimumCommunication );
void setAquiferCellThreshold( double aquiferCellThreshold );
protected:
// RimViewWindow overrides
QImage snapshotWindowContent() override;
QImage snapshotWindowContent() override;
// Overridden PDM methods
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
void onLoadDataAndUpdate() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void onLoadDataAndUpdate() override;
private:
caf::PdmPtrField<RimEclipseResultCase*> m_case;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
caf::PdmField<caf::AppEnum<TimeSelectionType> > m_timeStepSelectionType;
caf::PdmField<std::vector<int> > m_selectedTimeSteps;
caf::PdmField<std::vector<int> > m_selectedTimeStepsUi;
caf::PdmField<bool> m_applyTimeSteps;
caf::PdmField<bool> m_showLegend;
caf::PdmField<double> m_maxPvFraction;
caf::PdmPtrField<RimEclipseResultCase*> m_case;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
caf::PdmField<caf::AppEnum<TimeSelectionType>> m_timeStepSelectionType;
caf::PdmField<std::vector<int>> m_selectedTimeSteps;
caf::PdmField<std::vector<int>> m_selectedTimeStepsUi;
caf::PdmField<bool> m_applyTimeSteps;
caf::PdmField<bool> m_showLegend;
caf::PdmField<double> m_maxPvFraction;
caf::PdmField<RigFlowDiagResults::CellFilterEnum> m_cellFilter;
caf::PdmPtrField<RimEclipseView*> m_cellFilterView;
caf::PdmField<QString> m_tracerFilter;
caf::PdmField< std::vector<QString> > m_selectedTracerNames;
caf::PdmField<bool> m_showRegion;
caf::PdmPtrField<RimEclipseView*> m_cellFilterView;
caf::PdmField<QString> m_tracerFilter;
caf::PdmField<std::vector<QString>> m_selectedTracerNames;
caf::PdmField<bool> m_showRegion;
caf::PdmField<double> m_minCommunication;
caf::PdmField<int> m_maxTof;
caf::PdmField<double> m_minCommunication;
caf::PdmField<int> m_maxTof;
std::vector<int> m_currentlyPlottedTimeSteps;
std::vector<int> m_currentlyPlottedTimeSteps;
std::map<int, RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame> m_timeStepToFlowResultMap;
QPointer<RiuFlowCharacteristicsPlot> m_flowCharPlotWidget;
QPointer<RiuFlowCharacteristicsPlot> m_flowCharPlotWidget;
};

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -32,26 +32,26 @@
#include "RimEclipseView.h"
#include "RimSimWellInViewCollection.h"
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
CAF_PDM_SOURCE_INIT( RimFlowDiagSolution, "FlowDiagSolution" );
#define CROSS_FLOW_ENDING "-XF"
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimFlowDiagSolution::hasCrossFlowEnding(const QString& tracerName)
bool RimFlowDiagSolution::hasCrossFlowEnding( const QString& tracerName )
{
return tracerName.endsWith(CROSS_FLOW_ENDING);
return tracerName.endsWith( CROSS_FLOW_ENDING );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimFlowDiagSolution::removeCrossFlowEnding(const QString& tracerName)
QString RimFlowDiagSolution::removeCrossFlowEnding( const QString& tracerName )
{
if (tracerName.endsWith(CROSS_FLOW_ENDING))
if ( tracerName.endsWith( CROSS_FLOW_ENDING ) )
{
return tracerName.left(tracerName.size() - 3);
return tracerName.left( tracerName.size() - 3 );
}
else
{
@@ -60,32 +60,29 @@ QString RimFlowDiagSolution::removeCrossFlowEnding(const QString& tracerName)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimFlowDiagSolution::addCrossFlowEnding(const QString& wellName)
QString RimFlowDiagSolution::addCrossFlowEnding( const QString& wellName )
{
return wellName + CROSS_FLOW_ENDING;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::RimFlowDiagSolution(void)
RimFlowDiagSolution::RimFlowDiagSolution( void )
{
CAF_PDM_InitObject("Flow Diagnostics Solution", "", "", "");
CAF_PDM_InitField(&m_userDescription, "UserDescription", QString("All Wells") ,"Description", "", "","");
CAF_PDM_InitObject( "Flow Diagnostics Solution", "", "", "" );
CAF_PDM_InitField( &m_userDescription, "UserDescription", QString( "All Wells" ), "Description", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::~RimFlowDiagSolution(void)
{
}
RimFlowDiagSolution::~RimFlowDiagSolution( void ) {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimFlowDiagSolution::userDescription() const
{
@@ -93,7 +90,7 @@ QString RimFlowDiagSolution::userDescription() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
{
@@ -102,38 +99,37 @@ RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
size_t timeStepCount;
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
CVF_ASSERT(eclCase && eclCase->eclipseCaseData() );
this->firstAncestorOrThisOfType( eclCase );
timeStepCount = eclCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->maxTimeStepCount();
CVF_ASSERT( eclCase && eclCase->eclipseCaseData() );
timeStepCount = eclCase->eclipseCaseData()->results( RiaDefines::MATRIX_MODEL )->maxTimeStepCount();
}
m_flowDiagResults = new RigFlowDiagResults(this, timeStepCount);
m_flowDiagResults = new RigFlowDiagResults( this, timeStepCount );
}
return m_flowDiagResults.p();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimFlowDiagSolution::tracerNames() const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType( eclCase );
std::vector<QString> tracerNameSet;
if (eclCase && eclCase->eclipseCaseData())
if ( eclCase && eclCase->eclipseCaseData() )
{
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
for (size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx)
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
{
tracerNameSet.push_back(simWellData[wIdx]->m_wellName);
tracerNameSet.push_back(addCrossFlowEnding(simWellData[wIdx]->m_wellName));
tracerNameSet.push_back( simWellData[wIdx]->m_wellName );
tracerNameSet.push_back( addCrossFlowEnding( simWellData[wIdx]->m_wellName ) );
}
}
@@ -141,77 +137,79 @@ std::vector<QString> RimFlowDiagSolution::tracerNames() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allInjectorTracerActiveCellIndices(size_t timeStepIndex) const
std::map<std::string, std::vector<int>> RimFlowDiagSolution::allInjectorTracerActiveCellIndices( size_t timeStepIndex ) const
{
return allTracerActiveCellIndices(timeStepIndex, true);
return allTracerActiveCellIndices( timeStepIndex, true );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allProducerTracerActiveCellIndices(size_t timeStepIndex) const
std::map<std::string, std::vector<int>> RimFlowDiagSolution::allProducerTracerActiveCellIndices( size_t timeStepIndex ) const
{
return allTracerActiveCellIndices(timeStepIndex, false);
return allTracerActiveCellIndices( timeStepIndex, false );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCellIndices(size_t timeStepIndex, bool useInjectors) const
std::map<std::string, std::vector<int>> RimFlowDiagSolution::allTracerActiveCellIndices( size_t timeStepIndex,
bool useInjectors ) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
this->firstAncestorOrThisOfType( eclCase );
std::map<std::string, std::vector<int> > tracersWithCells;
std::map<std::string, std::vector<int>> tracersWithCells;
if (eclCase && eclCase->eclipseCaseData())
if ( eclCase && eclCase->eclipseCaseData() )
{
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid();
RigActiveCellInfo* activeCellInfo = eclCase->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL); //Todo: Must come from the results definition
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid();
RigActiveCellInfo* activeCellInfo = eclCase->eclipseCaseData()->activeCellInfo(
RiaDefines::MATRIX_MODEL ); // Todo: Must come from the results definition
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
{
if (!simWellData[wIdx]->hasWellResult(timeStepIndex) ) continue;
const RigWellResultFrame& wellResFrame = simWellData[wIdx]->wellResultFrame(timeStepIndex);
bool isInjectorWell = ( wellResFrame.m_productionType != RigWellResultFrame::PRODUCER
&& wellResFrame.m_productionType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE);
if ( !simWellData[wIdx]->hasWellResult( timeStepIndex ) ) continue;
const RigWellResultFrame& wellResFrame = simWellData[wIdx]->wellResultFrame( timeStepIndex );
bool isInjectorWell = ( wellResFrame.m_productionType != RigWellResultFrame::PRODUCER &&
wellResFrame.m_productionType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE );
std::string wellName = simWellData[wIdx]->m_wellName.toStdString();
std::string wellNameXf = addCrossFlowEnding(simWellData[wIdx]->m_wellName).toStdString();
std::string wellNameXf = addCrossFlowEnding( simWellData[wIdx]->m_wellName ).toStdString();
std::vector<int>& tracerCells = tracersWithCells[wellName];
std::vector<int>& tracerCells = tracersWithCells[wellName];
std::vector<int>& tracerCellsCrossFlow = tracersWithCells[wellNameXf];
for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches)
for ( const RigWellResultBranch& wBr : wellResFrame.m_wellResultBranches )
{
for (const RigWellResultPoint& wrp: wBr.m_branchResultPoints)
for ( const RigWellResultPoint& wrp : wBr.m_branchResultPoints )
{
if (wrp.isValid() && wrp.m_isOpen
&& ( (useInjectors && wrp.flowRate() < 0.0) || (!useInjectors && wrp.flowRate() > 0.0) ) )
if ( wrp.isValid() && wrp.m_isOpen &&
( ( useInjectors && wrp.flowRate() < 0.0 ) || ( !useInjectors && wrp.flowRate() > 0.0 ) ) )
{
RigGridBase * grid = mainGrid->gridByIndex(wrp.m_gridIndex);
size_t reservoirCellIndex = grid->reservoirCellIndex(wrp.m_gridCellIndex);
RigGridBase* grid = mainGrid->gridByIndex( wrp.m_gridIndex );
size_t reservoirCellIndex = grid->reservoirCellIndex( wrp.m_gridCellIndex );
int cellActiveIndex = static_cast<int>(activeCellInfo->cellResultIndex(reservoirCellIndex));
int cellActiveIndex = static_cast<int>( activeCellInfo->cellResultIndex( reservoirCellIndex ) );
if ( useInjectors == isInjectorWell )
{
tracerCells.push_back(cellActiveIndex);
tracerCells.push_back( cellActiveIndex );
}
else
else
{
tracerCellsCrossFlow.push_back(cellActiveIndex);
tracerCellsCrossFlow.push_back( cellActiveIndex );
}
}
}
}
if (tracerCells.empty()) tracersWithCells.erase(wellName);
if (tracerCellsCrossFlow.empty()) tracersWithCells.erase(wellNameXf);
if ( tracerCells.empty() ) tracersWithCells.erase( wellName );
if ( tracerCellsCrossFlow.empty() ) tracersWithCells.erase( wellNameXf );
}
}
@@ -219,38 +217,42 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(const QString& tracerName) const
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall( const QString& tracerName ) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfTypeAsserted(eclCase);
this->firstAncestorOrThisOfTypeAsserted( eclCase );
TracerStatusType tracerStatus = UNDEFINED;
if (eclCase && eclCase->eclipseCaseData())
if ( eclCase && eclCase->eclipseCaseData() )
{
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
{
QString wellName = removeCrossFlowEnding(tracerName);
QString wellName = removeCrossFlowEnding( tracerName );
if ( simWellData[wIdx]->m_wellName != wellName ) continue;
tracerStatus = CLOSED;
for ( const RigWellResultFrame& wellResFrame : simWellData[wIdx]->m_wellCellsTimeSteps )
{
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR ||
wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR ||
wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
if ( tracerStatus == PRODUCER ) tracerStatus = VARYING;
else tracerStatus = INJECTOR;
if ( tracerStatus == PRODUCER )
tracerStatus = VARYING;
else
tracerStatus = INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
else tracerStatus = PRODUCER;
if ( tracerStatus == INJECTOR )
tracerStatus = VARYING;
else
tracerStatus = PRODUCER;
}
if ( tracerStatus == VARYING ) break;
}
@@ -258,10 +260,12 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(c
break;
}
if (hasCrossFlowEnding(tracerName))
if ( hasCrossFlowEnding( tracerName ) )
{
if (tracerStatus == PRODUCER) tracerStatus = INJECTOR;
else if (tracerStatus == INJECTOR) tracerStatus = PRODUCER;
if ( tracerStatus == PRODUCER )
tracerStatus = INJECTOR;
else if ( tracerStatus == INJECTOR )
tracerStatus = PRODUCER;
}
}
@@ -269,44 +273,45 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(c
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeStep(const QString& tracerName, size_t timeStepIndex) const
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeStep( const QString& tracerName,
size_t timeStepIndex ) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfTypeAsserted(eclCase);
this->firstAncestorOrThisOfTypeAsserted( eclCase );
if (eclCase && eclCase->eclipseCaseData())
if ( eclCase && eclCase->eclipseCaseData() )
{
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
{
QString wellName = removeCrossFlowEnding(tracerName);
QString wellName = removeCrossFlowEnding( tracerName );
if ( simWellData[wIdx]->m_wellName != wellName ) continue;
if (!simWellData[wIdx]->hasWellResult(timeStepIndex)) return CLOSED;
if ( !simWellData[wIdx]->hasWellResult( timeStepIndex ) ) return CLOSED;
const RigWellResultFrame& wellResFrame = simWellData[wIdx]->wellResultFrame(timeStepIndex);
const RigWellResultFrame& wellResFrame = simWellData[wIdx]->wellResultFrame( timeStepIndex );
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR ||
wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR ||
wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
if ( hasCrossFlowEnding(tracerName) ) return PRODUCER;
if ( hasCrossFlowEnding( tracerName ) ) return PRODUCER;
return INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER
|| wellResFrame.m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER ||
wellResFrame.m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
{
if ( hasCrossFlowEnding(tracerName) ) return INJECTOR;
if ( hasCrossFlowEnding( tracerName ) ) return INJECTOR;
return PRODUCER;
}
else
{
CVF_ASSERT(false);
CVF_ASSERT( false );
}
}
}
@@ -315,32 +320,31 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimFlowDiagSolution::tracerColor(const QString& tracerName) const
cvf::Color3f RimFlowDiagSolution::tracerColor( const QString& tracerName ) const
{
QString wellName = removeCrossFlowEnding(tracerName);
QString wellName = removeCrossFlowEnding( tracerName );
if (wellName == RIG_FLOW_TOTAL_NAME) return cvf::Color3f::LIGHT_GRAY;
if (wellName == RIG_RESERVOIR_TRACER_NAME) return cvf::Color3f::LIGHT_GRAY;
if (wellName == RIG_TINY_TRACER_GROUP_NAME) return cvf::Color3f::DARK_GRAY;
if ( wellName == RIG_FLOW_TOTAL_NAME ) return cvf::Color3f::LIGHT_GRAY;
if ( wellName == RIG_RESERVOIR_TRACER_NAME ) return cvf::Color3f::LIGHT_GRAY;
if ( wellName == RIG_TINY_TRACER_GROUP_NAME ) return cvf::Color3f::DARK_GRAY;
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
this->firstAncestorOrThisOfType( eclCase );
if ( eclCase )
{
return eclCase->defaultWellColor(wellName);
return eclCase->defaultWellColor( wellName );
}
return cvf::Color3f::LIGHT_GRAY;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimFlowDiagSolution::userDescriptionField()
{
return &m_userDescription;
}

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -21,51 +21,51 @@
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfColor3.h"
#include "cvfObject.h"
class RigFlowDiagResults;
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimFlowDiagSolution : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
CAF_PDM_HEADER_INIT;
public:
RimFlowDiagSolution();
~RimFlowDiagSolution() override;
QString userDescription() const;
RigFlowDiagResults* flowDiagResults();
std::vector<QString> tracerNames() const;
QString userDescription() const;
RigFlowDiagResults* flowDiagResults();
std::vector<QString> tracerNames() const;
std::map<std::string, std::vector<int> > allInjectorTracerActiveCellIndices(size_t timeStepIndex) const;
std::map<std::string, std::vector<int> > allProducerTracerActiveCellIndices(size_t timeStepIndex) const;
std::map<std::string, std::vector<int>> allInjectorTracerActiveCellIndices( size_t timeStepIndex ) const;
std::map<std::string, std::vector<int>> allProducerTracerActiveCellIndices( size_t timeStepIndex ) const;
enum TracerStatusType
{
CLOSED, ///< Tracer has no active cells, and does not contribute
PRODUCER, ///< Tracer with producing cells
INJECTOR, ///< Tracer with injecting cells
VARYING, ///< Tracer is producing and injecting at different time steps. Only used as a timestep-overall type
UNDEFINED ///< Used as "Any" or "not set"
CLOSED, ///< Tracer has no active cells, and does not contribute
PRODUCER, ///< Tracer with producing cells
INJECTOR, ///< Tracer with injecting cells
VARYING, ///< Tracer is producing and injecting at different time steps. Only used as a timestep-overall type
UNDEFINED ///< Used as "Any" or "not set"
};
TracerStatusType tracerStatusOverall(const QString& tracerName) const;
TracerStatusType tracerStatusInTimeStep(const QString& tracerName, size_t timeStepIndex) const;
cvf::Color3f tracerColor(const QString& tracerName) const;
TracerStatusType tracerStatusOverall( const QString& tracerName ) const;
TracerStatusType tracerStatusInTimeStep( const QString& tracerName, size_t timeStepIndex ) const;
cvf::Color3f tracerColor( const QString& tracerName ) const;
static bool hasCrossFlowEnding( const QString& tracerName );
static QString removeCrossFlowEnding( const QString& tracerName );
static QString addCrossFlowEnding( const QString& wellName );
static bool hasCrossFlowEnding(const QString& tracerName);
static QString removeCrossFlowEnding(const QString& tracerName);
static QString addCrossFlowEnding(const QString& wellName);
private:
std::map<std::string, std::vector<int> > allTracerActiveCellIndices(size_t timeStepIndex, bool useInjectors) const;
std::map<std::string, std::vector<int>> allTracerActiveCellIndices( size_t timeStepIndex, bool useInjectors ) const;
caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmField<QString> m_userDescription;
cvf::ref<RigFlowDiagResults> m_flowDiagResults;

View File

@@ -1,51 +1,60 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimFlowPlotCollection.h"
#include "RimWellAllocationPlot.h"
#include "RimFlowCharacteristicsPlot.h"
#include "RimWellAllocationPlot.h"
#include "cvfAssert.h"
#include "cafProgressInfo.h"
#include "cvfAssert.h"
CAF_PDM_SOURCE_INIT(RimFlowPlotCollection, "FlowPlotCollection");
CAF_PDM_SOURCE_INIT( RimFlowPlotCollection, "FlowPlotCollection" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowPlotCollection::RimFlowPlotCollection()
{
CAF_PDM_InitObject("Flow Diagnostics Plots", ":/WellAllocPlots16x16.png", "", "");
CAF_PDM_InitObject( "Flow Diagnostics Plots", ":/WellAllocPlots16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault(&m_flowCharacteristicsPlot, "FlowCharacteristicsPlot", "", "", "", "");
m_flowCharacteristicsPlot.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault( &m_flowCharacteristicsPlot, "FlowCharacteristicsPlot", "", "", "", "" );
m_flowCharacteristicsPlot.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault(&m_defaultWellAllocPlot, "DefaultWellAllocationPlot", "", "", "", "");
m_defaultWellAllocPlot.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault( &m_defaultWellAllocPlot, "DefaultWellAllocationPlot", "", "", "", "" );
m_defaultWellAllocPlot.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault(&m_storedWellAllocPlots, "StoredWellAllocationPlots", "Stored Well Allocation Plots", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_storedFlowCharacteristicsPlots, "StoredFlowCharacteristicsPlots", "Stored Flow Characteristics Plots", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_storedWellAllocPlots,
"StoredWellAllocationPlots",
"Stored Well Allocation Plots",
"",
"",
"" );
CAF_PDM_InitFieldNoDefault( &m_storedFlowCharacteristicsPlots,
"StoredFlowCharacteristicsPlots",
"Stored Flow Characteristics Plots",
"",
"",
"" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowPlotCollection::~RimFlowPlotCollection()
{
@@ -55,7 +64,7 @@ RimFlowPlotCollection::~RimFlowPlotCollection()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
{
@@ -64,7 +73,7 @@ void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
m_defaultWellAllocPlot->removeFromMdiAreaAndDeleteViewWidget();
delete m_defaultWellAllocPlot();
}
delete m_flowCharacteristicsPlot;
m_storedWellAllocPlots.deleteAllChildObjects();
@@ -72,70 +81,70 @@ void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowPlotCollection::loadDataAndUpdate()
{
caf::ProgressInfo plotProgress(m_storedWellAllocPlots.size() + m_storedFlowCharacteristicsPlots.size() + 1, "");
caf::ProgressInfo plotProgress( m_storedWellAllocPlots.size() + m_storedFlowCharacteristicsPlots.size() + 1, "" );
if (m_defaultWellAllocPlot) m_defaultWellAllocPlot->loadDataAndUpdate();
if ( m_defaultWellAllocPlot ) m_defaultWellAllocPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
for (RimWellAllocationPlot* p : m_storedWellAllocPlots)
for ( RimWellAllocationPlot* p : m_storedWellAllocPlots )
{
p->loadDataAndUpdate();
plotProgress.incrementProgress();
}
for (RimFlowCharacteristicsPlot* p : m_storedFlowCharacteristicsPlots)
for ( RimFlowCharacteristicsPlot* p : m_storedFlowCharacteristicsPlots )
{
p->loadDataAndUpdate();
plotProgress.incrementProgress();
}
if (m_flowCharacteristicsPlot)
if ( m_flowCharacteristicsPlot )
{
m_flowCharacteristicsPlot->loadDataAndUpdate();
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
size_t RimFlowPlotCollection::plotCount() const
{
size_t plotCount = 0;
if (m_defaultWellAllocPlot) plotCount = 1;
if ( m_defaultWellAllocPlot ) plotCount = 1;
plotCount += m_storedWellAllocPlots.size();
plotCount += m_storedFlowCharacteristicsPlots.size();
return plotCount;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowPlotCollection::addWellAllocPlotToStoredPlots(RimWellAllocationPlot* plot)
void RimFlowPlotCollection::addWellAllocPlotToStoredPlots( RimWellAllocationPlot* plot )
{
m_storedWellAllocPlots.push_back(plot);
m_storedWellAllocPlots.push_back( plot );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimFlowPlotCollection::addFlowCharacteristicsPlotToStoredPlots(RimFlowCharacteristicsPlot* plot)
void RimFlowPlotCollection::addFlowCharacteristicsPlotToStoredPlots( RimFlowCharacteristicsPlot* plot )
{
m_storedFlowCharacteristicsPlots.push_back(plot);
m_storedFlowCharacteristicsPlots.push_back( plot );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlot* RimFlowPlotCollection::defaultWellAllocPlot()
{
if ( !m_defaultWellAllocPlot() )
if ( !m_defaultWellAllocPlot() )
{
m_defaultWellAllocPlot = new RimWellAllocationPlot;
m_defaultWellAllocPlot->setDescription("Default Flow Diagnostics Plot");
m_defaultWellAllocPlot = new RimWellAllocationPlot;
m_defaultWellAllocPlot->setDescription( "Default Flow Diagnostics Plot" );
}
this->updateConnectedEditors();
@@ -144,16 +153,16 @@ RimWellAllocationPlot* RimFlowPlotCollection::defaultWellAllocPlot()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimFlowCharacteristicsPlot* RimFlowPlotCollection::defaultFlowCharacteristicsPlot()
{
if ( !m_flowCharacteristicsPlot() )
if ( !m_flowCharacteristicsPlot() )
{
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
}
this->updateConnectedEditors();
return m_flowCharacteristicsPlot();
return m_flowCharacteristicsPlot();
}

View File

@@ -1,53 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmObject.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
#include "cafPdmObject.h"
class RimWellAllocationPlot;
class RimFlowCharacteristicsPlot;
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimFlowPlotCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimFlowPlotCollection();
~RimFlowPlotCollection() override;
void closeDefaultPlotWindowAndDeletePlots();
void loadDataAndUpdate();
void closeDefaultPlotWindowAndDeletePlots();
void loadDataAndUpdate();
size_t plotCount() const;
void addWellAllocPlotToStoredPlots(RimWellAllocationPlot* plot);
void addFlowCharacteristicsPlotToStoredPlots(RimFlowCharacteristicsPlot* plot);
RimWellAllocationPlot* defaultWellAllocPlot();
void addWellAllocPlotToStoredPlots( RimWellAllocationPlot* plot );
void addFlowCharacteristicsPlotToStoredPlots( RimFlowCharacteristicsPlot* plot );
RimWellAllocationPlot* defaultWellAllocPlot();
RimFlowCharacteristicsPlot* defaultFlowCharacteristicsPlot();
private:
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
caf::PdmChildField<RimWellAllocationPlot*> m_defaultWellAllocPlot;
caf::PdmChildArrayField<RimWellAllocationPlot*> m_storedWellAllocPlots;
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
caf::PdmChildField<RimWellAllocationPlot*> m_defaultWellAllocPlot;
caf::PdmChildArrayField<RimWellAllocationPlot*> m_storedWellAllocPlots;
caf::PdmChildArrayField<RimFlowCharacteristicsPlot*> m_storedFlowCharacteristicsPlots;
};

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -36,44 +36,47 @@
#include "cvfColor3.h"
CAF_PDM_SOURCE_INIT(RimTofAccumulatedPhaseFractionsPlot, "TofAccumulatedPhaseFractionsPlot");
CAF_PDM_SOURCE_INIT( RimTofAccumulatedPhaseFractionsPlot, "TofAccumulatedPhaseFractionsPlot" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimTofAccumulatedPhaseFractionsPlot::RimTofAccumulatedPhaseFractionsPlot()
{
CAF_PDM_InitObject("Cumulative Saturation by Time of Flight", ":/TOFAccSatPlot16x16.png", "", "");
CAF_PDM_InitObject( "Cumulative Saturation by Time of Flight", ":/TOFAccSatPlot16x16.png", "", "" );
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Cumulative Saturation by Time of Flight"), "Name", "", "", "");
m_userName.uiCapability()->setUiHidden(true);
CAF_PDM_InitField( &m_userName,
"PlotDescription",
QString( "Cumulative Saturation by Time of Flight" ),
"Name",
"",
"",
"" );
m_userName.uiCapability()->setUiHidden( true );
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
m_showPlotTitle.uiCapability()->setUiHidden(true);
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
m_showPlotTitle.uiCapability()->setUiHidden( true );
CAF_PDM_InitField(&m_maxTof, "MaxTof", 50, "Max Time of Flight [year]", "", "", "");
CAF_PDM_InitField( &m_maxTof, "MaxTof", 50, "Max Time of Flight [year]", "", "", "" );
m_showWindow = false;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimTofAccumulatedPhaseFractionsPlot::~RimTofAccumulatedPhaseFractionsPlot()
{
removeMdiWindowFromMdiArea();
deleteViewWidget();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::deleteViewWidget()
{
if (m_tofAccumulatedPhaseFractionsPlotWidget)
if ( m_tofAccumulatedPhaseFractionsPlotWidget )
{
m_tofAccumulatedPhaseFractionsPlotWidget->deleteLater();
m_tofAccumulatedPhaseFractionsPlotWidget = nullptr;
@@ -81,7 +84,7 @@ void RimTofAccumulatedPhaseFractionsPlot::deleteViewWidget()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::reloadFromWell()
{
@@ -89,40 +92,40 @@ void RimTofAccumulatedPhaseFractionsPlot::reloadFromWell()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultCase* RimTofAccumulatedPhaseFractionsPlot::resultCase()
{
RimWellAllocationPlot* allocationPlot;
firstAncestorOrThisOfTypeAsserted(allocationPlot);
firstAncestorOrThisOfTypeAsserted( allocationPlot );
return allocationPlot->rimCase();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimTofAccumulatedPhaseFractionsPlot::tracerName()
{
RimWellAllocationPlot* allocationPlot;
firstAncestorOrThisOfTypeAsserted(allocationPlot);
firstAncestorOrThisOfTypeAsserted( allocationPlot );
return allocationPlot->wellName();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
size_t RimTofAccumulatedPhaseFractionsPlot::timeStep()
{
RimWellAllocationPlot* allocationPlot;
firstAncestorOrThisOfTypeAsserted(allocationPlot);
firstAncestorOrThisOfTypeAsserted( allocationPlot );
return static_cast<size_t>(allocationPlot->timeStep());
return static_cast<size_t>( allocationPlot->timeStep() );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QWidget* RimTofAccumulatedPhaseFractionsPlot::viewWidget()
{
@@ -130,35 +133,31 @@ QWidget* RimTofAccumulatedPhaseFractionsPlot::viewWidget()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::zoomAll()
void RimTofAccumulatedPhaseFractionsPlot::zoomAll() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
}
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
if (changedField == &m_userName ||
changedField == &m_showPlotTitle)
if ( changedField == &m_userName || changedField == &m_showPlotTitle )
{
updateMdiWindowTitle();
}
else if (changedField == &m_maxTof)
else if ( changedField == &m_maxTof )
{
onLoadDataAndUpdate();
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QImage RimTofAccumulatedPhaseFractionsPlot::snapshotWindowContent()
{
@@ -170,16 +169,16 @@ QImage RimTofAccumulatedPhaseFractionsPlot::snapshotWindowContent()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::setDescription(const QString& description)
void RimTofAccumulatedPhaseFractionsPlot::setDescription( const QString& description )
{
m_userName = description;
this->updateMdiWindowTitle();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimTofAccumulatedPhaseFractionsPlot::description() const
{
@@ -187,35 +186,33 @@ QString RimTofAccumulatedPhaseFractionsPlot::description() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::onLoadDataAndUpdate()
{
updateMdiWindowVisibility();
if (m_tofAccumulatedPhaseFractionsPlotWidget && m_showWindow())
if ( m_tofAccumulatedPhaseFractionsPlotWidget && m_showWindow() )
{
RigTofAccumulatedPhaseFractionsCalculator calc(resultCase(), tracerName(), timeStep());
RigTofAccumulatedPhaseFractionsCalculator calc( resultCase(), tracerName(), timeStep() );
const std::vector<double>& xValues = calc.sortedUniqueTOFValues();
const std::vector<double>& xValues = calc.sortedUniqueTOFValues();
const std::vector<double>& watValues = calc.accumulatedPhaseFractionsSwat();
const std::vector<double>& oilValues = calc.accumulatedPhaseFractionsSoil();
const std::vector<double>& gasValues = calc.accumulatedPhaseFractionsSgas();
m_tofAccumulatedPhaseFractionsPlotWidget->setSamples(xValues, watValues, oilValues, gasValues, m_maxTof());
m_tofAccumulatedPhaseFractionsPlotWidget->setSamples( xValues, watValues, oilValues, gasValues, m_maxTof() );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QWidget* RimTofAccumulatedPhaseFractionsPlot::createViewWidget(QWidget* mainWindowParent)
QWidget* RimTofAccumulatedPhaseFractionsPlot::createViewWidget( QWidget* mainWindowParent )
{
if (!m_tofAccumulatedPhaseFractionsPlotWidget)
if ( !m_tofAccumulatedPhaseFractionsPlotWidget )
{
m_tofAccumulatedPhaseFractionsPlotWidget = new RiuTofAccumulatedPhaseFractionsPlot(this, mainWindowParent);
m_tofAccumulatedPhaseFractionsPlotWidget = new RiuTofAccumulatedPhaseFractionsPlot( this, mainWindowParent );
}
return m_tofAccumulatedPhaseFractionsPlotWidget;
}

View File

@@ -1,24 +1,23 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimViewWindow.h"
#include "cafPdmField.h"
@@ -34,18 +33,19 @@ class RimWellLogPlot;
class RiuTofAccumulatedPhaseFractionsPlot;
class RiuWellAllocationPlot;
namespace caf {
class PdmOptionItemInfo;
namespace caf
{
class PdmOptionItemInfo;
}
namespace cvf {
class Color3f;
namespace cvf
{
class Color3f;
}
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimTofAccumulatedPhaseFractionsPlot : public RimViewWindow
{
@@ -55,36 +55,41 @@ public:
RimTofAccumulatedPhaseFractionsPlot();
~RimTofAccumulatedPhaseFractionsPlot() override;
void setDescription(const QString& description);
QString description() const;
void setDescription( const QString& description );
QString description() const;
// RimViewWindow overrides
QWidget* viewWidget() override;
void zoomAll() override;
QWidget* createViewWidget(QWidget* mainWindowParent) override;
void deleteViewWidget() override;
QWidget* viewWidget() override;
void zoomAll() override;
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;
void reloadFromWell();
void reloadFromWell();
RimEclipseResultCase* resultCase();
QString tracerName();
size_t timeStep();
RimEclipseResultCase* resultCase();
QString tracerName();
size_t timeStep();
protected:
// RimViewWindow overrides
void onLoadDataAndUpdate() override;
QImage snapshotWindowContent() override;
void onLoadDataAndUpdate() override;
QImage snapshotWindowContent() override;
// Overridden PDM methods
caf::PdmFieldHandle* userDescriptionField() override { return &m_userName; }
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
caf::PdmFieldHandle* userDescriptionField() override
{
return &m_userName;
}
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
caf::PdmField<int> m_maxTof;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
caf::PdmField<int> m_maxTof;
QPointer<RiuTofAccumulatedPhaseFractionsPlot> m_tofAccumulatedPhaseFractionsPlotWidget;
QPointer<RiuTofAccumulatedPhaseFractionsPlot> m_tofAccumulatedPhaseFractionsPlotWidget;
};

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -28,55 +28,51 @@
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RiuPlotMainWindow.h"
#include "RiuNightchartsWidget.h"
#include "RiuPlotMainWindow.h"
#include "RiuWellAllocationPlot.h"
#include "cvfColor3.h"
CAF_PDM_SOURCE_INIT(RimTotalWellAllocationPlot, "TotalWellAllocationPlot");
CAF_PDM_SOURCE_INIT( RimTotalWellAllocationPlot, "TotalWellAllocationPlot" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimTotalWellAllocationPlot::RimTotalWellAllocationPlot()
{
CAF_PDM_InitObject("Total Allocation", ":/WellAllocPie16x16.png", "", "");
CAF_PDM_InitObject( "Total Allocation", ":/WellAllocPie16x16.png", "", "" );
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Total Allocation"), "Name", "", "", "");
m_userName.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Total Allocation" ), "Name", "", "", "" );
m_userName.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimTotalWellAllocationPlot::~RimTotalWellAllocationPlot()
{
removeMdiWindowFromMdiArea();
deleteViewWidget();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::deleteViewWidget()
{
if (m_wellTotalAllocationPlotWidget)
if ( m_wellTotalAllocationPlotWidget )
{
m_wellTotalAllocationPlotWidget->deleteLater();
m_wellTotalAllocationPlotWidget= nullptr;
m_wellTotalAllocationPlotWidget = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QWidget* RimTotalWellAllocationPlot::viewWidget()
{
@@ -84,31 +80,27 @@ QWidget* RimTotalWellAllocationPlot::viewWidget()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::zoomAll()
void RimTotalWellAllocationPlot::zoomAll() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
}
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
if (changedField == &m_userName ||
changedField == &m_showPlotTitle)
if ( changedField == &m_userName || changedField == &m_showPlotTitle )
{
updateMdiWindowTitle();
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QImage RimTotalWellAllocationPlot::snapshotWindowContent()
{
@@ -120,35 +112,34 @@ QImage RimTotalWellAllocationPlot::snapshotWindowContent()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::setDescription(const QString& description)
void RimTotalWellAllocationPlot::setDescription( const QString& description )
{
m_userName = description;
this->updateMdiWindowTitle();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimTotalWellAllocationPlot::description() const
{
return m_userName();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimTotalWellAllocationPlot::totalAllocationAsText() const
{
QString txt;
for (auto a : m_sliceInfo)
for ( auto a : m_sliceInfo )
{
txt += a.first;
txt += "\t";
txt += QString::number(a.second);
txt += QString::number( a.second );
txt += "\n";
}
@@ -156,24 +147,23 @@ QString RimTotalWellAllocationPlot::totalAllocationAsText() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::addSlice(const QString& name, const cvf::Color3f& color, float value)
void RimTotalWellAllocationPlot::addSlice( const QString& name, const cvf::Color3f& color, float value )
{
if ( m_wellTotalAllocationPlotWidget )
{
QColor sliceColor(color.rByte(), color.gByte(), color.bByte());
QColor sliceColor( color.rByte(), color.gByte(), color.bByte() );
m_wellTotalAllocationPlotWidget->addItem(name, sliceColor, value);
m_wellTotalAllocationPlotWidget->addItem( name, sliceColor, value );
m_wellTotalAllocationPlotWidget->update();
}
m_sliceInfo.push_back(std::make_pair(name, value));
m_sliceInfo.push_back( std::make_pair( name, value ) );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::clearSlices()
{
@@ -187,22 +177,19 @@ void RimTotalWellAllocationPlot::clearSlices()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::onLoadDataAndUpdate()
{
updateMdiWindowVisibility();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QWidget* RimTotalWellAllocationPlot::createViewWidget(QWidget* mainWindowParent)
QWidget* RimTotalWellAllocationPlot::createViewWidget( QWidget* mainWindowParent )
{
m_wellTotalAllocationPlotWidget = new RiuNightchartsWidget(mainWindowParent);
m_wellTotalAllocationPlotWidget->showLegend(false);
m_wellTotalAllocationPlotWidget = new RiuNightchartsWidget( mainWindowParent );
m_wellTotalAllocationPlotWidget->showLegend( false );
return m_wellTotalAllocationPlotWidget;
}

View File

@@ -1,24 +1,23 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimViewWindow.h"
#include "cafPdmField.h"
@@ -33,18 +32,19 @@ class RimWellLogPlot;
class RiuNightchartsWidget;
class RiuWellAllocationPlot;
namespace caf {
class PdmOptionItemInfo;
namespace caf
{
class PdmOptionItemInfo;
}
namespace cvf {
class Color3f;
namespace cvf
{
class Color3f;
}
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimTotalWellAllocationPlot : public RimViewWindow
{
@@ -54,34 +54,39 @@ public:
RimTotalWellAllocationPlot();
~RimTotalWellAllocationPlot() override;
void setDescription(const QString& description);
QString description() const;
QString totalAllocationAsText() const;
void setDescription( const QString& description );
QString description() const;
QString totalAllocationAsText() const;
void addSlice(const QString& name, const cvf::Color3f& color, float value);
void clearSlices();
void addSlice( const QString& name, const cvf::Color3f& color, float value );
void clearSlices();
// RimViewWindow overrides
QWidget* viewWidget() override;
void zoomAll() override;
QWidget* createViewWidget(QWidget* mainWindowParent) override;
void deleteViewWidget() override;
QWidget* viewWidget() override;
void zoomAll() override;
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;
protected:
// RimViewWindow overrides
void onLoadDataAndUpdate() override;
QImage snapshotWindowContent() override;
void onLoadDataAndUpdate() override;
QImage snapshotWindowContent() override;
// Overridden PDM methods
caf::PdmFieldHandle* userDescriptionField() override { return &m_userName; }
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
caf::PdmFieldHandle* userDescriptionField() override
{
return &m_userName;
}
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
QPointer<RiuNightchartsWidget> m_wellTotalAllocationPlotWidget;
QPointer<RiuNightchartsWidget> m_wellTotalAllocationPlotWidget;
std::vector<std::pair<QString, float> > m_sliceInfo;
std::vector<std::pair<QString, float>> m_sliceInfo;
};

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -19,28 +19,24 @@
#include "RimWellAllocationPlotLegend.h"
#include "RimWellAllocationPlot.h"
CAF_PDM_SOURCE_INIT(RimWellAllocationPlotLegend, "WellAllocationPlotLegend");
CAF_PDM_SOURCE_INIT( RimWellAllocationPlotLegend, "WellAllocationPlotLegend" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlotLegend::RimWellAllocationPlotLegend()
{
CAF_PDM_InitObject("Legend", ":/WellAllocLegend16x16.png", "", "");
CAF_PDM_InitField(&m_showLegend, "ShowPlotLegend", true, "Show Plot Legend", "", "", "");
CAF_PDM_InitObject( "Legend", ":/WellAllocLegend16x16.png", "", "" );
CAF_PDM_InitField( &m_showLegend, "ShowPlotLegend", true, "Show Plot Legend", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlotLegend::~RimWellAllocationPlotLegend()
{
}
RimWellAllocationPlotLegend::~RimWellAllocationPlotLegend() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellAllocationPlotLegend::objectToggleField()
{
@@ -48,16 +44,17 @@ caf::PdmFieldHandle* RimWellAllocationPlotLegend::objectToggleField()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlotLegend::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
void RimWellAllocationPlotLegend::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if (changedField == &m_showLegend)
if ( changedField == &m_showLegend )
{
RimWellAllocationPlot* walp;
firstAncestorOrThisOfType(walp);
firstAncestorOrThisOfType( walp );
if (walp) walp->showPlotLegend(m_showLegend());
if ( walp ) walp->showPlotLegend( m_showLegend() );
}
}

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
#include "cafPdmField.h"
#include "cafPdmObject.h"
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimWellAllocationPlotLegend : public caf::PdmObject
@@ -33,15 +33,17 @@ public:
RimWellAllocationPlotLegend();
~RimWellAllocationPlotLegend() override;
bool isShowingLegend() { return m_showLegend();}
bool isShowingLegend()
{
return m_showLegend();
}
protected:
caf::PdmFieldHandle* objectToggleField() override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
private:
caf::PdmField<bool> m_showLegend;
caf::PdmField<bool> m_showLegend;
};

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -34,34 +34,30 @@
#include <cmath>
//==================================================================================================
///
///
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellFlowRateCurve, "WellFlowRateCurve");
CAF_PDM_SOURCE_INIT( RimWellFlowRateCurve, "WellFlowRateCurve" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellFlowRateCurve::RimWellFlowRateCurve()
{
CAF_PDM_InitObject("Flow Rate Curve", "", "", "");
m_groupId = 0;
CAF_PDM_InitObject( "Flow Rate Curve", "", "", "" );
m_groupId = 0;
m_doFillCurve = true;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellFlowRateCurve::~RimWellFlowRateCurve()
{
}
RimWellFlowRateCurve::~RimWellFlowRateCurve() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimWellFlowRateCurve::wellName() const
{
@@ -69,7 +65,7 @@ QString RimWellFlowRateCurve::wellName() const
RimWellAllocationPlot* wap = wellAllocationPlot();
if (wap)
if ( wap )
{
name = wap->wellName();
}
@@ -82,7 +78,7 @@ QString RimWellFlowRateCurve::wellName() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimWellFlowRateCurve::wellLogChannelName() const
{
@@ -90,15 +86,15 @@ QString RimWellFlowRateCurve::wellLogChannelName() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::setGroupId(int groupId)
void RimWellFlowRateCurve::setGroupId( int groupId )
{
m_groupId = groupId;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
int RimWellFlowRateCurve::groupId() const
{
@@ -106,15 +102,15 @@ int RimWellFlowRateCurve::groupId() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::setDoFillCurve(bool doFill)
void RimWellFlowRateCurve::setDoFillCurve( bool doFill )
{
m_doFillCurve = doFill;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimWellFlowRateCurve::createCurveAutoName()
{
@@ -122,27 +118,26 @@ QString RimWellFlowRateCurve::createCurveAutoName()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::onLoadDataAndUpdate(bool updateParentPlot)
void RimWellFlowRateCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
this->RimPlotCurve::updateCurvePresentation(updateParentPlot);
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
if (isCurveVisible())
if ( isCurveVisible() )
{
m_qwtPlotCurve->setTitle(createCurveAutoName());
m_qwtPlotCurve->setTitle( createCurveAutoName() );
updateStackedPlotData();
updateZoomInParentPlot();
if (m_parentQwtPlot) m_parentQwtPlot->replot();
if ( m_parentQwtPlot ) m_parentQwtPlot->replot();
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::updateCurveAppearance()
{
@@ -151,116 +146,120 @@ void RimWellFlowRateCurve::updateCurveAppearance()
bool isLastCurveInGroup = false;
{
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfTypeAsserted(wellLogTrack);
firstAncestorOrThisOfTypeAsserted( wellLogTrack );
std::map<int, std::vector<RimWellFlowRateCurve*>> stackedCurveGroups = wellLogTrack->visibleStackedCurves();
const std::vector<RimWellFlowRateCurve*>& curveGroup = stackedCurveGroups[this->m_groupId];
isLastCurveInGroup = (curveGroup.back() == this);
const std::vector<RimWellFlowRateCurve*>& curveGroup = stackedCurveGroups[this->m_groupId];
isLastCurveInGroup = ( curveGroup.back() == this );
}
if ( isUsingConnectionNumberDepthType() )
{
m_qwtPlotCurve->setStyle(QwtPlotCurve::Steps);
m_qwtPlotCurve->setStyle( QwtPlotCurve::Steps );
}
if (m_doFillCurve || isLastCurveInGroup) // Fill the last curve in group with a transparent color to "tie" the group together
if ( m_doFillCurve ||
isLastCurveInGroup ) // Fill the last curve in group with a transparent color to "tie" the group together
{
QColor curveQColor = QColor (m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte());
QColor fillColor = curveQColor;
QColor lineColor = curveQColor.darker();
QColor curveQColor = QColor( m_curveColor.value().rByte(),
m_curveColor.value().gByte(),
m_curveColor.value().bByte() );
QColor fillColor = curveQColor;
QColor lineColor = curveQColor.darker();
if (!m_doFillCurve && isLastCurveInGroup)
{
fillColor = QColor(24, 16, 10, 50);
if ( !m_doFillCurve && isLastCurveInGroup )
{
fillColor = QColor( 24, 16, 10, 50 );
lineColor = curveQColor;
}
QLinearGradient gradient;
gradient.setCoordinateMode(QGradient::StretchToDeviceMode);
gradient.setColorAt(0, fillColor.darker(110));
gradient.setColorAt(0.15, fillColor);
gradient.setColorAt(0.25, fillColor);
gradient.setColorAt(0.4, fillColor.darker(110));
gradient.setColorAt(0.6, fillColor);
gradient.setColorAt(0.8, fillColor.darker(110));
gradient.setColorAt(1, fillColor);
m_qwtPlotCurve->setBrush(gradient);
gradient.setCoordinateMode( QGradient::StretchToDeviceMode );
gradient.setColorAt( 0, fillColor.darker( 110 ) );
gradient.setColorAt( 0.15, fillColor );
gradient.setColorAt( 0.25, fillColor );
gradient.setColorAt( 0.4, fillColor.darker( 110 ) );
gradient.setColorAt( 0.6, fillColor );
gradient.setColorAt( 0.8, fillColor.darker( 110 ) );
gradient.setColorAt( 1, fillColor );
m_qwtPlotCurve->setBrush( gradient );
QPen curvePen = m_qwtPlotCurve->pen();
curvePen.setColor(lineColor);
m_qwtPlotCurve->setPen(curvePen);
m_qwtPlotCurve->setOrientation(Qt::Horizontal);
m_qwtPlotCurve->setBaseline(0.0);
m_qwtPlotCurve->setCurveAttribute(QwtPlotCurve::Inverted, true);
curvePen.setColor( lineColor );
m_qwtPlotCurve->setPen( curvePen );
m_qwtPlotCurve->setOrientation( Qt::Horizontal );
m_qwtPlotCurve->setBaseline( 0.0 );
m_qwtPlotCurve->setCurveAttribute( QwtPlotCurve::Inverted, true );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimWellFlowRateCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add(&m_curveName);
m_curveName.uiCapability()->setUiReadOnly(true);
uiOrdering.add(&m_curveColor);
m_curveColor.uiCapability()->setUiReadOnly(true);
uiOrdering.add( &m_curveName );
m_curveName.uiCapability()->setUiReadOnly( true );
uiOrdering.add( &m_curveColor );
m_curveColor.uiCapability()->setUiReadOnly( true );
uiOrdering.skipRemainingFields();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::updateStackedPlotData()
{
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfTypeAsserted(wellLogPlot);
firstAncestorOrThisOfTypeAsserted( wellLogPlot );
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfTypeAsserted(wellLogTrack);
firstAncestorOrThisOfTypeAsserted( wellLogTrack );
bool isFirstTrack = (wellLogTrack == wellLogPlot->trackByIndex(0));
bool isFirstTrack = ( wellLogTrack == wellLogPlot->trackByIndex( 0 ) );
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_NONE;
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 hiding the things behind
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 hiding the things behind
// 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();
std::vector<RimWellFlowRateCurve*> stackedCurves;
if (stackedCurveGroups.count(groupId()) > 0)
if ( stackedCurveGroups.count( groupId() ) > 0 )
{
stackedCurves = stackedCurveGroups[groupId()];
}
std::vector<double> allDepthValues = m_curveData->measuredDepths();
std::vector<double> allStackedValues(allDepthValues.size());
std::vector<double> allStackedValues( allDepthValues.size() );
for (RimWellFlowRateCurve * stCurve : stackedCurves)
for ( RimWellFlowRateCurve* stCurve : stackedCurves )
{
std::vector<double> allValues = stCurve->curveData()->xValues();
for (size_t i = 0; i < allValues.size(); ++i)
for ( size_t i = 0; i < allValues.size(); ++i )
{
if (allValues[i] != HUGE_VAL)
if ( allValues[i] != HUGE_VAL )
{
allStackedValues[i] += allValues[i];
}
}
if (stCurve == this) break;
if ( stCurve == this ) break;
zPos -= 1.0;
}
RigWellLogCurveData tempCurveData;
tempCurveData.setValuesAndMD(allStackedValues, allDepthValues, RiaDefines::UNIT_NONE, false);
tempCurveData.setValuesAndMD( allStackedValues, allDepthValues, RiaDefines::UNIT_NONE, false );
depthValues = tempCurveData.measuredDepthPlotValues(displayUnit);
stackedValues = tempCurveData.xPlotValues();
depthValues = tempCurveData.measuredDepthPlotValues( displayUnit );
stackedValues = tempCurveData.xPlotValues();
polyLineStartStopIndices = tempCurveData.polylineStartStopIndices();
}
@@ -268,57 +267,57 @@ void RimWellFlowRateCurve::updateStackedPlotData()
if ( depthValues.size() ) // Should we really do this for all curve variants ?
{
depthValues.insert(depthValues.begin(), depthValues[0]);
stackedValues.insert(stackedValues.begin(), 0.0);
depthValues.insert( depthValues.begin(), depthValues[0] );
stackedValues.insert( stackedValues.begin(), 0.0 );
polyLineStartStopIndices.front().second += 1;
if (wellLogPlot->trackCount() > 1 && isFirstTrack)
if ( wellLogPlot->trackCount() > 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);
wellLogPlot->availableDepthRange( &availableMinDepth, &availableMaxDepth );
double depthSpan = 0.1 * cvf::Math::abs(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 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());
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() )
if ( isFirstTrack && isUsingConnectionNumberDepthType() )
{
stackedValues.push_back(stackedValues.back());
depthValues.push_back(0.0);
stackedValues.push_back( stackedValues.back() );
depthValues.push_back( 0.0 );
polyLineStartStopIndices.front().second += 1;
}
m_qwtPlotCurve->setSamples(stackedValues.data(), depthValues.data(), static_cast<int>(depthValues.size()));
m_qwtPlotCurve->setLineSegmentStartStopIndices(polyLineStartStopIndices);
m_qwtPlotCurve->setSamples( stackedValues.data(), depthValues.data(), static_cast<int>( depthValues.size() ) );
m_qwtPlotCurve->setLineSegmentStartStopIndices( polyLineStartStopIndices );
m_qwtPlotCurve->setZ(zPos);
m_qwtPlotCurve->setZ( zPos );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimWellFlowRateCurve::isUsingConnectionNumberDepthType() const
{
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType(wellLogPlot);
firstAncestorOrThisOfType( wellLogPlot );
if ( wellLogPlot && wellLogPlot->depthType() == RimWellLogPlot::CONNECTION_NUMBER )
{
return true;
@@ -328,25 +327,26 @@ bool RimWellFlowRateCurve::isUsingConnectionNumberDepthType() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
{
RimWellAllocationPlot* wap = nullptr;
this->firstAncestorOrThisOfType(wap);
this->firstAncestorOrThisOfType( wap );
return wap;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::setFlowValuesPrDepthValue(const QString& curveName, const std::vector<double>& depthValues, const std::vector<double>& flowRates)
void RimWellFlowRateCurve::setFlowValuesPrDepthValue( const QString& curveName,
const std::vector<double>& depthValues,
const std::vector<double>& flowRates )
{
m_curveData = new RigWellLogCurveData;
m_curveData->setValuesAndMD(flowRates, depthValues, RiaDefines::UNIT_NONE, false);
m_curveData->setValuesAndMD( flowRates, depthValues, RiaDefines::UNIT_NONE, false );
m_curveAutoName = curveName;
}

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -20,49 +20,50 @@
#include "RimWellLogCurve.h"
#include "cafPdmPtrField.h"
#include "cafPdmChildField.h"
#include "cafPdmPtrField.h"
class RimEclipseResultCase;
class RimWellAllocationPlot;
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimWellFlowRateCurve : public RimWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:
RimWellFlowRateCurve();
~RimWellFlowRateCurve() override;
void setFlowValuesPrDepthValue(const QString& curveName , const std::vector<double>& depthValues, const std::vector<double>& flowRates);
void setFlowValuesPrDepthValue( const QString& curveName,
const std::vector<double>& depthValues,
const std::vector<double>& flowRates );
void updateStackedPlotData();
QString wellName() const override;
QString wellLogChannelName() const override;
void setGroupId(int groupId);
int groupId() const;
void setGroupId( int groupId );
int groupId() const;
void setDoFillCurve(bool doFill);
void setDoFillCurve( bool doFill );
protected:
QString createCurveAutoName() override;
void onLoadDataAndUpdate(bool updateParentPlot) override;
void updateCurveAppearance() override;
void onLoadDataAndUpdate( bool updateParentPlot ) override;
void updateCurveAppearance() override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
bool isUsingConnectionNumberDepthType() const;
bool isUsingConnectionNumberDepthType() const;
RimWellAllocationPlot* wellAllocationPlot() const;
QString m_curveAutoName;
int m_groupId;
bool m_doFillCurve;
int m_groupId;
bool m_doFillCurve;
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -44,79 +44,92 @@ class RigEclipseCaseData;
class RigEclipseResultAddress;
//==================================================================================================
///
///
//==================================================================================================
enum FlowType { FLOW_TYPE_PHASE_SPLIT, FLOW_TYPE_TOTAL };
enum FlowPhase { FLOW_PHASE_NONE, FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER, FLOW_PHASE_TOTAL };
enum FlowType
{
FLOW_TYPE_PHASE_SPLIT,
FLOW_TYPE_TOTAL
};
enum FlowPhase
{
FLOW_PHASE_NONE,
FLOW_PHASE_OIL,
FLOW_PHASE_GAS,
FLOW_PHASE_WATER,
FLOW_PHASE_TOTAL
};
//==================================================================================================
///
///
//==================================================================================================
class RimWellPlotTools
{
public:
// PLT Only
static bool isOilFlowChannel(const QString& channelName);
static bool isGasFlowChannel(const QString& channelName);
static bool isWaterFlowChannel(const QString& channelName);
static bool isTotalFlowChannel(const QString& channelName);
static FlowPhase flowPhaseFromChannelName(const QString& channelName);
// PLT Only
static bool isOilFlowChannel( const QString& channelName );
static bool isGasFlowChannel( const QString& channelName );
static bool isWaterFlowChannel( const QString& channelName );
static bool isTotalFlowChannel( const QString& channelName );
static FlowPhase flowPhaseFromChannelName( const QString& channelName );
static std::vector<RimWellLogFile*> wellLogFilesContainingFlow(const QString& wellName);
static RimWellPath* wellPathByWellPathNameOrSimWellName(const QString& wellPathNameOrSimwellName);
static std::vector<RimWellLogFile*> wellLogFilesContainingFlow( const QString& wellName );
static RimWellPath* wellPathByWellPathNameOrSimWellName( const QString& wellPathNameOrSimwellName );
// RFT Only
// RFT Only
private:
static std::pair<RigEclipseResultAddress, QString> pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData);
static std::pair<RigEclipseResultAddress, QString> pressureResultDataInfo( const RigEclipseCaseData* eclipseCaseData );
public:
static void addTimeStepsToMap(std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& destMap,
const std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepsToAdd);
static std::vector<RimWellLogFile*> wellLogFilesContainingPressure(const QString& wellPathNameOrSimWellName);
static RimWellLogFileChannel* getPressureChannelFromWellFile(const RimWellLogFile* wellLogFile);
static RimWellPath* wellPathFromWellLogFile(const RimWellLogFile* wellLogFile);
static std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMapFromGridCase(RimEclipseCase* gridCase);
static RiaRftPltCurveDefinition curveDefFromCurve(const RimWellLogCurve* curve);
static void addTimeStepsToMap( std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& destMap,
const std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepsToAdd );
static std::vector<RimWellLogFile*> wellLogFilesContainingPressure( const QString& wellPathNameOrSimWellName );
static RimWellLogFileChannel* getPressureChannelFromWellFile( const RimWellLogFile* wellLogFile );
static RimWellPath* wellPathFromWellLogFile( const RimWellLogFile* wellLogFile );
static std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMapFromGridCase( RimEclipseCase* gridCase );
static RiaRftPltCurveDefinition curveDefFromCurve( const RimWellLogCurve* curve );
// others
static bool hasFlowData(const RimWellLogFile* wellLogFile);
static bool hasAssociatedWellPath(const QString& wellName);
// others
static bool hasFlowData( const RimWellLogFile* wellLogFile );
static bool hasAssociatedWellPath( const QString& wellName );
// Both
static std::vector<RimEclipseResultCase*> gridCasesForWell(const QString& simWellName);
static std::vector<RimEclipseResultCase*> rftCasesForWell(const QString& simWellName);
static std::vector<RimSummaryCaseCollection*> rftEnsemblesForWell(const QString& simWellName);
static std::vector<RimSummaryCaseCollection*> rftEnsembles();
static std::vector<RimObservedFmuRftData*> observedFmuRftDataForWell(const QString& simWellName);
static std::vector<RimObservedFmuRftData*> observedFmuRftData();
static QString simWellName(const QString& wellPathNameOrSimWellName);
// Both
static std::vector<RimEclipseResultCase*> gridCasesForWell( const QString& simWellName );
static std::vector<RimEclipseResultCase*> rftCasesForWell( const QString& simWellName );
static std::vector<RimSummaryCaseCollection*> rftEnsemblesForWell( const QString& simWellName );
static std::vector<RimSummaryCaseCollection*> rftEnsembles();
static std::vector<RimObservedFmuRftData*> observedFmuRftDataForWell( const QString& simWellName );
static std::vector<RimObservedFmuRftData*> observedFmuRftData();
static QString simWellName( const QString& wellPathNameOrSimWellName );
static std::map<QDateTime, std::set<RifDataSourceForRftPlt>>
calculateRelevantTimeStepsFromCases(const QString& wellPathNameOrSimWellName,
const std::vector<RifDataSourceForRftPlt>& selSources,
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults);
static std::map<QDateTime, std::set<RifDataSourceForRftPlt>> calculateRelevantTimeStepsFromCases(
const QString& wellPathNameOrSimWellName,
const std::vector<RifDataSourceForRftPlt>& selSources,
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults );
static void calculateValueOptionsForTimeSteps(const QString& wellPathNameOrSimWellName,
const std::vector<RifDataSourceForRftPlt>& selSources,
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults,
QList<caf::PdmOptionItemInfo>& options);
static void calculateValueOptionsForTimeSteps(
const QString& wellPathNameOrSimWellName,
const std::vector<RifDataSourceForRftPlt>& selSources,
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults,
QList<caf::PdmOptionItemInfo>& options );
static std::set < RiaRftPltCurveDefinition > curveDefsFromTimesteps(const QString& wellPathNameOrSimWellName,
const std::vector<QDateTime>& selectedTimeStepVector,
bool firstReportTimeStepIsValid,
const std::vector<RifDataSourceForRftPlt>& selectedSourcesExpanded,
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults);
static std::set<RiaRftPltCurveDefinition>
curveDefsFromTimesteps( const QString& wellPathNameOrSimWellName,
const std::vector<QDateTime>& selectedTimeStepVector,
bool firstReportTimeStepIsValid,
const std::vector<RifDataSourceForRftPlt>& selectedSourcesExpanded,
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults );
static QString flowPlotAxisTitle(RimWellLogFile::WellFlowCondition condition,
RiaEclipseUnitTools::UnitSystem unitSystem);
static QString flowPlotAxisTitle( RimWellLogFile::WellFlowCondition condition,
RiaEclipseUnitTools::UnitSystem unitSystem );
static QString flowUnitText(RimWellLogFile::WellFlowCondition condition,
RiaEclipseUnitTools::UnitSystem unitSystem);
static QString flowUnitText( RimWellLogFile::WellFlowCondition condition, RiaEclipseUnitTools::UnitSystem unitSystem );
static QString curveUnitText(RimWellLogFile::WellFlowCondition condition,
RiaEclipseUnitTools::UnitSystem unitSystem,
FlowPhase flowPhase);
static QString curveUnitText( RimWellLogFile::WellFlowCondition condition,
RiaEclipseUnitTools::UnitSystem unitSystem,
FlowPhase flowPhase );
static bool hasFlowData(const RimWellPath* wellPath);
static bool hasFlowData( const RimWellPath* wellPath );
private:
friend class StaticFieldsInitializer;
@@ -129,15 +142,15 @@ private:
static std::set<QString> FLOW_DATA_NAMES;
static bool hasPressureData(const RimWellLogFile* wellLogFile);
static bool isPressureChannel(RimWellLogFileChannel* channel);
static bool hasPressureData(RimEclipseResultCase* gridCase);
static bool hasPressureData(RimWellPath* wellPath);
static bool hasFlowData(RimEclipseResultCase* gridCase);
static bool isFlowChannel(RimWellLogFileChannel* channel);
static bool tryMatchChannelName(const std::set<QString>& channelNames, const QString& channelNameToMatch);
static std::set<QDateTime> findMatchingOrAdjacentTimeSteps(const std::set<QDateTime>& baseTimeLine, const std::set<QDateTime>& availableTimeSteps);
static std::set<QDateTime> availableSimWellTimesteps(RimEclipseCase * eclCase, const QString& simWellName, bool addFirstReportTimeStep);
static bool hasPressureData( const RimWellLogFile* wellLogFile );
static bool isPressureChannel( RimWellLogFileChannel* channel );
static bool hasPressureData( RimEclipseResultCase* gridCase );
static bool hasPressureData( RimWellPath* wellPath );
static bool hasFlowData( RimEclipseResultCase* gridCase );
static bool isFlowChannel( RimWellLogFileChannel* channel );
static bool tryMatchChannelName( const std::set<QString>& channelNames, const QString& channelNameToMatch );
static std::set<QDateTime> findMatchingOrAdjacentTimeSteps( const std::set<QDateTime>& baseTimeLine,
const std::set<QDateTime>& availableTimeSteps );
static std::set<QDateTime>
availableSimWellTimesteps( RimEclipseCase* eclCase, const QString& simWellName, bool addFirstReportTimeStep );
};