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

cleanup defined statements

parent 27d256bc
#if defined (HAVE_CONFIG_H)
#if defined(HAVE_CONFIG_H)
# include "config.h" /* HAVE_LIBMAGICS */
#endif
......@@ -114,7 +114,7 @@ int Set_magics_param_CTABLE( char *user_name, char *param_value )
return 1;
printf("Setting the CTABLE magics params \n");
#if 0
#if defined (HAVE_LIBMAGICS)
#if defined(HAVE_LIBMAGICS)
SetMagicsParameterValue( "contour_level_list", "floatarray", param_value );
#endif
#endif
......
......@@ -56,7 +56,7 @@ static void selEndOfPeriod(field_t *periods, field_t history, field_t current, i
{
if ( current.nmiss > 0 || history.nmiss > 0 )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared)
#endif
for ( i = 0; i < len; i++ )
......@@ -80,7 +80,7 @@ static void selEndOfPeriod(field_t *periods, field_t history, field_t current, i
}
else
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared)
#endif
for ( i = 0; i < len; i++ )
......@@ -91,7 +91,7 @@ static void selEndOfPeriod(field_t *periods, field_t history, field_t current, i
{
if ( current.nmiss > 0 )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared)
#endif
for ( i = 0; i < len; i++ )
......@@ -106,7 +106,7 @@ static void selEndOfPeriod(field_t *periods, field_t history, field_t current, i
}
else
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared)
#endif
for ( i = 0; i < len; i++ )
......@@ -219,7 +219,7 @@ void *Consecstat (void *argument)
streamDefRecord(ostreamID, varID, levelID);
streamWriteRecord(ostreamID, periods[varID][levelID].ptr, periods[varID][levelID].nmiss);
}
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared) schedule(static)
for ( i = 0; i < gridInqSize(vars[varID][levelID].grid); i++ )
hist[varID][levelID].ptr[i] = vars[varID][levelID].ptr[i];
......
......@@ -66,10 +66,10 @@ void MakeGeopotHeight(double *geop, double* gt, double *gq, double *ph, int nhor
gtl = gt + nhor*(j-1);
gql = gq + nhor*(j-1);
phl = ph + nhor*(j-1);
#if defined (SX)
#if defined(SX)
#pragma vdir nodep
#endif
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for
#endif
for ( i = 0; i < nhor; i++ )
......@@ -77,10 +77,10 @@ void MakeGeopotHeight(double *geop, double* gt, double *gq, double *ph, int nhor
* log(phl[i+nhor] / phl[i]);
}
#if defined (SX)
#if defined(SX)
#pragma vdir nodep
#endif
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for
#endif
for ( i = 0; i < nhor; i++ )
......@@ -89,23 +89,23 @@ void MakeGeopotHeight(double *geop, double* gt, double *gq, double *ph, int nhor
else /* No humidity */
{
for ( j = nlev ; j > 1 ; j-- )
#if defined (SX)
#if defined(SX)
#pragma vdir nodep
#endif
for ( i = nhor * (j-1) ; i < nhor * j ; i++ )
geop[i] = geop[i+nhor] + RD * gt[i] * log(ph[i+nhor] / ph[i]);
#if defined (SX)
#if defined(SX)
#pragma vdir nodep
#endif
for ( i = 0; i < nhor; i++ )
geop[i] = geop[i+nhor] + RD * gt[i] * z2log2;
}
#if defined (SX)
#if defined(SX)
#pragma vdir nodep
#endif
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for
#endif
for ( i = 0; i < nhor * (nlev+1); i++ ) geop[i] *= zrg;
......
......@@ -21,7 +21,7 @@
Detrend detrend Detrend
*/
#if defined (_OPENMP)
#if defined(_OPENMP)
# include <omp.h>
#endif
......@@ -177,12 +177,12 @@ void *Detrend(void *argument)
nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
for ( levelID = 0; levelID < nlevel; levelID++ )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared) private(i, ompthID, tsID)
#endif
for ( i = 0; i < gridsize; i++ )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
ompthID = omp_get_thread_num();
#else
ompthID = 0;
......
......@@ -340,7 +340,7 @@ void *EOFs(void * argument)
if ( grid_space )
{
// This could be done in parallel to save lots of time
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for private(i1,i2) default(shared)
#endif
for ( i1 = 0; i1 < gridsize; i1++ )
......@@ -491,7 +491,7 @@ void *EOFs(void * argument)
cov[j1] = (double*) malloc(nts*sizeof(double));
eigv = (double *) malloc (nts*sizeof(double));
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for private(j1,j2,i,sum, df1p, df2p) default(shared) schedule(dynamic)
#endif
for ( j1 = 0; j1 < nts; j1++ )
......@@ -543,7 +543,7 @@ void *EOFs(void * argument)
}
else if ( time_space )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for private(i2,j,sum) shared(datafieldv,eigenvectors)
#endif
for ( i2 = 0; i2 < npack; i2++ )
......@@ -557,7 +557,7 @@ void *EOFs(void * argument)
// NORMALIZING
sum = 0;
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for private(i2) default(none) reduction(+:sum) \
shared(eigenvectors,weight,pack,varID,levelID,i,npack)
#endif
......@@ -578,7 +578,7 @@ void *EOFs(void * argument)
if ( sum > 0 )
{
sum = sqrt(sum);
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for private(i2) default(none) \
shared(npack,varID,levelID,i,pack,sum,eigenvectors)
#endif
......@@ -587,7 +587,7 @@ void *EOFs(void * argument)
}
else
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for private(i2) default(none) \
shared(npack,varID,levelID,i,pack,sum,eigenvectors,missval)
#endif
......
......@@ -15,7 +15,7 @@
GNU General Public License for more details.
*/
#if defined (HAVE_CONFIG_H)
#if defined(HAVE_CONFIG_H)
# include "config.h"
#endif
......@@ -27,7 +27,7 @@
#include "pstream.h"
#if defined (HAVE_LIBNETCDF)
#if defined(HAVE_LIBNETCDF)
# include "netcdf.h"
#endif
......@@ -99,7 +99,7 @@ void inivars_ml(VAR **vars)
inivar(&(*vars)[4], GRID_SPECTRAL, ZAXIS_SURFACE, 152, "LSP", "log surface pressure", "");
}
#if defined (HAVE_LIBNETCDF)
#if defined(HAVE_LIBNETCDF)
static
void nce(int istat)
{
......@@ -115,7 +115,7 @@ static
int import_e5ml(const char *filename, VAR **vars)
{
int nvars = 0;
#if defined (HAVE_LIBNETCDF)
#if defined(HAVE_LIBNETCDF)
int nc_dim_id, nc_var_id;
size_t dimlen, nvals;
size_t start[3];
......@@ -275,7 +275,7 @@ int import_e5ml(const char *filename, VAR **vars)
static
void export_e5ml(const char *filename, VAR *vars, int nvars, int vdate, int vtime, int ntr)
{
#if defined (HAVE_LIBNETCDF)
#if defined(HAVE_LIBNETCDF)
int nc_var_id;
size_t nvals;
size_t start[3], count[3];
......@@ -360,7 +360,7 @@ void export_e5ml(const char *filename, VAR *vars, int nvars, int vdate, int vtim
if ( data_size*8 > 2147000000 )
{
#if defined (NC_64BIT_OFFSET)
#if defined(NC_64BIT_OFFSET)
writemode = NC_CLOBBER | NC_64BIT_OFFSET;
#else
cdoWarning("Datasize > 2GB and NC_64BIT_OFFSET not available!");
......@@ -606,7 +606,7 @@ void export_e5ml(const char *filename, VAR *vars, int nvars, int vdate, int vtim
#endif
}
#if defined (HAVE_LIBNETCDF)
#if defined(HAVE_LIBNETCDF)
static
void read_gg3d(int nc_file_id, const char *name, VAR *var, int gridID, int zaxisID)
{
......@@ -644,7 +644,7 @@ void read_gg3d(int nc_file_id, const char *name, VAR *var, int gridID, int zaxis
}
#endif
#if defined (HAVE_LIBNETCDF)
#if defined(HAVE_LIBNETCDF)
static
void read_fc4d(int nc_file_id, const char *name, VAR *var, int gridID, int zaxisID, int nhgl, int nmp1)
{
......@@ -685,7 +685,7 @@ static
int import_e5res(const char *filename, VAR **vars, ATTS *atts)
{
int nvars = 0;
#if defined (HAVE_LIBNETCDF)
#if defined(HAVE_LIBNETCDF)
int nc_var_id;
int varid;
size_t nvals;
......@@ -1078,7 +1078,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
static
void export_e5res(const char *filename, VAR *vars, int nvars)
{
#if defined (HAVE_LIBNETCDF)
#if defined(HAVE_LIBNETCDF)
int nc_var_id;
int varid;
size_t nvals;
......
......@@ -30,7 +30,7 @@
Ensstat enspctl Ensemble percentiles
*/
#if defined (_OPENMP)
#if defined(_OPENMP)
# include <omp.h>
#endif
......@@ -178,7 +178,7 @@ void *Ensstat(void *argument)
for ( recID = 0; recID < nrecs0; recID++ )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared) private(fileID, streamID, nmiss) \
lastprivate(varID, levelID)
#endif
......@@ -194,12 +194,12 @@ void *Ensstat(void *argument)
missval = vlistInqVarMissval(vlistID1, varID);
nmiss = 0;
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared) private(i, ompthID, fileID)
#endif
for ( i = 0; i < gridsize; i++ )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
ompthID = omp_get_thread_num();
#else
ompthID = 0;
......@@ -220,7 +220,7 @@ void *Ensstat(void *argument)
if ( DBL_IS_EQUAL(array2[i], field[ompthID].missval) )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp atomic
#endif
nmiss++;
......
......@@ -22,7 +22,7 @@
Ensstat3 ensroccurve Ensamble Receiver Operating Characteristics
*/
#if defined (_OPENMP)
#if defined(_OPENMP)
# include <omp.h>
#endif
......@@ -128,7 +128,7 @@ void *Ensstat3(void *argument)
/* ("first touch strategy") */
/* --> #pragma omp parallel for ... */
/* *************************************************** */
#if defined (_OPENMP)
#if defined(_OPENMP)
field = (field_t *) malloc(omp_get_max_threads()*sizeof(field_t));
for ( i = 0; i < omp_get_max_threads(); i++ )
#else
......@@ -279,7 +279,7 @@ void *Ensstat3(void *argument)
for ( recID = 0; recID < nrecs0; recID++ )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared) private(fileID, streamID, nmiss) \
lastprivate(varID, levelID)
#endif
......@@ -299,12 +299,12 @@ void *Ensstat3(void *argument)
for ( binID=0;binID<nfiles;binID++ )
array2[binID][0] = 0;
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared) private(i, binID, ompthID, fileID)
#endif
for ( i = 0; i < gridsize; i++ )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
ompthID = omp_get_thread_num();
#else
ompthID = 0;
......@@ -334,7 +334,7 @@ void *Ensstat3(void *argument)
/* ************** */
// for ( j=0; j<nfiles; j++ )
// fprintf(stderr,"%5.2g ",field[ompthID].ptr[j]);
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp critical
#endif
binID = (int) fldfun(field[ompthID], operfunc);
......
......@@ -28,7 +28,7 @@
* number of contributing values during summation.
*/
#if defined (_OPENMP)
#if defined(_OPENMP)
#include <omp.h>
#endif
......@@ -128,7 +128,7 @@ void *EOF3d(void * argument)
if ( cdoVerbose )
cdoPrint("Set eigen_mode to %s\n",eigen_mode == JACOBI? "jacobi" : "danielson_lanczos");
#if defined (_OPENMP)
#if defined(_OPENMP)
if ( omp_get_max_threads() > 1 && eigen_mode == DANIELSON_LANCZOS ) {
cdoWarning("Requested parallel computation with %i Threads ",omp_get_max_threads());
cdoWarning(" but environmental setting CDO_SVD_MODE causes sequential ");
......@@ -407,7 +407,7 @@ void *EOF3d(void * argument)
}
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for private(j1,j2,sum,df1p,df2p) default(shared) schedule(static,2000)
#endif
for ( j1 = 0; j1 < nts; j1++)
......@@ -449,7 +449,7 @@ void *EOF3d(void * argument)
for ( eofID = 0; eofID < n_eig; eofID++ )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for private(i,j,sum) shared(datafields, eigenvectors)
#endif
for ( i = 0; i < npack; i++ )
......@@ -462,7 +462,7 @@ void *EOF3d(void * argument)
// NORMALIZING
sum = 0;
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for private(i) default(none) reduction(+:sum) \
shared(eigenvectors,weight,pack,varID,eofID,npack,gridsize)
#endif
......@@ -473,7 +473,7 @@ void *EOF3d(void * argument)
if ( sum > 0 ) {
sum = sqrt(sum);
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for private(i) default(none) \
shared(sum,npack,eigenvectors,varID,eofID,pack)
#endif
......@@ -481,7 +481,7 @@ void *EOF3d(void * argument)
eigenvectors[varID][eofID].ptr[pack[i]] /= sum;
}
else
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for private(i) default(none) \
shared(eigenvectors,varID,eofID,pack,missval,npack)
#endif
......
......@@ -23,11 +23,11 @@
Filter bandpass
*/
#if defined (HAVE_CONFIG_H)
#if defined(HAVE_CONFIG_H)
# include "config.h"
#endif
#if defined ( HAVE_LIBFFTW3 )
#if defined( HAVE_LIBFFTW3 )
#include <fftw3.h>
#endif
......@@ -137,7 +137,7 @@ void create_fmasc(int nts, double fdata, double fmin, double fmax, int *fmasc)
}
#if defined ( HAVE_LIBFFTW3 )
#if defined( HAVE_LIBFFTW3 )
static
void filter_fftw(int nts, const int *fmasc,
fftw_complex *fft_in, fftw_complex *fft_out, fftw_plan *p_T2S, fftw_plan *p_S2T)
......@@ -203,7 +203,7 @@ void *Filter(void *argument)
field_t ***vars = NULL;
double fmin = 0, fmax = 0;
int *fmasc;
#if defined ( HAVE_LIBFFTW3 )
#if defined( HAVE_LIBFFTW3 )
fftw_plan p_T2S, p_S2T;
fftw_complex *out_fft;
fftw_complex *in_fft;
......@@ -309,7 +309,7 @@ void *Filter(void *argument)
nts = tsID;
/* round up nts to next power of two for (better) performance
** of fast fourier transformation */
#if defined ( HAVE_LIBFFTW3 )
#if defined( HAVE_LIBFFTW3 )
nts2 = nts;
out_fft = (fftw_complex *) malloc ( nts * sizeof(fftw_complex) );
......@@ -369,13 +369,13 @@ void *Filter(void *argument)
gridsize = gridInqSize(gridID);
nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
#if defined ( HAVE_LIBFFTW3 )
#if defined( HAVE_LIBFFTW3 )
fprintf(stderr," using fftw lib\n");
#endif
for ( levelID = 0; levelID < nlevel; levelID++ )
{
#if defined ( HAVE_LIBFFTW3 )
#if defined( HAVE_LIBFFTW3 )
for ( i = 0; i < gridsize-1; i++ )
{
for ( tsID = 0; tsID < nts; tsID++ )
......
......@@ -15,7 +15,7 @@
GNU General Public License for more details.
*/
#if defined (_OPENMP)
#if defined(_OPENMP)
# include <omp.h>
#endif
......@@ -130,13 +130,13 @@ void *Fourier(void *argument)
nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
for ( levelID = 0; levelID < nlevel; levelID++ )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared) private(i, ompthID, tsID)
#endif
for ( i = 0; i < gridsize; i++ )
{
int lmiss = 0;
#if defined (_OPENMP)
#if defined(_OPENMP)
ompthID = omp_get_thread_num();
#else
ompthID = 0;
......
......@@ -413,7 +413,7 @@ void *Gather(void *argument)
missval = vlistInqVarMissval(vlistID1, varID);
for ( i = 0; i < gridsize2; i++ ) array2[i] = missval;
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared) private(fileID, streamID, nmiss, i)
#endif
for ( fileID = 0; fileID < nfiles; fileID++ )
......
......@@ -23,7 +23,7 @@
*/
#if defined (HAVE_CONFIG_H)
#if defined(HAVE_CONFIG_H)
# include "config.h" /* VERSION */
#endif
......@@ -1051,7 +1051,7 @@ void *Gradsdes(void *argument)
gdp = fopen(ctlfile, "w");
if ( gdp == NULL ) cdoAbort("Open failed on %s", ctlfile);
#if defined (VERSION)
#if defined(VERSION)
fprintf(gdp, "* Generated by CDO version %s\n", VERSION);
fprintf(gdp, "*\n");
#endif
......
......@@ -27,7 +27,7 @@
Gridboxstat gridboxvar Gridbox variance
*/
#if defined (_OPENMP)
#if defined(_OPENMP)
# include <omp.h>
#endif
......@@ -566,12 +566,12 @@ void gridboxstat(field_t *field1, field_t *field2, int xinc, int yinc, int statf
nlat2 = gridInqYsize(gridID2);
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for default(shared) private(ig, ilat, ilon, j, jj, i, ii, index, isize, ompthID)
#endif
for ( ig = 0; ig < nlat2*nlon2; ++ig )
{
#if defined (_OPENMP)
#if defined(_OPENMP)
ompthID = omp_get_thread_num();
#else
ompthID = 0;
......
......@@ -15,7 +15,7 @@
GNU General Public License for more details.
*/
#if defined (HAVE_CONFIG_H)
#if defined(HAVE_CONFIG_H)
# include "config.h"
#endif
......
......@@ -15,13 +15,13 @@
GNU General Public License for more details.
*/
#if defined (HAVE_CONFIG_H)
#if defined(HAVE_CONFIG_H)
# include "config.h"
#endif
#define H5_USE_16_API
#if defined (HAVE_LIBHDF5)
#if defined(HAVE_LIBHDF5)
# include "hdf5.h"
#endif
......@@ -70,7 +70,7 @@ datasets_t;
#define NINT(x) ((x) < 0 ? (int)((x)-0.5) : (int)((x)+0.5))
#if defined (HAVE_LIBHDF5)
#if defined(HAVE_LIBHDF5)
static
void print_filter(hid_t dset_id, char *varname)
{
......@@ -1407,7 +1407,7 @@ void dsets_init(datasets_t *dsets)
void *Importcmsaf(void *argument)
{
#if defined (HAVE_LIBHDF5)
#if defined(HAVE_LIBHDF5)
int streamID;
int gridID = -1, zaxisID, taxisID, vlistID;
int i, offset;
......@@ -1429,7 +1429,7 @@ void *Importcmsaf(void *argument)
if ( cdoDefaultFileType == CDI_UNDEFID )
cdoDefaultFileType = FILETYPE_NC;
#if defined (HAVE_LIBHDF5)
#if defined(HAVE_LIBHDF5)
dsets_init(&dsets);
/* Open an existing file. */
......
......@@ -54,7 +54,7 @@ void interp_lev(int gridsize, double missval, double *vardata1, double *vardata2
var1L1 = vardata1+gridsize*idx1;
var1L2 = vardata1+gridsize*idx2;
#if defined (_OPENMP)
#if defined(_OPENMP)
#pragma omp parallel for shared(gridsize, var2, var1L1, var1L2, wgt1, wgt2, missval) private(i, w1, w2)
#endif
for ( i = 0; i < gridsize; ++i )
......
#if defined (HAVE_CONFIG_H)
#if defined(HAVE_CONFIG_H)
# include "config.h" /* HAVE_LIBMAGICS */
#endif
......@@ -10,12 +10,12 @@
#include "grid.h"
#include "pstream.h"
#if defined (HAVE_LIBMAGICS)
#if defined(HAVE_LIBMAGICS)
#include "magics_api.h"
#endif
#if defined (HAVE_LIBXML2)
#if defined(HAVE_LIBXML2)
#include<libxml/parser.h>
#include<libxml/tree.h>
......@@ -489,7 +489,7 @@ void maggraph(const char *plotfile, const char *varname,const char *varunits, lo
3. Set the attributes for the magics data and plot
*/
#if defined (HAVE_LIBMAGICS)
#if defined(HAVE_LIBMAGICS)
/* magics_template_parser( magics_node ); */
......@@ -755,7 +755,7 @@ int compareDateOrTimeStr( char *datetimestr1, char *datetimestr2, char *sep_char
}
#if defined (HAVE_LIBMAGICS)