Commit 62162edd authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

store_link_conserv: cleanup

parent b451c2cf
......@@ -60,14 +60,17 @@ case "${HOSTNAME}" in
fi
;;
hama*)
# CDOLIBS="--with-fftw3 \
# --with-jasper=/opt/local \
# --with-grib_api=$HOME/local/gribapi-1.13.0 \
# --with-netcdf=/opt/local \
# --with-hdf5=/opt/local \
# --with-szlib=$HOME/local \
# --with-proj=/opt/local \
# --with-curl=/opt/local"
CDOLIBS="--with-fftw3 \
--with-jasper=/opt/local \
--with-grib_api=$HOME/local/gribapi-1.13.0 \
--with-netcdf=/opt/local \
--with-hdf5=/opt/local \
--with-szlib=$HOME/local \
--with-proj=/opt/local \
--with-curl=/opt/local"
--with-netcdf=$HOME/local \
--with-hdf5=$HOME/local"
if test "$COMP" = icc ; then
${CONFPATH}configure --prefix=$HOME/local \
......@@ -81,7 +84,7 @@ case "${HOSTNAME}" in
${CONFPATH}configure --prefix=$HOME/local \
--enable-maintainer-mode \
$CDOLIBS \
CC=gcc CFLAGS="-g -pipe -Wall -W -Wfloat-equal -pedantic -O3 -march=native -fstack-protector"
CC=gcc CFLAGS="-g -pipe -Wall -W -Wfloat-equal -pedantic -O3 -fstack-protector"
# --with-libxml2=/usr \
# --with-magics=/Users/m214003/local/Magics-2.18.14nio \
fi
......
......@@ -22,20 +22,18 @@ void store_link_bilin(remapvars_t *rv, int dst_add, int src_add[4], double weigh
int src_add[4] ! addresses on source grid
double weights[4] ! array of remapping weights for these links
*/
long n;
long nlink;
/* link index */
long nlink = rv->num_links;
/*
Increment number of links and check to see if remap arrays need
to be increased to accomodate the new link. Then store the link.
*/
nlink = rv->num_links;
rv->num_links += 4;
if ( rv->num_links >= rv->max_links )
resize_remap_vars(rv, rv->resize_increment);
for ( n = 0; n < 4; ++n )
for ( long n = 0; n < 4; ++n )
{
rv->src_grid_add[nlink+n] = src_add[n];
rv->tgt_grid_add[nlink+n] = dst_add;
......
......@@ -11,30 +11,16 @@
address and weight arrays and resizes those arrays if necessary.
*/
static
void store_link_conserv(remapvars_t* rv, long add1, long add2, long num_wts, double* weights)
void store_link_conserv(remapvars_t* rv, long add1, long add2, double weight)
{
/*
Input variables:
int add1 ! address on source grid
int add2 ! address on target grid
double weights[] ! array of remapping weights for this link
double weight ! remapping weight for this link
*/
/* Local variables */
long nlink; /* link index */
long i;
/* If all weights are ZERO, do not bother storing the link */
if ( num_wts == 3 )
{
if ( IS_EQUAL(weights[0], 0) && IS_EQUAL(weights[1], 0) && IS_EQUAL(weights[2], 0) ) return;
}
else
{
if ( IS_EQUAL(weights[0], 0) ) return;
}
nlink = rv->num_links;
/* link index */
long nlink = rv->num_links;
rv->num_links++;
if ( rv->num_links >= rv->max_links )
......@@ -42,8 +28,7 @@ void store_link_conserv(remapvars_t* rv, long add1, long add2, long num_wts, dou
rv->src_grid_add[nlink] = add1;
rv->tgt_grid_add[nlink] = add2;
for ( i = 0; i < num_wts; ++i ) rv->wts[num_wts*nlink+i] = weights[i];
rv->wts[nlink] = weight;
} /* store_link_conserv */
......@@ -1107,13 +1092,15 @@ void remap_weights_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapva
for ( n = 0; n < num_weights; ++n )
{
double partial_weight = partial_weights[n];
src_grid_add = srch_add[n];
if ( 0 && cdoVerbose )
printf("tgt_grid_add %ld, src_grid_add %ld, partial_weights[n] %g, tgt_area %g\n", tgt_grid_add, src_grid_add, partial_weights[n], tgt_area);
// src_grid_add = n;
if ( partial_weights[n] <= 0. ) src_grid_add = -1;
if ( partial_weight <= 0. ) src_grid_add = -1;
/*
Store the appropriate addresses and weights.
......@@ -1128,16 +1115,19 @@ void remap_weights_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapva
#pragma omp critical
#endif
{
store_link_conserv(rv, src_grid_add, tgt_grid_add, num_wts, &partial_weights[n]);
src_grid->cell_frac[src_grid_add] += partial_weights[n];
store_link_conserv(rv, src_grid_add, tgt_grid_add, partial_weight);
}
tgt_grid->cell_frac[tgt_grid_add] += partial_weights[n];
#if defined(_OPENMP)
#pragma omp atomic
#endif
src_grid->cell_frac[src_grid_add] += partial_weight;
tgt_grid->cell_frac[tgt_grid_add] += partial_weight;
}
#if defined(_OPENMP)
#pragma omp atomic
#endif
src_grid->cell_area[src_grid_add] += partial_weights[n];
src_grid->cell_area[src_grid_add] += partial_weight;
}
}
......
......@@ -33,6 +33,14 @@ done
# 4024MB 5836MB 1240MB
####################################################
#
# CDO 1.6.8
#
# result on hama2: gcc 4.9.2
# =================
# bil bic nn con ycon
# reg2d 0.5 1.2 0.7 152 112
# curv 27 27 70 152 197
#
# CDO 1.6.4
#
# result on hama: gcc 4.9.1
......
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