mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Result Divided by Area: Establish concept used to compute flow velocity and normalized trans (#7349)
* Geometry Tools : Add convenience functions for polygon area * #7232 Result Divided by Area: Add cell face result and show in GUI Native support for flow rate is given by mass rate (mass per time) over a cell face. Add a derived result that takes flow rate divided by cell face area to get velocity (distance per time). Add support for this concept on relevant native results, and indicate this result type in UI using a "/A" postfix * Speed up divided-by-area calculations by using openmp * Some refactoring of result data access. * Make sure NNC data is scaled correctly in vector flow viz. Co-authored-by: jonjenssen <jon@soundsoft.no>
This commit is contained in:
@@ -473,7 +473,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
||||
->resultInfo( cellResAddr.eclipseResultAddress ) ) )
|
||||
{
|
||||
RiaLogging::warning( "Could not find a restart result property with name: \"" +
|
||||
cellResAddr.eclipseResultAddress.m_resultName + "\"" );
|
||||
cellResAddr.eclipseResultAddress.resultName() + "\"" );
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
||||
->resultInfo( cellResAddr.eclipseResultAddress ) ) )
|
||||
{
|
||||
RiaLogging::warning( "Could not find a restart result property with name: \"" +
|
||||
cellResAddr.eclipseResultAddress.m_resultName + "\"" );
|
||||
cellResAddr.eclipseResultAddress.resultName() + "\"" );
|
||||
continue;
|
||||
}
|
||||
RimGridTimeHistoryCurve* newCurve = new RimGridTimeHistoryCurve();
|
||||
|
@@ -104,16 +104,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
maxAbsResult = std::max( cvf::Math::abs( max ), cvf::Math::abs( min ) );
|
||||
}
|
||||
|
||||
float arrowScaling = arrowConstantScaling;
|
||||
if ( result->scaleMethod() == RimElementVectorResult::ScaleMethod::RESULT )
|
||||
{
|
||||
arrowScaling = arrowConstantScaling / maxAbsResult;
|
||||
}
|
||||
|
||||
if ( result->scaleMethod() == RimElementVectorResult::ScaleMethod::RESULT_LOG )
|
||||
{
|
||||
arrowScaling = result->sizeScale() * scaleLogarithmically( maxAbsResult );
|
||||
}
|
||||
float arrowScaling = arrowConstantScaling / maxAbsResult;
|
||||
|
||||
std::vector<RigEclipseResultAddress> resultAddresses;
|
||||
std::vector<cvf::StructGridInterface::FaceType> directions;
|
||||
@@ -190,15 +181,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
cvf::Vec3d faceCenter;
|
||||
cvf::Vec3d faceNormal;
|
||||
getFaceCenterAndNormal( gcIdx, directions[dir], faceCenter, faceNormal );
|
||||
|
||||
if ( result->scaleMethod() == RimElementVectorResult::ScaleMethod::RESULT )
|
||||
{
|
||||
faceNormal *= std::abs( resultValue );
|
||||
}
|
||||
else if ( result->scaleMethod() == RimElementVectorResult::ScaleMethod::RESULT_LOG )
|
||||
{
|
||||
faceNormal *= std::abs( scaleLogarithmically( std::abs( resultValue ) ) );
|
||||
}
|
||||
faceNormal *= std::abs( resultValue );
|
||||
|
||||
tensorVisualizations.push_back(
|
||||
ElementVectorResultVisualization( faceCenter,
|
||||
@@ -225,22 +208,8 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
cvf::Vec3d faceNormal;
|
||||
cvf::Vec3d faceNormalScaled;
|
||||
getFaceCenterAndNormal( gcIdx, directions[dir], faceCenter, faceNormal );
|
||||
faceNormalScaled = faceNormal;
|
||||
|
||||
if ( result->scaleMethod() == RimElementVectorResult::ScaleMethod::RESULT )
|
||||
{
|
||||
faceNormalScaled *= resultValue;
|
||||
}
|
||||
else if ( result->scaleMethod() == RimElementVectorResult::ScaleMethod::RESULT_LOG )
|
||||
{
|
||||
faceNormalScaled *= ( 1.0 - static_cast<double>( std::signbit( resultValue ) ) * 2.0 ) *
|
||||
scaleLogarithmically( std::abs( resultValue ) );
|
||||
}
|
||||
|
||||
faceNormalScaled = faceNormal * resultValue;
|
||||
aggregatedVector += faceNormalScaled;
|
||||
|
||||
// If the vector is scaled in a logarithmic scale, the result should still be the same as before.
|
||||
// Hence, we need to separate the result value from the vector.
|
||||
aggregatedResult += faceNormal.getNormalized() * resultValue;
|
||||
}
|
||||
if ( aggregatedResult.length() >= result->threshold() )
|
||||
@@ -266,7 +235,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
|
||||
for ( auto candidate : combinedAddresses )
|
||||
{
|
||||
if ( candidate.m_resultCatType == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
|
||||
if ( candidate.resultCatType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
|
||||
{
|
||||
if ( nncData->hasScalarValues( candidate ) )
|
||||
{
|
||||
@@ -288,21 +257,14 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
resultValue += nncResultVals.at( flIdx )->at( timeStepIndex )[nIdx];
|
||||
}
|
||||
}
|
||||
|
||||
cvf::Vec3d connCenter =
|
||||
static_cast<cvf::Vec3d>( cvf::GeometryTools::computePolygonCenter<cvf::Vec3f>( conn.polygon() ) );
|
||||
|
||||
cvf::Vec3d faceCenter;
|
||||
cvf::Vec3d connNormal;
|
||||
getFaceCenterAndNormal( conn.c1GlobIdx(), conn.face(), faceCenter, connNormal );
|
||||
|
||||
if ( result->scaleMethod() == RimElementVectorResult::ScaleMethod::RESULT )
|
||||
{
|
||||
connNormal *= std::abs( resultValue );
|
||||
}
|
||||
else if ( result->scaleMethod() == RimElementVectorResult::ScaleMethod::RESULT_LOG )
|
||||
{
|
||||
connNormal *= scaleLogarithmically( std::abs( resultValue ) );
|
||||
}
|
||||
connNormal *= std::abs( resultValue );
|
||||
|
||||
if ( std::abs( resultValue ) >= result->threshold() )
|
||||
{
|
||||
@@ -341,7 +303,7 @@ cvf::ref<cvf::Part>
|
||||
vertices.reserve( tensorVisualizations.size() * 7 );
|
||||
|
||||
uint counter = 0;
|
||||
for ( ElementVectorResultVisualization tensor : tensorVisualizations )
|
||||
for ( const ElementVectorResultVisualization& tensor : tensorVisualizations )
|
||||
{
|
||||
for ( const cvf::Vec3f& vertex : createArrowVertices( tensor ) )
|
||||
{
|
||||
@@ -430,7 +392,7 @@ void RivElementVectorResultPartMgr::createResultColorTextureCoords(
|
||||
size_t vertexCount = elementVectorResultVisualizations.size() * 7;
|
||||
if ( textureCoords->size() != vertexCount ) textureCoords->reserve( vertexCount );
|
||||
|
||||
for ( auto evrViz : elementVectorResultVisualizations )
|
||||
for ( auto& evrViz : elementVectorResultVisualizations )
|
||||
{
|
||||
for ( size_t vxIdx = 0; vxIdx < 7; ++vxIdx )
|
||||
{
|
||||
|
@@ -169,7 +169,7 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
|
||||
eclipseResultAddress = cellResultColors->eclipseResultAddress();
|
||||
}
|
||||
|
||||
if ( eclipseResultAddress.m_resultCatType == RiaDefines::ResultCatType::ALLAN_DIAGRAMS )
|
||||
if ( eclipseResultAddress.resultCatType() == RiaDefines::ResultCatType::ALLAN_DIAGRAMS )
|
||||
{
|
||||
showCompleteNncGeo = true;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
|
||||
|
||||
for ( const auto& s : stringsToMatch )
|
||||
{
|
||||
if ( eclipseResultAddress.m_resultName.contains( s, Qt::CaseInsensitive ) )
|
||||
if ( eclipseResultAddress.resultName().contains( s, Qt::CaseInsensitive ) )
|
||||
{
|
||||
showCompleteNncGeo = true;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
|
||||
if ( showNncs )
|
||||
{
|
||||
RigMainGrid* mainGrid = m_reservoirView->mainGrid();
|
||||
mainGrid->nncData()->ensureConnectionDataIsProcecced();
|
||||
mainGrid->nncData()->ensureConnectionDataIsProcessed();
|
||||
|
||||
if ( showCompleteNncGeo )
|
||||
{
|
||||
|
@@ -71,7 +71,7 @@ RimEclipsePropertyFilter::RimEclipsePropertyFilter()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition", "", "", "" );
|
||||
m_resultDefinition = new RimEclipseResultDefinition();
|
||||
m_resultDefinition->setDiffResultOptionsEnabled( true );
|
||||
m_resultDefinition->enableDeltaResults( true );
|
||||
|
||||
// Set to hidden to avoid this item to been displayed as a child item
|
||||
// Fields in this object are displayed using defineUiOrdering()
|
||||
|
@@ -162,8 +162,8 @@ void RimGridCrossPlotDataSet::setCellFilterView( RimGridView* cellFilterView )
|
||||
RigEclipseResultAddress resAddr = eclipseView->cellResult()->eclipseResultAddress();
|
||||
if ( resAddr.isValid() )
|
||||
{
|
||||
m_xAxisProperty->setResultType( resAddr.m_resultCatType );
|
||||
m_xAxisProperty->setResultVariable( resAddr.m_resultName );
|
||||
m_xAxisProperty->setResultType( resAddr.resultCatType() );
|
||||
m_xAxisProperty->setResultVariable( resAddr.resultName() );
|
||||
m_yAxisProperty->setResultType( RiaDefines::ResultCatType::STATIC_NATIVE );
|
||||
m_yAxisProperty->setResultVariable( "DEPTH" );
|
||||
m_timeStep = eclipseView->currentTimeStep();
|
||||
|
@@ -408,7 +408,7 @@ QString Rim3dOverlayInfoConfig::resultInfoText( const RigHistogramData& histData
|
||||
if ( isResultsInfoRelevant )
|
||||
{
|
||||
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
|
||||
QString diffResString = eclipseView->cellResult()->diffResultUiName();
|
||||
QString diffResString = eclipseView->cellResult()->additionalResultText();
|
||||
if ( !contourMap->contourMapProjection()->isColumnResult() )
|
||||
{
|
||||
infoText += QString( "<b>Cell Property:</b> %1<br>" ).arg( propName );
|
||||
@@ -443,7 +443,7 @@ QString Rim3dOverlayInfoConfig::resultInfoText( const RigHistogramData& histData
|
||||
if ( isResultsInfoRelevant )
|
||||
{
|
||||
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
|
||||
QString diffResString = eclipseView->cellResult()->diffResultUiName();
|
||||
QString diffResString = eclipseView->cellResult()->additionalResultText();
|
||||
QString timeRangeText = m_statisticsTimeRange().uiText();
|
||||
if ( eclipseView->cellResult()->isFlowDiagOrInjectionFlooding() )
|
||||
{
|
||||
|
@@ -720,7 +720,7 @@ bool RimEclipseCase::ensureNncDataIsComputed()
|
||||
RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
|
||||
if ( rigEclipseCase && rigEclipseCase->mainGrid() )
|
||||
{
|
||||
computedData = rigEclipseCase->mainGrid()->nncData()->ensureConnectionDataIsProcecced();
|
||||
computedData = rigEclipseCase->mainGrid()->nncData()->ensureConnectionDataIsProcessed();
|
||||
}
|
||||
|
||||
return computedData;
|
||||
|
@@ -97,7 +97,7 @@ void RimEclipseCellColors::fieldChangedByUi( const caf::PdmFieldHandle* changedF
|
||||
{
|
||||
if ( oldValue != newValue )
|
||||
{
|
||||
changeLegendConfig( this->resultVariable() );
|
||||
changeLegendConfig( this->resultVariableUiName() );
|
||||
}
|
||||
|
||||
if ( newValue != RiaResultNames::undefinedResultName() )
|
||||
@@ -187,6 +187,7 @@ RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const QStri
|
||||
if ( resultName.contains( s, Qt::CaseInsensitive ) )
|
||||
{
|
||||
useLog = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -290,7 +291,7 @@ void RimEclipseCellColors::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeO
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseCellColors::updateLegendCategorySettings()
|
||||
{
|
||||
changeLegendConfig( this->resultVariable() );
|
||||
changeLegendConfig( this->resultVariableUiName() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -48,7 +48,7 @@ RimEclipseFaultColors::RimEclipseFaultColors()
|
||||
"" );
|
||||
m_customFaultResultColors = new RimEclipseCellColors();
|
||||
m_customFaultResultColors.uiCapability()->setUiHidden( true );
|
||||
m_customFaultResultColors->setDiffResultOptionsEnabled( true );
|
||||
m_customFaultResultColors->enableDeltaResults( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -101,7 +101,7 @@ CAF_PDM_SOURCE_INIT( RimEclipseResultDefinition, "ResultDefinition" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::LabelPosType labelPosition )
|
||||
: m_diffResultOptionsEnabled( false )
|
||||
: m_isDeltaResultEnabled( false )
|
||||
, m_labelPosition( labelPosition )
|
||||
, m_ternaryEnabled( true )
|
||||
{
|
||||
@@ -135,6 +135,8 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_differenceCase, "DifferenceCase", "Difference Case", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_divideByCellFaceArea, "DivideByCellFaceArea", false, "Divide By Area", "", "", "" );
|
||||
|
||||
// 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.
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedTracers_OBSOLETE, "SelectedTracers", "Tracers", "", "", "" );
|
||||
@@ -238,6 +240,7 @@ void RimEclipseResultDefinition::simpleCopy( const RimEclipseResultDefinition* o
|
||||
|
||||
m_differenceCase = other->m_differenceCase();
|
||||
m_timeLapseBaseTimestep = other->m_timeLapseBaseTimestep();
|
||||
m_divideByCellFaceArea = other->m_divideByCellFaceArea();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -376,6 +379,11 @@ void RimEclipseResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
if ( &m_divideByCellFaceArea == changedField )
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
if ( &m_flowTracerSelectionMode == changedField )
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
@@ -875,17 +883,21 @@ RigEclipseResultAddress RimEclipseResultDefinition::eclipseResultAddress() const
|
||||
int timelapseTimeStep = RigEclipseResultAddress::noTimeLapseValue();
|
||||
int diffCaseId = RigEclipseResultAddress::noCaseDiffValue();
|
||||
|
||||
if ( isTimeDiffResult() )
|
||||
if ( isDeltaTimeStepActive() )
|
||||
{
|
||||
timelapseTimeStep = m_timeLapseBaseTimestep();
|
||||
}
|
||||
|
||||
if ( isCaseDiffResult() )
|
||||
if ( isDeltaCaseActive() )
|
||||
{
|
||||
diffCaseId = m_differenceCase->caseId();
|
||||
}
|
||||
|
||||
return RigEclipseResultAddress( m_resultType(), m_resultVariable(), timelapseTimeStep, diffCaseId );
|
||||
return RigEclipseResultAddress( m_resultType(),
|
||||
m_resultVariable(),
|
||||
timelapseTimeStep,
|
||||
diffCaseId,
|
||||
isDivideByCellFaceAreaActive() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -907,16 +919,17 @@ void RimEclipseResultDefinition::setFromEclipseResultAddress( const RigEclipseRe
|
||||
if ( rinfo ) canonizedAddress = rinfo->eclipseResultAddress();
|
||||
}
|
||||
|
||||
m_resultType = canonizedAddress.m_resultCatType;
|
||||
m_resultVariable = canonizedAddress.m_resultName;
|
||||
m_timeLapseBaseTimestep = canonizedAddress.m_timeLapseBaseFrameIdx;
|
||||
m_resultType = canonizedAddress.resultCatType();
|
||||
m_resultVariable = canonizedAddress.resultName();
|
||||
m_timeLapseBaseTimestep = canonizedAddress.deltaTimeStepIndex();
|
||||
m_divideByCellFaceArea = canonizedAddress.isDivideByCellFaceAreaActive();
|
||||
|
||||
if ( canonizedAddress.hasDifferenceCase() )
|
||||
if ( canonizedAddress.isDeltaCaseActive() )
|
||||
{
|
||||
auto eclipseCases = RimProject::current()->eclipseCases();
|
||||
for ( RimEclipseCase* c : eclipseCases )
|
||||
{
|
||||
if ( c && c->caseId() == canonizedAddress.m_differenceCaseId )
|
||||
if ( c && c->caseId() == canonizedAddress.deltaCaseId() )
|
||||
{
|
||||
m_differenceCase = c;
|
||||
}
|
||||
@@ -1036,6 +1049,11 @@ QString RimEclipseResultDefinition::resultVariableUiName() const
|
||||
return flowDiagResUiText( false, 32 );
|
||||
}
|
||||
|
||||
if ( isDivideByCellFaceAreaActive() )
|
||||
{
|
||||
return m_resultVariable() + " /A";
|
||||
}
|
||||
|
||||
return m_resultVariable();
|
||||
}
|
||||
|
||||
@@ -1049,74 +1067,62 @@ QString RimEclipseResultDefinition::resultVariableUiShortName() const
|
||||
return flowDiagResUiText( true, 24 );
|
||||
}
|
||||
|
||||
if ( isDivideByCellFaceAreaActive() )
|
||||
{
|
||||
return m_resultVariable() + " /A";
|
||||
}
|
||||
|
||||
return m_resultVariable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseResultDefinition::diffResultUiName() const
|
||||
QString RimEclipseResultDefinition::additionalResultText() const
|
||||
{
|
||||
QStringList diffResult;
|
||||
if ( isTimeDiffResult() )
|
||||
QStringList resultText;
|
||||
|
||||
if ( isDeltaTimeStepActive() )
|
||||
{
|
||||
std::vector<QDateTime> stepDates;
|
||||
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
|
||||
if ( gridCellResults )
|
||||
{
|
||||
stepDates = gridCellResults->timeStepDates();
|
||||
diffResult +=
|
||||
resultText +=
|
||||
QString( "<b>Base Time Step</b>: %1" )
|
||||
.arg( stepDates[m_timeLapseBaseTimestep()].toString( RiaQDateTimeTools::dateFormatString() ) );
|
||||
}
|
||||
}
|
||||
if ( isCaseDiffResult() )
|
||||
if ( isDeltaCaseActive() )
|
||||
{
|
||||
diffResult += QString( "<b>Base Case</b>: %1" ).arg( m_differenceCase()->caseUserDescription() );
|
||||
resultText += QString( "<b>Base Case</b>: %1" ).arg( m_differenceCase()->caseUserDescription() );
|
||||
}
|
||||
return diffResult.join( "\n" );
|
||||
return resultText.join( "<br>" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseResultDefinition::diffResultUiShortName() const
|
||||
QString RimEclipseResultDefinition::additionalResultTextShort() const
|
||||
{
|
||||
QStringList diffResult;
|
||||
if ( isTimeDiffResult() || isCaseDiffResult() )
|
||||
QString resultTextShort;
|
||||
if ( isDeltaTimeStepActive() || isDeltaCaseActive() )
|
||||
{
|
||||
diffResult += QString( "Diff. Options:" );
|
||||
QStringList resultTextLines;
|
||||
resultTextLines += QString( "\nDiff. Options:" );
|
||||
if ( isDeltaCaseActive() )
|
||||
{
|
||||
resultTextLines += QString( "Base Case: #%1" ).arg( m_differenceCase()->caseId() );
|
||||
}
|
||||
if ( isDeltaTimeStepActive() )
|
||||
{
|
||||
resultTextLines += QString( "Base Time: #%1" ).arg( m_timeLapseBaseTimestep() );
|
||||
}
|
||||
resultTextShort = resultTextLines.join( "\n" );
|
||||
}
|
||||
if ( isCaseDiffResult() )
|
||||
{
|
||||
diffResult += QString( "Base Case: #%1" ).arg( m_differenceCase()->caseId() );
|
||||
}
|
||||
if ( isTimeDiffResult() )
|
||||
{
|
||||
diffResult += QString( "Base Time: #%1" ).arg( m_timeLapseBaseTimestep() );
|
||||
}
|
||||
return diffResult.join( "\n" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseResultDefinition::diffResultUiShortNameHTML() const
|
||||
{
|
||||
QStringList diffResult;
|
||||
if ( isTimeDiffResult() || isCaseDiffResult() )
|
||||
{
|
||||
diffResult += QString( "<b>Diff. Options:</b>" );
|
||||
}
|
||||
if ( isCaseDiffResult() )
|
||||
{
|
||||
diffResult += QString( "Base Case: #%1" ).arg( m_differenceCase()->caseId() );
|
||||
}
|
||||
if ( isTimeDiffResult() )
|
||||
{
|
||||
diffResult += QString( "Base Time: #%1" ).arg( m_timeLapseBaseTimestep() );
|
||||
}
|
||||
return diffResult.join( "<br>" );
|
||||
return resultTextShort;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1169,7 +1175,7 @@ void RimEclipseResultDefinition::loadResult()
|
||||
RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
|
||||
if ( gridCellResults )
|
||||
{
|
||||
if ( isTimeDiffResult() || isCaseDiffResult() )
|
||||
if ( isDeltaTimeStepActive() || isDeltaCaseActive() || isDivideByCellFaceAreaActive() )
|
||||
{
|
||||
gridCellResults->createResultEntry( this->eclipseResultAddress(), false );
|
||||
}
|
||||
@@ -1444,9 +1450,9 @@ void RimEclipseResultDefinition::updateUiFieldsFromActiveResult()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultDefinition::setDiffResultOptionsEnabled( bool enabled )
|
||||
void RimEclipseResultDefinition::enableDeltaResults( bool enable )
|
||||
{
|
||||
m_diffResultOptionsEnabled = true;
|
||||
m_isDeltaResultEnabled = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1563,6 +1569,18 @@ void RimEclipseResultDefinition::defineUiOrdering( QString uiConfigName, caf::Pd
|
||||
uiOrdering.add( &m_inputPropertyFileName );
|
||||
}
|
||||
|
||||
if ( isDivideByCellFaceAreaPossible() )
|
||||
{
|
||||
uiOrdering.add( &m_divideByCellFaceArea );
|
||||
|
||||
QString resultPropertyLabel = "Result Property";
|
||||
if ( isDivideByCellFaceAreaActive() )
|
||||
{
|
||||
resultPropertyLabel += QString( "\nDivided by Area" );
|
||||
}
|
||||
m_resultVariableUiField.uiCapability()->setUiName( resultPropertyLabel );
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* legendGroup = uiOrdering.addNewGroup( "Legend" );
|
||||
legendGroup->add( &m_showOnlyVisibleTracersInLegend );
|
||||
|
||||
@@ -1570,21 +1588,21 @@ void RimEclipseResultDefinition::defineUiOrdering( QString uiConfigName, caf::Pd
|
||||
m_resultVariableUiField() == RIG_FLD_MAX_FRACTION_TRACER_RESNAME );
|
||||
legendGroup->setUiHidden( !showOnlyVisibleTracesOption );
|
||||
|
||||
if ( isCaseDiffResultAvailable() || isTimeDiffResultAvailable() )
|
||||
if ( isDeltaCasePossible() || isDeltaTimeStepPossible() )
|
||||
{
|
||||
caf::PdmUiGroup* differenceGroup = uiOrdering.addNewGroup( "Difference Options" );
|
||||
differenceGroup->setUiReadOnly( !( isTimeDiffResultAvailable() || isCaseDiffResultAvailable() ) );
|
||||
differenceGroup->setUiReadOnly( !( isDeltaTimeStepPossible() || isDeltaCasePossible() ) );
|
||||
|
||||
m_differenceCase.uiCapability()->setUiReadOnly( !isCaseDiffResultAvailable() );
|
||||
m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly( !isTimeDiffResultAvailable() );
|
||||
m_differenceCase.uiCapability()->setUiReadOnly( !isDeltaCasePossible() );
|
||||
m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly( !isDeltaTimeStepPossible() );
|
||||
|
||||
if ( isCaseDiffResultAvailable() ) differenceGroup->add( &m_differenceCase );
|
||||
if ( isTimeDiffResultAvailable() ) differenceGroup->add( &m_timeLapseBaseTimestep );
|
||||
if ( isDeltaCasePossible() ) differenceGroup->add( &m_differenceCase );
|
||||
if ( isDeltaTimeStepPossible() ) differenceGroup->add( &m_timeLapseBaseTimestep );
|
||||
|
||||
QString resultPropertyLabel = "Result Property";
|
||||
if ( isTimeDiffResult() || isCaseDiffResult() )
|
||||
if ( isDeltaTimeStepActive() || isDeltaCaseActive() )
|
||||
{
|
||||
resultPropertyLabel += QString( "\n%1" ).arg( diffResultUiShortName() );
|
||||
resultPropertyLabel += QString( "\n%1" ).arg( additionalResultTextShort() );
|
||||
}
|
||||
m_resultVariableUiField.uiCapability()->setUiName( resultPropertyLabel );
|
||||
}
|
||||
@@ -2182,9 +2200,9 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
|
||||
void RimEclipseResultDefinition::updateLegendTitle( RimRegularLegendConfig* legendConfig, const QString& legendHeading )
|
||||
{
|
||||
QString title = legendHeading + this->resultVariableUiName();
|
||||
if ( !this->diffResultUiShortName().isEmpty() )
|
||||
if ( !this->additionalResultTextShort().isEmpty() )
|
||||
{
|
||||
title += QString( "\n%1" ).arg( this->diffResultUiShortName() );
|
||||
title += additionalResultTextShort();
|
||||
}
|
||||
|
||||
if ( this->hasDualPorFractureResult() )
|
||||
@@ -2565,34 +2583,34 @@ void RimEclipseResultDefinition::syncProducerToInjectorSelection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultDefinition::enableDiffResultOptions() const
|
||||
bool RimEclipseResultDefinition::isDeltaResultEnabled() const
|
||||
{
|
||||
return m_diffResultOptionsEnabled;
|
||||
return m_isDeltaResultEnabled;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultDefinition::isTimeDiffResultAvailable() const
|
||||
bool RimEclipseResultDefinition::isDeltaTimeStepPossible() const
|
||||
{
|
||||
return enableDiffResultOptions() && m_resultTypeUiField() == RiaDefines::ResultCatType::DYNAMIC_NATIVE &&
|
||||
return isDeltaResultEnabled() && m_resultTypeUiField() == RiaDefines::ResultCatType::DYNAMIC_NATIVE &&
|
||||
!isTernarySaturationSelected();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultDefinition::isTimeDiffResult() const
|
||||
bool RimEclipseResultDefinition::isDeltaTimeStepActive() const
|
||||
{
|
||||
return isTimeDiffResultAvailable() && m_timeLapseBaseTimestep() >= 0;
|
||||
return isDeltaTimeStepPossible() && m_timeLapseBaseTimestep() >= 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultDefinition::isCaseDiffResultAvailable() const
|
||||
bool RimEclipseResultDefinition::isDeltaCasePossible() const
|
||||
{
|
||||
return enableDiffResultOptions() && !isTernarySaturationSelected() &&
|
||||
return isDeltaResultEnabled() && !isTernarySaturationSelected() &&
|
||||
( m_resultTypeUiField() == RiaDefines::ResultCatType::DYNAMIC_NATIVE ||
|
||||
m_resultTypeUiField() == RiaDefines::ResultCatType::STATIC_NATIVE ||
|
||||
m_resultTypeUiField() == RiaDefines::ResultCatType::GENERATED );
|
||||
@@ -2601,9 +2619,49 @@ bool RimEclipseResultDefinition::isCaseDiffResultAvailable() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultDefinition::isCaseDiffResult() const
|
||||
bool RimEclipseResultDefinition::isDeltaCaseActive() const
|
||||
{
|
||||
return isCaseDiffResultAvailable() && m_differenceCase() != nullptr;
|
||||
return isDeltaCasePossible() && m_differenceCase() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultDefinition::isDivideByCellFaceAreaPossible() const
|
||||
{
|
||||
QString str = m_resultVariable;
|
||||
|
||||
// TODO : Move to RiaDefines or a separate file for cell face results
|
||||
|
||||
if ( str == "FLRWATI+" ) return true;
|
||||
if ( str == "FLRWATJ+" ) return true;
|
||||
if ( str == "FLRWATK+" ) return true;
|
||||
|
||||
if ( str == "FLROILI+" ) return true;
|
||||
if ( str == "FLROILJ+" ) return true;
|
||||
if ( str == "FLROILK+" ) return true;
|
||||
|
||||
if ( str == "FLRGASI+" ) return true;
|
||||
if ( str == "FLRGASJ+" ) return true;
|
||||
if ( str == "FLRGASK+" ) return true;
|
||||
|
||||
if ( str == "TRANX" ) return true;
|
||||
if ( str == "TRANY" ) return true;
|
||||
if ( str == "TRANZ" ) return true;
|
||||
|
||||
if ( str == "riTRANX" ) return true;
|
||||
if ( str == "riTRANY" ) return true;
|
||||
if ( str == "riTRANZ" ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultDefinition::isDivideByCellFaceAreaActive() const
|
||||
{
|
||||
return isDivideByCellFaceAreaPossible() && m_divideByCellFaceArea;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -96,12 +96,10 @@ public:
|
||||
QString resultVariableUiName() const;
|
||||
QString resultVariableUiShortName() const;
|
||||
|
||||
QString diffResultUiName() const;
|
||||
QString diffResultUiShortName() const;
|
||||
QString diffResultUiShortNameHTML() const;
|
||||
|
||||
int timeLapseBaseTimeStep() const;
|
||||
int caseDiffIndex() const;
|
||||
void enableDeltaResults( bool enable );
|
||||
int timeLapseBaseTimeStep() const;
|
||||
int caseDiffIndex() const;
|
||||
QString additionalResultText() const;
|
||||
|
||||
void loadResult();
|
||||
RigEclipseResultAddress eclipseResultAddress() const;
|
||||
@@ -127,8 +125,6 @@ public:
|
||||
|
||||
void updateUiFieldsFromActiveResult();
|
||||
|
||||
void setDiffResultOptionsEnabled( bool enabled );
|
||||
|
||||
bool hasDualPorFractureResult();
|
||||
|
||||
static QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard( RiaDefines::ResultCatType resultCatType,
|
||||
@@ -162,11 +158,8 @@ protected:
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::ResultCatType>> m_resultType;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::PorosityModelType>> m_porosityModel;
|
||||
caf::PdmField<QString> m_resultVariable;
|
||||
caf::PdmField<int> m_timeLapseBaseTimestep;
|
||||
caf::PdmField<QString> m_inputPropertyFileName;
|
||||
|
||||
caf::PdmPtrField<RimEclipseCase*> m_differenceCase;
|
||||
|
||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowSolution;
|
||||
caf::PdmField<std::vector<QString>> m_selectedInjectorTracers;
|
||||
caf::PdmField<std::vector<QString>> m_selectedProducerTracers;
|
||||
@@ -207,6 +200,10 @@ private:
|
||||
bool operator()( const QString& lhs, const QString& rhs ) const;
|
||||
};
|
||||
|
||||
caf::PdmField<int> m_timeLapseBaseTimestep;
|
||||
caf::PdmPtrField<RimEclipseCase*> m_differenceCase;
|
||||
caf::PdmField<bool> m_divideByCellFaceArea;
|
||||
|
||||
private:
|
||||
void assignFlowSolutionFromCase();
|
||||
|
||||
@@ -232,22 +229,26 @@ private:
|
||||
void syncInjectorToProducerSelection();
|
||||
void syncProducerToInjectorSelection();
|
||||
|
||||
bool enableDiffResultOptions() const;
|
||||
bool isTimeDiffResultAvailable() const;
|
||||
bool isTimeDiffResult() const;
|
||||
bool isCaseDiffResultAvailable() const;
|
||||
bool isCaseDiffResult() const;
|
||||
// Delta Case / Delta Time Step / Divide by Cell Face Area
|
||||
bool isDeltaResultEnabled() const;
|
||||
bool isDeltaCasePossible() const;
|
||||
bool isDeltaCaseActive() const;
|
||||
bool isDeltaTimeStepPossible() const;
|
||||
bool isDeltaTimeStepActive() const;
|
||||
bool isDivideByCellFaceAreaPossible() const;
|
||||
bool isDivideByCellFaceAreaActive() const;
|
||||
|
||||
QString additionalResultTextShort() const;
|
||||
|
||||
bool showDerivedResultsFirstInVariableUiField() const;
|
||||
bool addPerCellFaceOptionsForVariableUiField() const;
|
||||
|
||||
void ensureProcessingOfObsoleteFields();
|
||||
bool isTernaryEnabled() const;
|
||||
|
||||
QString getInputPropertyFileName( const QString& resultName ) const;
|
||||
|
||||
private:
|
||||
bool m_diffResultOptionsEnabled;
|
||||
bool m_isDeltaResultEnabled;
|
||||
caf::PdmUiItemInfo::LabelPosType m_labelPosition;
|
||||
bool m_ternaryEnabled;
|
||||
};
|
||||
|
@@ -141,7 +141,7 @@ RimEclipseView::RimEclipseView()
|
||||
"" );
|
||||
m_cellResult = new RimEclipseCellColors();
|
||||
m_cellResult.uiCapability()->setUiHidden( true );
|
||||
m_cellResult->setDiffResultOptionsEnabled( true );
|
||||
m_cellResult->enableDeltaResults( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png", "", "" );
|
||||
m_cellEdgeResult = new RimCellEdgeColors();
|
||||
|
@@ -46,16 +46,6 @@ void AppEnum<RimElementVectorResult::TensorColors>::setUp()
|
||||
setDefault( RimElementVectorResult::TensorColors::RESULT_COLORS );
|
||||
}
|
||||
|
||||
template <>
|
||||
void AppEnum<RimElementVectorResult::ScaleMethod>::setUp()
|
||||
{
|
||||
addItem( RimElementVectorResult::ScaleMethod::RESULT, "RESULT", "Result" );
|
||||
addItem( RimElementVectorResult::ScaleMethod::RESULT_LOG, "RESULT_LOG", "Result (logarithmic scaling)" );
|
||||
addItem( RimElementVectorResult::ScaleMethod::CONSTANT, "CONSTANT", "Constant" );
|
||||
|
||||
setDefault( RimElementVectorResult::ScaleMethod::RESULT );
|
||||
}
|
||||
|
||||
template <>
|
||||
void AppEnum<RimElementVectorResult::VectorView>::setUp()
|
||||
{
|
||||
@@ -113,7 +103,6 @@ RimElementVectorResult::RimElementVectorResult()
|
||||
cvf::Color3f defaultUniformColor = cvf::Color3f::BLACK;
|
||||
CAF_PDM_InitField( &m_uniformVectorColor, "UniformVectorColor", defaultUniformColor, "Uniform Vector Color", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_scaleMethod, "ScaleMethod", "Scale Method", "", "", "" );
|
||||
CAF_PDM_InitField( &m_sizeScale, "SizeScale", 1.0f, "Size Scale", "", "", "" );
|
||||
}
|
||||
|
||||
@@ -241,14 +230,6 @@ RimElementVectorResult::TensorColors RimElementVectorResult::vectorColors() cons
|
||||
return m_vectorColor();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimElementVectorResult::ScaleMethod RimElementVectorResult::scaleMethod() const
|
||||
{
|
||||
return m_scaleMethod();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -332,6 +313,21 @@ void RimElementVectorResult::mappingRange( double& min, double& max ) const
|
||||
RigCaseCellResultsData* resultsData =
|
||||
eclipseView->eclipseCase()->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
|
||||
{
|
||||
// Check if native result is available
|
||||
// TODO: Refactor all derived results into separate result factory
|
||||
RigEclipseResultAddress nativeResult = resVarAddr;
|
||||
nativeResult.enableDivideByCellFaceArea( false );
|
||||
if ( resultsData->hasResultEntry( nativeResult ) )
|
||||
{
|
||||
resultsData->createResultEntry( resVarAddr, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
resultsData->ensureKnownResultLoaded( resVarAddr );
|
||||
if ( !resultsData->hasResultEntry( resVarAddr ) ) return;
|
||||
|
||||
@@ -386,30 +382,34 @@ void RimElementVectorResult::mappingRange( double& min, double& max ) const
|
||||
|
||||
for ( size_t flIdx = 0; flIdx < combinedAddresses.size(); flIdx++ )
|
||||
{
|
||||
if ( combinedAddresses[flIdx].m_resultCatType == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
|
||||
if ( combinedAddresses[flIdx].resultCatType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
|
||||
{
|
||||
if ( m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::AUTOMATIC_ALLTIMESTEPS )
|
||||
if ( nncData->generateScalarValues( combinedAddresses[flIdx] ) )
|
||||
{
|
||||
const std::vector<std::vector<double>>* nncResultVals =
|
||||
nncData->dynamicConnectionScalarResult( combinedAddresses[flIdx] );
|
||||
for ( size_t i = 0; i < nncResultVals->size(); i++ )
|
||||
if ( m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::AUTOMATIC_ALLTIMESTEPS )
|
||||
{
|
||||
for ( size_t j = 0; j < nncResultVals->at( i ).size(); j++ )
|
||||
const std::vector<std::vector<double>>* nncResultVals =
|
||||
nncData->dynamicConnectionScalarResult( combinedAddresses[flIdx] );
|
||||
for ( size_t i = 0; i < nncResultVals->size(); i++ )
|
||||
{
|
||||
max = std::max<double>( max, nncResultVals->at( i ).at( j ) );
|
||||
min = std::min<double>( min, nncResultVals->at( i ).at( j ) );
|
||||
for ( size_t j = 0; j < nncResultVals->at( i ).size(); j++ )
|
||||
{
|
||||
max = std::max<double>( max, nncResultVals->at( i ).at( j ) );
|
||||
min = std::min<double>( min, nncResultVals->at( i ).at( j ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP )
|
||||
{
|
||||
const std::vector<double>* nncResultVals =
|
||||
nncData->dynamicConnectionScalarResult( combinedAddresses[flIdx],
|
||||
static_cast<size_t>( currentTimeStep ) );
|
||||
for ( size_t i = 0; i < nncResultVals->size(); i++ )
|
||||
else if ( m_legendConfig->rangeMode() ==
|
||||
RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP )
|
||||
{
|
||||
max = std::max<double>( max, nncResultVals->at( i ) );
|
||||
min = std::min<double>( min, nncResultVals->at( i ) );
|
||||
const std::vector<double>* nncResultVals =
|
||||
nncData->dynamicConnectionScalarResult( combinedAddresses[flIdx],
|
||||
static_cast<size_t>( currentTimeStep ) );
|
||||
for ( size_t i = 0; i < nncResultVals->size(); i++ )
|
||||
{
|
||||
max = std::max<double>( max, nncResultVals->at( i ) );
|
||||
min = std::min<double>( min, nncResultVals->at( i ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -511,16 +511,13 @@ void RimElementVectorResult::defineUiOrdering( QString uiConfigName, caf::PdmUiO
|
||||
visibilityGroup->add( &m_showNncData );
|
||||
visibilityGroup->add( &m_threshold );
|
||||
|
||||
caf::PdmUiGroup* vectorColorsGroup = uiOrdering.addNewGroup( "Vector Colors" );
|
||||
vectorColorsGroup->add( &m_vectorColor );
|
||||
caf::PdmUiGroup* apperanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
||||
apperanceGroup->add( &m_vectorColor );
|
||||
if ( m_vectorColor == TensorColors::UNIFORM_COLOR )
|
||||
{
|
||||
vectorColorsGroup->add( &m_uniformVectorColor );
|
||||
apperanceGroup->add( &m_uniformVectorColor );
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* vectorSizeGroup = uiOrdering.addNewGroup( "Vector Size" );
|
||||
vectorSizeGroup->add( &m_sizeScale );
|
||||
vectorSizeGroup->add( &m_scaleMethod );
|
||||
apperanceGroup->add( &m_sizeScale );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
@@ -547,6 +544,12 @@ bool RimElementVectorResult::resultAddressesCombined( std::vector<RigEclipseResu
|
||||
addresses.push_back( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
RiaResultNames::combinedWaterFluxResultName() ) );
|
||||
}
|
||||
|
||||
for ( auto& adr : addresses )
|
||||
{
|
||||
adr.enableDivideByCellFaceArea( true );
|
||||
}
|
||||
|
||||
return addresses.size() > 0;
|
||||
}
|
||||
|
||||
@@ -576,6 +579,11 @@ bool RimElementVectorResult::resultAddressesIJK( std::vector<RigEclipseResultAdd
|
||||
addresses.push_back( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "FLRWATK+" ) );
|
||||
}
|
||||
|
||||
for ( auto& adr : addresses )
|
||||
{
|
||||
adr.enableDivideByCellFaceArea( true );
|
||||
}
|
||||
|
||||
return addresses.size() > 0;
|
||||
}
|
||||
|
||||
|
@@ -50,13 +50,6 @@ public:
|
||||
RESULT_COLORS
|
||||
};
|
||||
|
||||
enum class ScaleMethod
|
||||
{
|
||||
RESULT,
|
||||
RESULT_LOG,
|
||||
CONSTANT
|
||||
};
|
||||
|
||||
enum class VectorView
|
||||
{
|
||||
CELL_CENTER_TOTAL,
|
||||
@@ -87,7 +80,6 @@ public:
|
||||
float threshold() const;
|
||||
float sizeScale() const;
|
||||
TensorColors vectorColors() const;
|
||||
ScaleMethod scaleMethod() const;
|
||||
|
||||
const cvf::Color3f& getUniformVectorColor() const;
|
||||
const RimRegularLegendConfig* legendConfig() const;
|
||||
@@ -105,8 +97,6 @@ private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
|
||||
static QString fieldNameFromUi( const QString& uiFieldName );
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showResult;
|
||||
caf::PdmField<bool> m_showOil;
|
||||
@@ -121,7 +111,6 @@ private:
|
||||
caf::PdmField<float> m_threshold;
|
||||
caf::PdmField<caf::AppEnum<TensorColors>> m_vectorColor;
|
||||
caf::PdmField<cvf::Color3f> m_uniformVectorColor;
|
||||
caf::PdmField<caf::AppEnum<ScaleMethod>> m_scaleMethod;
|
||||
caf::PdmField<float> m_sizeScale;
|
||||
caf::PdmField<RimRegularLegendConfig::RangeModeEnum> m_rangeMode;
|
||||
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
|
||||
|
@@ -373,7 +373,7 @@ void RimHistogramCalculator::updateVisCellStatsIfNeeded( RimEclipseView*
|
||||
{
|
||||
RigEclipseResultAddress resAddr = eclResultDefinition->eclipseResultAddress();
|
||||
|
||||
QString resultName = resAddr.m_resultName;
|
||||
QString resultName = resAddr.resultName();
|
||||
|
||||
std::vector<RigEclipseResultAddress> addresses = sourcesForMultiPropertyResults( resultName );
|
||||
if ( addresses.size() )
|
||||
|
@@ -355,7 +355,7 @@ void RimSummaryPlotFilterTextCurveSetEditor::fieldChangedByUi( const caf::PdmFie
|
||||
if ( !( gridCellResults && gridCellResults->resultInfo( cellResAddr.eclipseResultAddress ) ) )
|
||||
{
|
||||
RiaLogging::warning( "Could not find a restart result property with name: \"" +
|
||||
cellResAddr.eclipseResultAddress.m_resultName + "\"" );
|
||||
cellResAddr.eclipseResultAddress.resultName() + "\"" );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -43,23 +43,21 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
|
||||
const RigEclipseResultAddress& address )
|
||||
{
|
||||
CVF_ASSERT( address.isValid() );
|
||||
CVF_ASSERT( address.hasDifferenceCase() || address.isTimeLapse() );
|
||||
CVF_ASSERT( address.isDeltaCaseActive() || address.isDeltaTimeStepActive() );
|
||||
|
||||
// Assume at this stage that data for the case is available
|
||||
// It is up to the caller to make sure the case is read from file
|
||||
|
||||
RigEclipseCaseData* baseCase = sourceCase;
|
||||
|
||||
if ( address.hasDifferenceCase() )
|
||||
if ( address.isDeltaCaseActive() )
|
||||
{
|
||||
auto eclipseCases = RimProject::current()->eclipseCases();
|
||||
for ( RimEclipseCase* c : eclipseCases )
|
||||
{
|
||||
auto eclipseCases = RimProject::current()->eclipseCases();
|
||||
for ( RimEclipseCase* c : eclipseCases )
|
||||
if ( c && c->caseId() == address.deltaCaseId() && c->eclipseCaseData() )
|
||||
{
|
||||
if ( c && c->caseId() == address.m_differenceCaseId && c->eclipseCaseData() )
|
||||
{
|
||||
baseCase = c->eclipseCaseData();
|
||||
}
|
||||
baseCase = c->eclipseCaseData();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,8 +90,8 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
|
||||
}
|
||||
|
||||
RigEclipseResultAddress nativeAddress( address );
|
||||
nativeAddress.m_differenceCaseId = RigEclipseResultAddress::noCaseDiffValue();
|
||||
nativeAddress.m_timeLapseBaseFrameIdx = RigEclipseResultAddress::noTimeLapseValue();
|
||||
nativeAddress.setDeltaCaseId( RigEclipseResultAddress::noCaseDiffValue() );
|
||||
nativeAddress.setDeltaTimeStepIndex( RigEclipseResultAddress::noTimeLapseValue() );
|
||||
if ( !sourceCaseResults->ensureKnownResultLoaded( nativeAddress ) )
|
||||
{
|
||||
RiaLogging::error( "Failed to load destination diff result" );
|
||||
@@ -128,7 +126,7 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
|
||||
size_t baseFrameCount = baseCaseResults->cellScalarResults( nativeAddress ).size();
|
||||
size_t sourceFrameCount = sourceCaseResults->cellScalarResults( nativeAddress ).size();
|
||||
size_t maxFrameCount = 0;
|
||||
if ( address.isTimeLapse() )
|
||||
if ( address.isDeltaTimeStepActive() )
|
||||
{
|
||||
// We have one defined time step for base case, loop over all source time steps
|
||||
maxFrameCount = sourceFrameCount;
|
||||
@@ -155,9 +153,9 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
|
||||
RigResultModifierFactory::createResultModifier( sourceCase, gridIdx, porosityModel, fIdx, address );
|
||||
|
||||
size_t baseFrameIdx = fIdx;
|
||||
if ( address.isTimeLapse() )
|
||||
if ( address.isDeltaTimeStepActive() )
|
||||
{
|
||||
baseFrameIdx = address.m_timeLapseBaseFrameIdx;
|
||||
baseFrameIdx = address.deltaTimeStepIndex();
|
||||
}
|
||||
|
||||
cvf::ref<RigResultAccessor> baseResultAccessor =
|
||||
@@ -181,3 +179,113 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigCaseCellResultCalculator::computeDivideByCellFaceArea( RigMainGrid* mainGrid,
|
||||
RigEclipseCaseData* destination,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
const RigEclipseResultAddress& address )
|
||||
{
|
||||
if ( !destination )
|
||||
{
|
||||
RiaLogging::error( "Missing input case for divide by area calculator" );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CVF_ASSERT( address.isValid() );
|
||||
CVF_ASSERT( address.isDivideByCellFaceAreaActive() );
|
||||
|
||||
RigCaseCellResultsData* baseCaseResults = destination->results( porosityModel );
|
||||
if ( !baseCaseResults )
|
||||
{
|
||||
RiaLogging::error( "Missing result data for divide by area calculator" );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
RigEclipseResultAddress nativeAddress( address );
|
||||
nativeAddress.enableDivideByCellFaceArea( false );
|
||||
if ( !baseCaseResults->ensureKnownResultLoaded( nativeAddress ) )
|
||||
{
|
||||
RiaLogging::error( "Failed to load source case for divide by area result" );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize difference result with infinity for correct number of time steps and values per time step
|
||||
{
|
||||
const std::vector<std::vector<double>>& srcFrames = baseCaseResults->cellScalarResults( nativeAddress );
|
||||
std::vector<std::vector<double>>* diffResultFrames =
|
||||
baseCaseResults->modifiableCellScalarResultTimesteps( address );
|
||||
diffResultFrames->resize( srcFrames.size() );
|
||||
for ( size_t fIdx = 0; fIdx < srcFrames.size(); ++fIdx )
|
||||
{
|
||||
const std::vector<double>& srcVals = srcFrames[fIdx];
|
||||
std::vector<double>& dstVals = diffResultFrames->at( fIdx );
|
||||
|
||||
// Clear the values, and resize with infinity as default value
|
||||
dstVals.clear();
|
||||
dstVals.resize( srcVals.size(), std::numeric_limits<double>::infinity() );
|
||||
}
|
||||
}
|
||||
|
||||
size_t baseFrameCount = baseCaseResults->cellScalarResults( nativeAddress ).size();
|
||||
|
||||
size_t maxGridCount = mainGrid->gridCount();
|
||||
|
||||
cvf::StructGridInterface::FaceType cellFace = cvf::StructGridInterface::NO_FACE;
|
||||
QString resultName = address.resultName();
|
||||
if ( resultName.contains( "I+" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_I;
|
||||
else if ( resultName.contains( "J+" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_J;
|
||||
else if ( resultName.contains( "K+" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_K;
|
||||
else if ( resultName.contains( "TRANX" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_I;
|
||||
else if ( resultName.contains( "TRANY" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_J;
|
||||
else if ( resultName.contains( "TRANZ" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_K;
|
||||
|
||||
for ( size_t gridIdx = 0; gridIdx < maxGridCount; ++gridIdx )
|
||||
{
|
||||
auto grid = mainGrid->gridByIndex( gridIdx );
|
||||
const RigActiveCellInfo* activeCellInfo = baseCaseResults->activeCellInfo();
|
||||
|
||||
for ( size_t fIdx = 0; fIdx < baseFrameCount; ++fIdx )
|
||||
{
|
||||
cvf::ref<RigResultAccessor> sourceResultAccessor =
|
||||
RigResultAccessorFactory::createFromResultAddress( destination, gridIdx, porosityModel, fIdx, nativeAddress );
|
||||
|
||||
cvf::ref<RigResultModifier> resultModifier =
|
||||
RigResultModifierFactory::createResultModifier( destination, gridIdx, porosityModel, fIdx, address );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int localGridCellIdx = 0; localGridCellIdx < static_cast<int>( grid->cellCount() ); localGridCellIdx++ )
|
||||
{
|
||||
const size_t reservoirCellIndex = grid->reservoirCellIndex( localGridCellIdx );
|
||||
if ( activeCellInfo->isActive( reservoirCellIndex ) )
|
||||
{
|
||||
double sourceVal = sourceResultAccessor->cellScalar( localGridCellIdx );
|
||||
|
||||
const auto faceNormal = grid->cell( localGridCellIdx ).faceNormalWithAreaLength( cellFace );
|
||||
const auto divisor = faceNormal.length();
|
||||
|
||||
const double epsilon = 1e-12;
|
||||
if ( divisor > epsilon )
|
||||
{
|
||||
sourceVal /= divisor;
|
||||
}
|
||||
|
||||
resultModifier->setCellScalar( localGridCellIdx, sourceVal );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
class RigEclipseCaseData;
|
||||
class RigEclipseResultAddress;
|
||||
class RigMainGrid;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -32,4 +33,9 @@ public:
|
||||
static bool computeDifference( RigEclipseCaseData* destination,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
const RigEclipseResultAddress& address );
|
||||
|
||||
static bool computeDivideByCellFaceArea( RigMainGrid* mainGrid,
|
||||
RigEclipseCaseData* destination,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
const RigEclipseResultAddress& address );
|
||||
};
|
||||
|
@@ -320,7 +320,7 @@ size_t RigCaseCellResultsData::findOrCreateScalarResultIndex( const RigEclipseRe
|
||||
// Create statistics calculator and add statistics cache object
|
||||
// Todo: Move to a "factory" method
|
||||
|
||||
QString resultName = resVarAddr.m_resultName;
|
||||
QString resultName = resVarAddr.resultName();
|
||||
|
||||
cvf::ref<RigStatisticsCalculator> statisticsCalculator;
|
||||
|
||||
@@ -483,8 +483,12 @@ QStringList RigCaseCellResultsData::resultNames( RiaDefines::ResultCatType resTy
|
||||
std::vector<RigEclipseResultInfo>::const_iterator it;
|
||||
for ( it = m_resultInfos.begin(); it != m_resultInfos.end(); ++it )
|
||||
{
|
||||
if ( it->resultType() == resType && !it->eclipseResultAddress().isTimeLapse() &&
|
||||
!it->eclipseResultAddress().hasDifferenceCase() )
|
||||
auto resultAddress = it->eclipseResultAddress();
|
||||
if ( resultAddress.isDeltaTimeStepActive() || resultAddress.isDeltaCaseActive() ||
|
||||
resultAddress.isDivideByCellFaceAreaActive() )
|
||||
continue;
|
||||
|
||||
if ( it->resultType() == resType )
|
||||
{
|
||||
varList.push_back( it->resultName() );
|
||||
}
|
||||
@@ -1045,7 +1049,7 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
}
|
||||
}
|
||||
|
||||
// riTRANSXYZbyArea and X, Y, Z
|
||||
// riTRANS X,Y,Z byArea
|
||||
{
|
||||
if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "TRANX" ) ) )
|
||||
{
|
||||
@@ -1070,7 +1074,9 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
false,
|
||||
0 );
|
||||
}
|
||||
|
||||
}
|
||||
// riTRANSXYZbyArea
|
||||
{
|
||||
if ( hasCompleteTransmissibilityResults() )
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
@@ -1184,7 +1190,7 @@ void RigCaseCellResultsData::createResultEntry( const RigEclipseResultAddress& r
|
||||
void RigCaseCellResultsData::ensureKnownResultLoadedForTimeStep( const RigEclipseResultAddress& resultAddress,
|
||||
size_t timeStepIndex )
|
||||
{
|
||||
CAF_ASSERT( resultAddress.m_resultCatType != RiaDefines::ResultCatType::UNDEFINED );
|
||||
CAF_ASSERT( resultAddress.resultCatType() != RiaDefines::ResultCatType::UNDEFINED );
|
||||
|
||||
findOrLoadKnownScalarResultForTimeStep( resultAddress, timeStepIndex );
|
||||
}
|
||||
@@ -1198,7 +1204,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
|
||||
{
|
||||
return cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
else if ( resVarAddr.m_resultCatType == RiaDefines::ResultCatType::UNDEFINED )
|
||||
else if ( resVarAddr.resultCatType() == RiaDefines::ResultCatType::UNDEFINED )
|
||||
{
|
||||
std::vector<RiaDefines::ResultCatType> searchOrder = { RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
@@ -1216,10 +1222,10 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T ) return cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
RiaDefines::ResultCatType type = resVarAddr.m_resultCatType;
|
||||
QString resultName = resVarAddr.m_resultName;
|
||||
RiaDefines::ResultCatType type = resVarAddr.resultCatType();
|
||||
QString resultName = resVarAddr.resultName();
|
||||
|
||||
if ( resVarAddr.hasDifferenceCase() || resVarAddr.isTimeLapse() )
|
||||
if ( resVarAddr.isDeltaCaseActive() || resVarAddr.isDeltaTimeStepActive() )
|
||||
{
|
||||
if ( !RigCaseCellResultCalculator::computeDifference( this->m_ownerCaseData, m_porosityModel, resVarAddr ) )
|
||||
{
|
||||
@@ -1229,6 +1235,20 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
|
||||
return scalarResultIndex;
|
||||
}
|
||||
|
||||
if ( resVarAddr.isDivideByCellFaceAreaActive() )
|
||||
{
|
||||
if ( !RigCaseCellResultCalculator::computeDivideByCellFaceArea( m_ownerMainGrid,
|
||||
this->m_ownerCaseData,
|
||||
m_porosityModel,
|
||||
resVarAddr ) )
|
||||
|
||||
{
|
||||
return cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
|
||||
return scalarResultIndex;
|
||||
}
|
||||
|
||||
// Load dependency data sets
|
||||
|
||||
if ( type == RiaDefines::ResultCatType::STATIC_NATIVE )
|
||||
@@ -1500,7 +1520,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder(
|
||||
for ( const auto& resultType : resultTypesOrdered )
|
||||
{
|
||||
RigEclipseResultAddress resVarAddressWithType = resVarAddr;
|
||||
resVarAddressWithType.m_resultCatType = resultType;
|
||||
resVarAddressWithType.setResultCatType( resultType );
|
||||
|
||||
size_t scalarResultIndex = this->findOrLoadKnownScalarResult( resVarAddressWithType );
|
||||
|
||||
@@ -1520,8 +1540,8 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder(
|
||||
size_t RigCaseCellResultsData::findOrLoadKnownScalarResultForTimeStep( const RigEclipseResultAddress& resVarAddr,
|
||||
size_t timeStepIndex )
|
||||
{
|
||||
RiaDefines::ResultCatType type = resVarAddr.m_resultCatType;
|
||||
QString resultName = resVarAddr.m_resultName;
|
||||
RiaDefines::ResultCatType type = resVarAddr.resultCatType();
|
||||
QString resultName = resVarAddr.resultName();
|
||||
|
||||
// Special handling for SOIL
|
||||
if ( type == RiaDefines::ResultCatType::DYNAMIC_NATIVE && resultName.toUpper() == "SOIL" )
|
||||
@@ -2596,6 +2616,7 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent( const QString& riTra
|
||||
|
||||
size_t riTranByAreaScResIdx = this->findScalarResultIndexFromAddress(
|
||||
RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, riTransByAreaCompResultName ) );
|
||||
|
||||
CVF_ASSERT( riTranByAreaScResIdx != cvf::UNDEFINED_SIZE_T );
|
||||
|
||||
// Get the result count, to handle that one of them might be globally defined
|
||||
@@ -3250,42 +3271,42 @@ size_t RigCaseCellResultsData::findScalarResultIndexFromAddress( const RigEclips
|
||||
{
|
||||
return cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
else if ( resVarAddr.m_resultCatType == RiaDefines::ResultCatType::UNDEFINED )
|
||||
else if ( resVarAddr.resultCatType() == RiaDefines::ResultCatType::UNDEFINED )
|
||||
{
|
||||
RigEclipseResultAddress resVarAddressWithType = resVarAddr;
|
||||
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::STATIC_NATIVE;
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::STATIC_NATIVE );
|
||||
|
||||
size_t scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::DYNAMIC_NATIVE;
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::DYNAMIC_NATIVE );
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
}
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::SOURSIMRL;
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::SOURSIMRL );
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
}
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::GENERATED;
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::GENERATED );
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
}
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::INPUT_PROPERTY;
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::INPUT_PROPERTY );
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
}
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::FORMATION_NAMES;
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::FORMATION_NAMES );
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
}
|
||||
|
||||
return scalarResultIndex;
|
||||
|
@@ -29,6 +29,7 @@ public:
|
||||
: m_resultCatType( RiaDefines::ResultCatType::UNDEFINED )
|
||||
, m_timeLapseBaseFrameIdx( NO_TIME_LAPSE )
|
||||
, m_differenceCaseId( NO_CASE_DIFF )
|
||||
, m_divideByCellFaceArea( false )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -37,18 +38,22 @@ public:
|
||||
, m_resultName( resultName )
|
||||
, m_timeLapseBaseFrameIdx( NO_TIME_LAPSE )
|
||||
, m_differenceCaseId( NO_CASE_DIFF )
|
||||
, m_divideByCellFaceArea( false )
|
||||
{
|
||||
}
|
||||
|
||||
explicit RigEclipseResultAddress( RiaDefines::ResultCatType type,
|
||||
const QString& resultName,
|
||||
int timeLapseBaseTimeStep = NO_TIME_LAPSE,
|
||||
int differenceCaseId = NO_CASE_DIFF )
|
||||
int differenceCaseId = NO_CASE_DIFF,
|
||||
bool divideByCellFaceArea = false )
|
||||
: m_resultCatType( type )
|
||||
, m_resultName( resultName )
|
||||
, m_timeLapseBaseFrameIdx( timeLapseBaseTimeStep )
|
||||
, m_differenceCaseId( differenceCaseId )
|
||||
, m_divideByCellFaceArea( false )
|
||||
{
|
||||
enableDivideByCellFaceArea( divideByCellFaceArea );
|
||||
}
|
||||
|
||||
bool isValid() const
|
||||
@@ -63,17 +68,46 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// Delta Time Step
|
||||
bool isDeltaTimeStepActive() const { return m_timeLapseBaseFrameIdx > NO_TIME_LAPSE; }
|
||||
void setDeltaTimeStepIndex( int timeStepIndex ) { m_timeLapseBaseFrameIdx = timeStepIndex; }
|
||||
int deltaTimeStepIndex() const { return m_timeLapseBaseFrameIdx; }
|
||||
bool representsAllTimeLapses() const { return m_timeLapseBaseFrameIdx == ALL_TIME_LAPSES; }
|
||||
static constexpr int allTimeLapsesValue() { return ALL_TIME_LAPSES; }
|
||||
static constexpr int noTimeLapseValue() { return NO_TIME_LAPSE; }
|
||||
|
||||
// Delta Grid Case
|
||||
bool isDeltaCaseActive() const { return m_differenceCaseId > NO_CASE_DIFF; }
|
||||
void setDeltaCaseId( int caseId ) { m_differenceCaseId = caseId; }
|
||||
int deltaCaseId() const { return m_differenceCaseId; }
|
||||
static constexpr int noCaseDiffValue() { return NO_CASE_DIFF; }
|
||||
|
||||
bool isTimeLapse() const { return m_timeLapseBaseFrameIdx > NO_TIME_LAPSE; }
|
||||
bool representsAllTimeLapses() const { return m_timeLapseBaseFrameIdx == ALL_TIME_LAPSES; }
|
||||
// Divide by Cell Face Area
|
||||
void enableDivideByCellFaceArea( bool enable )
|
||||
{
|
||||
if ( enable )
|
||||
{
|
||||
if ( !m_divideByCellFaceArea )
|
||||
{
|
||||
m_resultName += " /A";
|
||||
}
|
||||
}
|
||||
else if ( m_divideByCellFaceArea )
|
||||
{
|
||||
m_resultName = m_resultName.left( m_resultName.size() - 3 );
|
||||
}
|
||||
m_divideByCellFaceArea = enable;
|
||||
}
|
||||
|
||||
bool hasDifferenceCase() const { return m_differenceCaseId > NO_CASE_DIFF; }
|
||||
bool isDivideByCellFaceAreaActive() const { return m_divideByCellFaceArea; }
|
||||
|
||||
bool operator<( const RigEclipseResultAddress& other ) const
|
||||
{
|
||||
if ( m_divideByCellFaceArea != other.m_divideByCellFaceArea )
|
||||
{
|
||||
return ( m_divideByCellFaceArea < other.m_divideByCellFaceArea );
|
||||
}
|
||||
|
||||
if ( m_differenceCaseId != other.m_differenceCaseId )
|
||||
{
|
||||
return ( m_differenceCaseId < other.m_differenceCaseId );
|
||||
@@ -95,7 +129,8 @@ public:
|
||||
bool operator==( const RigEclipseResultAddress& other ) const
|
||||
{
|
||||
if ( m_resultCatType != other.m_resultCatType || m_resultName != other.m_resultName ||
|
||||
m_timeLapseBaseFrameIdx != other.m_timeLapseBaseFrameIdx || m_differenceCaseId != other.m_differenceCaseId )
|
||||
m_timeLapseBaseFrameIdx != other.m_timeLapseBaseFrameIdx ||
|
||||
m_differenceCaseId != other.m_differenceCaseId || m_divideByCellFaceArea != other.m_divideByCellFaceArea )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -103,13 +138,19 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
const QString& resultName() const { return m_resultName; }
|
||||
void setResultName( QString name ) { m_resultName = name; }
|
||||
|
||||
RiaDefines::ResultCatType resultCatType() const { return m_resultCatType; }
|
||||
void setResultCatType( RiaDefines::ResultCatType catType ) { m_resultCatType = catType; }
|
||||
|
||||
private:
|
||||
int m_timeLapseBaseFrameIdx;
|
||||
int m_differenceCaseId;
|
||||
bool m_divideByCellFaceArea;
|
||||
RiaDefines::ResultCatType m_resultCatType;
|
||||
QString m_resultName;
|
||||
|
||||
int m_timeLapseBaseFrameIdx;
|
||||
int m_differenceCaseId;
|
||||
|
||||
private:
|
||||
static const int ALL_TIME_LAPSES = -2;
|
||||
static const int NO_TIME_LAPSE = -1;
|
||||
static const int NO_CASE_DIFF = -1;
|
||||
|
@@ -70,7 +70,7 @@ RigEclipseResultInfo::RigEclipseResultInfo( const RigEclipseResultAddress& resul
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::ResultCatType RigEclipseResultInfo::resultType() const
|
||||
{
|
||||
return m_resultAddress.m_resultCatType;
|
||||
return m_resultAddress.resultCatType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -78,7 +78,7 @@ RiaDefines::ResultCatType RigEclipseResultInfo::resultType() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigEclipseResultInfo::setResultType( RiaDefines::ResultCatType newType )
|
||||
{
|
||||
m_resultAddress.m_resultCatType = newType;
|
||||
m_resultAddress.setResultCatType( newType );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -86,7 +86,7 @@ void RigEclipseResultInfo::setResultType( RiaDefines::ResultCatType newType )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString& RigEclipseResultInfo::resultName() const
|
||||
{
|
||||
return m_resultAddress.m_resultName;
|
||||
return m_resultAddress.resultName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -94,7 +94,7 @@ const QString& RigEclipseResultInfo::resultName() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigEclipseResultInfo::setResultName( const QString& name )
|
||||
{
|
||||
m_resultAddress.m_resultName = name;
|
||||
m_resultAddress.setResultName( name );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -188,7 +188,7 @@ size_t RigNNCData::connectionsWithNoCommonArea( QStringList& connectionTextFirst
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigNNCData::ensureConnectionDataIsProcecced()
|
||||
bool RigNNCData::ensureConnectionDataIsProcessed()
|
||||
{
|
||||
if ( m_connectionsAreProcessed ) return false;
|
||||
|
||||
@@ -258,7 +258,7 @@ size_t RigNNCData::nativeConnectionCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigConnectionContainer& RigNNCData::connections()
|
||||
{
|
||||
ensureConnectionDataIsProcecced();
|
||||
ensureConnectionDataIsProcessed();
|
||||
|
||||
return m_connections;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ RigConnectionContainer& RigNNCData::connections()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double>& RigNNCData::makeStaticConnectionScalarResult( QString nncDataType )
|
||||
{
|
||||
ensureConnectionDataIsProcecced();
|
||||
ensureConnectionDataIsProcessed();
|
||||
|
||||
std::vector<std::vector<double>>& results = m_connectionResults[nncDataType];
|
||||
results.resize( 1 );
|
||||
@@ -566,15 +566,17 @@ std::vector<QString> RigNNCData::availableProperties( NNCResultType resultType )
|
||||
|
||||
for ( auto it : m_connectionResults )
|
||||
{
|
||||
if ( resultType == NNC_STATIC && it.second.size() == 1 && it.second[0].size() > 0 && isNative( it.first ) )
|
||||
if ( resultType == NNCResultType::NNC_STATIC && it.second.size() == 1 && it.second[0].size() > 0 &&
|
||||
isNative( it.first ) )
|
||||
{
|
||||
properties.push_back( it.first );
|
||||
}
|
||||
else if ( resultType == NNC_DYNAMIC && it.second.size() > 1 && it.second[0].size() > 0 && isNative( it.first ) )
|
||||
else if ( resultType == NNCResultType::NNC_DYNAMIC && it.second.size() > 1 && it.second[0].size() > 0 &&
|
||||
isNative( it.first ) )
|
||||
{
|
||||
properties.push_back( it.first );
|
||||
}
|
||||
else if ( resultType == NNC_GENERATED && !isNative( it.first ) )
|
||||
else if ( resultType == NNCResultType::NNC_GENERATED && !isNative( it.first ) )
|
||||
{
|
||||
properties.push_back( it.first );
|
||||
}
|
||||
@@ -603,6 +605,62 @@ bool RigNNCData::hasScalarValues( const RigEclipseResultAddress& resVarAddr )
|
||||
return ( it != m_connectionResults.end() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigNNCData::generateScalarValues( const RigEclipseResultAddress& resVarAddr )
|
||||
{
|
||||
if ( hasScalarValues( resVarAddr ) ) return true;
|
||||
|
||||
if ( resVarAddr.isDivideByCellFaceAreaActive() && resVarAddr.resultCatType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
|
||||
{
|
||||
RigEclipseResultAddress tmpAddr = resVarAddr;
|
||||
tmpAddr.enableDivideByCellFaceArea( false );
|
||||
|
||||
auto nameit = m_resultAddrToNNCDataType.find( tmpAddr );
|
||||
if ( nameit == m_resultAddrToNNCDataType.end() ) return false;
|
||||
|
||||
auto it = m_connectionResults.find( nameit->second );
|
||||
if ( it == m_connectionResults.end() ) return false;
|
||||
|
||||
auto& srcdata = it->second;
|
||||
|
||||
auto& dstdata = makeDynamicConnectionScalarResult( resVarAddr.resultName(), srcdata.size() );
|
||||
|
||||
const double epsilon = 1.0e-3;
|
||||
|
||||
std::vector<double> areas( m_connections.size() );
|
||||
|
||||
for ( size_t dataIdx = 0; dataIdx < m_connections.size(); dataIdx++ )
|
||||
{
|
||||
double area = 0.0;
|
||||
if ( m_connections[dataIdx].hasCommonArea() )
|
||||
area = cvf::GeometryTools::polygonArea( m_connections[dataIdx].polygon() );
|
||||
areas[dataIdx] = area;
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int i = 0; i < static_cast<int>( srcdata.size() ); i++ )
|
||||
{
|
||||
size_t timeIdx = i;
|
||||
dstdata[timeIdx].resize( srcdata[timeIdx].size() );
|
||||
|
||||
for ( size_t dataIdx = 0; dataIdx < srcdata[timeIdx].size(); dataIdx++ )
|
||||
{
|
||||
double scaledVal = 0.0;
|
||||
if ( areas[dataIdx] > epsilon ) scaledVal = srcdata[timeIdx][dataIdx] / areas[dataIdx];
|
||||
dstdata[timeIdx][dataIdx] = scaledVal;
|
||||
}
|
||||
}
|
||||
|
||||
m_resultAddrToNNCDataType[resVarAddr] = resVarAddr.resultName();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -613,6 +671,7 @@ const QString RigNNCData::getNNCDataTypeFromScalarResultIndex( const RigEclipseR
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@ class QStringList;
|
||||
class RigNNCData : public cvf::Object
|
||||
{
|
||||
public:
|
||||
enum NNCResultType
|
||||
enum class NNCResultType
|
||||
{
|
||||
NNC_DYNAMIC,
|
||||
NNC_STATIC,
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
RigNNCData();
|
||||
|
||||
bool ensureConnectionDataIsProcecced();
|
||||
bool ensureConnectionDataIsProcessed();
|
||||
void setSourceDataForProcessing( RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells );
|
||||
@@ -89,6 +89,8 @@ public:
|
||||
|
||||
bool hasScalarValues( const RigEclipseResultAddress& resVarAddr );
|
||||
|
||||
bool generateScalarValues( const RigEclipseResultAddress& resVarAddr );
|
||||
|
||||
private:
|
||||
const QString getNNCDataTypeFromScalarResultIndex( const RigEclipseResultAddress& resVarAddr ) const;
|
||||
bool isNative( QString nncDataType ) const;
|
||||
|
@@ -95,8 +95,8 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultAddress( c
|
||||
}
|
||||
|
||||
size_t adjustedTimeStepIndex = timeStepIndex;
|
||||
if ( resVarAddr.m_resultCatType == RiaDefines::ResultCatType::STATIC_NATIVE ||
|
||||
resVarAddr.m_resultCatType == RiaDefines::ResultCatType::FORMATION_NAMES )
|
||||
if ( resVarAddr.resultCatType() == RiaDefines::ResultCatType::STATIC_NATIVE ||
|
||||
resVarAddr.resultCatType() == RiaDefines::ResultCatType::FORMATION_NAMES )
|
||||
{
|
||||
adjustedTimeStepIndex = 0;
|
||||
}
|
||||
@@ -127,26 +127,26 @@ cvf::ref<RigResultAccessor>
|
||||
RigEclipseResultAddress nativeAddr( resVarAddr );
|
||||
const RigGridBase* grid = eclipseCase->grid( gridIndex );
|
||||
|
||||
if ( resVarAddr.m_resultName == RiaResultNames::combinedTransmissibilityResultName() )
|
||||
if ( resVarAddr.resultName() == RiaResultNames::combinedTransmissibilityResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
nativeAddr.m_resultName = "TRANX";
|
||||
nativeAddr.setResultName( "TRANX" );
|
||||
cvf::ref<RigResultAccessor> xTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "TRANY";
|
||||
nativeAddr.setResultName( "TRANY" );
|
||||
cvf::ref<RigResultAccessor> yTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "TRANZ";
|
||||
nativeAddr.setResultName( "TRANZ" );
|
||||
cvf::ref<RigResultAccessor> zTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -158,43 +158,43 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedMultResultName() )
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedMultResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombMultResultAccessor> cellFaceAccessObject = new RigCombMultResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = "MULTX";
|
||||
nativeAddr.setResultName( "MULTX" );
|
||||
cvf::ref<RigResultAccessor> multXPos = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "MULTX-";
|
||||
nativeAddr.setResultName( "MULTX-" );
|
||||
cvf::ref<RigResultAccessor> multXNeg = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "MULTY";
|
||||
nativeAddr.setResultName( "MULTY" );
|
||||
cvf::ref<RigResultAccessor> multYPos = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "MULTY-";
|
||||
nativeAddr.setResultName( "MULTY-" );
|
||||
cvf::ref<RigResultAccessor> multYNeg = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "MULTZ";
|
||||
nativeAddr.setResultName( "MULTZ" );
|
||||
cvf::ref<RigResultAccessor> multZPos = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "MULTZ-";
|
||||
nativeAddr.setResultName( "MULTZ-" );
|
||||
cvf::ref<RigResultAccessor> multZNeg = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
@@ -206,27 +206,27 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedRiTranResultName() )
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedRiTranResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = RiaResultNames::riTranXResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riTranXResultName() );
|
||||
cvf::ref<RigResultAccessor> xTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riTranYResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riTranYResultName() );
|
||||
cvf::ref<RigResultAccessor> yTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riTranZResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riTranZResultName() );
|
||||
cvf::ref<RigResultAccessor> zTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -238,26 +238,26 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedRiMultResultName() )
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedRiMultResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
nativeAddr.m_resultName = RiaResultNames::riMultXResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riMultXResultName() );
|
||||
cvf::ref<RigResultAccessor> xRiMultAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riMultYResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riMultYResultName() );
|
||||
cvf::ref<RigResultAccessor> yRiMultAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riMultZResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riMultZResultName() );
|
||||
cvf::ref<RigResultAccessor> zRiMultAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -269,27 +269,28 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedRiAreaNormTranResultName() )
|
||||
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedRiAreaNormTranResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = RiaResultNames::riAreaNormTranXResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riAreaNormTranXResultName() );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riAreaNormTranYResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riAreaNormTranYResultName() );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riAreaNormTranZResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riAreaNormTranZResultName() );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -303,25 +304,26 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedWaterFluxResultName() )
|
||||
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedWaterFluxResultName() )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = "FLRWATI+";
|
||||
nativeAddr.setResultName( "FLRWATI+" );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLRWATJ+";
|
||||
nativeAddr.setResultName( "FLRWATJ+" );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLRWATK+";
|
||||
nativeAddr.setResultName( "FLRWATK+" );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -335,25 +337,25 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedOilFluxResultName() )
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedOilFluxResultName() )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = "FLROILI+";
|
||||
nativeAddr.setResultName( "FLROILI+" );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLROILJ+";
|
||||
nativeAddr.setResultName( "FLROILJ+" );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLROILK+";
|
||||
nativeAddr.setResultName( "FLROILK+" );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -367,25 +369,25 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedGasFluxResultName() )
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedGasFluxResultName() )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = "FLRGASI+";
|
||||
nativeAddr.setResultName( "FLRGASI+" );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLRGASJ+";
|
||||
nativeAddr.setResultName( "FLRGASJ+" );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLRGASK+";
|
||||
nativeAddr.setResultName( "FLRGASK+" );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -399,24 +401,24 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName.endsWith( "IJK" ) )
|
||||
else if ( resVarAddr.resultName().endsWith( "IJK" ) )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
QString baseName = resVarAddr.m_resultName.left( resVarAddr.m_resultName.size() - 3 );
|
||||
QString baseName = resVarAddr.resultName().left( resVarAddr.resultName().size() - 3 );
|
||||
|
||||
nativeAddr.m_resultName = QString( "%1I" ).arg( baseName );
|
||||
nativeAddr.setResultName( QString( "%1I" ).arg( baseName ) );
|
||||
cvf::ref<RigResultAccessor> iAccessor = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = QString( "%1J" ).arg( baseName );
|
||||
nativeAddr.setResultName( QString( "%1J" ).arg( baseName ) );
|
||||
cvf::ref<RigResultAccessor> jAccessor = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = QString( "%1K" ).arg( baseName );
|
||||
nativeAddr.setResultName( QString( "%1K" ).arg( baseName ) );
|
||||
cvf::ref<RigResultAccessor> kAccessor = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
|
@@ -852,6 +852,26 @@ cvf::Vec3f GeometryTools::polygonAreaNormal3D( const std::vector<cvf::Vec3f>& po
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
float GeometryTools::polygonArea( const std::vector<cvf::Vec3f>& polygon )
|
||||
{
|
||||
auto areaNormal3D = polygonAreaNormal3D( polygon );
|
||||
|
||||
return areaNormal3D.length();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double GeometryTools::polygonArea( const std::vector<cvf::Vec3d>& polygon )
|
||||
{
|
||||
auto areaNormal3D = polygonAreaNormal3D( polygon );
|
||||
|
||||
return areaNormal3D.length();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -81,6 +81,9 @@ public:
|
||||
static cvf::Vec3d polygonAreaNormal3D( const std::vector<cvf::Vec3d>& polygon );
|
||||
static cvf::Vec3f polygonAreaNormal3D( const std::vector<cvf::Vec3f>& polygon );
|
||||
|
||||
static float polygonArea( const std::vector<cvf::Vec3f>& polygon );
|
||||
static double polygonArea( const std::vector<cvf::Vec3d>& polygon );
|
||||
|
||||
enum IntersectionStatus
|
||||
{
|
||||
NO_INTERSECTION,
|
||||
|
@@ -258,11 +258,11 @@ public:
|
||||
std::vector<RigNNCData::NNCResultType> resultTypes;
|
||||
std::vector<QString> resultTypeNames;
|
||||
|
||||
resultTypes.push_back( RigNNCData::NNC_DYNAMIC );
|
||||
resultTypes.push_back( RigNNCData::NNCResultType::NNC_DYNAMIC );
|
||||
resultTypeNames.push_back( "DynamicNative" );
|
||||
resultTypes.push_back( RigNNCData::NNC_STATIC );
|
||||
resultTypes.push_back( RigNNCData::NNCResultType::NNC_STATIC );
|
||||
resultTypeNames.push_back( "StaticNative" );
|
||||
resultTypes.push_back( RigNNCData::NNC_GENERATED );
|
||||
resultTypes.push_back( RigNNCData::NNCResultType::NNC_GENERATED );
|
||||
resultTypeNames.push_back( "Generated" );
|
||||
|
||||
for ( size_t rtIdx = 0; rtIdx < resultTypes.size(); ++rtIdx )
|
||||
|
@@ -530,6 +530,32 @@ TEST( CellFaceIntersectionTst, PolygonAreaNormal3D )
|
||||
EXPECT_DOUBLE_EQ( 0.0, area.y() );
|
||||
EXPECT_DOUBLE_EQ( 0.0, area.z() );
|
||||
}
|
||||
|
||||
// Area (float)
|
||||
|
||||
{
|
||||
std::vector<cvf::Vec3f> vxs;
|
||||
vxs.push_back( { 0, 0, 0 } );
|
||||
vxs.push_back( { 0, 0, 2 } );
|
||||
vxs.push_back( { 0, 2, 2 } );
|
||||
vxs.push_back( { 0, 2, 0 } );
|
||||
|
||||
auto area = GeometryTools::polygonArea( vxs );
|
||||
EXPECT_FLOAT_EQ( 4.0, area );
|
||||
}
|
||||
|
||||
// Area (double)
|
||||
|
||||
{
|
||||
std::vector<cvf::Vec3d> vxs;
|
||||
vxs.push_back( { 0, 0, 0 } );
|
||||
vxs.push_back( { 0, 0, 2 } );
|
||||
vxs.push_back( { 0, 2, 2 } );
|
||||
vxs.push_back( { 0, 2, 0 } );
|
||||
|
||||
auto area = GeometryTools::polygonArea( vxs );
|
||||
EXPECT_DOUBLE_EQ( 4.0, area );
|
||||
}
|
||||
}
|
||||
|
||||
TEST( EarClipTesselator, ErrorTest )
|
||||
|
@@ -692,7 +692,6 @@ void RiuResultTextBuilder::appendTextFromResultColors( RigEclipseCaseData*
|
||||
scalarValue = resultAccessor->cellFaceScalar( cellIndex, cvf::StructGridInterface::POS_K );
|
||||
resultInfoText->append( QString( "riMult Z : %1\n" ).arg( scalarValue ) );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if ( resultColors->resultVariable().compare( RiaResultNames::combinedRiAreaNormTranResultName(),
|
||||
@@ -962,8 +961,12 @@ QString RiuResultTextBuilder::cellResultText( RimEclipseResultDefinition* eclRes
|
||||
RigResultAccessorFactory::createFromResultDefinition( eclipseCaseData, m_gridIndex, adjustedTimeStep, eclResDef );
|
||||
if ( resultAccessor.notNull() )
|
||||
{
|
||||
double scalarValue = resultAccessor->cellFaceScalar( m_cellIndex, m_face );
|
||||
QString resultVar = eclResDef->resultVariableUiName();
|
||||
double scalarValue = resultAccessor->cellFaceScalar( m_cellIndex, m_face );
|
||||
QString resultDescriptionText = eclResDef->resultVariableUiName();
|
||||
if ( eclResDef->eclipseResultAddress().isDivideByCellFaceAreaActive() )
|
||||
{
|
||||
resultDescriptionText += "/A";
|
||||
}
|
||||
|
||||
QString resultValueText;
|
||||
if ( eclResDef->hasCategoryResult() )
|
||||
@@ -993,7 +996,7 @@ QString RiuResultTextBuilder::cellResultText( RimEclipseResultDefinition* eclRes
|
||||
resultValueText = QString( "%1" ).arg( scalarValue );
|
||||
}
|
||||
|
||||
text = QString( "%1 : %2" ).arg( resultVar ).arg( resultValueText );
|
||||
text = QString( "%1 : %2" ).arg( resultDescriptionText ).arg( resultValueText );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -165,17 +165,17 @@ const std::vector<double>* getScalarResultByName( const RigNNCData* nncD
|
||||
const QString& propertyName,
|
||||
size_t timeStep )
|
||||
{
|
||||
if ( resultType == RigNNCData::NNC_STATIC )
|
||||
if ( resultType == RigNNCData::NNCResultType::NNC_STATIC )
|
||||
{
|
||||
return nncData->staticConnectionScalarResultByName( propertyName );
|
||||
}
|
||||
|
||||
if ( resultType == RigNNCData::NNC_DYNAMIC )
|
||||
if ( resultType == RigNNCData::NNCResultType::NNC_DYNAMIC )
|
||||
{
|
||||
return nncData->dynamicConnectionScalarResultByName( propertyName, timeStep );
|
||||
}
|
||||
|
||||
if ( resultType == RigNNCData::NNC_GENERATED )
|
||||
if ( resultType == RigNNCData::NNCResultType::NNC_GENERATED )
|
||||
{
|
||||
return nncData->generatedConnectionScalarResultByName( propertyName, timeStep );
|
||||
}
|
||||
@@ -243,9 +243,9 @@ grpc::Status RiaGrpcNNCPropertiesService::GetAvailableNNCProperties( grpc::Serve
|
||||
RigNNCData* nncData = eclipseCase->eclipseCaseData()->mainGrid()->nncData();
|
||||
|
||||
std::vector<RigNNCData::NNCResultType> resultTypes;
|
||||
resultTypes.push_back( RigNNCData::NNC_DYNAMIC );
|
||||
resultTypes.push_back( RigNNCData::NNC_STATIC );
|
||||
resultTypes.push_back( RigNNCData::NNC_GENERATED );
|
||||
resultTypes.push_back( RigNNCData::NNCResultType::NNC_DYNAMIC );
|
||||
resultTypes.push_back( RigNNCData::NNCResultType::NNC_STATIC );
|
||||
resultTypes.push_back( RigNNCData::NNCResultType::NNC_GENERATED );
|
||||
|
||||
for ( size_t rtIdx = 0; rtIdx < resultTypes.size(); ++rtIdx )
|
||||
{
|
||||
|
Reference in New Issue
Block a user