mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1056 Added support for flow data for cell edge in 3D view
This commit is contained in:
parent
8970d93a4d
commit
f16228ecc5
@ -298,10 +298,22 @@ cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeResultAccess
|
||||
const RigGridBase* grid)
|
||||
{
|
||||
cvf::ref<RigCellEdgeResultAccessor> cellEdgeResultAccessor = new RigCellEdgeResultAccessor();
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
|
||||
if (cellEdgeResultColors->propertyType() == RimCellEdgeColors::ANY_SINGLE_PROPERTY)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> daObj = RivCellEdgeGeometryUtils::createCellCenterResultAccessor(cellEdgeResultColors->singleVarEdgeResultColors(), timeStepIndex, eclipseCase, grid);
|
||||
|
||||
for (size_t cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
|
||||
{
|
||||
cellEdgeResultAccessor->setDataAccessObjectForFace(static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx), daObj.p());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t resultIndices[6];
|
||||
cellEdgeResultColors->gridScalarIndices(resultIndices);
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
|
||||
std::vector<RimCellEdgeMetaData> metaData;
|
||||
cellEdgeResultColors->cellEdgeMetaData(&metaData);
|
||||
@ -343,9 +355,3 @@ cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellCenterResultAcce
|
||||
return resultAccessor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -102,9 +102,9 @@ void RimCellEdgeColors::loadResult()
|
||||
|
||||
if (isUsingSingleVariable())
|
||||
{
|
||||
size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadScalarResult(m_singleVarEdgeResultColors->resultType(),
|
||||
m_singleVarEdgeResultColors->resultVariable());
|
||||
|
||||
m_singleVarEdgeResultColors->loadResult();;
|
||||
|
||||
size_t resultindex = m_singleVarEdgeResultColors->scalarResultIndex();
|
||||
for (int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
|
||||
{
|
||||
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(m_singleVarEdgeResultColors->resultVariable(), resultindex);
|
||||
@ -397,6 +397,11 @@ bool RimCellEdgeColors::hasResult() const
|
||||
{
|
||||
if (!enableCellEdgeColors()) return false;
|
||||
|
||||
if (isUsingSingleVariable() && m_singleVarEdgeResultColors->resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hasResult = false;
|
||||
int cubeFaceIndex;
|
||||
for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex)
|
||||
@ -549,3 +554,11 @@ RimLegendConfig* RimCellEdgeColors::legendConfig()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellEdgeColors::PropertyType RimCellEdgeColors::propertyType() const
|
||||
{
|
||||
return m_propertyType();
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,11 @@ public:
|
||||
void loadResult();
|
||||
bool hasResult() const;
|
||||
bool hasCategoryResult() const;
|
||||
bool isUsingSingleVariable() const;
|
||||
|
||||
RimEclipseCellColors* singleVarEdgeResultColors();
|
||||
RimLegendConfig* legendConfig();
|
||||
PropertyType propertyType() const;
|
||||
|
||||
void minMaxCellEdgeValues(double& min, double& max);
|
||||
void posNegClosestToZero(double& pos, double& neg);
|
||||
@ -115,7 +118,6 @@ private:
|
||||
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
||||
double m_ignoredResultScalar;
|
||||
|
||||
bool isUsingSingleVariable() const;
|
||||
|
||||
caf::PdmField<caf::AppEnum< PropertyType > > m_propertyType;
|
||||
caf::PdmChildField<RimLegendConfig*> m_legendConfig;
|
||||
|
@ -20,7 +20,13 @@
|
||||
|
||||
#include "RimEclipseCellColors.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseFaultColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimLegendConfig.h"
|
||||
@ -234,6 +240,107 @@ RimEclipseView* RimEclipseCellColors::reservoirView()
|
||||
return m_reservoirView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
|
||||
{
|
||||
if (this->resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
RigFlowDiagResults* flowResultsData = this->flowDiagSolution()->flowDiagResults();
|
||||
RigFlowDiagResultAddress resAddr = this->flowDiagResAddress();
|
||||
|
||||
int integerTimeStep = static_cast<int>(currentTimeStep);
|
||||
|
||||
flowResultsData->minMaxScalarValues(resAddr, integerTimeStep, &globalMin, &globalMax);
|
||||
flowResultsData->posNegClosestToZero(resAddr, integerTimeStep, &globalPosClosestToZero, &globalNegClosestToZero);
|
||||
|
||||
double localMin, localMax;
|
||||
double localPosClosestToZero, localNegClosestToZero;
|
||||
if (this->hasDynamicResult())
|
||||
{
|
||||
flowResultsData->minMaxScalarValues(resAddr, integerTimeStep, &localMin, &localMax);
|
||||
flowResultsData->posNegClosestToZero(resAddr, integerTimeStep, &localPosClosestToZero, &localNegClosestToZero);
|
||||
}
|
||||
else
|
||||
{
|
||||
localMin = globalMin;
|
||||
localMax = globalMax;
|
||||
|
||||
localPosClosestToZero = globalPosClosestToZero;
|
||||
localNegClosestToZero = globalNegClosestToZero;
|
||||
}
|
||||
|
||||
CVF_ASSERT(this->legendConfig());
|
||||
|
||||
this->legendConfig()->disableAllTimeStepsRange(true);
|
||||
this->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
this->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if (this->hasCategoryResult())
|
||||
{
|
||||
this->legendConfig()->setNamedCategories(this->flowDiagSolution()->tracerNames());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RimEclipseCase* rimEclipseCase = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimEclipseCase);
|
||||
CVF_ASSERT(rimEclipseCase);
|
||||
if (!rimEclipseCase) return;
|
||||
|
||||
RigEclipseCaseData* eclipseCase = rimEclipseCase->reservoirData();
|
||||
CVF_ASSERT(eclipseCase);
|
||||
if (!eclipseCase) return;
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(this->porosityModel());
|
||||
RigCaseCellResultsData* cellResultsData = eclipseCase->results(porosityModel);
|
||||
CVF_ASSERT(cellResultsData);
|
||||
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
cellResultsData->minMaxCellScalarValues(this->scalarResultIndex(), globalMin, globalMax);
|
||||
cellResultsData->posNegClosestToZero(this->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero);
|
||||
|
||||
double localMin, localMax;
|
||||
double localPosClosestToZero, localNegClosestToZero;
|
||||
if (this->hasDynamicResult())
|
||||
{
|
||||
cellResultsData->minMaxCellScalarValues(this->scalarResultIndex(), currentTimeStep, localMin, localMax);
|
||||
cellResultsData->posNegClosestToZero(this->scalarResultIndex(), currentTimeStep, localPosClosestToZero, localNegClosestToZero);
|
||||
}
|
||||
else
|
||||
{
|
||||
localMin = globalMin;
|
||||
localMax = globalMax;
|
||||
|
||||
localPosClosestToZero = globalPosClosestToZero;
|
||||
localNegClosestToZero = globalNegClosestToZero;
|
||||
}
|
||||
|
||||
CVF_ASSERT(this->legendConfig());
|
||||
|
||||
this->legendConfig()->disableAllTimeStepsRange(false);
|
||||
this->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
this->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if (this->hasCategoryResult())
|
||||
{
|
||||
if (this->resultType() != RimDefines::FORMATION_NAMES)
|
||||
{
|
||||
this->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(this->scalarResultIndex()));
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<QString>& fnVector = eclipseCase->activeFormationNames()->formationNames();
|
||||
this->legendConfig()->setNamedCategoriesInverse(fnVector);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
void setReservoirView(RimEclipseView* ownerReservoirView);
|
||||
RimEclipseView* reservoirView();
|
||||
|
||||
void updateLegendData(size_t timestep);
|
||||
RimLegendConfig* legendConfig();
|
||||
caf::PdmChildField<RimTernaryLegendConfig*> ternaryLegendConfig;
|
||||
|
||||
|
@ -960,24 +960,31 @@ void RimEclipseView::updateLegends()
|
||||
|
||||
if (this->cellEdgeResult()->hasResult())
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
this->cellEdgeResult()->minMaxCellEdgeValues(globalMin, globalMax);
|
||||
this->cellEdgeResult()->posNegClosestToZero(globalPosClosestToZero, globalNegClosestToZero);
|
||||
|
||||
this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero);
|
||||
this->cellEdgeResult()->legendConfig()->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax);
|
||||
|
||||
if (this->cellEdgeResult()->hasCategoryResult())
|
||||
if (this->cellEdgeResult()->isUsingSingleVariable())
|
||||
{
|
||||
if(cellEdgeResult()->singleVarEdgeResultColors()->resultType() != RimDefines::FORMATION_NAMES)
|
||||
this->cellEdgeResult()->singleVarEdgeResultColors()->updateLegendData(m_currentTimeStep);
|
||||
}
|
||||
else
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
this->cellEdgeResult()->minMaxCellEdgeValues(globalMin, globalMax);
|
||||
this->cellEdgeResult()->posNegClosestToZero(globalPosClosestToZero, globalNegClosestToZero);
|
||||
|
||||
this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero);
|
||||
this->cellEdgeResult()->legendConfig()->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax);
|
||||
|
||||
if (this->cellEdgeResult()->hasCategoryResult())
|
||||
{
|
||||
cellEdgeResult()->legendConfig()->setIntegerCategories(results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->scalarResultIndex()));
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<QString>& fnVector = eclipseCase->activeFormationNames()->formationNames();
|
||||
cellEdgeResult()->legendConfig()->setNamedCategoriesInverse(fnVector);
|
||||
if(cellEdgeResult()->singleVarEdgeResultColors()->resultType() != RimDefines::FORMATION_NAMES)
|
||||
{
|
||||
cellEdgeResult()->legendConfig()->setIntegerCategories(results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->scalarResultIndex()));
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<QString>& fnVector = eclipseCase->activeFormationNames()->formationNames();
|
||||
cellEdgeResult()->legendConfig()->setNamedCategoriesInverse(fnVector);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -998,92 +1005,12 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
|
||||
{
|
||||
if (resultColors->hasResult())
|
||||
{
|
||||
if (resultColors->resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
RigFlowDiagResults* flowResultsData = resultColors->flowDiagSolution()->flowDiagResults();
|
||||
RigFlowDiagResultAddress resAddr = resultColors->flowDiagResAddress();
|
||||
|
||||
flowResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &globalMin, &globalMax);
|
||||
flowResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &globalPosClosestToZero, &globalNegClosestToZero);
|
||||
|
||||
double localMin, localMax;
|
||||
double localPosClosestToZero, localNegClosestToZero;
|
||||
if ( resultColors->hasDynamicResult() )
|
||||
{
|
||||
flowResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &localMin, &localMax);
|
||||
flowResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero);
|
||||
}
|
||||
else
|
||||
{
|
||||
localMin = globalMin;
|
||||
localMax = globalMax;
|
||||
|
||||
localPosClosestToZero = globalPosClosestToZero;
|
||||
localNegClosestToZero = globalNegClosestToZero;
|
||||
}
|
||||
|
||||
CVF_ASSERT(resultColors->legendConfig());
|
||||
|
||||
resultColors->legendConfig()->disableAllTimeStepsRange(true);
|
||||
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if ( resultColors->hasCategoryResult() )
|
||||
{
|
||||
resultColors->legendConfig()->setNamedCategories(resultColors->flowDiagSolution()->tracerNames());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), globalMin, globalMax);
|
||||
cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero);
|
||||
|
||||
double localMin, localMax;
|
||||
double localPosClosestToZero, localNegClosestToZero;
|
||||
if ( resultColors->hasDynamicResult() )
|
||||
{
|
||||
cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), m_currentTimeStep, localMin, localMax);
|
||||
cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), m_currentTimeStep, localPosClosestToZero, localNegClosestToZero);
|
||||
}
|
||||
else
|
||||
{
|
||||
localMin = globalMin;
|
||||
localMax = globalMax;
|
||||
|
||||
localPosClosestToZero = globalPosClosestToZero;
|
||||
localNegClosestToZero = globalNegClosestToZero;
|
||||
}
|
||||
|
||||
CVF_ASSERT(resultColors->legendConfig());
|
||||
|
||||
resultColors->legendConfig()->disableAllTimeStepsRange(false);
|
||||
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if ( resultColors->hasCategoryResult() )
|
||||
{
|
||||
if ( resultColors->resultType() != RimDefines::FORMATION_NAMES )
|
||||
{
|
||||
resultColors->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex()));
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<QString>& fnVector = eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
|
||||
resultColors->legendConfig()->setNamedCategoriesInverse(fnVector);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultColors->updateLegendData(m_currentTimeStep);
|
||||
|
||||
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
|
||||
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariableUiName()));
|
||||
}
|
||||
|
||||
|
||||
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();
|
||||
if (resultColors->isTernarySaturationSelected() && maxTimeStepCount > 1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user