From 1c5c9eb5790e6221d6b3fef315d254febd80ef08 Mon Sep 17 00:00:00 2001 From: Martin Reinecke Date: Fri, 26 Oct 2018 16:06:30 +0200 Subject: [PATCH] updates --- c_utils/walltime_c.c | 15 ++++++++++++++- libsharp/sharp_cxx.h | 6 +++--- libsharp/sharp_geomhelpers.c | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/c_utils/walltime_c.c b/c_utils/walltime_c.c index c9dce3a..8f4ac0c 100644 --- a/c_utils/walltime_c.c +++ b/c_utils/walltime_c.c @@ -25,7 +25,7 @@ /* * Functionality for reading wall clock time * - * Copyright (C) 2010, 2011 Max-Planck-Society + * Copyright (C) 2010-2016 Max-Planck-Society * Author: Martin Reinecke */ @@ -33,6 +33,8 @@ #include #elif defined (USE_MPI) #include "mpi.h" +#elif defined (_WIN32) +#include #else #include #include @@ -46,6 +48,17 @@ double wallTime(void) return omp_get_wtime(); #elif defined (USE_MPI) return MPI_Wtime(); +#elif defined (_WIN32) + static double inv_freq = -1.; + if (inv_freq<0) + { + LARGE_INTEGER freq; + QueryPerformanceFrequency(&freq); + inv_freq = 1. / double(freq.QuadPart); + } + LARGE_INTEGER count; + QueryPerformanceCounter(&count); + return count.QuadPart*inv_freq; #else struct timeval t; gettimeofday(&t, NULL); diff --git a/libsharp/sharp_cxx.h b/libsharp/sharp_cxx.h index 2c37505..f0c2738 100644 --- a/libsharp/sharp_cxx.h +++ b/libsharp/sharp_cxx.h @@ -25,7 +25,7 @@ /*! \file sharp_cxx.h * Spherical transform library * - * Copyright (C) 2012-2016 Max-Planck-Society + * Copyright (C) 2012-2017 Max-Planck-Society * \author Martin Reinecke */ @@ -48,8 +48,8 @@ class sharp_base : ainfo(0), ginfo(0) {} ~sharp_base() { - sharp_destroy_geom_info(ginfo); - sharp_destroy_alm_info(ainfo); + if (ginfo) sharp_destroy_geom_info(ginfo); + if (ainfo) sharp_destroy_alm_info(ainfo); } void set_general_geometry (int nrings, const int *nph, const ptrdiff_t *ofs, diff --git a/libsharp/sharp_geomhelpers.c b/libsharp/sharp_geomhelpers.c index 8efb8a0..0f6af39 100644 --- a/libsharp/sharp_geomhelpers.c +++ b/libsharp/sharp_geomhelpers.c @@ -25,7 +25,7 @@ /*! \file sharp_geomhelpers.c * Spherical transform library * - * Copyright (C) 2006-2018 Max-Planck-Society
+ * Copyright (C) 2006-2018 Max-Planck-Society * \author Martin Reinecke */