Commit 82e46e7d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Fix some clang-tidy warnings.

parent ed3a7d17
Pipeline #3301 passed with stages
in 14 minutes and 11 seconds
......@@ -19,9 +19,9 @@
#include "config.h" // restrict
#endif
#include <float.h>
#include <fenv.h>
#include <assert.h>
#include <cfloat>
#include <cfenv>
#include <cassert>
#include "compare.h"
#include "array.h"
......@@ -156,7 +156,7 @@ MinMaxMean
varrayMinMaxMean(const size_t len, const Varray<double> &array)
{
auto mms = varrayMinMaxSum(len, array, MinMaxSum());
const auto rmean = len ? mms.sum / (double) len : 0.0;
const auto rmean = len != 0 ? mms.sum / static_cast<double>(len) : 0.0;
return MinMaxMean(mms.min, mms.max, rmean, len);
}
......@@ -164,7 +164,7 @@ MinMaxMean
varrayMinMaxMeanMV(const size_t len, const Varray<double> &array, const double missval)
{
auto mms = varrayMinMaxSumMV(len, array, missval, MinMaxSum());
const auto rmean = mms.n ? mms.sum / (double) mms.n : missval;
const auto rmean = mms.n != 0 ? mms.sum / static_cast<double>(mms.n) : missval;
return MinMaxMean(mms.min, mms.max, rmean, mms.n);
}
......@@ -178,7 +178,7 @@ arrayMinMaxMask(const size_t len, const double *const array, const Varray<int> &
{
for (size_t i = 0; i < len; ++i)
{
if (!mask[i])
if (mask[i] == 0)
{
if (array[i] < zmin) zmin = array[i];
if (array[i] > zmax) zmax = array[i];
......@@ -570,7 +570,7 @@ varrayWeightedAvgMV(const size_t len, const Varray<double> &v, const Varray<doub
static void
varrayPrevarsum0(size_t len, const Varray<double> &v, double &rsum, double &rsumw)
{
rsum = 0;
rsum = 0.0;
for (size_t i = 0; i < len; i++)
{
rsum += v[i];
......@@ -581,7 +581,7 @@ varrayPrevarsum0(size_t len, const Varray<double> &v, double &rsum, double &rsum
static void
varrayPrevarsum0MV(size_t len, const Varray<double> &v, double missval, double &rsum, double &rsumw)
{
rsum = rsumw = 0;
rsum = rsumw = 0.0;
for (size_t i = 0; i < len; i++)
if (!DBL_IS_EQUAL(v[i], missval))
{
......@@ -594,7 +594,7 @@ static void
varrayPrevarsum(size_t len, const Varray<double> &v,
double &rsum, double &rsumw, double &rsumq, double &rsumwq)
{
rsum = rsumq = 0;
rsum = rsumq = 0.0;
for (size_t i = 0; i < len; i++)
{
rsum += v[i];
......@@ -608,7 +608,7 @@ static void
varrayPrevarsumMV(size_t len, const Varray<double> &v, double missval,
double &rsum, double &rsumw, double &rsumq, double &rsumwq)
{
rsum = rsumq = rsumw = rsumwq = 0;
rsum = rsumq = rsumw = rsumwq = 0.0;
for (size_t i = 0; i < len; i++)
if (!DBL_IS_EQUAL(v[i], missval))
{
......@@ -622,8 +622,8 @@ varrayPrevarsumMV(size_t len, const Varray<double> &v, double missval,
double
varrayVar(size_t len, const Varray<double> &v, size_t nmiss, double missval)
{
double rsum, rsumw, rsumq, rsumwq;
if (nmiss)
double rsum = 0.0, rsumw = 0.0, rsumq = 0.0, rsumwq = 0.0;
if (nmiss > 0)
varrayPrevarsumMV(len, v, missval, rsum, rsumw, rsumq, rsumwq);
else
varrayPrevarsum(len, v, rsum, rsumw, rsumq, rsumwq);
......@@ -637,8 +637,8 @@ varrayVar(size_t len, const Varray<double> &v, size_t nmiss, double missval)
double
varrayVar1(size_t len, const Varray<double> &v, size_t nmiss, double missval)
{
double rsum, rsumw, rsumq, rsumwq;
if (nmiss)
double rsum = 0.0, rsumw = 0.0, rsumq = 0.0, rsumwq = 0.0;
if (nmiss > 0)
varrayPrevarsumMV(len, v, missval, rsum, rsumw, rsumq, rsumwq);
else
varrayPrevarsum(len, v, rsum, rsumw, rsumq, rsumwq);
......@@ -681,8 +681,8 @@ varrayWeightedPrevarsumMV(size_t len, const Varray<double> &v, const Varray<doub
double
varrayWeightedVar(size_t len, const Varray<double> &v, const Varray<double> &w, size_t nmiss, double missval)
{
double rsum, rsumw, rsumq, rsumwq;
if (nmiss)
double rsum = 0.0, rsumw = 0.0, rsumq = 0.0, rsumwq = 0.0;
if (nmiss > 0)
varrayWeightedPrevarsumMV(len, v, w, missval, rsum, rsumw, rsumq, rsumwq);
else
varrayWeightedPrevarsum(len, v, w, rsum, rsumw, rsumq, rsumwq);
......@@ -696,8 +696,8 @@ varrayWeightedVar(size_t len, const Varray<double> &v, const Varray<double> &w,
double
varrayWeightedVar1(size_t len, const Varray<double> &v, const Varray<double> &w, size_t nmiss, double missval)
{
double rsum, rsumw, rsumq, rsumwq;
if (nmiss)
double rsum = 0.0, rsumw = 0.0, rsumq = 0.0, rsumwq = 0.0;
if (nmiss > 0)
varrayWeightedPrevarsumMV(len, v, w, missval, rsum, rsumw, rsumq, rsumwq);
else
varrayWeightedPrevarsum(len, v, w, rsum, rsumw, rsumq, rsumwq);
......@@ -712,7 +712,7 @@ static void
varrayPrekurtsum(size_t len, const Varray<double> &v, const double mean,
double &rsum3w, double &rsum4w, double &rsum2diff, double &rsum4diff)
{
rsum2diff = rsum4diff = 0;
rsum2diff = rsum4diff = 0.0;
for (size_t i = 0; i < len; i++)
{
const auto vdiff = v[i] - mean;
......@@ -727,7 +727,7 @@ static void
varrayPrekurtsumMV(size_t len, const Varray<double> &v, double missval, const double mean,
double &rsum3w, double &rsum4w, double &rsum2diff, double &rsum4diff)
{
rsum3w = rsum4w = rsum2diff = rsum4diff = 0;
rsum3w = rsum4w = rsum2diff = rsum4diff = 0.0;
for (size_t i = 0; i < len; i++)
if (!DBL_IS_EQUAL(v[i], missval))
{
......@@ -746,7 +746,7 @@ varrayKurt(size_t len, const Varray<double> &v, size_t nmiss, double missval)
double rsum4w; // 4th moment variables
double rsum2diff, rsum4diff;
double rsum, rsumw;
if (nmiss)
if (nmiss > 0)
{
varrayPrevarsum0MV(len, v, missval, rsum, rsumw);
varrayPrekurtsumMV(len, v, missval, (rsum / rsumw), rsum3w, rsum4w, rsum2diff, rsum4diff);
......@@ -760,7 +760,7 @@ varrayKurt(size_t len, const Varray<double> &v, size_t nmiss, double missval)
if (IS_EQUAL(rsum3w, 0.0) || IS_EQUAL(rsum2diff, 0.0)) return missval;
auto rkurt = ((rsum4diff / rsum3w) / std::pow(rsum2diff / rsum3w, 2)) - 3.0;
if (rkurt < 0 && rkurt > -1.e-5) rkurt = 0;
if (rkurt < 0.0 && rkurt > -1.e-5) rkurt = 0.0;
return rkurt;
}
......@@ -769,7 +769,7 @@ static void
varrayPreskewsum(size_t len, const Varray<double> &v, const double mean,
double &rsum3w, double &rsum4w, double &rsum3diff, double &rsum2diff)
{
rsum3diff = rsum2diff = 0;
rsum3diff = rsum2diff = 0.0;
for (size_t i = 0; i < len; i++)
{
const auto vdiff = v[i] - mean;
......@@ -784,7 +784,7 @@ static void
varrayPreskewsumMV(size_t len, const Varray<double> &v, double missval, const double mean,
double &rsum3w, double &rsum4w, double &rsum3diff, double &rsum2diff)
{
rsum3w = rsum4w = rsum3diff = rsum2diff = 0;
rsum3w = rsum4w = rsum3diff = rsum2diff = 0.0;
for (size_t i = 0; i < len; i++)
if (!DBL_IS_EQUAL(v[i], missval))
{
......@@ -803,7 +803,7 @@ varraySkew(size_t len, const Varray<double> &v, size_t nmiss, double missval)
double rsum4w; // 4th moment variables
double rsum3diff, rsum2diff;
double rsum, rsumw;
if (nmiss)
if (nmiss > 0)
{
varrayPrevarsum0MV(len, v, missval, rsum, rsumw);
varrayPreskewsumMV(len, v, missval, (rsum / rsumw), rsum3w, rsum4w, rsum3diff, rsum2diff);
......@@ -817,7 +817,7 @@ varraySkew(size_t len, const Varray<double> &v, size_t nmiss, double missval)
if (IS_EQUAL(rsum3w, 0.0) || IS_EQUAL(rsum3w, 1.0) || IS_EQUAL(rsum2diff, 0.0)) return missval;
auto rskew = (rsum3diff / rsum3w) / std::pow((rsum2diff) / (rsum3w - 1.0), 1.5);
if (rskew < 0 && rskew > -1.e-5) rskew = 0;
if (rskew < 0.0 && rskew > -1.e-5) rskew = 0.0;
return rskew;
}
......@@ -149,7 +149,7 @@ void remapSearchInit(RemapMethod mapType, RemapSearch &search, RemapGrid &src_gr
void remapSearchFree(RemapSearch &search);
void remapSearchPoints(RemapSearch &rsearch, const LonLatPoint &llp, knnWeightsType &knnWeights);
int remapSearchSquare(RemapSearch &rsearch, const LonLatPoint &llp, size_t *src_add, double *src_lats, double *src_lons);
int remapSearchSquare(RemapSearch &rsearch, const LonLatPoint &llp, size_t (&src_add)[4], double (&src_lats)[4], double (&src_lons)[4]);
size_t remapSearchCells(RemapSearch &rsearch, bool isReg2dCell, grid_cell &gridCell, size_t *srchAddr);
void remapBilinearWeights(RemapSearch &rsearch, RemapVars &rv);
......@@ -183,15 +183,15 @@ size_t get_srch_cells(size_t tgt_cell_addr, GridSearchBins &tgtBins, GridSearchB
int gridSearchSquareReg2dNN(size_t nx, size_t ny, size_t *nbr_add, double *nbr_dist, double plat, double plon,
const Varray<double> &src_center_lat, const Varray<double> &src_center_lon);
int gridSearchSquareReg2d(RemapGrid *src_grid, size_t *src_add, double *src_lats, double *src_lons, double plat, double plon);
int gridSearchSquareReg2d(RemapGrid *src_grid, size_t (&src_add)[4], double (&src_lats)[4], double (&src_lons)[4], double plat, double plon);
bool pointInQuad(bool isCyclic, size_t nx, size_t ny, size_t i, size_t j, size_t adds[4], double lons[4], double lats[4],
double plon, double plat, const double *centerLon, const double *centerLat);
int gridSearchSquareCurv2dScrip(RemapGrid *src_grid, size_t *src_add, double *src_lats, double *src_lons, double plat, double plon,
int gridSearchSquareCurv2dScrip(RemapGrid *src_grid, size_t (&src_add)[4], double (&src_lats)[4], double (&src_lons)[4], double plat, double plon,
GridSearchBins &srcBins);
bool remapFindWeights(const LonLatPoint &llpoint, double *src_lons, double *src_lats, double *ig, double *jg);
bool remapFindWeights(const LonLatPoint &llpoint, const double (&src_lons)[4], const double (&src_lats)[4], double *ig, double *jg);
int rect_grid_search(size_t &ii, size_t &jj, double x, double y, size_t nxm, size_t nym, const Varray<double> &xm, const Varray<double> &ym);
LonLatPoint remapgrid_get_lonlat(RemapGrid *grid, size_t cell_add);
......
......@@ -27,7 +27,7 @@
// bicubic interpolation
static void
bicubicSetWeights(double iw, double jw, double wgts[4][4])
bicubicSetWeights(double iw, double jw, double (&wgts)[4][4])
{
// clang-format off
wgts[0][0] = (1.-jw*jw*(3.-2.*jw)) * (1.-iw*iw*(3.-2.*iw));
......@@ -49,11 +49,11 @@ bicubicSetWeights(double iw, double jw, double wgts[4][4])
// clang-format on
}
unsigned num_src_points(const std::vector<uint8_t> &mask, const size_t src_add[4], double src_lats[4]);
unsigned num_src_points(const int *restrict mask, const size_t src_add[4], double src_lats[4]);
template <typename T>
int num_src_points(const std::vector<T> &mask, const size_t (&src_add)[4], double (&src_lats)[4]);
static void
renormalizeWeights(const double src_lats[4], double wgts[4][4])
renormalizeWeights(const double (&src_lats)[4], double (&wgts)[4][4])
{
double sum_wgts = 0.0; // sum of weights for normalization
for (unsigned n = 0; n < 4; ++n) sum_wgts += std::fabs(src_lats[n]);
......@@ -76,7 +76,7 @@ bicubicWarning()
}
static double
bicubicRemap(const double *restrict src_array, const double wgts[4][4], const size_t src_add[4], const RemapGradients &gradients)
bicubicRemap(const double *restrict src_array, const double (&wgts)[4][4], const size_t (&src_add)[4], const RemapGradients &gradients)
{
const auto &glat = gradients.grad_lat;
const auto &glon = gradients.grad_lon;
......@@ -107,7 +107,7 @@ remapBicubicWeights(RemapSearch &rsearch, RemapVars &rv)
if (src_grid->rank != 2) cdoAbort("Can't do bicubic interpolation when source grid rank != 2");
double start = Options::cdoVerbose ? cdo_get_wtime() : 0;
auto start = Options::cdoVerbose ? cdo_get_wtime() : 0.0;
progress::init();
......@@ -118,7 +118,7 @@ remapBicubicWeights(RemapSearch &rsearch, RemapVars &rv)
std::vector<WeightLinks4> weightLinks(tgt_grid_size);
weightLinks4Alloc(tgt_grid_size, weightLinks);
double findex = 0;
auto findex = 0.0;
// Loop over destination grid
......@@ -145,7 +145,7 @@ remapBicubicWeights(RemapSearch &rsearch, RemapVars &rv)
double wgts[4][4]; // bicubic weights for four corners
// Find nearest square of grid points on source grid
int search_result = remapSearchSquare(rsearch, llpoint, src_add, src_lats, src_lons);
auto search_result = remapSearchSquare(rsearch, llpoint, src_add, src_lats, src_lons);
// Check to see if points are mask points
if (search_result > 0)
......@@ -159,7 +159,7 @@ remapBicubicWeights(RemapSearch &rsearch, RemapVars &rv)
{
tgt_grid->cell_frac[tgt_cell_add] = 1.;
double iw, jw; // current guess for bilinear coordinate
double iw = 0.0, jw = 0.0; // current guess for bilinear coordinate
if (remapFindWeights(llpoint, src_lons, src_lats, &iw, &jw))
{
// Successfully found iw,jw - compute weights
......@@ -177,7 +177,7 @@ remapBicubicWeights(RemapSearch &rsearch, RemapVars &rv)
// (this is typically near the pole) Distance was stored in src_lats!
if (search_result < 0)
{
if (num_src_points(&src_grid->mask[0], src_add, src_lats) > 0)
if (num_src_points(src_grid->mask, src_add, src_lats) > 0)
{
tgt_grid->cell_frac[tgt_cell_add] = 1.;
renormalizeWeights(src_lats, wgts);
......@@ -211,7 +211,7 @@ remapBicubic(RemapSearch &rsearch, const double *restrict src_array, double *res
if (src_grid->rank != 2) cdoAbort("Can't do bicubic interpolation when source grid rank != 2");
double start = Options::cdoVerbose ? cdo_get_wtime() : 0;
auto start = Options::cdoVerbose ? cdo_get_wtime() : 0.0;
progress::init();
......@@ -229,7 +229,7 @@ remapBicubic(RemapSearch &rsearch, const double *restrict src_array, double *res
RemapGradients gradients(src_grid->size);
remapGradients(*src_grid, src_grid_mask, src_array, gradients);
double findex = 0;
auto findex = 0.0;
// Loop over destination grid
......@@ -257,7 +257,7 @@ remapBicubic(RemapSearch &rsearch, const double *restrict src_array, double *res
double wgts[4][4]; // bicubic weights for four corners
// Find nearest square of grid points on source grid
int search_result = remapSearchSquare(rsearch, llpoint, src_add, src_lats, src_lons);
auto search_result = remapSearchSquare(rsearch, llpoint, src_add, src_lats, src_lons);
// Check to see if points are mask points
if (search_result > 0)
......@@ -271,7 +271,7 @@ remapBicubic(RemapSearch &rsearch, const double *restrict src_array, double *res
{
tgt_grid->cell_frac[tgt_cell_add] = 1.;
double iw, jw; // current guess for bilinear coordinate
double iw = 0.0, jw = 0.0; // current guess for bilinear coordinate
if (remapFindWeights(llpoint, src_lons, src_lats, &iw, &jw))
{
// Successfully found iw,jw - compute weights
......
......@@ -33,7 +33,7 @@ limit_dphi_bounds(double &dphi)
}
bool
remapFindWeights(const LonLatPoint &llpoint, double *restrict src_lons, double *restrict src_lats, double *ig, double *jg)
remapFindWeights(const LonLatPoint &llpoint, const double (&src_lons)[4], const double (&src_lats)[4], double *ig, double *jg)
{
constexpr double converge = 1.e-10; // Convergence criterion
extern long remap_max_iter;
......@@ -60,7 +60,7 @@ remapFindWeights(const LonLatPoint &llpoint, double *restrict src_lons, double *
double iguess = 0.5;
double jguess = 0.5;
long iter; // iteration counters
long iter = 0; // iteration counters
for (iter = 0; iter < remap_max_iter; ++iter)
{
const auto dthp = llpoint.lat - src_lats[0] - dth1 * iguess - dth2 * jguess - dth3 * iguess * jguess;
......@@ -93,7 +93,7 @@ remapFindWeights(const LonLatPoint &llpoint, double *restrict src_lons, double *
}
static void
bilinearSetWeights(double iw, double jw, double wgts[4])
bilinearSetWeights(double iw, double jw, double (&wgts)[4])
{
// clang-format off
wgts[0] = (1.-iw) * (1.-jw);
......@@ -103,14 +103,15 @@ bilinearSetWeights(double iw, double jw, double wgts[4])
// clang-format on
}
unsigned
num_src_points(const std::vector<uint8_t> &mask, const size_t src_add[4], double src_lats[4])
template <typename T>
int
num_src_points(const std::vector<T> &mask, const size_t (&src_add)[4], double (&src_lats)[4])
{
unsigned icount = 0;
int icount = 0;
for (unsigned n = 0; n < 4; ++n)
for (int n = 0; n < 4; ++n)
{
if (mask[src_add[n]])
if (mask[src_add[n]] != 0)
icount++;
else
src_lats[n] = 0.;
......@@ -119,24 +120,12 @@ num_src_points(const std::vector<uint8_t> &mask, const size_t src_add[4], double
return icount;
}
unsigned
num_src_points(const int *restrict mask, const size_t src_add[4], double src_lats[4])
{
unsigned icount = 0;
for (unsigned n = 0; n < 4; ++n)
{
if (mask[src_add[n]])
icount++;
else
src_lats[n] = 0.;
}
return icount;
}
// Explicit instantiation
template int num_src_points(const std::vector<uint8_t> &mask, const size_t (&src_add)[4], double (&src_lats)[4]);
template int num_src_points(const std::vector<int> &mask, const size_t (&src_add)[4], double (&src_lats)[4]);
static void
renormalizeWeights(const double src_lats[4], double wgts[4])
renormalizeWeights(const double (&src_lats)[4], double (&wgts)[4])
{
double sum_wgts = 0.0; // sum of weights for normalization
for (unsigned n = 0; n < 4; ++n) sum_wgts += std::fabs(src_lats[n]);
......@@ -156,7 +145,7 @@ bilinearWarning()
}
static inline double
bilinearRemap(const double *restrict src_array, const double wgts[4], const size_t src_add[4])
bilinearRemap(const double *restrict src_array, const double (&wgts)[4], const size_t (&src_add)[4])
{
// *tgt_point = 0.;
// for (unsigned n = 0; n < 4; ++n) *tgt_point += src_array[src_add[n]]*wgts[n];
......@@ -175,7 +164,7 @@ remapBilinearWeights(RemapSearch &rsearch, RemapVars &rv)
if (src_grid->rank != 2) cdoAbort("Can't do bilinear interpolation when source grid rank != 2");
double start = Options::cdoVerbose ? cdo_get_wtime() : 0;
auto start = Options::cdoVerbose ? cdo_get_wtime() : 0.0;
progress::init();
......@@ -186,7 +175,7 @@ remapBilinearWeights(RemapSearch &rsearch, RemapVars &rv)
std::vector<WeightLinks> weightLinks(tgt_grid_size);
weightLinksAlloc(4, tgt_grid_size, weightLinks);
double findex = 0;
auto findex = 0.0;
// Loop over destination grid
......@@ -213,7 +202,7 @@ remapBilinearWeights(RemapSearch &rsearch, RemapVars &rv)
double wgts[4]; // bilinear weights for four corners
// Find nearest square of grid points on source grid
int search_result = remapSearchSquare(rsearch, llpoint, src_add, src_lats, src_lons);
auto search_result = remapSearchSquare(rsearch, llpoint, src_add, src_lats, src_lons);
// Check to see if points are mask points
if (search_result > 0)
......@@ -227,7 +216,7 @@ remapBilinearWeights(RemapSearch &rsearch, RemapVars &rv)
{
tgt_grid->cell_frac[tgt_cell_add] = 1.;
double iw, jw; // current guess for bilinear coordinate
double iw = 0.0, jw = 0.0; // current guess for bilinear coordinate
if (remapFindWeights(llpoint, src_lons, src_lats, &iw, &jw))
{
// Successfully found iw,jw - compute weights
......@@ -247,7 +236,7 @@ remapBilinearWeights(RemapSearch &rsearch, RemapVars &rv)
*/
if (search_result < 0)
{
if (num_src_points(&src_grid->mask[0], src_add, src_lats) > 0)
if (num_src_points(src_grid->mask, src_add, src_lats) > 0)
{
tgt_grid->cell_frac[tgt_cell_add] = 1.;
renormalizeWeights(src_lats, wgts);
......@@ -274,7 +263,7 @@ remapBilinear(RemapSearch &rsearch, const double *restrict src_array, double *re
if (src_grid->rank != 2) cdoAbort("Can't do bilinear interpolation when source grid rank != 2");
double start = Options::cdoVerbose ? cdo_get_wtime() : 0;
auto start = Options::cdoVerbose ? cdo_get_wtime() : 0.0;
progress::init();
......@@ -289,7 +278,7 @@ remapBilinear(RemapSearch &rsearch, const double *restrict src_array, double *re
// Compute mappings from source to target grid
double findex = 0;
auto findex = 0.0;
// Loop over destination grid
......@@ -317,13 +306,13 @@ remapBilinear(RemapSearch &rsearch, const double *restrict src_array, double *re
double wgts[4]; // bilinear weights for four corners
// Find nearest square of grid points on source grid
int search_result = remapSearchSquare(rsearch, llpoint, src_add, src_lats, src_lons);
auto search_result = remapSearchSquare(rsearch, llpoint, src_add, src_lats, src_lons);
// Check to see if points are mask points
if (search_result > 0)
{
for (unsigned n = 0; n < 4; ++n)
if (!src_grid_mask[src_add[n]]) search_result = 0;
if (src_grid_mask[src_add[n]] == 0) search_result = 0;
}
// If point found, find local iw,jw coordinates for weights
......@@ -331,7 +320,7 @@ remapBilinear(RemapSearch &rsearch, const double *restrict src_array, double *re
{
tgt_grid->cell_frac[tgt_cell_add] = 1.;
double iw, jw; // current guess for bilinear coordinate
double iw = 0.0, jw = 0.0; // current guess for bilinear coordinate
if (remapFindWeights(llpoint, src_lons, src_lats, &iw, &jw))
{
// Successfully found iw,jw - compute weights
......
......@@ -263,7 +263,7 @@ remapSearchPoints(RemapSearch &rsearch, const LonLatPoint &llp, knnWeightsType &
}
static int
gridSearchSquareCurv2d(GridPointSearch &gps, RemapGrid *rgrid, size_t *src_add, double *src_lats, double *src_lons,
gridSearchSquareCurv2d(GridPointSearch &gps, RemapGrid *rgrid, size_t (&src_add)[4], double (&src_lats)[4], double (&src_lons)[4],
double plat, double plon)
{
/*
......@@ -328,7 +328,7 @@ gridSearchSquareCurv2d(GridPointSearch &gps, RemapGrid *rgrid, size_t *src_add,
}
int
remapSearchSquare(RemapSearch &rsearch, const LonLatPoint &llp, size_t *src_add, double *src_lats, double *src_lons)
remapSearchSquare(RemapSearch &rsearch, const LonLatPoint &llp, size_t (&src_add)[4], double (&src_lats)[4], double (&src_lons)[4])
{
if (rsearch.srcGrid->type == RemapGridType::Reg2D)
return gridSearchSquareReg2d(rsearch.srcGrid, src_add, src_lats, src_lons, llp.lat, llp.lon);
......
......@@ -319,7 +319,7 @@ pointInQuad(bool isCyclic, size_t nx, size_t ny, size_t i, size_t j, size_t adds
}
int
gridSearchSquareCurv2dScrip(RemapGrid *src_grid, size_t *restrict src_add, double *restrict src_lats, double *restrict src_lons,
gridSearchSquareCurv2dScrip(RemapGrid *src_grid, size_t (&src_add)[4], double (&src_lats)[4], double (&src_lons)[4],
double plat, double plon, GridSearchBins &srcBins)
{
/*
......@@ -339,9 +339,9 @@ gridSearchSquareCurv2dScrip(RemapGrid *src_grid, size_t *restrict src_add, doubl
double src_center_lat[] ! latitude of each src grid center
double src_center_lon[] ! longitude of each src grid center
float src_grid_bound_box[][4] ! bound box for source grid
float src_grid_bound_box[][4] ! bound box for source grid
int src_bin_addr[][2] ! latitude bins for restricting
int src_bin_addr[][2] ! latitude bins for restricting
*/
int search_result = 0;
......
......@@ -111,7 +111,7 @@ gridSearchSquareReg2dNN(size_t nx, size_t ny, size_t *nbr_add, double *nbr_dist,
}
int
gridSearchSquareReg2d(RemapGrid *src_grid, size_t *src_add, double *src_lats, double *src_lons,
gridSearchSquareReg2d(RemapGrid *src_grid, size_t (&src_add)[4], double (&src_lats)[4], double (&src_lons)[4],
double plat, double plon)
{
/*
......
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