#7116 Janitor: Use CAF_ASSERT, not cassert.

This commit is contained in:
Kristian Bendiksen
2021-03-05 19:18:22 +01:00
committed by Magne Sjaastad
parent f3fe51ef65
commit c174bf947c
@@ -18,7 +18,8 @@
#include "RiaInterpolationTools.h" #include "RiaInterpolationTools.h"
#include <cassert> #include "cafAssert.h"
#include <cmath> #include <cmath>
#include <cstdlib> #include <cstdlib>
#include <limits> #include <limits>
@@ -45,7 +46,7 @@ double RiaInterpolationTools::linear( const std::vector<double>& x,
double value, double value,
ExtrapolationMode extrapolationMode ) ExtrapolationMode extrapolationMode )
{ {
assert( x.size() == y.size() ); CAF_ASSERT( x.size() == y.size() );
// Handle cases with only one data point. // Handle cases with only one data point.
if ( x.size() <= 1 ) if ( x.size() <= 1 )
@@ -83,7 +84,7 @@ double RiaInterpolationTools::linear( const std::vector<double>& x,
return extrapolate( x, y, value ); return extrapolate( x, y, value );
} }
assert( extrapolationMode == ExtrapolationMode::NONE ); CAF_ASSERT( extrapolationMode == ExtrapolationMode::NONE );
return std::numeric_limits<double>::infinity(); return std::numeric_limits<double>::infinity();
} }
@@ -137,7 +138,7 @@ int RiaInterpolationTools::findNextDataPoint( const std::vector<double>& values,
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
int RiaInterpolationTools::findPreviousDataPoint( const std::vector<double>& values, int index ) int RiaInterpolationTools::findPreviousDataPoint( const std::vector<double>& values, int index )
{ {
assert( index >= 0 ); CAF_ASSERT( index >= 0 );
for ( int i = index; i >= 0; i-- ) for ( int i = index; i >= 0; i-- )
{ {
@@ -177,7 +178,7 @@ int RiaInterpolationTools::interpolateRange( int start,
const std::vector<double>& x, const std::vector<double>& x,
std::vector<double>& y ) std::vector<double>& y )
{ {
assert( start <= end ); CAF_ASSERT( start <= end );
std::vector<double> xs = { x[firstPoint], x[lastPoint] }; std::vector<double> xs = { x[firstPoint], x[lastPoint] };
std::vector<double> ys = { y[firstPoint], y[lastPoint] }; std::vector<double> ys = { y[firstPoint], y[lastPoint] };
@@ -194,7 +195,7 @@ int RiaInterpolationTools::interpolateRange( int start,
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaInterpolationTools::interpolateMissingValues( const std::vector<double>& x, std::vector<double>& y ) void RiaInterpolationTools::interpolateMissingValues( const std::vector<double>& x, std::vector<double>& y )
{ {
assert( x.size() == y.size() ); CAF_ASSERT( x.size() == y.size() );
int index = 0; int index = 0;