2018-10-16 02:53:30 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) Statoil ASA
|
|
|
|
// Copyright (C) Ceetron Solutions AS
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "RimCheckableNamedObject.h"
|
|
|
|
#include "RimRegularLegendConfig.h"
|
|
|
|
|
|
|
|
#include "cafDisplayCoordTransform.h"
|
|
|
|
#include "cafPdmChildField.h"
|
|
|
|
#include "cafPdmField.h"
|
|
|
|
#include "cafPdmObject.h"
|
|
|
|
|
2018-10-31 10:09:14 -05:00
|
|
|
#include "cvfBoundingBox.h"
|
2018-10-16 02:53:30 -05:00
|
|
|
#include "cvfGeometryBuilderFaceList.h"
|
|
|
|
#include "cvfVector2.h"
|
|
|
|
|
|
|
|
class RigMainGrid;
|
2018-10-23 09:32:40 -05:00
|
|
|
class RigResultAccessor;
|
2018-10-16 02:53:30 -05:00
|
|
|
class RimEclipseResultCase;
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
2018-11-09 02:04:40 -06:00
|
|
|
class RimContourMapProjection : public RimCheckableNamedObject
|
2018-10-16 02:53:30 -05:00
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
|
|
enum ResultAggregationEnum
|
|
|
|
{
|
2018-11-01 09:21:35 -05:00
|
|
|
RESULTS_TOP_VALUE,
|
|
|
|
RESULTS_MEAN_VALUE,
|
|
|
|
RESULTS_GEOM_VALUE,
|
|
|
|
RESULTS_HARM_VALUE,
|
2018-10-16 02:53:30 -05:00
|
|
|
RESULTS_MIN_VALUE,
|
2018-11-01 09:21:35 -05:00
|
|
|
RESULTS_MAX_VALUE,
|
2018-11-05 07:31:07 -06:00
|
|
|
RESULTS_SUM,
|
|
|
|
RESULTS_OIL_COLUMN,
|
|
|
|
RESULTS_GAS_COLUMN,
|
|
|
|
RESULTS_HC_COLUMN
|
2018-10-16 02:53:30 -05:00
|
|
|
};
|
|
|
|
typedef caf::AppEnum<ResultAggregationEnum> ResultAggregation;
|
2018-10-30 05:43:50 -05:00
|
|
|
typedef std::vector<cvf::ref<cvf::Vec3fArray>> ContourPolygons;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
2018-11-09 02:04:40 -06:00
|
|
|
RimContourMapProjection();
|
|
|
|
~RimContourMapProjection() override;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
|
|
|
void generateVertices(cvf::Vec3fArray* vertices, const caf::DisplayCoordTransform* displayCoordTransform);
|
2018-10-30 05:43:50 -05:00
|
|
|
|
|
|
|
ContourPolygons generateContourPolygons(const caf::DisplayCoordTransform* displayCoordTransform);
|
2018-10-17 08:46:47 -05:00
|
|
|
void generateResults();
|
2018-10-16 02:53:30 -05:00
|
|
|
double maxValue() const;
|
|
|
|
double minValue() const;
|
2018-11-06 05:47:54 -06:00
|
|
|
double meanValue() const;
|
|
|
|
double sumAllValues() const;
|
2018-10-16 02:53:30 -05:00
|
|
|
double sampleSpacing() const;
|
2018-11-05 09:19:04 -06:00
|
|
|
bool showContourLines() const;
|
|
|
|
|
2018-10-30 05:43:50 -05:00
|
|
|
const std::vector<double>& aggregatedResults() const;
|
2018-11-05 09:13:33 -06:00
|
|
|
bool isSummationResult() const;
|
2018-11-06 06:23:24 -06:00
|
|
|
bool isColumnResult() const;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
|
|
|
double value(uint i, uint j) const;
|
2018-11-05 07:31:07 -06:00
|
|
|
|
2018-10-16 02:53:30 -05:00
|
|
|
bool hasResultAt(uint i, uint j) const;
|
|
|
|
|
|
|
|
cvf::Vec2ui surfaceGridSize() const;
|
|
|
|
uint vertexCount() const;
|
2018-11-06 05:47:54 -06:00
|
|
|
uint validVertexCount() const;
|
2018-10-16 02:53:30 -05:00
|
|
|
RimRegularLegendConfig* legendConfig() const;
|
|
|
|
|
|
|
|
size_t gridIndex(uint i, uint j) const;
|
|
|
|
cvf::Vec2ui ijFromGridIndex(size_t gridIndex) const;
|
2018-10-17 08:46:47 -05:00
|
|
|
void updateLegend();
|
2018-10-17 06:26:15 -05:00
|
|
|
|
2018-11-06 05:47:54 -06:00
|
|
|
ResultAggregation resultAggregation() const;
|
|
|
|
QString resultAggregationText() const;
|
|
|
|
|
2018-10-16 02:53:30 -05:00
|
|
|
protected:
|
2018-11-05 07:31:07 -06:00
|
|
|
double calculateValue(uint i, uint j) const;
|
2018-11-06 06:14:13 -06:00
|
|
|
double calculateVolumeSum(uint i, uint j) const;
|
2018-11-06 06:23:24 -06:00
|
|
|
double calculateSoilSum(uint i, uint j) const;
|
2018-11-05 07:31:07 -06:00
|
|
|
|
2018-10-31 10:09:14 -05:00
|
|
|
cvf::BoundingBox expandedBoundingBox() const;
|
2018-10-30 05:43:50 -05:00
|
|
|
void generateGridMapping();
|
2018-11-08 03:18:49 -06:00
|
|
|
void calculateTotalCellVisibility();
|
2018-10-30 05:43:50 -05:00
|
|
|
cvf::Vec2d globalPos2d(uint i, uint j) const;
|
2018-11-08 03:18:49 -06:00
|
|
|
const std::vector<std::pair<size_t, double>>& cellsAtPos2d(uint i, uint j) const;
|
2018-10-30 05:43:50 -05:00
|
|
|
std::vector<double> xPositions() const;
|
|
|
|
std::vector<double> yPositions() const;
|
|
|
|
|
2018-11-08 03:18:49 -06:00
|
|
|
std::vector<std::pair<size_t, double>> visibleCellsAndWeightMatching2dPoint(const cvf::Vec2d& globalPos2d) const;
|
2018-11-05 07:31:07 -06:00
|
|
|
double findColumnResult(ResultAggregation resultAggregation, size_t cellGlobalIdx) const;
|
2018-11-06 06:23:24 -06:00
|
|
|
double findSoilResult(size_t cellGlobalIdx) const;
|
2018-10-16 02:53:30 -05:00
|
|
|
const RimEclipseResultCase* eclipseCase() const;
|
|
|
|
RigMainGrid* mainGrid() const;
|
|
|
|
|
2018-10-18 12:45:57 -05:00
|
|
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
|
|
|
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
|
|
|
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
2018-11-05 09:13:33 -06:00
|
|
|
void initAfterRead() override;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
|
|
|
protected:
|
2018-11-06 06:39:23 -06:00
|
|
|
caf::PdmField<double> m_relativeSampleSpacing;
|
2018-10-17 06:26:15 -05:00
|
|
|
caf::PdmField<ResultAggregation> m_resultAggregation;
|
2018-11-05 09:19:04 -06:00
|
|
|
caf::PdmField<bool> m_showContourLines;
|
|
|
|
|
2018-11-08 03:18:49 -06:00
|
|
|
cvf::ref<cvf::UByteArray> m_cellGridIdxVisibility;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
2018-11-08 03:18:49 -06:00
|
|
|
std::vector<double> m_aggregatedResults;
|
|
|
|
std::vector<std::vector<std::pair<size_t, double>>> m_projected3dGridIndices;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
2018-10-23 09:32:40 -05:00
|
|
|
cvf::ref<RigResultAccessor> m_resultAccessor;
|
2018-10-16 02:53:30 -05:00
|
|
|
};
|