Whitespace

This commit is contained in:
Magne Sjaastad committed 2019-02-08 13:02:48 +01:00
1 parent 75833f491a
commit 3586988d1d
1 file changed
+86 -103
@@ -31,9 +31,9 @@
#include "Rim3dView.h" #include "Rim3dView.h"
#include "Rim3dWellLogCurve.h" #include "Rim3dWellLogCurve.h"
#include "RimCellEdgeColors.h" #include "RimCellEdgeColors.h"
#include "RimEclipseContourMapProjection.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimEclipseCellColors.h" #include "RimEclipseCellColors.h"
#include "RimEclipseContourMapProjection.h"
#include "RimEclipseFaultColors.h" #include "RimEclipseFaultColors.h"
#include "RimEclipsePropertyFilter.h" #include "RimEclipsePropertyFilter.h"
#include "RimEclipseResultCase.h" #include "RimEclipseResultCase.h"
@@ -43,6 +43,7 @@
#include "RimIntersectionCollection.h" #include "RimIntersectionCollection.h"
#include "RimPlotCurve.h" #include "RimPlotCurve.h"
#include "RimReservoirCellResultsStorage.h" #include "RimReservoirCellResultsStorage.h"
#include "RimTools.h"
#include "RimViewLinker.h" #include "RimViewLinker.h"
#include "RimWellLogExtractionCurve.h" #include "RimWellLogExtractionCurve.h"
@@ -51,24 +52,20 @@
#include "cafPdmUiTreeSelectionEditor.h" #include "cafPdmUiTreeSelectionEditor.h"
#include "cafUtils.h" #include "cafUtils.h"
#include <QDebug>
#include <QList>
#include "RimTools.h"
namespace caf namespace caf
{ {
template<> template<>
void RimEclipseResultDefinition::FlowTracerSelectionEnum::setUp() void RimEclipseResultDefinition::FlowTracerSelectionEnum::setUp()
{ {
addItem(RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD, "FLOW_TR_INJ_AND_PROD", "All Injectors and Producers"); addItem(RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD, "FLOW_TR_INJ_AND_PROD", "All Injectors and Producers");
addItem(RimEclipseResultDefinition::FLOW_TR_PRODUCERS, "FLOW_TR_PRODUCERS", "All Producers"); addItem(RimEclipseResultDefinition::FLOW_TR_PRODUCERS, "FLOW_TR_PRODUCERS", "All Producers");
addItem(RimEclipseResultDefinition::FLOW_TR_INJECTORS, "FLOW_TR_INJECTORS", "All Injectors"); addItem(RimEclipseResultDefinition::FLOW_TR_INJECTORS, "FLOW_TR_INJECTORS", "All Injectors");
addItem(RimEclipseResultDefinition::FLOW_TR_BY_SELECTION, "FLOW_TR_BY_SELECTION", "By Selection"); addItem(RimEclipseResultDefinition::FLOW_TR_BY_SELECTION, "FLOW_TR_BY_SELECTION", "By Selection");
setDefault(RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD); setDefault(RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD);
}
} }
} // namespace caf
CAF_PDM_SOURCE_INIT(RimEclipseResultDefinition, "ResultDefinition"); CAF_PDM_SOURCE_INIT(RimEclipseResultDefinition, "ResultDefinition");
@@ -85,7 +82,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
CAF_PDM_InitFieldNoDefault(&m_porosityModel, "PorosityModelType", "Porosity", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_porosityModel, "PorosityModelType", "Porosity", "", "", "");
m_porosityModel.uiCapability()->setUiHidden(true); m_porosityModel.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_resultVariable, "ResultVariable", RiaDefines::undefinedResultName(), "Variable", "", "", "" ); CAF_PDM_InitField(&m_resultVariable, "ResultVariable", RiaDefines::undefinedResultName(), "Variable", "", "", "");
m_resultVariable.uiCapability()->setUiHidden(true); m_resultVariable.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_flowSolution, "FlowDiagSolution", "Solution", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_flowSolution, "FlowDiagSolution", "Solution", "", "", "");
@@ -97,7 +94,6 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
CAF_PDM_InitField(&m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", 0, "Base Time Step", "", "", ""); CAF_PDM_InitField(&m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", 0, "Base Time Step", "", "", "");
m_timeLapseBaseTimestep.uiCapability()->setUiHidden(true); m_timeLapseBaseTimestep.uiCapability()->setUiHidden(true);
// One single tracer list has been split into injectors and producers. // One single tracer list has been split into injectors and producers.
// The old list is defined as injectors and we'll have to move any producers in old projects. // The old list is defined as injectors and we'll have to move any producers in old projects.
CAF_PDM_InitFieldNoDefault(&m_selectedTracers_OBSOLETE, "SelectedTracers", "Tracers", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_selectedTracers_OBSOLETE, "SelectedTracers", "Tracers", "", "", "");
@@ -109,7 +105,6 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
CAF_PDM_InitFieldNoDefault(&m_selectedProducerTracers, "SelectedProducerTracers", "Producer Tracers", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_selectedProducerTracers, "SelectedProducerTracers", "Producer Tracers", "", "", "");
m_selectedProducerTracers.uiCapability()->setUiHidden(true); m_selectedProducerTracers.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_selectedSouringTracers, "SelectedSouringTracers", "Tracers", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_selectedSouringTracers, "SelectedSouringTracers", "Tracers", "", "", "");
m_selectedSouringTracers.uiCapability()->setUiHidden(true); m_selectedSouringTracers.uiCapability()->setUiHidden(true);
@@ -124,17 +119,23 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
CAF_PDM_InitFieldNoDefault(&m_porosityModelUiField, "MPorosityModelType", "Porosity", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_porosityModelUiField, "MPorosityModelType", "Porosity", "", "", "");
m_porosityModelUiField.xmlCapability()->disableIO(); m_porosityModelUiField.xmlCapability()->disableIO();
CAF_PDM_InitField(&m_resultVariableUiField, "MResultVariable", RiaDefines::undefinedResultName(), "Result Property", "", "", "" ); CAF_PDM_InitField(
&m_resultVariableUiField, "MResultVariable", RiaDefines::undefinedResultName(), "Result Property", "", "", "");
m_resultVariableUiField.xmlCapability()->disableIO(); m_resultVariableUiField.xmlCapability()->disableIO();
m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName()); m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
CAF_PDM_InitField(&m_isTimeLapseResultUiField, "IsTimeLapseResultUI", false, "Enable Time Difference", "", "Use the difference with respect to a specific time step as the result variable to plot", ""); CAF_PDM_InitField(&m_isTimeLapseResultUiField,
"IsTimeLapseResultUI",
false,
"Enable Time Difference",
"",
"Use the difference with respect to a specific time step as the result variable to plot",
"");
m_isTimeLapseResultUiField.xmlCapability()->disableIO(); m_isTimeLapseResultUiField.xmlCapability()->disableIO();
CAF_PDM_InitField(&m_timeLapseBaseTimestepUiField, "TimeLapseBaseTimeStepUI", 0, "Base Time Step", "", "", ""); CAF_PDM_InitField(&m_timeLapseBaseTimestepUiField, "TimeLapseBaseTimeStepUI", 0, "Base Time Step", "", "", "");
m_timeLapseBaseTimestepUiField.xmlCapability()->disableIO(); m_timeLapseBaseTimestepUiField.xmlCapability()->disableIO();
CAF_PDM_InitFieldNoDefault(&m_flowSolutionUiField, "MFlowDiagSolution", "Solution", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_flowSolutionUiField, "MFlowDiagSolution", "Solution", "", "", "");
m_flowSolutionUiField.xmlCapability()->disableIO(); m_flowSolutionUiField.xmlCapability()->disableIO();
m_flowSolutionUiField.uiCapability()->setUiHidden(true); // For now since there are only one to choose from m_flowSolutionUiField.uiCapability()->setUiHidden(true); // For now since there are only one to choose from
@@ -145,7 +146,6 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
CAF_PDM_InitField(&m_syncProducerToInjectorSelection, "MSyncSelectedProdInj", false, "<- Add Communicators", "", "", ""); CAF_PDM_InitField(&m_syncProducerToInjectorSelection, "MSyncSelectedProdInj", false, "<- Add Communicators", "", "", "");
m_syncProducerToInjectorSelection.uiCapability()->setUiEditorTypeName(caf::PdmUiToolButtonEditor::uiEditorTypeName()); m_syncProducerToInjectorSelection.uiCapability()->setUiEditorTypeName(caf::PdmUiToolButtonEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_selectedInjectorTracersUiField, "MSelectedInjectorTracers", "Injector Tracers", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_selectedInjectorTracersUiField, "MSelectedInjectorTracers", "Injector Tracers", "", "", "");
m_selectedInjectorTracersUiField.xmlCapability()->disableIO(); m_selectedInjectorTracersUiField.xmlCapability()->disableIO();
m_selectedInjectorTracersUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); m_selectedInjectorTracersUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
@@ -164,10 +164,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimEclipseResultDefinition::~RimEclipseResultDefinition() RimEclipseResultDefinition::~RimEclipseResultDefinition() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -195,13 +192,12 @@ void RimEclipseResultDefinition::setEclipseCase(RimEclipseCase* eclipseCase)
assignFlowSolutionFromCase(); assignFlowSolutionFromCase();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigCaseCellResultsData* RimEclipseResultDefinition::currentGridCellResults() const RigCaseCellResultsData* RimEclipseResultDefinition::currentGridCellResults() const
{ {
if (!m_eclipseCase ) return nullptr; if (!m_eclipseCase) return nullptr;
return m_eclipseCase->results(m_porosityModel()); return m_eclipseCase->results(m_porosityModel());
} }
@@ -209,11 +205,11 @@ RigCaseCellResultsData* RimEclipseResultDefinition::currentGridCellResults() con
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{ {
if ( &m_flowSolutionUiField == changedField if (&m_flowSolutionUiField == changedField || &m_resultTypeUiField == changedField || &m_porosityModelUiField == changedField)
|| &m_resultTypeUiField == changedField
|| &m_porosityModelUiField == changedField )
{ {
// If the user are seeing the list with the actually selected result, // If the user are seeing the list with the actually selected result,
// select that result in the list. Otherwise select nothing. // select that result in the list. Otherwise select nothing.
@@ -222,10 +218,8 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
bool isFlowDiagFieldsRelevant = (m_resultType() == RiaDefines::FLOW_DIAGNOSTICS); bool isFlowDiagFieldsRelevant = (m_resultType() == RiaDefines::FLOW_DIAGNOSTICS);
if ((m_flowSolutionUiField() == m_flowSolution() || !isFlowDiagFieldsRelevant) &&
if ( ( m_flowSolutionUiField() == m_flowSolution() || !isFlowDiagFieldsRelevant) m_resultTypeUiField() == m_resultType() && m_porosityModelUiField() == m_porosityModel())
&& m_resultTypeUiField() == m_resultType()
&& m_porosityModelUiField() == m_porosityModel() )
{ {
if (varList.contains(resultVariable())) if (varList.contains(resultVariable()))
{ {
@@ -287,8 +281,7 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
loadDataAndUpdate(); loadDataAndUpdate();
} }
if (&m_selectedInjectorTracersUiField == changedField)
if (&m_selectedInjectorTracersUiField == changedField )
{ {
changedTracerSelectionField(true); changedTracerSelectionField(true);
} }
@@ -310,7 +303,6 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
m_syncProducerToInjectorSelection = false; m_syncProducerToInjectorSelection = false;
} }
if (&m_selectedSouringTracersUiField == changedField) if (&m_selectedSouringTracersUiField == changedField)
{ {
if (!m_resultVariable().isEmpty()) if (!m_resultVariable().isEmpty())
@@ -341,10 +333,9 @@ void RimEclipseResultDefinition::changedTracerSelectionField(bool injector)
{ {
m_flowSolution = m_flowSolutionUiField(); m_flowSolution = m_flowSolutionUiField();
std::vector<QString>& selectedTracers = injector ? m_selectedInjectorTracers.v() std::vector<QString>& selectedTracers = injector ? m_selectedInjectorTracers.v() : m_selectedProducerTracers.v();
: m_selectedProducerTracers.v(); std::vector<QString>& selectedTracersUi =
std::vector<QString>& selectedTracersUi = injector ? m_selectedInjectorTracersUiField.v() injector ? m_selectedInjectorTracersUiField.v() : m_selectedProducerTracersUiField.v();
: m_selectedProducerTracersUiField.v();
selectedTracers = selectedTracersUi; selectedTracers = selectedTracersUi;
@@ -510,15 +501,16 @@ void RimEclipseResultDefinition::loadDataAndUpdate()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly)
{ {
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_resultTypeUiField ) if (fieldNeedingOptions == &m_resultTypeUiField)
{ {
bool hasSourSimRLFile = false; bool hasSourSimRLFile = false;
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p()); RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
if ( eclResCase && eclResCase->eclipseCaseData() ) if (eclResCase && eclResCase->eclipseCaseData())
{ {
hasSourSimRLFile = eclResCase->hasSourSimFile(); hasSourSimRLFile = eclResCase->hasSourSimFile();
} }
@@ -543,26 +535,23 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
} }
#endif /* ENABLE_SOURING */ #endif /* ENABLE_SOURING */
RimGridTimeHistoryCurve* timeHistoryCurve; RimGridTimeHistoryCurve* timeHistoryCurve;
this->firstAncestorOrThisOfType(timeHistoryCurve); this->firstAncestorOrThisOfType(timeHistoryCurve);
// Do not include flow diagnostics results if it is a time history curve // Do not include flow diagnostics results if it is a time history curve
// Do not include SourSimRL if no SourSim file is loaded // Do not include SourSimRL if no SourSim file is loaded
if ( timeHistoryCurve != nullptr || !hasSourSimRLFile || !enableSouring ) if (timeHistoryCurve != nullptr || !hasSourSimRLFile || !enableSouring)
{ {
using ResCatEnum = caf::AppEnum< RiaDefines::ResultCatType >; using ResCatEnum = caf::AppEnum<RiaDefines::ResultCatType>;
for ( size_t i = 0; i < ResCatEnum::size(); ++i ) for (size_t i = 0; i < ResCatEnum::size(); ++i)
{ {
RiaDefines::ResultCatType resType = ResCatEnum::fromIndex(i); RiaDefines::ResultCatType resType = ResCatEnum::fromIndex(i);
if ( resType == RiaDefines::FLOW_DIAGNOSTICS if (resType == RiaDefines::FLOW_DIAGNOSTICS && (timeHistoryCurve))
&& (timeHistoryCurve) )
{ {
continue; continue;
} }
if ( resType == RiaDefines::SOURSIMRL if (resType == RiaDefines::SOURSIMRL && (!hasSourSimRLFile))
&& (!hasSourSimRLFile ) )
{ {
continue; continue;
} }
@@ -578,9 +567,9 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
} }
} }
if ( m_resultTypeUiField() == RiaDefines::FLOW_DIAGNOSTICS ) if (m_resultTypeUiField() == RiaDefines::FLOW_DIAGNOSTICS)
{ {
if ( fieldNeedingOptions == &m_resultVariableUiField ) if (fieldNeedingOptions == &m_resultVariableUiField)
{ {
options.push_back(caf::PdmOptionItemInfo(timeOfFlightString(false), RIG_FLD_TOF_RESNAME)); options.push_back(caf::PdmOptionItemInfo(timeOfFlightString(false), RIG_FLD_TOF_RESNAME));
if (m_phaseSelection() == RigFlowDiagResultAddress::PHASE_ALL) if (m_phaseSelection() == RigFlowDiagResultAddress::PHASE_ALL)
@@ -622,8 +611,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
for (const QString& resultName : dynamicResultNames) for (const QString& resultName : dynamicResultNames)
{ {
if (!resultName.endsWith("F") || if (!resultName.endsWith("F") || resultName == RiaDefines::completionTypeResultName())
resultName == RiaDefines::completionTypeResultName())
{ {
continue; continue;
} }
@@ -638,7 +626,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
} }
else else
{ {
if ( fieldNeedingOptions == &m_resultVariableUiField ) if (fieldNeedingOptions == &m_resultVariableUiField)
{ {
options = calcOptionsForVariableUiFieldStandard(); options = calcOptionsForVariableUiFieldStandard();
} }
@@ -646,20 +634,19 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
{ {
std::vector<QDateTime> stepDates; std::vector<QDateTime> stepDates;
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
if(gridCellResults) if (gridCellResults)
{ {
stepDates = gridCellResults->timeStepDates(); stepDates = gridCellResults->timeStepDates();
} }
for (size_t stepIdx = 0; stepIdx < stepDates.size(); ++stepIdx) for (size_t stepIdx = 0; stepIdx < stepDates.size(); ++stepIdx)
{ {
options.push_back(caf::PdmOptionItemInfo(stepDates[stepIdx].toString(RimTools::dateFormatString()), options.push_back(
static_cast<int>(stepIdx))); caf::PdmOptionItemInfo(stepDates[stepIdx].toString(RimTools::dateFormatString()), static_cast<int>(stepIdx)));
} }
} }
} }
(*useOptionsOnly) = true; (*useOptionsOnly) = true;
return options; return options;
@@ -673,7 +660,7 @@ RigEclipseResultAddress RimEclipseResultDefinition::eclipseResultAddress() const
if (isFlowDiagOrInjectionFlooding()) return RigEclipseResultAddress(); if (isFlowDiagOrInjectionFlooding()) return RigEclipseResultAddress();
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
if (gridCellResults ) if (gridCellResults)
{ {
if (m_isTimeLapseResult()) if (m_isTimeLapseResult())
return RigEclipseResultAddress(m_resultType(), m_resultVariable(), m_timeLapseBaseTimestep()); return RigEclipseResultAddress(m_resultType(), m_resultVariable(), m_timeLapseBaseTimestep());
@@ -848,7 +835,6 @@ void RimEclipseResultDefinition::loadResult()
gridCellResults->ensureKnownResultLoaded(this->eclipseResultAddress()); gridCellResults->ensureKnownResultLoaded(this->eclipseResultAddress());
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -862,7 +848,7 @@ bool RimEclipseResultDefinition::hasStaticResult() const
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
RigEclipseResultAddress gridScalarResultIndex = this->eclipseResultAddress(); RigEclipseResultAddress gridScalarResultIndex = this->eclipseResultAddress();
if (hasResult() && gridCellResults->timeStepCount(gridScalarResultIndex) == 1 ) if (hasResult() && gridCellResults->timeStepCount(gridScalarResultIndex) == 1)
{ {
return true; return true;
} }
@@ -881,7 +867,7 @@ bool RimEclipseResultDefinition::hasResult() const
{ {
if (m_flowSolution() && !m_resultVariable().isEmpty()) return true; if (m_flowSolution() && !m_resultVariable().isEmpty()) return true;
} }
else if (this->currentGridCellResults() ) else if (this->currentGridCellResults())
{ {
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
@@ -920,7 +906,7 @@ bool RimEclipseResultDefinition::hasDynamicResult() const
{ {
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
RigEclipseResultAddress gridScalarResultIndex = this->eclipseResultAddress(); RigEclipseResultAddress gridScalarResultIndex = this->eclipseResultAddress();
if (gridCellResults->timeStepCount(gridScalarResultIndex) > 1 ) if (gridCellResults->timeStepCount(gridScalarResultIndex) > 1)
{ {
return true; return true;
} }
@@ -930,7 +916,6 @@ bool RimEclipseResultDefinition::hasDynamicResult() const
return false; return false;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -1092,16 +1077,15 @@ bool RimEclipseResultDefinition::isCompletionTypeSelected() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::hasCategoryResult() const bool RimEclipseResultDefinition::hasCategoryResult() const
{ {
if (this->m_resultType() == RiaDefines::FORMATION_NAMES if (this->m_resultType() == RiaDefines::FORMATION_NAMES && m_eclipseCase && m_eclipseCase->eclipseCaseData() &&
&& m_eclipseCase m_eclipseCase->eclipseCaseData()->activeFormationNames())
&& m_eclipseCase->eclipseCaseData() return true;
&& m_eclipseCase->eclipseCaseData()->activeFormationNames() ) return true;
if (this->m_resultType() == RiaDefines::DYNAMIC_NATIVE if (this->m_resultType() == RiaDefines::DYNAMIC_NATIVE && this->resultVariable() == RiaDefines::completionTypeResultName())
&& this->resultVariable() == RiaDefines::completionTypeResultName()) return true; return true;
if (this->m_resultType() == RiaDefines::FLOW_DIAGNOSTICS if (this->m_resultType() == RiaDefines::FLOW_DIAGNOSTICS && m_resultVariable() == RIG_FLD_MAX_FRACTION_TRACER_RESNAME)
&& m_resultVariable() == RIG_FLD_MAX_FRACTION_TRACER_RESNAME) return true; return true;
if (!this->hasStaticResult()) return false; if (!this->hasStaticResult()) return false;
@@ -1133,8 +1117,7 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
uiOrdering.add(&m_porosityModelUiField); uiOrdering.add(&m_porosityModelUiField);
} }
if (m_resultTypeUiField() == RiaDefines::FLOW_DIAGNOSTICS)
if ( m_resultTypeUiField() == RiaDefines::FLOW_DIAGNOSTICS )
{ {
uiOrdering.add(&m_flowSolutionUiField); uiOrdering.add(&m_flowSolutionUiField);
@@ -1156,7 +1139,7 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
uiOrdering.add(&m_phaseSelection); uiOrdering.add(&m_phaseSelection);
if ( m_flowSolution() == nullptr ) if (m_flowSolution() == nullptr)
{ {
assignFlowSolutionFromCase(); assignFlowSolutionFromCase();
} }
@@ -1176,12 +1159,11 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
uiOrdering.add(&m_resultVariableUiField); uiOrdering.add(&m_resultVariableUiField);
} }
if ( m_resultTypeUiField() == RiaDefines::DYNAMIC_NATIVE ) if (m_resultTypeUiField() == RiaDefines::DYNAMIC_NATIVE)
{ {
caf::PdmUiGroup * timeLapseGr = uiOrdering.addNewGroup("Time Difference Options"); caf::PdmUiGroup* timeLapseGr = uiOrdering.addNewGroup("Time Difference Options");
timeLapseGr->add(&m_isTimeLapseResultUiField); timeLapseGr->add(&m_isTimeLapseResultUiField);
if ( m_isTimeLapseResultUiField() ) if (m_isTimeLapseResultUiField()) timeLapseGr->add(&m_timeLapseBaseTimestepUiField);
timeLapseGr->add(&m_timeLapseBaseTimestepUiField);
} }
uiOrdering.skipRemainingFields(true); uiOrdering.skipRemainingFields(true);
@@ -1190,7 +1172,9 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) void RimEclipseResultDefinition::defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute)
{ {
if (m_resultTypeUiField() == RiaDefines::FLOW_DIAGNOSTICS) if (m_resultTypeUiField() == RiaDefines::FLOW_DIAGNOSTICS)
{ {
@@ -1202,8 +1186,7 @@ void RimEclipseResultDefinition::defineEditorAttribute(const caf::PdmFieldHandle
listEditAttr->m_heightHint = 50; listEditAttr->m_heightHint = 50;
} }
} }
else if (field == &m_syncInjectorToProducerSelection || else if (field == &m_syncInjectorToProducerSelection || field == &m_syncProducerToInjectorSelection)
field == &m_syncProducerToInjectorSelection)
{ {
caf::PdmUiToolButtonEditorAttribute* toolButtonAttr = dynamic_cast<caf::PdmUiToolButtonEditorAttribute*>(attribute); caf::PdmUiToolButtonEditorAttribute* toolButtonAttr = dynamic_cast<caf::PdmUiToolButtonEditorAttribute*>(attribute);
if (toolButtonAttr) if (toolButtonAttr)
@@ -1291,8 +1274,7 @@ void RimEclipseResultDefinition::assignFlowSolutionFromCase()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::hasDualPorFractureResult() bool RimEclipseResultDefinition::hasDualPorFractureResult()
{ {
if (m_eclipseCase if (m_eclipseCase && m_eclipseCase->eclipseCaseData())
&& m_eclipseCase->eclipseCaseData())
{ {
return m_eclipseCase->eclipseCaseData()->hasFractureResults(); return m_eclipseCase->eclipseCaseData()->hasFractureResults();
} }
@@ -1362,7 +1344,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
RigCaseCellResultsData* results = this->currentGridCellResults(); RigCaseCellResultsData* results = this->currentGridCellResults();
foreach(QString s, getResultNamesForCurrentUiResultType()) foreach (QString s, getResultNamesForCurrentUiResultType())
{ {
if (s == RiaDefines::completionTypeResultName() && results->timeStepDates().empty()) continue; if (s == RiaDefines::completionTypeResultName() && results->timeStepDates().empty()) continue;
@@ -1380,20 +1362,24 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
cellFaceResultNames.sort(); cellFaceResultNames.sort();
// Cell Center result names // Cell Center result names
foreach(QString s, cellCenterResultNames) foreach (QString s, cellCenterResultNames)
{ {
optionList.push_back(caf::PdmOptionItemInfo(convertToTimeDiffUiVarName(s), s)); optionList.push_back(caf::PdmOptionItemInfo(convertToTimeDiffUiVarName(s), s));
} }
// Ternary Result // Ternary Result
bool hasAtLeastOneTernaryComponent = false; bool hasAtLeastOneTernaryComponent = false;
if (cellCenterResultNames.contains("SOIL")) hasAtLeastOneTernaryComponent = true; if (cellCenterResultNames.contains("SOIL"))
else if (cellCenterResultNames.contains("SGAS")) hasAtLeastOneTernaryComponent = true; hasAtLeastOneTernaryComponent = true;
else if (cellCenterResultNames.contains("SWAT")) hasAtLeastOneTernaryComponent = true; else if (cellCenterResultNames.contains("SGAS"))
hasAtLeastOneTernaryComponent = true;
else if (cellCenterResultNames.contains("SWAT"))
hasAtLeastOneTernaryComponent = true;
if (m_resultTypeUiField == RiaDefines::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent) if (m_resultTypeUiField == RiaDefines::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent)
{ {
optionList.push_front(caf::PdmOptionItemInfo(RiaDefines::ternarySaturationResultName(), RiaDefines::ternarySaturationResultName())); optionList.push_front(
caf::PdmOptionItemInfo(RiaDefines::ternarySaturationResultName(), RiaDefines::ternarySaturationResultName()));
} }
// Cell Face result names // Cell Face result names
@@ -1402,10 +1388,10 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
RimEclipseFaultColors* rimEclipseFaultColors = nullptr; RimEclipseFaultColors* rimEclipseFaultColors = nullptr;
this->firstAncestorOrThisOfType(rimEclipseFaultColors); this->firstAncestorOrThisOfType(rimEclipseFaultColors);
if ( rimEclipseFaultColors ) showDerivedResultsFirstInList = true; if (rimEclipseFaultColors) showDerivedResultsFirstInList = true;
} }
foreach(QString s, cellFaceResultNames) foreach (QString s, cellFaceResultNames)
{ {
if (showDerivedResultsFirstInList) if (showDerivedResultsFirstInList)
{ {
@@ -1430,7 +1416,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
RimCellEdgeColors* cellEdge = nullptr; RimCellEdgeColors* cellEdge = nullptr;
this->firstAncestorOrThisOfType(cellEdge); this->firstAncestorOrThisOfType(cellEdge);
if ( propFilter || curve || cellEdge ) if (propFilter || curve || cellEdge)
{ {
removePerCellFaceOptionItems(optionList); removePerCellFaceOptionItems(optionList);
} }
@@ -1497,8 +1483,8 @@ QString RimEclipseResultDefinition::timeOfFlightString(bool shorter) const
tofString = shorter ? "TOF" : "Time Of Flight"; tofString = shorter ? "TOF" : "Time Of Flight";
} }
multipleSelected = multipleSelected || multipleSelected =
injectorSelectionState() >= MULTIPLE_SELECTED || producerSelectionState() >= MULTIPLE_SELECTED; multipleSelected || injectorSelectionState() >= MULTIPLE_SELECTED || producerSelectionState() >= MULTIPLE_SELECTED;
if (multipleSelected && !shorter) if (multipleSelected && !shorter)
{ {
@@ -1516,14 +1502,12 @@ QString RimEclipseResultDefinition::maxFractionTracerString(bool shorter) const
if (injectorSelectionState() >= ONE_SELECTED && producerSelectionState() == NONE_SELECTED) if (injectorSelectionState() >= ONE_SELECTED && producerSelectionState() == NONE_SELECTED)
{ {
mfString = shorter ? "FloodReg" : "Flooding Region"; mfString = shorter ? "FloodReg" : "Flooding Region";
if (injectorSelectionState() >= MULTIPLE_SELECTED) if (injectorSelectionState() >= MULTIPLE_SELECTED) mfString += "s";
mfString += "s";
} }
else if (injectorSelectionState() == NONE_SELECTED && producerSelectionState() >= ONE_SELECTED) else if (injectorSelectionState() == NONE_SELECTED && producerSelectionState() >= ONE_SELECTED)
{ {
mfString = shorter ? "DrainReg" : "Drainage Region"; mfString = shorter ? "DrainReg" : "Drainage Region";
if (producerSelectionState() >= MULTIPLE_SELECTED) if (producerSelectionState() >= MULTIPLE_SELECTED) mfString += "s";
mfString += "s";
} }
else else
{ {
@@ -1700,11 +1684,11 @@ RimEclipseResultDefinition::FlowTracerSelectionState RimEclipseResultDefinition:
{ {
return ALL_SELECTED; return ALL_SELECTED;
} }
else if (m_selectedInjectorTracers().size() == (size_t) 1) else if (m_selectedInjectorTracers().size() == (size_t)1)
{ {
return ONE_SELECTED; return ONE_SELECTED;
} }
else if (m_selectedInjectorTracers().size() > (size_t) 1) else if (m_selectedInjectorTracers().size() > (size_t)1)
{ {
return MULTIPLE_SELECTED; return MULTIPLE_SELECTED;
} }
@@ -1727,17 +1711,16 @@ RimEclipseResultDefinition::FlowTracerSelectionState RimEclipseResultDefinition:
{ {
return ALL_SELECTED; return ALL_SELECTED;
} }
else if (m_selectedProducerTracers().size() == (size_t) 1) else if (m_selectedProducerTracers().size() == (size_t)1)
{ {
return ONE_SELECTED; return ONE_SELECTED;
} }
else if (m_selectedProducerTracers().size() > (size_t) 1) else if (m_selectedProducerTracers().size() > (size_t)1)
{ {
return MULTIPLE_SELECTED; return MULTIPLE_SELECTED;
} }
} }
return NONE_SELECTED; return NONE_SELECTED;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------