2019-01-11 06:03:46 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2018- Equinor ASA
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RimEclipseContourMapProjection.h"
|
2018-10-16 02:53:30 -05:00
|
|
|
|
2018-11-01 09:21:35 -05:00
|
|
|
#include "RiaWeightedGeometricMeanCalculator.h"
|
|
|
|
#include "RiaWeightedHarmonicMeanCalculator.h"
|
2018-10-17 06:26:15 -05:00
|
|
|
#include "RiaWeightedMeanCalculator.h"
|
|
|
|
|
2018-10-16 02:53:30 -05:00
|
|
|
#include "RigActiveCellInfo.h"
|
2018-11-05 07:31:07 -06:00
|
|
|
#include "RigCaseCellResultsData.h"
|
2018-11-01 07:21:13 -05:00
|
|
|
#include "RigCell.h"
|
2018-11-06 06:14:13 -06:00
|
|
|
#include "RigCellGeometryTools.h"
|
2018-10-16 02:53:30 -05:00
|
|
|
#include "RigEclipseCaseData.h"
|
2018-10-17 06:26:15 -05:00
|
|
|
#include "RigHexIntersectionTools.h"
|
2018-10-16 02:53:30 -05:00
|
|
|
#include "RigMainGrid.h"
|
|
|
|
#include "RigResultAccessor.h"
|
|
|
|
#include "RigResultAccessorFactory.h"
|
|
|
|
|
2018-10-30 05:43:50 -05:00
|
|
|
#include "RimCellRangeFilterCollection.h"
|
2019-01-11 06:56:35 -06:00
|
|
|
#include "RimEclipseContourMapView.h"
|
2018-10-16 02:53:30 -05:00
|
|
|
#include "RimEclipseCellColors.h"
|
|
|
|
#include "RimEclipseView.h"
|
|
|
|
#include "RimEclipseResultCase.h"
|
2018-11-09 08:25:35 -06:00
|
|
|
#include "RimEclipseResultDefinition.h"
|
2018-10-16 02:53:30 -05:00
|
|
|
#include "RimProject.h"
|
2018-10-30 05:43:50 -05:00
|
|
|
#include "RimRegularLegendConfig.h"
|
2018-12-20 03:38:20 -06:00
|
|
|
#include "RimTextAnnotation.h"
|
2018-10-16 02:53:30 -05:00
|
|
|
|
2018-10-30 05:43:50 -05:00
|
|
|
#include "cafContourLines.h"
|
2018-10-16 02:53:30 -05:00
|
|
|
#include "cafPdmUiDoubleSliderEditor.h"
|
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
2018-10-30 05:43:50 -05:00
|
|
|
|
2018-10-17 06:26:15 -05:00
|
|
|
#include "cvfArray.h"
|
|
|
|
#include "cvfCellRange.h"
|
2018-11-15 14:40:10 -06:00
|
|
|
#include "cvfGeometryTools.h"
|
2019-01-02 08:53:13 -06:00
|
|
|
#include "cvfGeometryUtils.h"
|
2018-10-30 05:43:50 -05:00
|
|
|
#include "cvfScalarMapper.h"
|
2018-10-17 06:26:15 -05:00
|
|
|
#include "cvfStructGridGeometryGenerator.h"
|
|
|
|
|
2018-10-16 02:53:30 -05:00
|
|
|
#include <algorithm>
|
2019-01-02 08:53:13 -06:00
|
|
|
#include <omp.h>
|
2018-10-16 02:53:30 -05:00
|
|
|
|
2019-01-11 08:11:38 -06:00
|
|
|
CAF_PDM_SOURCE_INIT(RimEclipseContourMapProjection, "RimEclipseContourMapProjection");
|
2018-10-16 02:53:30 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
RimEclipseContourMapProjection::RimEclipseContourMapProjection()
|
2019-01-11 08:11:38 -06:00
|
|
|
: RimContourMapProjection()
|
2018-10-16 02:53:30 -05:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
CAF_PDM_InitObject("RimEclipseContourMapProjection", ":/2DMapProjection16x16.png", "", "");
|
2018-11-05 09:19:04 -06:00
|
|
|
|
2018-11-09 08:25:35 -06:00
|
|
|
CAF_PDM_InitField(&m_weightByParameter, "WeightByParameter", false, "Weight by Result Parameter", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_weightingResult, "WeightingResult", "", "", "", "");
|
|
|
|
m_weightingResult.uiCapability()->setUiHidden(true);
|
|
|
|
m_weightingResult.uiCapability()->setUiTreeChildrenHidden(true);
|
|
|
|
m_weightingResult = new RimEclipseResultDefinition;
|
|
|
|
m_weightingResult->findField("MResultType")->uiCapability()->setUiName("Result Type");
|
2018-12-20 03:38:20 -06:00
|
|
|
|
2018-11-09 02:04:40 -06:00
|
|
|
setName("Map Projection");
|
2018-10-16 02:53:30 -05:00
|
|
|
nameField()->uiCapability()->setUiReadOnly(true);
|
2018-11-02 07:15:03 -05:00
|
|
|
|
|
|
|
m_resultAccessor = new RigHugeValResultAccessor;
|
2018-10-16 02:53:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
RimEclipseContourMapProjection::~RimEclipseContourMapProjection()
|
2018-10-16 02:53:30 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2018-11-21 02:32:04 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
QString RimEclipseContourMapProjection::resultDescriptionText() const
|
2018-11-21 02:32:04 -06:00
|
|
|
{
|
|
|
|
QString resultText = resultAggregationText();
|
|
|
|
if (!isColumnResult())
|
|
|
|
{
|
|
|
|
resultText += QString(", %1").arg(view()->cellResult()->resultVariable());
|
|
|
|
}
|
|
|
|
|
|
|
|
return resultText;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
QString RimEclipseContourMapProjection::weightingParameter() const
|
2018-11-21 02:32:04 -06:00
|
|
|
{
|
|
|
|
QString parameter = "None";
|
|
|
|
if (m_weightByParameter() && !m_weightingResult->isTernarySaturationSelected())
|
|
|
|
{
|
|
|
|
parameter = m_weightingResult->resultVariableUiShortName();
|
|
|
|
}
|
|
|
|
return parameter;
|
|
|
|
}
|
|
|
|
|
2018-10-30 05:43:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
RimRegularLegendConfig* RimEclipseContourMapProjection::legendConfig() const
|
2018-10-30 05:43:50 -05:00
|
|
|
{
|
2018-11-21 02:32:04 -06:00
|
|
|
return view()->cellResult()->legendConfig();
|
2018-10-30 05:43:50 -05:00
|
|
|
}
|
|
|
|
|
2018-11-09 08:25:35 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
void RimEclipseContourMapProjection::updateLegend()
|
2018-11-21 02:32:04 -06:00
|
|
|
{
|
|
|
|
RimEclipseCellColors* cellColors = view()->cellResult();
|
|
|
|
|
2019-01-11 09:06:08 -06:00
|
|
|
if (use3dGridLegendRange())
|
2018-11-09 08:25:35 -06:00
|
|
|
{
|
2018-11-21 02:32:04 -06:00
|
|
|
cellColors->updateLegendData(view()->currentTimeStep(), legendConfig());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-01-11 09:06:08 -06:00
|
|
|
CVF_ASSERT(use2dMapLegendRange());
|
|
|
|
|
2018-11-21 02:32:04 -06:00
|
|
|
double minVal = minValue();
|
|
|
|
double maxVal = maxValue();
|
|
|
|
|
|
|
|
legendConfig()->setAutomaticRanges(minVal, maxVal, minVal, maxVal);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_resultAggregation() == RESULTS_OIL_COLUMN ||
|
|
|
|
m_resultAggregation() == RESULTS_GAS_COLUMN ||
|
|
|
|
m_resultAggregation() == RESULTS_HC_COLUMN)
|
|
|
|
{
|
|
|
|
legendConfig()->setTitle(QString("Map Projection\n%1").arg(m_resultAggregation().uiText()));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QString projectionLegendText = QString("Map Projection\n%1").arg(m_resultAggregation().uiText());
|
|
|
|
if (weightingParameter() != "None")
|
|
|
|
{
|
|
|
|
projectionLegendText += QString("(W: %1)").arg(weightingParameter());
|
|
|
|
}
|
|
|
|
projectionLegendText += QString("\nResult: %1").arg(cellColors->resultVariableUiShortName());
|
|
|
|
|
|
|
|
legendConfig()->setTitle(projectionLegendText);
|
2018-11-09 08:25:35 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-15 14:40:10 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
void RimEclipseContourMapProjection::updatedWeightingResult()
|
2018-11-15 14:40:10 -06:00
|
|
|
{
|
2019-01-11 05:32:46 -06:00
|
|
|
this->clearGridMapping();
|
2018-11-21 02:32:04 -06:00
|
|
|
this->updateConnectedEditors();
|
2019-01-11 03:48:28 -06:00
|
|
|
this->generateResultsIfNecessary(view()->currentTimeStep());
|
2018-11-21 02:32:04 -06:00
|
|
|
this->updateLegend();
|
|
|
|
|
|
|
|
RimProject* proj;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted(proj);
|
|
|
|
proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
2018-11-06 06:23:24 -06:00
|
|
|
}
|
|
|
|
|
2019-01-11 03:48:28 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
void RimEclipseContourMapProjection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
2019-01-11 03:48:28 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
RimContourMapProjection::defineUiOrdering(uiConfigName, uiOrdering);
|
2019-01-11 03:48:28 -06:00
|
|
|
|
|
|
|
caf::PdmUiGroup* weightingGroup = uiOrdering.addNewGroup("Mean Weighting Options");
|
|
|
|
weightingGroup->add(&m_weightByParameter);
|
|
|
|
weightingGroup->setCollapsedByDefault(true);
|
|
|
|
|
|
|
|
m_weightByParameter.uiCapability()->setUiReadOnly(!isMeanResult());
|
|
|
|
if (!isMeanResult())
|
|
|
|
{
|
|
|
|
m_weightByParameter = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_weightByParameter())
|
|
|
|
{
|
|
|
|
m_weightingResult->uiOrdering(uiConfigName, *weightingGroup);
|
|
|
|
}
|
|
|
|
|
|
|
|
uiOrdering.skipRemainingFields(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
void RimEclipseContourMapProjection::initAfterRead()
|
2019-01-11 03:48:28 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
RimContourMapProjection::initAfterRead();
|
2019-01-11 03:48:28 -06:00
|
|
|
if (eclipseCase())
|
|
|
|
{
|
|
|
|
m_weightingResult->setEclipseCase(eclipseCase());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
void RimEclipseContourMapProjection::generateGridMapping()
|
2019-01-11 03:48:28 -06:00
|
|
|
{
|
|
|
|
clearResults();
|
|
|
|
|
|
|
|
m_cellGridIdxVisibility = view()->currentTotalCellVisibility();
|
|
|
|
|
|
|
|
int nCells = numberOfCells();
|
|
|
|
m_projected3dGridIndices.resize(nCells);
|
|
|
|
|
|
|
|
const std::vector<double>* weightingResultValues = nullptr;
|
|
|
|
if (m_weightByParameter())
|
|
|
|
{
|
|
|
|
size_t gridScalarResultIdx = m_weightingResult->scalarResultIndex();
|
|
|
|
if (gridScalarResultIdx != cvf::UNDEFINED_SIZE_T)
|
|
|
|
{
|
|
|
|
m_weightingResult->loadResult();
|
|
|
|
int timeStep = 0;
|
|
|
|
if (m_weightingResult->hasDynamicResult())
|
|
|
|
{
|
|
|
|
timeStep = view()->currentTimeStep();
|
|
|
|
}
|
|
|
|
weightingResultValues =
|
|
|
|
&(m_weightingResult->currentGridCellResults()->cellScalarResults(gridScalarResultIdx)[timeStep]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isStraightSummationResult())
|
|
|
|
{
|
|
|
|
#pragma omp parallel for
|
|
|
|
for (int index = 0; index < nCells; ++index)
|
|
|
|
{
|
|
|
|
cvf::Vec2ui ij = ijFromCellIndex(index);
|
|
|
|
|
|
|
|
cvf::Vec2d globalPos = cellCenterPosition(ij.x(), ij.y()) + origin2d();
|
|
|
|
m_projected3dGridIndices[index] = visibleCellsAndLengthInCellFrom2dPoint(globalPos, weightingResultValues);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#pragma omp parallel for
|
|
|
|
for (int index = 0; index < nCells; ++index)
|
|
|
|
{
|
|
|
|
cvf::Vec2ui ij = ijFromCellIndex(index);
|
|
|
|
|
|
|
|
cvf::Vec2d globalPos = cellCenterPosition(ij.x(), ij.y()) + origin2d();
|
2019-01-11 08:11:38 -06:00
|
|
|
m_projected3dGridIndices[index] = visibleCellsAndOverlapVolumeFrom2dPoint(globalPos, weightingResultValues);
|
|
|
|
}
|
2019-01-11 03:48:28 -06:00
|
|
|
}
|
2018-11-21 02:32:04 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 08:11:38 -06:00
|
|
|
void RimEclipseContourMapProjection::generateResults(int timeStep)
|
2018-11-21 02:32:04 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
clearGeometry();
|
|
|
|
|
|
|
|
m_weightingResult->loadResult();
|
|
|
|
|
|
|
|
size_t nCells = numberOfCells();
|
|
|
|
size_t nVertices = numberOfVertices();
|
2018-11-21 02:32:04 -06:00
|
|
|
|
2019-01-11 08:11:38 -06:00
|
|
|
m_aggregatedResults = std::vector<double>(nCells, std::numeric_limits<double>::infinity());
|
|
|
|
m_aggregatedVertexResults = std::vector<double>(nVertices, std::numeric_limits<double>::infinity());
|
|
|
|
RimEclipseCellColors* cellColors = view()->cellResult();
|
2019-01-11 03:48:28 -06:00
|
|
|
|
2019-01-11 08:11:38 -06:00
|
|
|
RimEclipseResultCase* eclipseCase = this->eclipseCase();
|
2019-01-10 13:55:58 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
if (!cellColors->isTernarySaturationSelected())
|
2019-01-10 13:55:58 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
RigCaseCellResultsData* resultData = eclipseCase->results(RiaDefines::MATRIX_MODEL);
|
|
|
|
|
|
|
|
if (isColumnResult())
|
2019-01-11 03:48:28 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
m_currentResultName = "";
|
|
|
|
resultData->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PORO");
|
|
|
|
resultData->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "NTG");
|
|
|
|
resultData->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DZ");
|
|
|
|
if (m_resultAggregation == RESULTS_OIL_COLUMN || m_resultAggregation == RESULTS_HC_COLUMN)
|
2019-01-11 05:32:46 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
resultData->findOrLoadScalarResultForTimeStep(RiaDefines::DYNAMIC_NATIVE, "SOIL", timeStep);
|
2019-01-11 05:32:46 -06:00
|
|
|
}
|
2019-01-11 08:11:38 -06:00
|
|
|
if (m_resultAggregation == RESULTS_GAS_COLUMN || m_resultAggregation == RESULTS_HC_COLUMN)
|
2019-01-11 05:32:46 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
resultData->findOrLoadScalarResultForTimeStep(RiaDefines::DYNAMIC_NATIVE, "SGAS", timeStep);
|
2019-01-11 05:32:46 -06:00
|
|
|
}
|
2019-01-11 08:11:38 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_currentResultName = cellColors->resultVariable();
|
|
|
|
m_resultAccessor =
|
|
|
|
RigResultAccessorFactory::createFromResultDefinition(eclipseCase->eclipseCaseData(), 0, timeStep, cellColors);
|
2019-01-11 05:32:46 -06:00
|
|
|
|
2019-01-11 08:11:38 -06:00
|
|
|
if (m_resultAccessor.isNull())
|
2019-01-11 03:48:28 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
m_resultAccessor = new RigHugeValResultAccessor;
|
2019-01-11 03:48:28 -06:00
|
|
|
}
|
|
|
|
}
|
2019-01-11 08:11:38 -06:00
|
|
|
|
|
|
|
#pragma omp parallel for
|
|
|
|
for (int index = 0; index < static_cast<int>(nCells); ++index)
|
|
|
|
{
|
|
|
|
cvf::Vec2ui ij = ijFromCellIndex(index);
|
|
|
|
m_aggregatedResults[index] = calculateValueInCell(ij.x(), ij.y());
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma omp parallel for
|
|
|
|
for (int index = 0; index < static_cast<int>(nVertices); ++index)
|
|
|
|
{
|
|
|
|
cvf::Vec2ui ij = ijFromVertexIndex(index);
|
|
|
|
m_aggregatedVertexResults[index] = calculateValueAtVertex(ij.x(), ij.y());
|
|
|
|
}
|
2018-11-21 02:32:04 -06:00
|
|
|
}
|
|
|
|
}
|
2019-01-11 08:11:38 -06:00
|
|
|
m_currentResultTimestep = timeStep;
|
2018-11-15 14:40:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 09:06:08 -06:00
|
|
|
bool RimEclipseContourMapProjection::gridMappingImplNeedsUpdating() const
|
2018-11-05 07:31:07 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
if (m_cellGridIdxVisibility.isNull())
|
2018-11-15 14:40:10 -06:00
|
|
|
{
|
2019-01-11 03:48:28 -06:00
|
|
|
return true;
|
2018-11-15 14:40:10 -06:00
|
|
|
}
|
2019-01-11 03:48:28 -06:00
|
|
|
cvf::ref<cvf::UByteArray> currentVisibility = view()->currentTotalCellVisibility();
|
|
|
|
CVF_ASSERT(currentVisibility->size() == m_cellGridIdxVisibility->size());
|
|
|
|
for (size_t i = 0; i < currentVisibility->size(); ++i)
|
2018-11-14 05:38:20 -06:00
|
|
|
{
|
2019-01-11 03:48:28 -06:00
|
|
|
if ((*currentVisibility)[i] != (*m_cellGridIdxVisibility)[i]) return true;
|
2018-11-14 05:38:20 -06:00
|
|
|
}
|
2019-01-11 09:06:08 -06:00
|
|
|
return false;
|
2018-11-05 07:31:07 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 09:06:08 -06:00
|
|
|
bool RimEclipseContourMapProjection::resultsImplNeedsUpdating() const
|
2019-01-11 08:11:38 -06:00
|
|
|
{
|
2019-01-11 05:32:46 -06:00
|
|
|
if (!m_currentResultName.isEmpty())
|
|
|
|
{
|
|
|
|
RimEclipseCellColors* cellColors = view()->cellResult();
|
|
|
|
if (cellColors->resultVariable() != m_currentResultName)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2019-01-11 09:06:08 -06:00
|
|
|
return false;
|
2018-10-16 02:53:30 -05:00
|
|
|
}
|
|
|
|
|
2019-01-10 13:55:58 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 09:06:08 -06:00
|
|
|
void RimEclipseContourMapProjection::clearImplSpecificResultData()
|
2019-01-10 13:55:58 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
m_currentResultName = "";
|
2018-10-16 02:53:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
double RimEclipseContourMapProjection::calculateValueInCell(uint i, uint j) const
|
2018-11-06 05:47:54 -06:00
|
|
|
{
|
2018-11-30 06:47:46 -06:00
|
|
|
if (!isColumnResult())
|
2018-11-06 05:47:54 -06:00
|
|
|
{
|
2018-11-30 06:47:46 -06:00
|
|
|
if (!view()->cellResult()->isFlowDiagOrInjectionFlooding() &&
|
|
|
|
view()->cellResult()->scalarResultIndex() == cvf::UNDEFINED_SIZE_T)
|
|
|
|
{
|
|
|
|
return 0.0; // Special case of NONE-result. Show 0 all over to ensure we see something.
|
|
|
|
}
|
2018-11-21 02:32:04 -06:00
|
|
|
}
|
|
|
|
const std::vector<std::pair<size_t, double>>& matchingCells = cellsAtIJ(i, j);
|
|
|
|
if (!matchingCells.empty())
|
|
|
|
{
|
|
|
|
switch (m_resultAggregation())
|
2018-11-06 05:47:54 -06:00
|
|
|
{
|
2018-11-21 02:32:04 -06:00
|
|
|
case RESULTS_TOP_VALUE:
|
|
|
|
{
|
|
|
|
size_t cellIdx = matchingCells.front().first;
|
|
|
|
double cellValue = m_resultAccessor->cellScalarGlobIdx(cellIdx);
|
|
|
|
return cellValue;
|
|
|
|
}
|
|
|
|
case RESULTS_MEAN_VALUE:
|
|
|
|
{
|
|
|
|
RiaWeightedMeanCalculator<double> calculator;
|
|
|
|
for (auto cellIdxAndWeight : matchingCells)
|
|
|
|
{
|
|
|
|
size_t cellIdx = cellIdxAndWeight.first;
|
|
|
|
double cellValue = m_resultAccessor->cellScalarGlobIdx(cellIdx);
|
|
|
|
calculator.addValueAndWeight(cellValue, cellIdxAndWeight.second);
|
|
|
|
}
|
|
|
|
if (calculator.validAggregatedWeight())
|
|
|
|
{
|
|
|
|
return calculator.weightedMean();
|
|
|
|
}
|
|
|
|
return std::numeric_limits<double>::infinity();
|
|
|
|
}
|
|
|
|
case RESULTS_GEOM_VALUE:
|
|
|
|
{
|
|
|
|
RiaWeightedGeometricMeanCalculator calculator;
|
|
|
|
for (auto cellIdxAndWeight : matchingCells)
|
|
|
|
{
|
|
|
|
size_t cellIdx = cellIdxAndWeight.first;
|
|
|
|
double cellValue = m_resultAccessor->cellScalarGlobIdx(cellIdx);
|
|
|
|
if (cellValue < 1.0e-8)
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
calculator.addValueAndWeight(cellValue, cellIdxAndWeight.second);
|
|
|
|
}
|
|
|
|
if (calculator.validAggregatedWeight())
|
|
|
|
{
|
|
|
|
return calculator.weightedMean();
|
|
|
|
}
|
|
|
|
return std::numeric_limits<double>::infinity();
|
|
|
|
}
|
|
|
|
case RESULTS_HARM_VALUE:
|
|
|
|
{
|
|
|
|
RiaWeightedHarmonicMeanCalculator calculator;
|
|
|
|
for (auto cellIdxAndWeight : matchingCells)
|
|
|
|
{
|
|
|
|
size_t cellIdx = cellIdxAndWeight.first;
|
|
|
|
double cellValue = m_resultAccessor->cellScalarGlobIdx(cellIdx);
|
|
|
|
if (std::fabs(cellValue) < 1.0e-8)
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
calculator.addValueAndWeight(cellValue, cellIdxAndWeight.second);
|
|
|
|
}
|
|
|
|
if (calculator.validAggregatedWeight())
|
|
|
|
{
|
|
|
|
return calculator.weightedMean();
|
|
|
|
}
|
|
|
|
return std::numeric_limits<double>::infinity();
|
|
|
|
}
|
|
|
|
case RESULTS_MAX_VALUE:
|
|
|
|
{
|
|
|
|
double maxValue = -std::numeric_limits<double>::infinity();
|
|
|
|
for (auto cellIdxAndWeight : matchingCells)
|
|
|
|
{
|
|
|
|
size_t cellIdx = cellIdxAndWeight.first;
|
|
|
|
double cellValue = m_resultAccessor->cellScalarGlobIdx(cellIdx);
|
|
|
|
maxValue = std::max(maxValue, cellValue);
|
|
|
|
}
|
|
|
|
return maxValue;
|
|
|
|
}
|
|
|
|
case RESULTS_MIN_VALUE:
|
|
|
|
{
|
|
|
|
double minValue = std::numeric_limits<double>::infinity();
|
|
|
|
for (auto cellIdxAndWeight : matchingCells)
|
|
|
|
{
|
|
|
|
size_t cellIdx = cellIdxAndWeight.first;
|
|
|
|
double cellValue = m_resultAccessor->cellScalarGlobIdx(cellIdx);
|
|
|
|
minValue = std::min(minValue, cellValue);
|
|
|
|
}
|
|
|
|
return minValue;
|
|
|
|
}
|
|
|
|
case RESULTS_VOLUME_SUM:
|
|
|
|
case RESULTS_SUM:
|
|
|
|
{
|
|
|
|
double sum = 0.0;
|
|
|
|
for (auto cellIdxAndWeight : matchingCells)
|
|
|
|
{
|
|
|
|
size_t cellIdx = cellIdxAndWeight.first;
|
|
|
|
double cellValue = m_resultAccessor->cellScalarGlobIdx(cellIdx);
|
|
|
|
sum += cellValue * cellIdxAndWeight.second;
|
|
|
|
}
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
case RESULTS_OIL_COLUMN:
|
|
|
|
case RESULTS_GAS_COLUMN:
|
|
|
|
case RESULTS_HC_COLUMN:
|
|
|
|
{
|
|
|
|
double sum = 0.0;
|
|
|
|
for (auto cellIdxAndWeight : matchingCells)
|
|
|
|
{
|
|
|
|
size_t cellIdx = cellIdxAndWeight.first;
|
2019-01-11 09:06:08 -06:00
|
|
|
double cellValue = calculateColumnResult(m_resultAggregation(), cellIdx);
|
2018-11-21 02:32:04 -06:00
|
|
|
sum += cellValue * cellIdxAndWeight.second;
|
|
|
|
}
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
CVF_TIGHT_ASSERT(false);
|
2018-11-06 05:47:54 -06:00
|
|
|
}
|
|
|
|
}
|
2018-11-21 02:32:04 -06:00
|
|
|
return std::numeric_limits<double>::infinity();
|
2018-10-29 06:52:57 -05:00
|
|
|
}
|
|
|
|
|
2019-01-11 09:06:08 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
double RimEclipseContourMapProjection::calculateColumnResult(ResultAggregation resultAggregation, size_t cellGlobalIdx) const
|
|
|
|
{
|
|
|
|
const RigCaseCellResultsData* resultData = eclipseCase()->results(RiaDefines::MATRIX_MODEL);
|
|
|
|
size_t poroResultIndex = resultData->findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PORO");
|
|
|
|
size_t ntgResultIndex = resultData->findScalarResultIndex(RiaDefines::STATIC_NATIVE, "NTG");
|
|
|
|
size_t dzResultIndex = resultData->findScalarResultIndex(RiaDefines::STATIC_NATIVE, "DZ");
|
|
|
|
|
|
|
|
if (poroResultIndex == cvf::UNDEFINED_SIZE_T || ntgResultIndex == cvf::UNDEFINED_SIZE_T)
|
|
|
|
{
|
|
|
|
return std::numeric_limits<double>::infinity();
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::vector<double>& poroResults = resultData->cellScalarResults(poroResultIndex)[0];
|
|
|
|
const std::vector<double>& ntgResults = resultData->cellScalarResults(ntgResultIndex)[0];
|
|
|
|
const std::vector<double>& dzResults = resultData->cellScalarResults(dzResultIndex)[0];
|
|
|
|
|
|
|
|
const RigActiveCellInfo* activeCellInfo = eclipseCase()->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
|
|
|
size_t cellResultIdx = activeCellInfo->cellResultIndex(cellGlobalIdx);
|
|
|
|
|
|
|
|
if (cellResultIdx >= poroResults.size() || cellResultIdx >= ntgResults.size())
|
|
|
|
{
|
|
|
|
return std::numeric_limits<double>::infinity();
|
|
|
|
}
|
|
|
|
|
|
|
|
double poro = poroResults.at(cellResultIdx);
|
|
|
|
double ntg = ntgResults.at(cellResultIdx);
|
|
|
|
double dz = dzResults.at(cellResultIdx);
|
|
|
|
|
|
|
|
int timeStep = view()->currentTimeStep();
|
|
|
|
|
|
|
|
double resultValue = 0.0;
|
|
|
|
if (resultAggregation == RESULTS_OIL_COLUMN || resultAggregation == RESULTS_HC_COLUMN)
|
|
|
|
{
|
|
|
|
size_t soilResultIndex = resultData->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "SOIL");
|
|
|
|
const std::vector<double>& soilResults = resultData->cellScalarResults(soilResultIndex)[timeStep];
|
|
|
|
if (cellResultIdx < soilResults.size())
|
|
|
|
{
|
|
|
|
resultValue = soilResults.at(cellResultIdx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (resultAggregation == RESULTS_GAS_COLUMN || resultAggregation == RESULTS_HC_COLUMN)
|
|
|
|
{
|
|
|
|
size_t sgasResultIndex = resultData->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "SGAS");
|
|
|
|
const std::vector<double>& sgasResults = resultData->cellScalarResults(sgasResultIndex)[timeStep];
|
|
|
|
if (cellResultIdx < sgasResults.size())
|
|
|
|
{
|
|
|
|
resultValue += sgasResults.at(cellResultIdx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return resultValue * poro * ntg * dz;
|
|
|
|
}
|
|
|
|
|
2018-10-17 06:26:15 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-11-21 02:32:04 -06:00
|
|
|
std::vector<std::pair<size_t, double>>
|
2019-01-11 06:03:46 -06:00
|
|
|
RimEclipseContourMapProjection::visibleCellsAndOverlapVolumeFrom2dPoint(const cvf::Vec2d& globalPos2d,
|
2018-11-21 02:32:04 -06:00
|
|
|
const std::vector<double>* weightingResultValues) const
|
|
|
|
{
|
2019-01-10 14:16:22 -06:00
|
|
|
cvf::Vec3d top2dElementCentroid(globalPos2d, m_expandedBoundingBox.max().z());
|
|
|
|
cvf::Vec3d bottom2dElementCentroid(globalPos2d, m_expandedBoundingBox.min().z());
|
2018-11-15 14:40:10 -06:00
|
|
|
cvf::Vec3d planarDiagonalVector(0.5 * m_sampleSpacing, 0.5 * m_sampleSpacing, 0.0);
|
2018-11-21 02:32:04 -06:00
|
|
|
cvf::Vec3d topNECorner = top2dElementCentroid + planarDiagonalVector;
|
2018-11-05 01:46:50 -06:00
|
|
|
cvf::Vec3d bottomSWCorner = bottom2dElementCentroid - planarDiagonalVector;
|
2018-10-17 06:26:15 -05:00
|
|
|
|
2018-11-06 06:23:24 -06:00
|
|
|
cvf::BoundingBox bbox2dElement(bottomSWCorner, topNECorner);
|
2018-10-17 06:26:15 -05:00
|
|
|
|
2019-01-10 14:16:22 -06:00
|
|
|
std::vector<std::pair<size_t, double>> matchingVisibleCellsAndWeight;
|
|
|
|
|
|
|
|
// Bounding box has been expanded, so 2d element may be outside actual 3d grid
|
|
|
|
if (!bbox2dElement.intersects(m_gridBoundingBox))
|
|
|
|
{
|
|
|
|
return matchingVisibleCellsAndWeight;
|
|
|
|
}
|
|
|
|
|
2018-10-17 06:26:15 -05:00
|
|
|
std::vector<size_t> allCellIndices;
|
2018-11-21 02:32:04 -06:00
|
|
|
m_mainGrid->findIntersectingCells(bbox2dElement, &allCellIndices);
|
2018-10-17 06:26:15 -05:00
|
|
|
|
2018-11-13 07:22:34 -06:00
|
|
|
typedef std::map<size_t, std::vector<std::pair<size_t, double>>> KLayerCellWeightMap;
|
2018-11-21 02:32:04 -06:00
|
|
|
KLayerCellWeightMap matchingVisibleCellsWeightPerKLayer;
|
2018-10-17 08:46:47 -05:00
|
|
|
|
2018-11-06 06:23:24 -06:00
|
|
|
std::array<cvf::Vec3d, 8> hexCorners;
|
2018-10-23 09:32:40 -05:00
|
|
|
for (size_t globalCellIdx : allCellIndices)
|
2018-10-17 06:26:15 -05:00
|
|
|
{
|
2018-11-08 03:18:49 -06:00
|
|
|
if ((*m_cellGridIdxVisibility)[globalCellIdx])
|
2018-10-17 06:26:15 -05:00
|
|
|
{
|
2018-11-21 02:32:04 -06:00
|
|
|
RigCell cell = m_mainGrid->globalCellArray()[globalCellIdx];
|
2018-11-13 07:22:34 -06:00
|
|
|
|
|
|
|
size_t mainGridCellIdx = cell.mainGridCellIndex();
|
|
|
|
size_t i, j, k;
|
2018-11-21 02:32:04 -06:00
|
|
|
m_mainGrid->ijkFromCellIndex(mainGridCellIdx, &i, &j, &k);
|
2018-11-13 07:22:34 -06:00
|
|
|
|
|
|
|
size_t localCellIdx = cell.gridLocalCellIndex();
|
2018-11-21 02:32:04 -06:00
|
|
|
RigGridBase* localGrid = cell.hostGrid();
|
2018-11-08 03:18:49 -06:00
|
|
|
|
2018-11-06 06:23:24 -06:00
|
|
|
localGrid->cellCornerVertices(localCellIdx, hexCorners.data());
|
|
|
|
|
2018-11-21 02:32:04 -06:00
|
|
|
cvf::BoundingBox overlapBBox;
|
|
|
|
std::array<cvf::Vec3d, 8> overlapCorners =
|
|
|
|
RigCellGeometryTools::estimateHexOverlapWithBoundingBox(hexCorners, bbox2dElement, &overlapBBox);
|
|
|
|
|
2018-11-08 03:18:49 -06:00
|
|
|
double overlapVolume = RigCellGeometryTools::calculateCellVolume(overlapCorners);
|
2018-11-05 01:46:50 -06:00
|
|
|
|
2018-11-06 06:23:24 -06:00
|
|
|
if (overlapVolume > 0.0)
|
2018-11-09 08:25:35 -06:00
|
|
|
{
|
|
|
|
double weight = overlapVolume;
|
|
|
|
if (weightingResultValues)
|
|
|
|
{
|
2018-11-21 02:32:04 -06:00
|
|
|
const RigActiveCellInfo* activeCellInfo =
|
|
|
|
eclipseCase()->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
2018-11-09 08:25:35 -06:00
|
|
|
size_t cellResultIdx = activeCellInfo->cellResultIndex(globalCellIdx);
|
2018-11-21 02:32:04 -06:00
|
|
|
double result = std::max((*weightingResultValues)[cellResultIdx], 0.0);
|
2018-11-09 08:25:35 -06:00
|
|
|
if (result < 1.0e-6)
|
|
|
|
{
|
|
|
|
result = 0.0;
|
|
|
|
}
|
|
|
|
weight *= result;
|
|
|
|
}
|
|
|
|
if (weight > 0.0)
|
|
|
|
{
|
2018-11-13 07:22:34 -06:00
|
|
|
matchingVisibleCellsWeightPerKLayer[k].push_back(std::make_pair(globalCellIdx, weight));
|
2018-11-09 08:25:35 -06:00
|
|
|
}
|
2018-10-17 06:26:15 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-13 07:22:34 -06:00
|
|
|
for (auto kLayerCellWeight : matchingVisibleCellsWeightPerKLayer)
|
|
|
|
{
|
|
|
|
for (auto cellWeight : kLayerCellWeight.second)
|
|
|
|
{
|
2018-11-13 07:31:08 -06:00
|
|
|
matchingVisibleCellsAndWeight.push_back(std::make_pair(cellWeight.first, cellWeight.second));
|
2018-11-13 07:22:34 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return matchingVisibleCellsAndWeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
std::vector<std::pair<size_t, double>> RimEclipseContourMapProjection::visibleCellsAndLengthInCellFrom2dPoint(
|
2018-11-21 02:32:04 -06:00
|
|
|
const cvf::Vec2d& globalPos2d,
|
|
|
|
const std::vector<double>* weightingResultValues /*= nullptr*/) const
|
2018-11-13 07:22:34 -06:00
|
|
|
{
|
2019-01-10 14:16:22 -06:00
|
|
|
std::vector<std::pair<size_t, double>> matchingVisibleCellsAndWeight;
|
|
|
|
|
|
|
|
cvf::Vec3d highestPoint(globalPos2d, m_expandedBoundingBox.max().z());
|
|
|
|
cvf::Vec3d lowestPoint(globalPos2d, m_expandedBoundingBox.min().z());
|
|
|
|
|
|
|
|
// Bounding box has been expanded, so ray may be outside actual grid
|
|
|
|
if (!m_gridBoundingBox.contains(highestPoint))
|
|
|
|
{
|
|
|
|
return matchingVisibleCellsAndWeight;
|
|
|
|
}
|
2018-11-13 07:22:34 -06:00
|
|
|
|
|
|
|
cvf::BoundingBox rayBBox;
|
|
|
|
rayBBox.add(highestPoint);
|
|
|
|
rayBBox.add(lowestPoint);
|
|
|
|
|
|
|
|
std::vector<size_t> allCellIndices;
|
2018-11-21 02:32:04 -06:00
|
|
|
m_mainGrid->findIntersectingCells(rayBBox, &allCellIndices);
|
2018-11-13 07:22:34 -06:00
|
|
|
|
|
|
|
std::map<size_t, std::vector<std::pair<size_t, double>>> matchingVisibleCellsAndWeightPerKLayer;
|
|
|
|
|
|
|
|
cvf::Vec3d hexCorners[8];
|
|
|
|
for (size_t globalCellIdx : allCellIndices)
|
|
|
|
{
|
|
|
|
if ((*m_cellGridIdxVisibility)[globalCellIdx])
|
2018-11-21 02:32:04 -06:00
|
|
|
{
|
|
|
|
RigCell cell = m_mainGrid->globalCellArray()[globalCellIdx];
|
|
|
|
|
2018-11-13 07:22:34 -06:00
|
|
|
size_t mainGridCellIdx = cell.mainGridCellIndex();
|
|
|
|
size_t i, j, k;
|
2018-11-21 02:32:04 -06:00
|
|
|
m_mainGrid->ijkFromCellIndex(mainGridCellIdx, &i, &j, &k);
|
2018-11-13 07:22:34 -06:00
|
|
|
|
|
|
|
size_t localCellIdx = cell.gridLocalCellIndex();
|
2018-11-21 02:32:04 -06:00
|
|
|
RigGridBase* localGrid = cell.hostGrid();
|
2018-11-13 07:22:34 -06:00
|
|
|
|
|
|
|
localGrid->cellCornerVertices(localCellIdx, hexCorners);
|
|
|
|
std::vector<HexIntersectionInfo> intersections;
|
|
|
|
|
|
|
|
if (RigHexIntersectionTools::lineHexCellIntersection(highestPoint, lowestPoint, hexCorners, 0, &intersections))
|
|
|
|
{
|
2018-11-21 02:32:04 -06:00
|
|
|
double lengthInCell =
|
|
|
|
(intersections.back().m_intersectionPoint - intersections.front().m_intersectionPoint).length();
|
2018-11-13 07:22:34 -06:00
|
|
|
matchingVisibleCellsAndWeightPerKLayer[k].push_back(std::make_pair(globalCellIdx, lengthInCell));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto kLayerCellWeight : matchingVisibleCellsAndWeightPerKLayer)
|
2018-11-01 09:21:35 -05:00
|
|
|
{
|
2018-11-13 07:22:34 -06:00
|
|
|
// Make sure the sum of all weights in the same K-layer is 1.
|
|
|
|
double weightSumThisKLayer = 0.0;
|
|
|
|
for (auto cellWeight : kLayerCellWeight.second)
|
|
|
|
{
|
|
|
|
weightSumThisKLayer += cellWeight.second;
|
|
|
|
}
|
2018-11-02 05:48:33 -05:00
|
|
|
|
2018-11-13 07:22:34 -06:00
|
|
|
for (auto cellWeight : kLayerCellWeight.second)
|
2018-11-02 05:48:33 -05:00
|
|
|
{
|
2018-11-13 07:22:34 -06:00
|
|
|
matchingVisibleCellsAndWeight.push_back(std::make_pair(cellWeight.first, cellWeight.second / weightSumThisKLayer));
|
2018-11-02 05:48:33 -05:00
|
|
|
}
|
2018-11-01 09:21:35 -05:00
|
|
|
}
|
|
|
|
|
2018-10-17 08:46:47 -05:00
|
|
|
return matchingVisibleCellsAndWeight;
|
2018-10-17 06:26:15 -05:00
|
|
|
}
|
|
|
|
|
2018-11-15 14:40:10 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
void RimEclipseContourMapProjection::updateGridInformation()
|
2018-11-15 14:40:10 -06:00
|
|
|
{
|
2018-11-21 02:32:04 -06:00
|
|
|
m_mainGrid = eclipseCase()->eclipseCaseData()->mainGrid();
|
|
|
|
m_sampleSpacing = m_relativeSampleSpacing * m_mainGrid->characteristicIJCellSize();
|
2019-01-10 14:16:22 -06:00
|
|
|
m_gridBoundingBox = eclipseCase()->activeCellsBoundingBox();
|
|
|
|
cvf::Vec3d minExpandedPoint = m_gridBoundingBox.min() - cvf::Vec3d(gridEdgeOffset(), gridEdgeOffset(), 0.0);
|
|
|
|
cvf::Vec3d maxExpandedPoint = m_gridBoundingBox.max() + cvf::Vec3d(gridEdgeOffset(), gridEdgeOffset(), 0.0);
|
|
|
|
m_expandedBoundingBox = cvf::BoundingBox(minExpandedPoint, maxExpandedPoint);
|
|
|
|
|
2018-11-21 02:32:04 -06:00
|
|
|
m_mapSize = calculateMapSize();
|
2018-11-20 04:00:02 -06:00
|
|
|
|
|
|
|
// Re-jig max point to be an exact multiple of cell size
|
2019-01-10 14:16:22 -06:00
|
|
|
cvf::Vec3d minPoint = m_expandedBoundingBox.min();
|
|
|
|
cvf::Vec3d maxPoint = m_expandedBoundingBox.max();
|
2018-11-20 04:00:02 -06:00
|
|
|
maxPoint.x() = minPoint.x() + m_mapSize.x() * m_sampleSpacing;
|
|
|
|
maxPoint.y() = minPoint.y() + m_mapSize.y() * m_sampleSpacing;
|
2019-01-10 14:16:22 -06:00
|
|
|
m_expandedBoundingBox = cvf::BoundingBox(minPoint, maxPoint);
|
2018-11-15 14:40:10 -06:00
|
|
|
}
|
|
|
|
|
2018-11-21 02:32:04 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:03:46 -06:00
|
|
|
RimEclipseResultCase* RimEclipseContourMapProjection::eclipseCase() const
|
2018-11-21 02:32:04 -06:00
|
|
|
{
|
|
|
|
RimEclipseResultCase* eclipseCase = nullptr;
|
|
|
|
firstAncestorOrThisOfType(eclipseCase);
|
|
|
|
return eclipseCase;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 08:11:38 -06:00
|
|
|
RimGridView* RimEclipseContourMapProjection::baseView() const
|
2018-11-21 02:32:04 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
return view();
|
2018-11-21 02:32:04 -06:00
|
|
|
}
|
2019-01-02 08:53:13 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 08:11:38 -06:00
|
|
|
RimEclipseContourMapView* RimEclipseContourMapProjection::view() const
|
2019-01-02 08:53:13 -06:00
|
|
|
{
|
2019-01-11 08:11:38 -06:00
|
|
|
RimEclipseContourMapView* view = nullptr;
|
|
|
|
firstAncestorOrThisOfTypeAsserted(view);
|
|
|
|
return view;
|
2019-01-02 08:53:13 -06:00
|
|
|
}
|