#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

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