WSL/SLF GitLab Repository

Commit 3c4f3dd3 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

fixed some warnings found on Hera (int/long int or double/long int)

parent d9de92cf
......@@ -780,7 +780,7 @@ bool WinstralAlgorithm::isExposed(const DEMObject& dem, Coords location)
const double min_dh = cellsize/shade_factor; //min_dist=cellsize -> min_dh
const double search_dist = (dem.grid2D.getMax() - alt_ref) * shade_factor;
if (search_dist<=cellsize) return true;
const int search_idx = Optim::ceil( search_dist/cellsize );
const int search_idx = static_cast<int>( Optim::ceil( search_dist/cellsize ) );
const size_t i_min = static_cast<size_t>(std::max( 0, i_ref-search_idx ));
const size_t i_max = static_cast<size_t>(std::min( static_cast<int>(dem.getNx()-1), i_ref+search_idx ));
......@@ -823,7 +823,7 @@ double WinstralAlgorithm::getSynopticBearing(const std::vector<MeteoData>& vecMe
//const double meanspeed = sqrt(ve*ve + vn*vn);
const double meandirection = fmod( atan2(ve,vn) * Cst::to_deg + 360., 360.);
return Optim::round(meandirection/10.)*10; //round to nearest 10 deg
return static_cast<double>(Optim::round(meandirection/10.))*10.; //round to nearest 10 deg
}
return IOUtils::nodata;
......
......@@ -179,7 +179,7 @@ std::vector<double> Interpol1D::derivative(const std::vector<double>& X, const s
* @param X vector of abscissae
* @param Y vector of ordinates
*/
void Interpol1D::equalBin(const size_t k, std::vector<double> &X, std::vector<double> &Y)
void Interpol1D::equalBin(const unsigned int k, std::vector<double> &X, std::vector<double> &Y)
{
const size_t Xsize = X.size();
if (Xsize!=Y.size()) {
......@@ -198,7 +198,7 @@ void Interpol1D::equalBin(const size_t k, std::vector<double> &X, std::vector<do
std::vector<size_t> counts(k, 0.);
for (size_t ii=0; ii<Xsize; ii++) {
if (X[ii]==IOUtils::nodata || Y[ii]==IOUtils::nodata) continue;
const size_t index = (X[ii]!=Xmax)? Optim::floor( (X[ii]-Xmin) / width ) : k-1;
bins[index] += Y[ii];
counts[index]++;
......@@ -223,7 +223,7 @@ void Interpol1D::equalBin(const size_t k, std::vector<double> &X, std::vector<do
* @param X vector of abscissae
* @param Y vector of ordinates
*/
void Interpol1D::equalCountBin(const size_t k, std::vector<double> &X, std::vector<double> &Y)
void Interpol1D::equalCountBin(const unsigned int k, std::vector<double> &X, std::vector<double> &Y)
{
if (X.size()!=Y.size()) {
ostringstream ss;
......@@ -250,8 +250,8 @@ void Interpol1D::equalCountBin(const size_t k, std::vector<double> &X, std::vect
//the first classes receive count_per_class+1 point
if ((class_count<=remainder && count>count_per_class) ||
(class_count>remainder && count>=count_per_class)) {
X_bin.push_back( sum_X/count );
Y_bin.push_back( sum_Y/count );
X_bin.push_back( sum_X/static_cast<double>(count) );
Y_bin.push_back( sum_Y/static_cast<double>(count) );
sum_X=0.;
sum_Y=0.;
count=0;
......@@ -259,8 +259,8 @@ void Interpol1D::equalCountBin(const size_t k, std::vector<double> &X, std::vect
}
}
if (count>0) { //close last class
X_bin.push_back( sum_X/count );
Y_bin.push_back( sum_Y/count );
X_bin.push_back( sum_X/static_cast<double>(count) );
Y_bin.push_back( sum_Y/static_cast<double>(count) );
}
X = X_bin;
......
......@@ -41,8 +41,8 @@ class Interpol1D {
static std::vector<double> quantiles(const std::vector<double>& X, const std::vector<double>& quartiles);
static std::vector<double> derivative(const std::vector<double>& X, const std::vector<double>& Y);
static void sort(std::vector<double>& X, std::vector<double>& Y, const bool& keep_nodata=true);
static void equalBin(const size_t k, std::vector<double> &X, std::vector<double> &Y);
static void equalCountBin(const size_t k, std::vector<double> &X, std::vector<double> &Y);
static void equalBin(const unsigned int k, std::vector<double> &X, std::vector<double> &Y);
static void equalCountBin(const unsigned int k, std::vector<double> &X, std::vector<double> &Y);
static double weightedMean(const double& d1, const double& d2, const double& weight=1.);
static double weightedMean(const std::vector<double>& vecData, const std::vector<double>& weight);
static double arithmeticMean(const std::vector<double>& vecData);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment