Commit d5dbd7f8 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

remapGradients: changed type of parameter mask from bool to uint8_t (bool...

remapGradients: changed type of parameter mask from bool to uint8_t (bool cause problems with clang-10).
parent 711cc428
Pipeline #3084 passed with stages
in 14 minutes
......@@ -165,7 +165,7 @@ void remapConserv(NormOpt normOpt, RemapSearch &rsearch, const double *src_array
void remapStat(int remapOrder, RemapGrid &src_grid, RemapGrid &tgt_grid, RemapVars &rv, const Varray<double> &array1,
const Varray<double> &array2, double missval);
void remapGradients(RemapGrid &grid, const std::vector<bool> &mask, const double *array, RemapGradients &gradients);
void remapGradients(RemapGrid &grid, const std::vector<uint8_t> &mask, const double *array, RemapGradients &gradients);
void remapGradients(RemapGrid &grid, const double *array, RemapGradients &gradients);
void sort_add(size_t num_links, size_t num_wts, size_t *add1, size_t *add2, double *weights);
......
......@@ -49,7 +49,7 @@ bicubicSetWeights(double iw, double jw, double wgts[4][4])
// clang-format on
}
unsigned num_src_points(const std::vector<bool> &mask, const size_t src_add[4], double src_lats[4]);
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]);
static void
......@@ -219,12 +219,10 @@ remapBicubic(RemapSearch &rsearch, const double *restrict src_array, double *res
auto tgt_grid_size = tgt_grid->size;
auto src_grid_size = src_grid->size;
std::vector<bool> src_grid_mask(src_grid_size);
/* doesn't work with bool vector!!!
std::vector<uint8_t> src_grid_mask(src_grid_size);
#ifdef _OPENMP
#pragma omp parallel for default(none) schedule(static) shared(src_grid_size, src_array, src_grid_mask, missval)
#endif
*/
for (size_t i = 0; i < src_grid_size; ++i) src_grid_mask[i] = !DBL_IS_EQUAL(src_array[i], missval);
// Compute mappings from source to target grid
......
......@@ -104,7 +104,7 @@ bilinearSetWeights(double iw, double jw, double wgts[4])
}
unsigned
num_src_points(const std::vector<bool> &mask, const size_t src_add[4], double src_lats[4])
num_src_points(const std::vector<uint8_t> &mask, const size_t src_add[4], double src_lats[4])
{
unsigned icount = 0;
......@@ -155,7 +155,7 @@ bilinearWarning()
}
}
static double
static inline double
bilinearRemap(const double *restrict src_array, const double wgts[4], const size_t src_add[4])
{
// *tgt_point = 0.;
......@@ -281,12 +281,10 @@ remapBilinear(RemapSearch &rsearch, const double *restrict src_array, double *re
auto tgt_grid_size = tgt_grid->size;
auto src_grid_size = src_grid->size;
std::vector<bool> src_grid_mask(src_grid_size);
/* doesn't work with bool vector!!!
std::vector<uint8_t> src_grid_mask(src_grid_size);
#ifdef _OPENMP
#pragma omp parallel for default(none) schedule(static) shared(src_grid_size, src_array, src_grid_mask, missval)
#endif
*/
for (size_t i = 0; i < src_grid_size; ++i) src_grid_mask[i] = !DBL_IS_EQUAL(src_array[i], missval);
// Compute mappings from source to target grid
......
......@@ -56,10 +56,10 @@
*/
/*
2013-11-08 Uwe Schulzweida: split remapgrid class to src_grid and tgt_grid
2012-01-16 Uwe Schulzweida: alloc grid2_bound_box only for conservative
remapping 2011-01-07 Uwe Schulzweida: Changed remap weights from 2D to 1D
array 2009-05-25 Uwe Schulzweida: Changed restrict data type from double to
int 2009-01-11 Uwe Schulzweida: OpenMP parallelization
2012-01-16 Uwe Schulzweida: alloc grid2_bound_box only for conservative remapping
2011-01-07 Uwe Schulzweida: Changed remap weights from 2D to 1D array
2009-05-25 Uwe Schulzweida: Changed restrict data type from double to int
2009-01-11 Uwe Schulzweida: OpenMP parallelization
*/
#ifdef HAVE_CONFIG_H
......@@ -852,7 +852,7 @@ remapStat(int remapOrder, RemapGrid &src_grid, RemapGrid &tgt_grid, RemapVars &r
/*****************************************************************************/
void
remapGradients(RemapGrid &grid, const std::vector<bool> &mask, const double *restrict array, RemapGradients &gradients)
remapGradients(RemapGrid &grid, const std::vector<uint8_t> &mask, const double *restrict array, RemapGradients &gradients)
{
if (grid.rank != 2) cdoAbort("Internal problem (remapGradients), grid rank = %d!", grid.rank);
......@@ -1020,12 +1020,10 @@ void
remapGradients(RemapGrid &grid, const double *restrict array, RemapGradients &gradients)
{
size_t grid_size = grid.size;
std::vector<bool> mask(grid_size);
/* doesn't work with bool vector!!!
std::vector<uint8_t> mask(grid_size);
#ifdef _OPENMP
#pragma omp parallel for default(none) schedule(static) shared(grid_size, grid, mask)
#endif
*/
for (size_t i = 0; i < grid_size; ++i) mask[i] = grid.mask[i] > 0;
remapGradients(grid, mask, array, gradients);
......
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