mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
#1046 Made property filters work for ordinary flow diag results
This commit is contained in:
@@ -117,9 +117,8 @@ void RicEclipsePropertyFilterFeatureImpl::setDefaults(RimEclipsePropertyFilter*
|
|||||||
CVF_ASSERT(reservoirView);
|
CVF_ASSERT(reservoirView);
|
||||||
|
|
||||||
propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase());
|
propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase());
|
||||||
propertyFilter->resultDefinition->setResultVariable(reservoirView->cellResult->resultVariable());
|
propertyFilter->resultDefinition->simpleCopy(reservoirView->cellResult);
|
||||||
propertyFilter->resultDefinition->setPorosityModel(reservoirView->cellResult->porosityModel());
|
|
||||||
propertyFilter->resultDefinition->setResultType(reservoirView->cellResult->resultType());
|
|
||||||
propertyFilter->resultDefinition->loadResult();
|
propertyFilter->resultDefinition->loadResult();
|
||||||
propertyFilter->setToDefaultValues();
|
propertyFilter->setToDefaultValues();
|
||||||
propertyFilter->updateFilterName();
|
propertyFilter->updateFilterName();
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
|
|
||||||
#include "cvfAssert.h"
|
#include "cvfAssert.h"
|
||||||
#include "cvfMath.h"
|
#include "cvfMath.h"
|
||||||
|
#include "RigFlowDiagResults.h"
|
||||||
|
#include "RimFlowDiagSolution.h"
|
||||||
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
@@ -292,32 +294,53 @@ void RimEclipsePropertyFilter::computeResultValueRange()
|
|||||||
|
|
||||||
clearCategories();
|
clearCategories();
|
||||||
|
|
||||||
size_t scalarIndex = resultDefinition->scalarResultIndex();
|
if (resultDefinition->resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||||
if (scalarIndex != cvf::UNDEFINED_SIZE_T)
|
|
||||||
{
|
{
|
||||||
RimReservoirCellResultsStorage* results = resultDefinition->currentGridCellResults();
|
RimView* view;
|
||||||
if (results)
|
this->firstAncestorOrThisOfType(view);
|
||||||
|
|
||||||
|
int timeStep = 0;
|
||||||
|
if (view) timeStep = view->currentTimeStep();
|
||||||
|
RigFlowDiagResultAddress resAddr = resultDefinition->flowDiagResAddress();
|
||||||
|
if ( resultDefinition->flowDiagSolution() )
|
||||||
{
|
{
|
||||||
results->cellResults()->minMaxCellScalarValues(scalarIndex, min, max);
|
RigFlowDiagResults* results = resultDefinition->flowDiagSolution()->flowDiagResults();
|
||||||
|
results->minMaxScalarValues(resAddr, timeStep, &max, &max);
|
||||||
|
|
||||||
if (resultDefinition->hasCategoryResult())
|
if ( resultDefinition->hasCategoryResult() )
|
||||||
{
|
{
|
||||||
if (resultDefinition->resultType() != RimDefines::FORMATION_NAMES)
|
setCategoryValues(results->uniqueCellScalarValues(resAddr, timeStep));
|
||||||
{
|
}
|
||||||
setCategoryValues(results->cellResults()->uniqueCellScalarValues(scalarIndex));
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData());
|
size_t scalarIndex = resultDefinition->scalarResultIndex();
|
||||||
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames());
|
if ( scalarIndex != cvf::UNDEFINED_SIZE_T )
|
||||||
|
{
|
||||||
|
RimReservoirCellResultsStorage* results = resultDefinition->currentGridCellResults();
|
||||||
|
if ( results )
|
||||||
|
{
|
||||||
|
results->cellResults()->minMaxCellScalarValues(scalarIndex, min, max);
|
||||||
|
|
||||||
const std::vector<QString>& fnVector = parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
|
if ( resultDefinition->hasCategoryResult() )
|
||||||
setCategoryNames(fnVector);
|
{
|
||||||
|
if ( resultDefinition->resultType() != RimDefines::FORMATION_NAMES )
|
||||||
|
{
|
||||||
|
setCategoryValues(results->cellResults()->uniqueCellScalarValues(scalarIndex));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData());
|
||||||
|
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames());
|
||||||
|
|
||||||
|
const std::vector<QString>& fnVector = parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
|
||||||
|
setCategoryNames(fnVector);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_maximumResultValue = max;
|
m_maximumResultValue = max;
|
||||||
m_minimumResultValue = min;
|
m_minimumResultValue = min;
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,18 @@ RimEclipseResultDefinition::~RimEclipseResultDefinition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEclipseResultDefinition::simpleCopy(const RimEclipseResultDefinition* other)
|
||||||
|
{
|
||||||
|
this->setResultVariable(other->resultVariable());
|
||||||
|
this->setPorosityModel(other->porosityModel());
|
||||||
|
this->setResultType(other->resultType());
|
||||||
|
this->setFlowSolution(other->m_flowSolution());
|
||||||
|
this->setSelectedTracers(other->m_selectedTracers());
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -124,23 +136,35 @@ RimReservoirCellResultsStorage* RimEclipseResultDefinition::currentGridCellResul
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
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_resultTypeUiField == changedField
|
if ( &m_flowSolutionUiField == changedField
|
||||||
|
|| &m_resultTypeUiField == changedField
|
||||||
|| &m_porosityModelUiField == changedField )
|
|| &m_porosityModelUiField == changedField )
|
||||||
{
|
{
|
||||||
|
// If the user are seeing the list with the actually selected result,
|
||||||
|
// select that result in the list. Otherwise select nothing.
|
||||||
|
|
||||||
QStringList varList = getResultNamesForCurrentUiResultType();
|
QStringList varList = getResultNamesForCurrentUiResultType();
|
||||||
|
|
||||||
// If the user are seeing the list with the actually selected result, select that result in the list. Otherwise select nothing.
|
bool isFlowDiagFieldsRelevant = (m_resultType() == RimDefines::FLOW_DIAGNOSTICS);
|
||||||
if ( m_resultTypeUiField() == m_resultType()
|
|
||||||
&& m_porosityModelUiField() == m_porosityModel()
|
|
||||||
&& varList.contains(resultVariable()))
|
if ( ( m_flowSolutionUiField() == m_flowSolution() || !isFlowDiagFieldsRelevant)
|
||||||
|
&& m_resultTypeUiField() == m_resultType()
|
||||||
|
&& m_porosityModelUiField() == m_porosityModel() )
|
||||||
{
|
{
|
||||||
m_resultVariableUiField = resultVariable();
|
if (varList.contains(resultVariable()))
|
||||||
|
{
|
||||||
|
m_resultVariableUiField = resultVariable();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFlowDiagFieldsRelevant) m_selectedTracersUiField = m_selectedTracers();
|
||||||
|
else m_selectedTracersUiField = std::vector<QString>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_resultVariableUiField = "";
|
m_resultVariableUiField = "";
|
||||||
|
m_selectedTracersUiField = std::vector<QString>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (&m_resultVariableUiField == changedField)
|
if (&m_resultVariableUiField == changedField)
|
||||||
@@ -464,6 +488,8 @@ size_t RimEclipseResultDefinition::scalarResultIndex() const
|
|||||||
{
|
{
|
||||||
size_t gridScalarResultIndex = cvf::UNDEFINED_SIZE_T;
|
size_t gridScalarResultIndex = cvf::UNDEFINED_SIZE_T;
|
||||||
|
|
||||||
|
if (m_resultType() == RimDefines::FLOW_DIAGNOSTICS) return cvf::UNDEFINED_SIZE_T;
|
||||||
|
|
||||||
const RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
|
const RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
|
||||||
if (gridCellResults && gridCellResults->cellResults())
|
if (gridCellResults && gridCellResults->cellResults())
|
||||||
{
|
{
|
||||||
@@ -478,6 +504,8 @@ size_t RimEclipseResultDefinition::scalarResultIndex() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
|
RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
|
||||||
{
|
{
|
||||||
|
CVF_ASSERT(m_resultType() == RimDefines::FLOW_DIAGNOSTICS);
|
||||||
|
|
||||||
std::set<std::string> selTracerNames;
|
std::set<std::string> selTracerNames;
|
||||||
for (const QString& tName : m_selectedTracers())
|
for (const QString& tName : m_selectedTracers())
|
||||||
{
|
{
|
||||||
@@ -492,6 +520,8 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEclipseResultDefinition::loadResult()
|
void RimEclipseResultDefinition::loadResult()
|
||||||
{
|
{
|
||||||
|
if (m_resultType() == RimDefines::FLOW_DIAGNOSTICS) return; // Will load automatically on access
|
||||||
|
|
||||||
RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
|
RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
|
||||||
if (gridCellResults)
|
if (gridCellResults)
|
||||||
{
|
{
|
||||||
@@ -622,6 +652,24 @@ RimFlowDiagSolution* RimEclipseResultDefinition::flowDiagSolution()
|
|||||||
return m_flowSolution();
|
return m_flowSolution();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEclipseResultDefinition::setFlowSolution(RimFlowDiagSolution* flowSol)
|
||||||
|
{
|
||||||
|
this->m_flowSolution = flowSol;
|
||||||
|
this->m_flowSolutionUiField = flowSol;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEclipseResultDefinition::setSelectedTracers(const std::vector<QString>& selectedTracers)
|
||||||
|
{
|
||||||
|
this->m_selectedTracers = selectedTracers;
|
||||||
|
this->m_selectedTracersUiField = selectedTracers;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -643,6 +691,9 @@ bool RimEclipseResultDefinition::hasCategoryResult() const
|
|||||||
&& m_eclipseCase->reservoirData()
|
&& m_eclipseCase->reservoirData()
|
||||||
&& m_eclipseCase->reservoirData()->activeFormationNames() ) return true;
|
&& m_eclipseCase->reservoirData()->activeFormationNames() ) return true;
|
||||||
|
|
||||||
|
if (this->m_resultType() == RimDefines::FLOW_DIAGNOSTICS
|
||||||
|
&& m_resultVariable() == RIG_FLD_MAX_FRACTION_TRACER_RESNAME) return true;
|
||||||
|
|
||||||
if (!this->hasStaticResult()) return false;
|
if (!this->hasStaticResult()) return false;
|
||||||
|
|
||||||
return this->resultVariable().contains("NUM", Qt::CaseInsensitive);
|
return this->resultVariable().contains("NUM", Qt::CaseInsensitive);
|
||||||
@@ -680,6 +731,17 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
|
|||||||
{
|
{
|
||||||
uiOrdering.add(&m_flowSolutionUiField);
|
uiOrdering.add(&m_flowSolutionUiField);
|
||||||
uiOrdering.add(&m_selectedTracersUiField);
|
uiOrdering.add(&m_selectedTracersUiField);
|
||||||
|
|
||||||
|
if ( m_flowSolution() == nullptr )
|
||||||
|
{
|
||||||
|
RimEclipseResultCase* eclCase;
|
||||||
|
this->firstAncestorOrThisOfType(eclCase);
|
||||||
|
if ( eclCase )
|
||||||
|
{
|
||||||
|
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
|
||||||
|
if (flowSols.size()){ this->setFlowSolution(flowSols[0]); }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
uiOrdering.add(&m_resultVariableUiField);
|
uiOrdering.add(&m_resultVariableUiField);
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ public:
|
|||||||
RimEclipseResultDefinition();
|
RimEclipseResultDefinition();
|
||||||
virtual ~RimEclipseResultDefinition();
|
virtual ~RimEclipseResultDefinition();
|
||||||
|
|
||||||
|
void simpleCopy(const RimEclipseResultDefinition* other);
|
||||||
|
|
||||||
void setEclipseCase(RimEclipseCase* eclipseCase);
|
void setEclipseCase(RimEclipseCase* eclipseCase);
|
||||||
|
|
||||||
RimDefines::ResultCatType resultType() const { return m_resultType(); }
|
RimDefines::ResultCatType resultType() const { return m_resultType(); }
|
||||||
@@ -103,7 +105,10 @@ protected:
|
|||||||
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
|
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool hasDualPorFractureResult();
|
void setFlowSolution(RimFlowDiagSolution* flowSol);
|
||||||
|
void setSelectedTracers(const std::vector<QString>& selectedTracers);
|
||||||
|
|
||||||
|
bool hasDualPorFractureResult();
|
||||||
|
|
||||||
QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard();
|
QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard();
|
||||||
QStringList getResultNamesForCurrentUiResultType();
|
QStringList getResultNamesForCurrentUiResultType();
|
||||||
|
|||||||
@@ -142,9 +142,7 @@ void RimViewLinker::updateCellResult()
|
|||||||
{
|
{
|
||||||
if (viewLink->isResultColorControlled())
|
if (viewLink->isResultColorControlled())
|
||||||
{
|
{
|
||||||
eclipeView->cellResult()->setPorosityModel(eclipseCellResultDefinition->porosityModel());
|
eclipeView->cellResult()->simpleCopy(eclipseCellResultDefinition);
|
||||||
eclipeView->cellResult()->setResultType(eclipseCellResultDefinition->resultType());
|
|
||||||
eclipeView->cellResult()->setResultVariable(eclipseCellResultDefinition->resultVariable());
|
|
||||||
|
|
||||||
if (viewLink->isLegendDefinitionsControlled())
|
if (viewLink->isLegendDefinitionsControlled())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ void RimWellLogExtractionCurve::setPropertiesFromView(RimView* view)
|
|||||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view);
|
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view);
|
||||||
if (eclipseView)
|
if (eclipseView)
|
||||||
{
|
{
|
||||||
m_eclipseResultDefinition->setResultType(eclipseView->cellResult()->resultType());
|
m_eclipseResultDefinition->simpleCopy(eclipseView->cellResult());
|
||||||
m_eclipseResultDefinition->setResultVariable(eclipseView->cellResult()->resultVariable());
|
|
||||||
m_timeStep = eclipseView->currentTimeStep();
|
m_timeStep = eclipseView->currentTimeStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user