From 6bbd0f46f5bb545c787e73670a7b35c8d8550c6f Mon Sep 17 00:00:00 2001 From: Martin Reinecke Date: Thu, 22 Nov 2012 23:02:42 +0100 Subject: [PATCH] add phi0 parameter to sharp_make_gauss_geom_info() --- libsharp/sharp.c | 2 +- libsharp/sharp_acctest.c | 4 ++-- libsharp/sharp_bench.c | 2 +- libsharp/sharp_bench2.c | 2 +- libsharp/sharp_geomhelpers.c | 12 ++++++------ libsharp/sharp_geomhelpers.h | 11 ++++++----- libsharp/sharp_scaletest.c | 2 +- libsharp/sharp_test.c | 2 +- libsharp/sharp_test_mpi.c | 2 +- 9 files changed, 20 insertions(+), 19 deletions(-) diff --git a/libsharp/sharp.c b/libsharp/sharp.c index df4c39b..8e2cf3a 100644 --- a/libsharp/sharp.c +++ b/libsharp/sharp.c @@ -648,7 +648,7 @@ static int sharp_oracle (sharp_jobtype type, int spin, int ntrans) ptrdiff_t npix=(ptrdiff_t)nrings*ppring; sharp_geom_info *tinfo; - sharp_make_gauss_geom_info (nrings, ppring, 1, ppring, &tinfo); + sharp_make_gauss_geom_info (nrings, ppring, 0., 1, ppring, &tinfo); ptrdiff_t nalms = ((mmax+1)*(mmax+2))/2 + (mmax+1)*(lmax-mmax); int ncomp = ntrans*((spin==0) ? 1 : 2); diff --git a/libsharp/sharp_acctest.c b/libsharp/sharp_acctest.c index 175487b..56ada7b 100644 --- a/libsharp/sharp_acctest.c +++ b/libsharp/sharp_acctest.c @@ -94,7 +94,7 @@ static void check_sign_scale(void) int nrings=lmax+1; int ppring=2*lmax+2; ptrdiff_t npix=(ptrdiff_t)nrings*ppring; - sharp_make_gauss_geom_info (nrings, ppring, 1, ppring, &tinfo); + sharp_make_gauss_geom_info (nrings, ppring, 0., 1, ppring, &tinfo); /* flip theta to emulate the "old" Gaussian grid geometry */ for (int i=0; inpairs; ++i) @@ -247,7 +247,7 @@ int main(void) int nrings=lmax+1; int ppring=2*lmax+2; ptrdiff_t npix=(ptrdiff_t)nrings*ppring; - sharp_make_gauss_geom_info (nrings, ppring, 1, ppring, &tinfo); + sharp_make_gauss_geom_info (nrings, ppring, 0., 1, ppring, &tinfo); for (int nv=1; nv<=6; ++nv) for (int ntrans=1; ntrans<=6; ++ntrans) { diff --git a/libsharp/sharp_bench.c b/libsharp/sharp_bench.c index 4bf4f0e..e7f8f23 100644 --- a/libsharp/sharp_bench.c +++ b/libsharp/sharp_bench.c @@ -50,7 +50,7 @@ static void bench_sht (int spin, int nv, sharp_jobtype type, int ppring=1024; ptrdiff_t npix=(ptrdiff_t)nrings*ppring; sharp_geom_info *tinfo; - sharp_make_gauss_geom_info (nrings, ppring, 1, ppring, &tinfo); + sharp_make_gauss_geom_info (nrings, ppring, 0., 1, ppring, &tinfo); ptrdiff_t nalms = ((mmax+1)*(mmax+2))/2 + (mmax+1)*(lmax-mmax); int ncomp = ntrans*((spin==0) ? 1 : 2); diff --git a/libsharp/sharp_bench2.c b/libsharp/sharp_bench2.c index 91b3fa9..e669d29 100644 --- a/libsharp/sharp_bench2.c +++ b/libsharp/sharp_bench2.c @@ -140,7 +140,7 @@ int main(int argc, char **argv) { int nrings=geom2=lmax+1; int ppring=atoi(argv[3]); - sharp_make_gauss_geom_info (nrings, ppring, 1, ppring, &tinfo); + sharp_make_gauss_geom_info (nrings, ppring, 0., 1, ppring, &tinfo); } else if (strcmp(argv[1],"ecp")==0) { diff --git a/libsharp/sharp_geomhelpers.c b/libsharp/sharp_geomhelpers.c index 7f0b8f1..14deb00 100644 --- a/libsharp/sharp_geomhelpers.c +++ b/libsharp/sharp_geomhelpers.c @@ -173,15 +173,15 @@ static void makeweights (int bw, double *weights) } } -void sharp_make_gauss_geom_info (int nrings, int nphi, int stride_lon, - int stride_lat, sharp_geom_info **geom_info) +void sharp_make_gauss_geom_info (int nrings, int nphi, double phi0, + int stride_lon, int stride_lat, sharp_geom_info **geom_info) { const double pi=3.141592653589793238462643383279502884197; double *theta=RALLOC(double,nrings); double *weight=RALLOC(double,nrings); int *nph=RALLOC(int,nrings); - double *phi0=RALLOC(double,nrings); + double *phi0_=RALLOC(double,nrings); ptrdiff_t *ofs=RALLOC(ptrdiff_t,nrings); int *stride_=RALLOC(int,nrings); @@ -190,19 +190,19 @@ void sharp_make_gauss_geom_info (int nrings, int nphi, int stride_lon, { theta[m] = acos(-theta[m]); nph[m]=nphi; - phi0[m]=0; + phi0_[m]=phi0; ofs[m]=(ptrdiff_t)m*stride_lat; stride_[m]=stride_lon; weight[m]*=2*pi/nphi; } - sharp_make_geom_info (nrings, nph, ofs, stride_, phi0, theta, NULL, weight, + sharp_make_geom_info (nrings, nph, ofs, stride_, phi0_, theta, NULL, weight, geom_info); DEALLOC(theta); DEALLOC(weight); DEALLOC(nph); - DEALLOC(phi0); + DEALLOC(phi0_); DEALLOC(ofs); DEALLOC(stride_); } diff --git a/libsharp/sharp_geomhelpers.h b/libsharp/sharp_geomhelpers.h index 7f44b16..ba534d0 100644 --- a/libsharp/sharp_geomhelpers.h +++ b/libsharp/sharp_geomhelpers.h @@ -53,12 +53,13 @@ void sharp_make_weighted_healpix_geom_info (int nside, int stride, /*! 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 0. The index difference between two adjacent pixels - in an iso-latitude ring is \a stride_lon, the index difference between the - two start pixels in consecutive iso-latitude rings is \a stride_lat. + pixel in each ring is \a phi0 (in radians). The index difference between + two adjacent pixels in an iso-latitude ring is \a stride_lon, the index + difference between the two start pixels in consecutive iso-latitude rings + is \a stride_lat. \ingroup geominfogroup */ -void sharp_make_gauss_geom_info (int nrings, int nphi, int stride_lon, - int stride_lat, sharp_geom_info **geom_info); +void sharp_make_gauss_geom_info (int nrings, int nphi, double phi0, + int stride_lon, int stride_lat, sharp_geom_info **geom_info); /*! Creates a geometry information describing an ECP map with \a nrings iso-latitude rings and \a nphi pixels per ring. The azimuth of the first diff --git a/libsharp/sharp_scaletest.c b/libsharp/sharp_scaletest.c index 1271831..0acd1f3 100644 --- a/libsharp/sharp_scaletest.c +++ b/libsharp/sharp_scaletest.c @@ -190,7 +190,7 @@ int main(int argc, char **argv) ptrdiff_t npix=0; int nrings=lmax+1; int ppring=atoi(argv[2]); - sharp_make_gauss_geom_info (nrings, ppring, 1, ppring, &tinfo); + sharp_make_gauss_geom_info (nrings, ppring, 0., 1, ppring, &tinfo); reduce_geom_info(tinfo); npix=get_npix(tinfo); diff --git a/libsharp/sharp_test.c b/libsharp/sharp_test.c index 7cf3261..61dc1de 100644 --- a/libsharp/sharp_test.c +++ b/libsharp/sharp_test.c @@ -211,7 +211,7 @@ int main(int argc, char **argv) ptrdiff_t npix=(ptrdiff_t)nrings*ppring; printf("\nTesting Gaussian grid (%d rings, %d pixels/ring, %ld pixels)\n", nrings,ppring,(long)npix); - sharp_make_gauss_geom_info (nrings, ppring, 1, ppring, &tinfo); + sharp_make_gauss_geom_info (nrings, ppring, 0., 1, ppring, &tinfo); check_accuracy(tinfo,lmax,lmax,npix,spin,ntrans,niter); sharp_destroy_geom_info(tinfo); } diff --git a/libsharp/sharp_test_mpi.c b/libsharp/sharp_test_mpi.c index 8ac3cb2..2c87fde 100644 --- a/libsharp/sharp_test_mpi.c +++ b/libsharp/sharp_test_mpi.c @@ -308,7 +308,7 @@ int main(int argc, char **argv) if (mytask==0) printf("\nTesting Gaussian grid (%d rings, %d pixels/ring, %ld pixels)\n", nrings,ppring,(long)npix); - sharp_make_gauss_geom_info (nrings, ppring, 1, ppring, &tinfo); + sharp_make_gauss_geom_info (nrings, ppring, 0., 1, ppring, &tinfo); reduce_geom_info(tinfo); npix=get_npix(tinfo); check_accuracy(tinfo,lmax,lmax,npix,spin,ntrans,niter);