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

remap_store_link: cleanup

parent 0ef7dbcb
......@@ -195,6 +195,7 @@ void remap_weights_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapva
void scrip_remap_bilinear(remapgrid_t* src_grid, remapgrid_t* tgt_grid, const double* restrict src_array, double* restrict tgt_array, double missval);
void scrip_remap_bicubic(remapgrid_t *src_grid, remapgrid_t *tgt_grid, const double* restrict src_array, double* restrict tgt_array, double missval);
void remap_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, const double* restrict src_array, double* restrict tgt_array, double missval);
void resize_remap_vars(remapvars_t *rv, int increment);
......
......@@ -106,8 +106,8 @@ static
int cmpwgts(const void *s1, const void *s2)
{
int cmp = 0;
const addwgts_t *c1 = s1;
const addwgts_t *c2 = s2;
const addwgts_t* c1 = (const addwgts_t*) s1;
const addwgts_t* c2 = (const addwgts_t*) s2;
if ( c1->add < c2->add ) cmp = -1;
else if ( c1->add > c2->add ) cmp = 1;
......
......@@ -189,8 +189,8 @@ static
int cmpwgts(const void *s1, const void *s2)
{
int cmp = 0;
const addwgts_t *c1 = s1;
const addwgts_t *c2 = s2;
const addwgts_t* c1 = (const addwgts_t*) s1;
const addwgts_t* c2 = (const addwgts_t*) s2;
if ( c1->add < c2->add ) cmp = -1;
else if ( c1->add > c2->add ) cmp = 1;
......
......@@ -392,11 +392,11 @@ void remap_weights_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapva
long tgt_grid_add; /* current linear address for target grid cell */
long n, k; /* generic counters */
long nbins, num_links;
double norm_factor = 0; /* factor for normalizing wts */
long num_wts;
long max_srch_cells; /* num cells in restricted search arrays */
long num_srch_cells; /* num cells in restricted search arrays */
long srch_corners; /* num of corners of srch cells */
double norm_factor = 0; /* factor for normalizing wts */
int* srch_add; /* global address of cells in srch arrays */
int ompthID, i;
......@@ -938,3 +938,8 @@ void remap_weights_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapva
if ( cdoTimer ) timer_stop(timer_remap_con);
} /* remap_weights_conserv */
void remap_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, const double* restrict src_array, double* restrict tgt_array, double missval)
{
} /* remap_conserv */
......@@ -50,19 +50,20 @@ void grid_store_init(grid_store_t* grid_store, long gridsize)
void grid_store_delete(grid_store_t* grid_store)
{
grid_layer_t *grid_layer, *grid_layer_f;
long ilayer;
long i, j;
long iblk;
long j;
long nblocks = grid_store->nblocks;
for ( iblk = 0; iblk < grid_store->nblocks; ++iblk )
for ( long iblk = 0; iblk < nblocks; ++iblk )
{
j = 0;
grid_layer = grid_store->layers[iblk];
for ( ilayer = 0; ilayer < grid_store->nlayers[iblk]; ++ilayer )
long nlayers = grid_store->nlayers[iblk];
long blksize = grid_store->blksize[iblk];
for ( long ilayer = 0; ilayer < nlayers; ++ilayer )
{
if ( cdoVerbose )
{
for ( i = 0; i < grid_store->blksize[iblk]; ++i )
for ( long i = 0; i < blksize; ++i )
if ( grid_layer->grid2_link[i] != -1 ) j++;
}
......@@ -74,9 +75,8 @@ void grid_store_delete(grid_store_t* grid_store)
if ( cdoVerbose )
{
fprintf(stderr, "block = %ld nlayers = %d allocated = %d used = %ld\n",
iblk+1, grid_store->nlayers[iblk],
grid_store->nlayers[iblk]*grid_store->blksize[iblk], j);
fprintf(stderr, "block = %ld nlayers = %ld allocated = %ld used = %ld\n",
iblk+1, nlayers, nlayers*blksize, j);
}
}
......
......@@ -1274,8 +1274,7 @@ void remap_laf(double *restrict dst_array, double missval, long dst_size, long n
#if defined(_OPENMP)
#pragma omp parallel for default(none) \
shared(dst_size, src_cls2, src_wts2, num_links, dst_add, src_add, src_array, map_wts, \
num_wts, dst_array, max_cls) \
shared(dst_size, src_cls2, src_wts2, num_links, dst_add, src_add, src_array, map_wts, num_wts, dst_array, max_cls) \
private(i, n, k, ompthID, src_cls, src_wts, ncls, imax, wts) \
schedule(dynamic,1)
#endif
......
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