#4348 System , cppcheck : Remove unused functions

This commit is contained in:
Magne Sjaastad
2019-04-21 08:58:21 +02:00
parent b786c2c5f3
commit d152147fd4
8 changed files with 10 additions and 261 deletions

View File

@@ -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.

View File

@@ -116,7 +116,6 @@ public:
LgrNameFactory();
QString newName(RigCompletionData::CompletionType completionType);
QString newName(const QString& baseName, int number);
void resetNumbering();
private:
std::map<RigCompletionData::CompletionType, std::pair<QString, int>> m_counters;
@@ -678,108 +677,6 @@ RicExportLgrFeature::cellsIntersectingCompletions(RimEclipseCase* eclipseCase,
return cells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionDataGridCell> cellsIntersectingCompletion(const std::map<RigCompletionDataGridCell, std::vector<RigCompletionData>>& allCells,
caf::PdmObject* sourcePdmObject)
{
std::vector<RigCompletionDataGridCell> 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<std::pair<RigCompletionDataGridCell, std::vector<RigCompletionData>>>
createOrderedIntersectionList(const std::vector<WellPathCellIntersectionInfo>& allWellPathCells,
const std::map<RigCompletionDataGridCell, std::vector<RigCompletionData>>& completionCells)
{
// All cell indices intersecting a completion and lookup into map
std::set<size_t> complCellIndices;
std::map<size_t, RigCompletionDataGridCell> complCellLookup;
std::set<CellInfo> cellsOnWellPath;
std::vector<std::pair<bool, CellInfo>> 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<std::pair<RigCompletionDataGridCell, std::vector<RigCompletionData>>> 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;
}
}

View File

@@ -344,12 +344,3 @@ void RicCreateTemporaryLgrFeature::computeCachedData(RimEclipseCase* eclipseCase
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateTemporaryLgrFeature::containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells)
{
return std::find_if(cells.begin(), cells.end(), [](const RigCompletionDataGridCell& cell) {
return !cell.isMainGridCell();
}) != cells.end();
}

View File

@@ -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<RigCompletionDataGridCell>& cells);
};

View File

@@ -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

View File

@@ -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<RigEclipseResultBinSorter> catBinSorter;
const std::vector<std::vector<double>>* catValuesForAllSteps = nullptr;
if (xAddress.isValid() && yAddress.isValid())

View File

@@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigEclipseResultBinSorter.h"
#include <algorithm>
#include <limits>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseResultBinSorter::RigEclipseResultBinSorter(const std::vector<std::vector<double>>& allDataValues, int binCount)
: m_allDataValues(allDataValues)
, m_binCount(binCount)
, m_minValue(std::numeric_limits<double>::infinity())
, m_maxValue(-std::numeric_limits<double>::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<int>(distFromMin / m_binSize));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<double, double> 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<double>& doubleRange : m_allDataValues)
{
if (!doubleRange.empty())
{
for (double value : doubleRange)
{
if (value != std::numeric_limits<double>::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;
}
}

View File

@@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <utility>
#include <vector>
//==================================================================================================
///
///
//==================================================================================================
class RigEclipseResultBinSorter
{
public:
RigEclipseResultBinSorter(const std::vector<std::vector<double>>& allDataValues, int binCount);
int binNumber(double value) const;
std::pair<double, double> binRange(int binNumber) const;
private:
void calculateRange();
private:
const std::vector<std::vector<double>>& m_allDataValues;
int m_binCount;
double m_minValue;
double m_maxValue;
double m_binSize;
};