///////////////////////////////////////////////////////////////////////////////// // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "cvfVector2.h" #include "cvfVector3.h" #include #include #include class RigContourMapGrid; class RigContourMapProjection; class RigPolyLinesData; //================================================================================================== /// /// //================================================================================================== class RigContourMapCalculator { public: using CellIndexAndResult = std::pair; enum ResultAggregationType { TOP_VALUE, MEAN, GEOMETRIC_MEAN, HARMONIC_MEAN, MIN_VALUE, MAX_VALUE, SUM, OIL_COLUMN, GAS_COLUMN, HYDROCARBON_COLUMN, MOBILE_OIL_COLUMN, MOBILE_GAS_COLUMN, MOBILE_HYDROCARBON_COLUMN }; static std::vector>> generateGridMapping( RigContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid, ResultAggregationType resultAggregation, const std::vector& weightingResultValues, const std::set& kLayers, const std::vector>& limitToPolygons ); static double calculateValueInMapCell( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues, ResultAggregationType resultAggregation ); static std::vector cellOverlapVolumesAndResults( const RigContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid, const cvf::Vec2d& globalPos2d, const std::vector& weightingResultValues, const std::set& kLayers ); static std::vector cellRayIntersectionAndResults( const RigContourMapProjection& contourMapProjection, const RigContourMapGrid& contourMapGrid, const cvf::Vec2d& globalPos2d, const std::vector& weightingResultValues, const std::set& kLayers ); static bool isColumnResult( ResultAggregationType aggregationType ); static bool isMeanResult( ResultAggregationType aggregationType ); static bool isStraightSummationResult( ResultAggregationType aggregationType ); static bool isMobileColumnResult( ResultAggregationType aggregationType ); private: static double calculateTopValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); static double calculateMeanValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); static double calculateGeometricMeanValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); static double calculateHarmonicMeanValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); static double calculateMaxValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); static double calculateMinValue( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); static double calculateSum( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, const std::vector& gridCellValues ); static bool isPointInsidePolygons( cvf::Vec2d point, const std::vector>& polygons ); };