Commit 4af40f6a authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

adapted multiple files to progress changes

parent 367a986a
......@@ -27,6 +27,7 @@
#include "pstream_int.h"
#include "timer.h"
#include "util_files.h"
#include "progress.h"
void *
Cat(void *process)
......@@ -51,7 +52,7 @@ Cat(void *process)
int streamCnt = cdoStreamCnt();
int nfiles = streamCnt - 1;
progressInit();
Progress::init();
for (int indf = 0; indf < nfiles; ++indf)
{
......@@ -127,7 +128,7 @@ Cat(void *process)
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID1)))
{
double fstatus = (ntsteps > 1) ? indf + (tsID1 + 1.) / ntsteps : indf + 1.;
if (!Options::cdoVerbose) progressStatus(0, 1, fstatus / nfiles);
if (!Options::cdoVerbose) Progress::update(0, 1, fstatus / nfiles);
taxisCopyTimestep(taxisID2, taxisID1);
pstreamDefTimestep(streamID2, tsID2);
......
......@@ -29,6 +29,7 @@
#include "grid.h"
#include "grid_point_search.h"
#include "cdoOptions.h"
#include "progress.h"
void
fillmiss(Field *field1, Field *field2, int nfill)
......@@ -462,7 +463,7 @@ setmisstodis(Field *field1, Field *field2, int numNeighbors)
if (Options::cdoVerbose) cdoPrint("Point search created: %.2f seconds", cdo_get_wtime() - start);
progressInit();
Progress::init();
start = Options::cdoVerbose ? cdo_get_wtime() : 0;
......@@ -478,7 +479,7 @@ setmisstodis(Field *field1, Field *field2, int numNeighbors)
#pragma omp atomic
#endif
findex++;
if (cdo_omp_get_thread_num() == 0) progressStatus(0, 1, findex / nmiss);
if (cdo_omp_get_thread_num() == 0) Progress::update(0, 1, findex / nmiss);
int ompthID = cdo_omp_get_thread_num();
......@@ -495,7 +496,7 @@ setmisstodis(Field *field1, Field *field2, int numNeighbors)
}
}
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
if (Options::cdoVerbose) cdoPrint("Point search nearest: %.2f seconds", cdo_get_wtime() - start);
......
......@@ -37,6 +37,7 @@
#include "pstream_int.h"
#include "grid.h"
#include "cdoOptions.h"
#include "progress.h"
static void
genBoxGridReg2D(int gridID1, size_t xinc, size_t yinc, int gridID2)
......@@ -446,7 +447,7 @@ gridboxstat(Field *field1, Field *field2, size_t xinc, size_t yinc, int statfunc
/*
double findex = 0;
progressInit();
Progress::init();
*/
size_t gridsize = xinc * yinc;
......@@ -485,7 +486,7 @@ gridboxstat(Field *field1, Field *field2, size_t xinc, size_t yinc, int statfunc
if ( ompthID != 0 ) lprogress = 0;
#endif
findex++;
if ( lprogress ) progressStatus(0, 1, findex/nlat2*nlon2);
if ( lprogress ) Progress::update(0, 1, findex/nlat2*nlon2);
*/
size_t ilat = ig / nlon2;
size_t ilon = ig - ilat * nlon2;
......
......@@ -29,6 +29,7 @@
#include "datetime.h"
#include "sellist.h"
#include "printinfo.h"
#include "progress.h"
double datestr_to_double(const char *datestr, int opt);
......@@ -182,13 +183,13 @@ Select(void *process)
DateTimeList dtlist;
if (!Options::cdoVerbose && nfiles > 1) progressInit();
if (!Options::cdoVerbose && nfiles > 1) Progress::init();
timestep = 0;
int tsID2 = 0;
for (int indf = 0; indf < nfiles; ++indf)
{
if (!Options::cdoVerbose && nfiles > 1) progressStatus(0, 1, (indf + 1.) / nfiles);
if (!Options::cdoVerbose && nfiles > 1) Progress::update(0, 1, (indf + 1.) / nfiles);
if (Options::cdoVerbose) cdoPrint("Process file: %s", cdoGetStreamName(indf));
int streamID1 = cdoStreamOpenRead(cdoStreamName(indf));
......@@ -685,7 +686,7 @@ Select(void *process)
END_LABEL:
if (!Options::cdoVerbose && nfiles > 1) progressStatus(0, 1, 1);
if (!Options::cdoVerbose && nfiles > 1) Progress::update(0, 1, 1);
SELLIST_CHECK_FLAG(timestep_of_year);
SELLIST_CHECK_FLAG(timestep);
......
......@@ -31,6 +31,7 @@
#include "constants.h" // planet radius
#include "pmlist.h"
#include "cdoOptions.h"
#include "progress.h"
#include "grid_point_search.h"
......@@ -107,7 +108,7 @@ smooth(int gridID, double missval, const double *restrict array1, double *restri
if (Options::cdoVerbose) cdoPrint("Point search created: %.2f seconds", cdo_get_wtime() - start);
if (Options::cdoVerbose) progressInit();
if (Options::cdoVerbose) Progress::init();
start = Options::cdoVerbose ? cdo_get_wtime() : 0;
......@@ -127,7 +128,7 @@ smooth(int gridID, double missval, const double *restrict array1, double *restri
#pragma omp atomic
#endif
findex++;
if (Options::cdoVerbose && cdo_omp_get_thread_num() == 0) progressStatus(0, 1, findex / gridsize);
if (Options::cdoVerbose && cdo_omp_get_thread_num() == 0) Progress::update(0, 1, findex / gridsize);
gridSearchPoint(gps, xvals[i], yvals[i], knnWeights[ompthID]);
......@@ -147,7 +148,7 @@ smooth(int gridID, double missval, const double *restrict array1, double *restri
*nmiss = nmissx;
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
if (Options::cdoVerbose) cdoPrint("Point search nearest: %.2f seconds", cdo_get_wtime() - start);
if (Options::cdoVerbose) cdoPrint("Max points found: %zu\n", naddsMax);
......
......@@ -32,7 +32,6 @@
#include <vector>
#include <cdi.h>
#include "cdoOptions.h"
#include "grid.h"
#include "grid_proj.h"
#include "compare.h"
......
......@@ -21,6 +21,7 @@
#include "grid.h"
#include "cdoOptions.h"
#include "interpol.h"
#include "progress.h"
/**
* Find the interval i-1 .. i in which an element x fits and return i, the
......@@ -227,7 +228,7 @@ intlinarr2(double missval, int lon_is_circular, size_t nxm, size_t nym, const do
for (size_t jj = 0; jj < nym; ++jj)
for (size_t ii = 0; ii < nlon1; ++ii) grid1_mask[jj * nlon1 + ii] = !DBL_IS_EQUAL(fieldm[jj * nlon1 + ii], missval);
progressInit();
Progress::init();
#ifdef _OPENMP
#pragma omp parallel for default(none) shared(findex, field, fieldm, x, y, xm, ym, nxm, nym, gridsize2, missval, nlon1, \
......@@ -245,7 +246,7 @@ intlinarr2(double missval, int lon_is_circular, size_t nxm, size_t nym, const do
#pragma omp atomic
#endif
findex++;
if (lprogress) progressStatus(0, 1, findex / gridsize2);
if (lprogress) Progress::update(0, 1, findex / gridsize2);
size_t ii, jj;
int lfound = rect_grid_search(&ii, &jj, x[i], y[i], nxm, nym, xm, ym);
......@@ -280,7 +281,7 @@ intlinarr2(double missval, int lon_is_circular, size_t nxm, size_t nym, const do
}
}
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
}
void
......
......@@ -21,6 +21,7 @@
#include "cdoOptions.h"
#include "remap.h"
#include "remap_store_link.h"
#include "progress.h"
// bicubic interpolation
......@@ -105,7 +106,7 @@ remapBicubicWeights(RemapSearch &rsearch, RemapVars &rv)
double start = Options::cdoVerbose ? cdo_get_wtime() : 0;
progressInit();
Progress::init();
// Compute mappings from source to target grid
......@@ -127,7 +128,7 @@ remapBicubicWeights(RemapSearch &rsearch, RemapVars &rv)
#pragma omp atomic
#endif
findex++;
if (cdo_omp_get_thread_num() == 0) progressStatus(0, 1, findex / tgt_grid_size);
if (cdo_omp_get_thread_num() == 0) Progress::update(0, 1, findex / tgt_grid_size);
weightLinks[tgt_cell_add].nlinks = 0;
......@@ -185,7 +186,7 @@ remapBicubicWeights(RemapSearch &rsearch, RemapVars &rv)
}
}
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
weightLinks4ToRemapLinks(tgt_grid_size, weightLinks, rv);
......@@ -212,7 +213,7 @@ remapBicubic(RemapSearch &rsearch, const double *restrict src_array, double *res
double start = Options::cdoVerbose ? cdo_get_wtime() : 0;
progressInit();
Progress::init();
size_t tgt_grid_size = tgt_grid->size;
......@@ -235,7 +236,7 @@ remapBicubic(RemapSearch &rsearch, const double *restrict src_array, double *res
#pragma omp atomic
#endif
findex++;
if (cdo_omp_get_thread_num() == 0) progressStatus(0, 1, findex / tgt_grid_size);
if (cdo_omp_get_thread_num() == 0) Progress::update(0, 1, findex / tgt_grid_size);
tgt_array[tgt_cell_add] = missval;
......@@ -295,7 +296,7 @@ remapBicubic(RemapSearch &rsearch, const double *restrict src_array, double *res
}
}
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
if (Options::cdoVerbose) cdoPrint("Square search nearest: %.2f seconds", cdo_get_wtime() - start);
} // remapBicubic
......@@ -20,6 +20,7 @@
#include "remap.h"
#include "remap_store_link.h"
#include "cdoOptions.h"
#include "progress.h"
// bilinear interpolation
......@@ -166,7 +167,7 @@ remapBilinearWeights(RemapSearch &rsearch, RemapVars &rv)
double start = Options::cdoVerbose ? cdo_get_wtime() : 0;
progressInit();
Progress::init();
// Compute mappings from source to target grid
......@@ -188,7 +189,7 @@ remapBilinearWeights(RemapSearch &rsearch, RemapVars &rv)
#pragma omp atomic
#endif
findex++;
if (cdo_omp_get_thread_num() == 0) progressStatus(0, 1, findex / tgt_grid_size);
if (cdo_omp_get_thread_num() == 0) Progress::update(0, 1, findex / tgt_grid_size);
weightLinks[tgt_cell_add].nlinks = 0;
......@@ -246,7 +247,7 @@ remapBilinearWeights(RemapSearch &rsearch, RemapVars &rv)
}
}
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
weightLinksToRemapLinks(0, tgt_grid_size, weightLinks, rv);
......@@ -273,7 +274,7 @@ remapBilinear(RemapSearch &rsearch, const double *restrict src_array, double *re
double start = Options::cdoVerbose ? cdo_get_wtime() : 0;
progressInit();
Progress::init();
size_t tgt_grid_size = tgt_grid->size;
......@@ -293,7 +294,7 @@ remapBilinear(RemapSearch &rsearch, const double *restrict src_array, double *re
#pragma omp atomic
#endif
findex++;
if (cdo_omp_get_thread_num() == 0) progressStatus(0, 1, findex / tgt_grid_size);
if (cdo_omp_get_thread_num() == 0) Progress::update(0, 1, findex / tgt_grid_size);
tgt_array[tgt_cell_add] = missval;
......@@ -353,7 +354,7 @@ remapBilinear(RemapSearch &rsearch, const double *restrict src_array, double *re
}
}
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
if (Options::cdoVerbose) cdoPrint("Square search nearest: %.2f seconds", cdo_get_wtime() - start);
} // remapBilinear
......@@ -20,6 +20,7 @@
#include "remap.h"
#include "remap_store_link.h"
#include "cdoOptions.h"
#include "progress.h"
extern "C" {
#include "lib/yac/clipping.h"
......@@ -451,7 +452,7 @@ remapConservWeights(RemapSearch &rsearch, RemapVars &rv)
if (Options::cdoVerbose) cdoPrint("Called %s()", __func__);
progressInit();
Progress::init();
double start = Options::cdoVerbose ? cdo_get_wtime() : 0;
......@@ -543,7 +544,7 @@ remapConservWeights(RemapSearch &rsearch, RemapVars &rv)
#pragma omp atomic
#endif
findex++;
if (ompthID == 0) progressStatus(0, 1, findex / tgt_grid_size);
if (ompthID == 0) Progress::update(0, 1, findex / tgt_grid_size);
weightLinks[tgt_cell_add].nlinks = 0;
......@@ -683,7 +684,7 @@ remapConservWeights(RemapSearch &rsearch, RemapVars &rv)
// printf("area %d %g %g\n", tgt_cell_add, tgt_grid->cell_area[tgt_cell_add], tgt_area);
}
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
if (1 && Options::cdoVerbose)
{
......
......@@ -20,6 +20,7 @@
#include "remap.h"
#include "remap_store_link_cnsrv.h"
#include "cdoOptions.h"
#include "progress.h"
#define ZERO 0.0
#define ONE 1.0
......@@ -1221,7 +1222,7 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
if (Options::cdoVerbose) cdoPrint("Called %s()", __func__);
progressInit();
Progress::init();
long num_wts = rv.num_wts;
......@@ -1293,7 +1294,7 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
#pragma omp atomic
#endif
findex++;
if (ompthID == 0) progressStatus(0, 0.5, findex / src_grid_size);
if (ompthID == 0) Progress::update(0, 0.5, findex / src_grid_size);
bool lcoinc; // flag for coincident segments
bool lthresh = false;
......@@ -1489,7 +1490,7 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
#pragma omp atomic
#endif
findex++;
if (ompthID == 0) progressStatus(0.5, 0.5, findex / tgt_grid_size);
if (ompthID == 0) Progress::update(0.5, 0.5, findex / tgt_grid_size);
bool lcoinc; // flag for coincident segments
bool lthresh = false;
......@@ -1647,7 +1648,7 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
}
}
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
/* Finished with all cells: deallocate search arrays */
......
......@@ -20,6 +20,7 @@
#include "remap.h"
#include "remap_store_link.h"
#include "cdoOptions.h"
#include "progress.h"
// Interpolation using a distance-weighted average
......@@ -32,7 +33,7 @@ remapDistwgtWeights(size_t numNeighbors, RemapSearch &rsearch, RemapVars &rv)
if (Options::cdoVerbose) cdoPrint("Called %s()", __func__);
progressInit();
Progress::init();
// Compute mappings from source to target grid
......@@ -61,7 +62,7 @@ remapDistwgtWeights(size_t numNeighbors, RemapSearch &rsearch, RemapVars &rv)
#pragma omp atomic
#endif
findex++;
if (ompthID == 0) progressStatus(0, 1, findex / tgt_grid_size);
if (ompthID == 0) Progress::update(0, 1, findex / tgt_grid_size);
weightLinks[tgt_cell_add].nlinks = 0;
......@@ -83,7 +84,7 @@ remapDistwgtWeights(size_t numNeighbors, RemapSearch &rsearch, RemapVars &rv)
storeWeightLinks(0, nadds, knnWeights[ompthID].m_addr.data(), knnWeights[ompthID].m_dist.data(), tgt_cell_add, weightLinks);
}
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
if (rsearch.gps) gridPointSearchDelete(rsearch.gps);
rsearch.gps = NULL;
......@@ -104,7 +105,7 @@ remapDistwgt(size_t numNeighbors, RemapSearch &rsearch, const double *restrict s
if (Options::cdoVerbose) cdoPrint("Called %s()", __func__);
progressInit();
Progress::init();
// Compute mappings from source to target grid
......@@ -131,7 +132,7 @@ remapDistwgt(size_t numNeighbors, RemapSearch &rsearch, const double *restrict s
#pragma omp atomic
#endif
findex++;
if (ompthID == 0) progressStatus(0, 1, findex / tgt_grid_size);
if (ompthID == 0) Progress::update(0, 1, findex / tgt_grid_size);
tgt_array[tgt_cell_add] = missval;
......@@ -148,7 +149,7 @@ remapDistwgt(size_t numNeighbors, RemapSearch &rsearch, const double *restrict s
if (nadds) tgt_array[tgt_cell_add] = knnWeights[ompthID].arrayWeightsSum(src_array);
}
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
if (Options::cdoVerbose) cdoPrint("Point search nearest: %.2f seconds", cdo_get_wtime() - start);
} // remapDistwgt
......@@ -168,7 +169,7 @@ intgriddis(Field *field1, Field *field2, size_t numNeighbors)
if (Options::cdoVerbose) cdoPrint("Called %s()", __func__);
progressInit();
Progress::init();
// Interpolate from source to target grid
......@@ -203,7 +204,7 @@ intgriddis(Field *field1, Field *field2, size_t numNeighbors)
int ompthID = cdo_omp_get_thread_num();
findex++;
if (ompthID == 0) progressStatus(0, 1, findex / tgt_grid_size);
if (ompthID == 0) Progress::update(0, 1, findex / tgt_grid_size);
tgt_array[tgt_cell_add] = tgt_missval;
......@@ -223,7 +224,7 @@ intgriddis(Field *field1, Field *field2, size_t numNeighbors)
nmiss++;
}
progressStatus(0, 1, 1);
Progress::update(0, 1, 1);
field2->nmiss = nmiss;
......
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