mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1046 Made property filters work for ordinary flow diag results
This commit is contained in:
parent
003271ff54
commit
ed5e7b94ad
@ -117,9 +117,8 @@ void RicEclipsePropertyFilterFeatureImpl::setDefaults(RimEclipsePropertyFilter*
|
||||
CVF_ASSERT(reservoirView);
|
||||
|
||||
propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase());
|
||||
propertyFilter->resultDefinition->setResultVariable(reservoirView->cellResult->resultVariable());
|
||||
propertyFilter->resultDefinition->setPorosityModel(reservoirView->cellResult->porosityModel());
|
||||
propertyFilter->resultDefinition->setResultType(reservoirView->cellResult->resultType());
|
||||
propertyFilter->resultDefinition->simpleCopy(reservoirView->cellResult);
|
||||
|
||||
propertyFilter->resultDefinition->loadResult();
|
||||
propertyFilter->setToDefaultValues();
|
||||
propertyFilter->updateFilterName();
|
||||
|
@ -37,6 +37,8 @@
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfMath.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
|
||||
|
||||
namespace caf
|
||||
@ -292,32 +294,53 @@ void RimEclipsePropertyFilter::computeResultValueRange()
|
||||
|
||||
clearCategories();
|
||||
|
||||
size_t scalarIndex = resultDefinition->scalarResultIndex();
|
||||
if (scalarIndex != cvf::UNDEFINED_SIZE_T)
|
||||
if (resultDefinition->resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
RimReservoirCellResultsStorage* results = resultDefinition->currentGridCellResults();
|
||||
if (results)
|
||||
RimView* view;
|
||||
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->cellResults()->uniqueCellScalarValues(scalarIndex));
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData());
|
||||
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames());
|
||||
setCategoryValues(results->uniqueCellScalarValues(resAddr, timeStep));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t scalarIndex = resultDefinition->scalarResultIndex();
|
||||
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();
|
||||
setCategoryNames(fnVector);
|
||||
if ( resultDefinition->hasCategoryResult() )
|
||||
{
|
||||
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_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)
|
||||
{
|
||||
if ( &m_resultTypeUiField == changedField
|
||||
if ( &m_flowSolutionUiField == changedField
|
||||
|| &m_resultTypeUiField == 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();
|
||||
|
||||
// If the user are seeing the list with the actually selected result, select that result in the list. Otherwise select nothing.
|
||||
if ( m_resultTypeUiField() == m_resultType()
|
||||
&& m_porosityModelUiField() == m_porosityModel()
|
||||
&& varList.contains(resultVariable()))
|
||||
bool isFlowDiagFieldsRelevant = (m_resultType() == RimDefines::FLOW_DIAGNOSTICS);
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
m_resultVariableUiField = "";
|
||||
m_selectedTracersUiField = std::vector<QString>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (&m_resultVariableUiField == changedField)
|
||||
@ -464,6 +488,8 @@ size_t RimEclipseResultDefinition::scalarResultIndex() const
|
||||
{
|
||||
size_t gridScalarResultIndex = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
if (m_resultType() == RimDefines::FLOW_DIAGNOSTICS) return cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
const RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
|
||||
if (gridCellResults && gridCellResults->cellResults())
|
||||
{
|
||||
@ -478,6 +504,8 @@ size_t RimEclipseResultDefinition::scalarResultIndex() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
|
||||
{
|
||||
CVF_ASSERT(m_resultType() == RimDefines::FLOW_DIAGNOSTICS);
|
||||
|
||||
std::set<std::string> selTracerNames;
|
||||
for (const QString& tName : m_selectedTracers())
|
||||
{
|
||||
@ -492,6 +520,8 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultDefinition::loadResult()
|
||||
{
|
||||
if (m_resultType() == RimDefines::FLOW_DIAGNOSTICS) return; // Will load automatically on access
|
||||
|
||||
RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
|
||||
if (gridCellResults)
|
||||
{
|
||||
@ -622,6 +652,24 @@ RimFlowDiagSolution* RimEclipseResultDefinition::flowDiagSolution()
|
||||
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()->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;
|
||||
|
||||
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_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);
|
||||
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
RimEclipseResultDefinition();
|
||||
virtual ~RimEclipseResultDefinition();
|
||||
|
||||
void simpleCopy(const RimEclipseResultDefinition* other);
|
||||
|
||||
void setEclipseCase(RimEclipseCase* eclipseCase);
|
||||
|
||||
RimDefines::ResultCatType resultType() const { return m_resultType(); }
|
||||
@ -103,7 +105,10 @@ protected:
|
||||
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
|
||||
|
||||
private:
|
||||
bool hasDualPorFractureResult();
|
||||
void setFlowSolution(RimFlowDiagSolution* flowSol);
|
||||
void setSelectedTracers(const std::vector<QString>& selectedTracers);
|
||||
|
||||
bool hasDualPorFractureResult();
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard();
|
||||
QStringList getResultNamesForCurrentUiResultType();
|
||||
|
@ -142,9 +142,7 @@ void RimViewLinker::updateCellResult()
|
||||
{
|
||||
if (viewLink->isResultColorControlled())
|
||||
{
|
||||
eclipeView->cellResult()->setPorosityModel(eclipseCellResultDefinition->porosityModel());
|
||||
eclipeView->cellResult()->setResultType(eclipseCellResultDefinition->resultType());
|
||||
eclipeView->cellResult()->setResultVariable(eclipseCellResultDefinition->resultVariable());
|
||||
eclipeView->cellResult()->simpleCopy(eclipseCellResultDefinition);
|
||||
|
||||
if (viewLink->isLegendDefinitionsControlled())
|
||||
{
|
||||
|
@ -128,8 +128,8 @@ void RimWellLogExtractionCurve::setPropertiesFromView(RimView* view)
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view);
|
||||
if (eclipseView)
|
||||
{
|
||||
m_eclipseResultDefinition->setResultType(eclipseView->cellResult()->resultType());
|
||||
m_eclipseResultDefinition->setResultVariable(eclipseView->cellResult()->resultVariable());
|
||||
m_eclipseResultDefinition->simpleCopy(eclipseView->cellResult());
|
||||
|
||||
m_timeStep = eclipseView->currentTimeStep();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user