From d152147fd421399425d305e79e6d8bbed969ac32 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 21 Apr 2019 08:58:21 +0200 Subject: [PATCH] #4348 System , cppcheck : Remove unused functions --- .../201-04-21-delete-unused_functions.txt | 20 ++-- .../ExportCommands/RicExportLgrFeature.cpp | 113 ------------------ .../Commands/RicCreateTemporaryLgrFeature.cpp | 9 -- .../Commands/RicCreateTemporaryLgrFeature.h | 1 - .../ReservoirDataModel/CMakeLists_files.cmake | 2 - .../RigEclipseCrossPlotDataExtractor.cpp | 2 - .../RigEclipseResultBinSorter.cpp | 79 ------------ .../RigEclipseResultBinSorter.h | 45 ------- 8 files changed, 10 insertions(+), 261 deletions(-) delete mode 100644 ApplicationCode/ReservoirDataModel/RigEclipseResultBinSorter.cpp delete mode 100644 ApplicationCode/ReservoirDataModel/RigEclipseResultBinSorter.h diff --git a/ApplicationCode/Adm/sourceCodeMaintenance/201-04-21-delete-unused_functions.txt b/ApplicationCode/Adm/sourceCodeMaintenance/201-04-21-delete-unused_functions.txt index 1b2c58100d..1e3fe91b4e 100644 --- a/ApplicationCode/Adm/sourceCodeMaintenance/201-04-21-delete-unused_functions.txt +++ b/ApplicationCode/Adm/sourceCodeMaintenance/201-04-21-delete-unused_functions.txt @@ -2,6 +2,11 @@ Nothing to do ------------- +unchanged ApplicationCode\Commands\HoloLensCommands\farmhash\farmhash.cc 1948 style unusedFunction false The function 'Hash128WithSeed' is never used. +unchanged ApplicationCode\ReservoirDataModel\cvfGeometryTools.cpp 614 style unusedFunction false The function 'addMidEdgeNodes' is never used. +unchanged ApplicationCode\WellPathImportSsihub\RiuWellImportWizard.cpp 147 style unusedFunction false The function 'cancelDownload' is never used. +unchanged ApplicationCode\GeoMech\GeoMechDataModel\RigFemPartGrid.cpp 453 style unusedFunction false The function 'cellIJKFromCoordinate' is never used. +unchanged ApplicationCode\GeoMech\GeoMechDataModel\RigFemPartGrid.cpp 486 style unusedFunction false The function 'cellMinMaxCordinates' is never used. WIP --- @@ -18,21 +23,18 @@ Must be changed Deleted ------- - -Backlog -------- -unchanged ApplicationCode\Commands\HoloLensCommands\farmhash\farmhash.cc 1948 style unusedFunction false The function 'Hash128WithSeed' is never used. -unchanged ApplicationCode\ReservoirDataModel\cvfGeometryTools.cpp 614 style unusedFunction false The function 'addMidEdgeNodes' is never used. unchanged ApplicationCode\FileInterface\RifEclipseDataTableFormatter.cpp 278 style unusedFunction false The function 'addValueTable' is never used. unchanged ApplicationCode\ReservoirDataModel\Completions\RigEclipseToStimPlanCellTransmissibilityCalculator.cpp 109 style unusedFunction false The function 'aggregatedMatrixTransmissibility' is never used. unchanged ApplicationCode\ProjectDataModel\Annotations\RimAnnotationInViewCollection.cpp 231 style unusedFunction false The function 'annotationsCount' is never used. unchanged ApplicationCode\Commands\ExportCommands\RicExportLgrFeature.cpp 848 style unusedFunction false The function 'appendIntersectedCells' is never used. unchanged ApplicationCode\Application\Tools\RiaQIconTools.cpp 26 style unusedFunction false The function 'appendPixmapUpperLeft' is never used. unchanged ApplicationCode\ReservoirDataModel\RigEclipseResultBinSorter.cpp 48 style unusedFunction false The function 'binRange' is never used. -unchanged ApplicationCode\WellPathImportSsihub\RiuWellImportWizard.cpp 147 style unusedFunction false The function 'cancelDownload' is never used. -unchanged ApplicationCode\GeoMech\GeoMechDataModel\RigFemPartGrid.cpp 453 style unusedFunction false The function 'cellIJKFromCoordinate' is never used. -unchanged ApplicationCode\GeoMech\GeoMechDataModel\RigFemPartGrid.cpp 486 style unusedFunction false The function 'cellMinMaxCordinates' is never used. unchanged ApplicationCode\Commands\ExportCommands\RicExportLgrFeature.cpp 684 style unusedFunction false The function 'cellsIntersectingCompletion' is never used. +unchanged ApplicationCode\Commands\ExportCommands\RicExportLgrFeature.cpp 702 style unusedFunction false The function 'createOrderedIntersectionList' is never used. +unchanged ApplicationCode\Commands\ExportCommands\RicExportLgrFeature.cpp 1129 style unusedFunction false The function 'resetNumbering' is never used. + +Backlog +------- unchanged ApplicationCode\UserInterface\RiuWellLogPlot.cpp 527 style unusedFunction false The function 'changeEvent' is never used. unchanged ApplicationCode\Commands\AnnotationCommands\RicTextAnnotation3dEditor.cpp 133 style unusedFunction false The function 'cleanupBeforeSettingPdmObject' is never used. unchanged ApplicationCode\Commands\AnnotationCommands\RicTextAnnotation3dEditor.cpp 73 style unusedFunction false The function 'configureAndUpdateUi' is never used. @@ -41,7 +43,6 @@ unchanged ApplicationCode\UserInterface\RiuGridCrossQwtPlot.cpp 359 style unused unchanged ApplicationCode\Application\Tools\RiaColorTools.cpp 147 style unusedFunction false The function 'contrastRatio' is never used. unchanged ApplicationCode\Commands\HoloLensCommands\VdeCachingHashedIdFactory.cpp 233 style unusedFunction false The function 'crc' is never used. unchanged ApplicationCode\Application\Tools\RiaColorTables.cpp 580 style unusedFunction false The function 'createBrightnessBasedColorTable' is never used. -unchanged ApplicationCode\Commands\ExportCommands\RicExportLgrFeature.cpp 702 style unusedFunction false The function 'createOrderedIntersectionList' is never used. unchanged ApplicationCode\GeoMech\GeoMechVisualization\RivFemPartGeometryGenerator.cpp 106 style unusedFunction false The function 'createOutlineMeshDrawable' is never used. unchanged ApplicationCode\ModelVisualization\RivWellConnectionFactorGeometryGenerator.cpp 202 style unusedFunction false The function 'createStarGeometry' is never used. unchanged ApplicationCode\Commands\SummaryPlotCommands\RicSummaryCurveCalculatorEditor.cpp 119 style unusedFunction false The function 'createWidget' is never used. @@ -91,7 +92,6 @@ unchanged ApplicationCode\UserInterface\RiuViewer.cpp 345 style unusedFunction f unchanged ApplicationCode\ProjectDataModel\RimProject.cpp 1066 style unusedFunction false The function 'polylineAnnotations' is never used. unchanged ApplicationCode\Application\RiaApplication.cpp 326 style unusedFunction false The function 'processNonGuiEvents' is never used. unchanged ApplicationCode\Commands\SummaryPlotCommands\RicSummaryCurveCalculatorEditor.cpp 65 style unusedFunction false The function 'recursivelyConfigureAndUpdateTopLevelUiOrdering' is never used. -unchanged ApplicationCode\Commands\ExportCommands\RicExportLgrFeature.cpp 1129 style unusedFunction false The function 'resetNumbering' is never used. unchanged ApplicationCode\ProjectDataModel\RimContourMapProjection.cpp 223 style unusedFunction false The function 'resultAggregation' is never used. unchanged ApplicationCode\ProjectDataModel\Annotations\RimAnnotationTextAppearance.cpp 75 style unusedFunction false The function 'setAnchorLineColor' is never used. unchanged ApplicationCode\ProjectDataModel\RimScaleLegendConfig.cpp 447 style unusedFunction false The function 'setCurrentScale' is never used. diff --git a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp index 20a4c48d48..2887bf31f8 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp @@ -116,7 +116,6 @@ public: LgrNameFactory(); QString newName(RigCompletionData::CompletionType completionType); QString newName(const QString& baseName, int number); - void resetNumbering(); private: std::map> m_counters; @@ -678,108 +677,6 @@ RicExportLgrFeature::cellsIntersectingCompletions(RimEclipseCase* eclipseCase, return cells; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector cellsIntersectingCompletion(const std::map>& allCells, - caf::PdmObject* sourcePdmObject) -{ - std::vector cells; - for (const auto& intInfo : allCells) - { - for (const auto& completion : intInfo.second) - { - if (completion.sourcePdmObject() == sourcePdmObject) cells.push_back(intInfo.first); - } - } - return cells; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector>> - createOrderedIntersectionList(const std::vector& allWellPathCells, - const std::map>& completionCells) -{ - // All cell indices intersecting a completion and lookup into map - std::set complCellIndices; - std::map complCellLookup; - std::set cellsOnWellPath; - std::vector> cellsNotOnWellPath; - { - for (const auto& complCell : completionCells) - { - complCellIndices.insert(complCell.first.globalCellIndex()); - complCellLookup.insert({complCell.first.globalCellIndex(), complCell.first}); - - bool cellFoundOnWellPath = false; - for (const auto& wellPathCell : allWellPathCells) - { - if (complCell.first.globalCellIndex() == wellPathCell.globCellIndex) - { - cellsOnWellPath.insert(CellInfo(complCell.first.globalCellIndex(), wellPathCell.startMD, wellPathCell.endMD)); - cellFoundOnWellPath = true; - break; - } - } - - if (!cellFoundOnWellPath) - { - cellsNotOnWellPath.emplace_back( true, CellInfo(complCell.first.globalCellIndex()) ); - } - } - } - - std::vector>> result; - - // Walk along well path - for (const auto& cellOnWellPath : cellsOnWellPath) - { - // Add cell on well path first - auto complDataGridCell = complCellLookup.at(cellOnWellPath.globCellIndex); - auto complDataList = completionCells.at(complDataGridCell); - result.emplace_back(complDataGridCell, complDataList); - - // Check intersected completions in current cell - RigCompletionData::CompletionType complTypes[] = { RigCompletionData::FRACTURE, RigCompletionData::FISHBONES, RigCompletionData::PERFORATION }; - - for (auto complType : complTypes) - { - const caf::PdmObject* completion = nullptr; - for (const auto& complData : complDataList) - { - if (complData.completionType() == complType) - { - completion = complData.sourcePdmObject(); - break; - } - } - - if (completion) - { - // Add all cells intersecting this completion - for (auto& cellNotOnWellPath : cellsNotOnWellPath) - { - if (!cellNotOnWellPath.first) continue; - - auto complDataList2 = completionCells.at(complCellLookup.at(cellNotOnWellPath.second.globCellIndex)); - auto itr = std::find_if(complDataList2.begin(), complDataList2.end(), - [&completion](const RigCompletionData& cd) { return cd.sourcePdmObject() == completion; }); - - if (itr != complDataList2.end()) - { - result.emplace_back( complCellLookup.at(cellNotOnWellPath.second.globCellIndex), complDataList2); - cellNotOnWellPath.first = false; - } - } - } - } - } - - return result; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1042,13 +939,3 @@ QString LgrNameFactory::newName(const QString& baseName, int number) return lgrName.replace(" ", "_"); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void LgrNameFactory::resetNumbering() -{ - for (auto& counter : m_counters) - { - counter.second.second = 1; - } -} diff --git a/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp b/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp index 16fa9d2aa0..d13090c4f7 100644 --- a/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp +++ b/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp @@ -344,12 +344,3 @@ void RicCreateTemporaryLgrFeature::computeCachedData(RimEclipseCase* eclipseCase } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicCreateTemporaryLgrFeature::containsAnyNonMainGridCells(const std::vector& cells) -{ - return std::find_if(cells.begin(), cells.end(), [](const RigCompletionDataGridCell& cell) { - return !cell.isMainGridCell(); - }) != cells.end(); -} diff --git a/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.h b/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.h index 0d3864cebd..86bd89da2f 100644 --- a/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.h +++ b/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.h @@ -65,5 +65,4 @@ private: void createLgr(const LgrInfo& lgrInfo, RigMainGrid* mainGrid); void computeCachedData(RimEclipseCase* eclipseCase); void deleteAllCachedData(RimEclipseCase* eclipseCase); - bool containsAnyNonMainGridCells(const std::vector& cells); }; diff --git a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake index fa50149ec9..4058f706c7 100644 --- a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake @@ -53,7 +53,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools.h ${CMAKE_CURRENT_LIST_DIR}/RigWellPathIntersectionTools.h ${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultInfo.h ${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultAddress.h -${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultBinSorter.h ${CMAKE_CURRENT_LIST_DIR}/RigTofAccumulatedPhaseFractionsCalculator.h ${CMAKE_CURRENT_LIST_DIR}/RigTransmissibilityEquations.h ${CMAKE_CURRENT_LIST_DIR}/RigNumberOfFloodedPoreVolumesCalculator.h @@ -122,7 +121,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RigTesselatorTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RigWellPathIntersectionTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultInfo.cpp -${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultBinSorter.cpp ${CMAKE_CURRENT_LIST_DIR}/RigTofAccumulatedPhaseFractionsCalculator.cpp ${CMAKE_CURRENT_LIST_DIR}/RigTransmissibilityEquations.cpp ${CMAKE_CURRENT_LIST_DIR}/RigNumberOfFloodedPoreVolumesCalculator.cpp diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseCrossPlotDataExtractor.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseCrossPlotDataExtractor.cpp index 0bb217e274..64e408278b 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseCrossPlotDataExtractor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseCrossPlotDataExtractor.cpp @@ -24,7 +24,6 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" -#include "RigEclipseResultBinSorter.h" #include "RigFormationNames.h" #include "RigMainGrid.h" @@ -49,7 +48,6 @@ RigEclipseCrossPlotResult RigEclipseCrossPlotDataExtractor::extract(RigEclipseCa RigFormationNames* activeFormationNames = resultData->activeFormationNames(); - std::unique_ptr catBinSorter; const std::vector>* catValuesForAllSteps = nullptr; if (xAddress.isValid() && yAddress.isValid()) diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseResultBinSorter.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseResultBinSorter.cpp deleted file mode 100644 index 5b6600af12..0000000000 --- a/ApplicationCode/ReservoirDataModel/RigEclipseResultBinSorter.cpp +++ /dev/null @@ -1,79 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- 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. -// -///////////////////////////////////////////////////////////////////////////////// -#include "RigEclipseResultBinSorter.h" - -#include -#include - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RigEclipseResultBinSorter::RigEclipseResultBinSorter(const std::vector>& allDataValues, int binCount) - : m_allDataValues(allDataValues) - , m_binCount(binCount) - , m_minValue(std::numeric_limits::infinity()) - , m_maxValue(-std::numeric_limits::infinity()) - , m_binSize(0.0) -{ - calculateRange(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -int RigEclipseResultBinSorter::binNumber(double value) const -{ - double distFromMin = value - m_minValue; - return std::min(m_binCount - 1, static_cast(distFromMin / m_binSize)); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::pair RigEclipseResultBinSorter::binRange(int binNumber) const -{ - double minBinValue = m_minValue + m_binSize * binNumber; - double maxBinBalue = minBinValue + m_binSize; - return std::make_pair(minBinValue, maxBinBalue); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RigEclipseResultBinSorter::calculateRange() -{ - for (const std::vector& doubleRange : m_allDataValues) - { - if (!doubleRange.empty()) - { - for (double value : doubleRange) - { - if (value != std::numeric_limits::infinity()) - { - m_minValue = std::min(m_minValue, value); - m_maxValue = std::max(m_maxValue, value); - } - } - } - } - - if (m_maxValue > m_minValue) - { - m_binSize = (m_maxValue - m_minValue) / m_binCount; - } -} diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseResultBinSorter.h b/ApplicationCode/ReservoirDataModel/RigEclipseResultBinSorter.h deleted file mode 100644 index 6f49beb1d9..0000000000 --- a/ApplicationCode/ReservoirDataModel/RigEclipseResultBinSorter.h +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- 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 -#include - -//================================================================================================== -/// -/// -//================================================================================================== -class RigEclipseResultBinSorter -{ -public: - RigEclipseResultBinSorter(const std::vector>& allDataValues, int binCount); - - int binNumber(double value) const; - std::pair binRange(int binNumber) const; - -private: - void calculateRange(); - -private: - const std::vector>& m_allDataValues; - int m_binCount; - double m_minValue; - double m_maxValue; - double m_binSize; -}; -