From af988856e9486fe921e7cfe9278b01141cc771a2 Mon Sep 17 00:00:00 2001 From: Martin Reinecke Date: Thu, 27 Dec 2012 14:56:17 +0100 Subject: [PATCH] simplification --- libsharp/sharp_geomhelpers.c | 11 +---------- libsharp/sharp_geomhelpers.h | 14 ++++++++------ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/libsharp/sharp_geomhelpers.c b/libsharp/sharp_geomhelpers.c index ed913ee..645592a 100644 --- a/libsharp/sharp_geomhelpers.c +++ b/libsharp/sharp_geomhelpers.c @@ -35,15 +35,6 @@ #include "c_utils.h" #include "ls_fft.h" -void sharp_make_healpix_geom_info (int nside, int stride, - sharp_geom_info **geom_info) - { - double *weight=RALLOC(double,2*nside); - SET_ARRAY(weight,0,2*nside,1); - sharp_make_weighted_healpix_geom_info (nside, stride, weight, geom_info); - DEALLOC(weight); - } - void sharp_make_weighted_healpix_geom_info (int nside, int stride, const double *weight, sharp_geom_info **geom_info) { @@ -87,7 +78,7 @@ void sharp_make_weighted_healpix_geom_info (int nside, int stride, theta[m] = pi-theta[m]; ofs[m] = (npix - nph[m])*stride - ofs[m]; } - weight_[m]=4.*pi/npix*weight[northring-1]; + weight_[m]=4.*pi/npix*((weight==NULL) ? 1. : weight[northring-1]); } sharp_make_geom_info (nrings, nph, ofs, stride_, phi0, theta, weight_, diff --git a/libsharp/sharp_geomhelpers.h b/libsharp/sharp_geomhelpers.h index 0985744..0c9e89b 100644 --- a/libsharp/sharp_geomhelpers.h +++ b/libsharp/sharp_geomhelpers.h @@ -38,19 +38,21 @@ extern "C" { #endif -/*! Creates a geometry information describing a HEALPix map with an - Nside parameter \a nside. - \ingroup geominfogroup */ -void sharp_make_healpix_geom_info (int nside, int stride, - sharp_geom_info **geom_info); - /*! Creates a geometry information describing a HEALPix map with an Nside parameter \a nside. \a weight contains the relative ring weights and must have \a 2*nside entries. + \note if \a weight is a null pointer, all weights are assumed to be 1. \ingroup geominfogroup */ void sharp_make_weighted_healpix_geom_info (int nside, int stride, const double *weight, sharp_geom_info **geom_info); +/*! Creates a geometry information describing a HEALPix map with an + Nside parameter \a nside. + \ingroup geominfogroup */ +static inline void sharp_make_healpix_geom_info (int nside, int stride, + sharp_geom_info **geom_info) + { sharp_make_weighted_healpix_geom_info (nside, stride, NULL, geom_info); } + /*! Creates a geometry information describing a Gaussian map with \a nrings iso-latitude rings and \a nphi pixels per ring. The azimuth of the first pixel in each ring is \a phi0 (in radians). The index difference between