Commit 32c4c7bc by Martin Reinecke

start working on compiler warnings

parent d3a896b0
 ... @@ -71,12 +71,12 @@ MRUTIL_NOINLINE int sharp_get_mlim (int lmax, int spin, double sth, double cth) ... @@ -71,12 +71,12 @@ MRUTIL_NOINLINE int sharp_get_mlim (int lmax, int spin, double sth, double cth) if (ofs<100.) ofs=100.; if (ofs<100.) ofs=100.; double b = -2*spin*fabs(cth); double b = -2*spin*fabs(cth); double t1 = lmax*sth+ofs; double t1 = lmax*sth+ofs; double c = (double)spin*spin-t1*t1; double c = double(spin)*spin-t1*t1; double discr = b*b-4*c; double discr = b*b-4*c; if (discr<=0) return lmax; if (discr<=0) return lmax; double res=(-b+sqrt(discr))/2.; double res=(-b+sqrt(discr))/2.; if (res>lmax) res=lmax; if (res>lmax) res=lmax; return (int)(res+0.5); return int(res+0.5); } } struct ringhelper struct ringhelper ... @@ -141,7 +141,7 @@ struct ringhelper ... @@ -141,7 +141,7 @@ struct ringhelper data[0]=phase[0].real()*wgt; data[0]=phase[0].real()*wgt; fill(data+1,data+nph+2,0.); fill(data+1,data+nph+2,0.); int idx1=1, idx2=nph-1; ptrdiff_t idx1=1, idx2=nph-1; for (int m=1; m<=mmax; ++m) for (int m=1; m<=mmax; ++m) { { dcmplx tmp = phase[m*pstride]*wgt; dcmplx tmp = phase[m*pstride]*wgt; ... @@ -203,25 +203,25 @@ struct ringhelper ... @@ -203,25 +203,25 @@ struct ringhelper } } }; }; sharp_alm_info::sharp_alm_info (int lmax, int nm, int stride, const int *mval, sharp_alm_info::sharp_alm_info (size_t lmax_, size_t nm_, ptrdiff_t stride_, const ptrdiff_t *mstart) const size_t *mval_, const ptrdiff_t *mstart) : lmax(lmax), nm(nm), mval(nm), mvstart(nm), stride(stride) : lmax(lmax_), nm(nm_), mval(nm_), mvstart(nm), stride(stride_) { { for (int mi=0; mimval[mi] = mval[mi]; mval[mi] = mval_[mi]; this->mvstart[mi] = mstart[mi]; mvstart[mi] = mstart[mi]; } } } } sharp_alm_info::sharp_alm_info (int lmax, int mmax, int stride, sharp_alm_info::sharp_alm_info (size_t lmax_, size_t mmax, ptrdiff_t stride_, const ptrdiff_t *mstart) const ptrdiff_t *mstart) : lmax(lmax), nm(mmax+1), mval(mmax+1), mvstart(mmax+1), stride(stride) : lmax(lmax_), nm(mmax+1), mval(mmax+1), mvstart(mmax+1), stride(stride_) { { for (int i=0; i<=mmax; ++i) for (size_t i=0; i<=mmax; ++i) { { mval[i]=i; mval[i]=i; this->mvstart[i] = mstart[i]; mvstart[i] = mstart[i]; } } } } ... @@ -230,17 +230,16 @@ ptrdiff_t sharp_alm_info::index (int l, int mi) ... @@ -230,17 +230,16 @@ ptrdiff_t sharp_alm_info::index (int l, int mi) return mvstart[mi]+stride*l; return mvstart[mi]+stride*l; } } sharp_geom_info::sharp_geom_info(int nrings, const int *nph, const ptrdiff_t *ofs, sharp_geom_info::sharp_geom_info(size_t nrings, const size_t *nph, const ptrdiff_t *ofs, const int *stride, const double *phi0, const double *theta, const double *wgt) const ptrdiff_t *stride, const double *phi0, const double *theta, const double *wgt) { { vector infos(nrings); vector infos(nrings); int pos=0; size_t pos=0; int npairs=0; nphmax=0; nphmax=0; for (int m=0; m &mval) static size_t sharp_get_mmax (const vector &mval) { { //FIXME: if gaps are allowed, we have to search the maximum m in the array //FIXME: if gaps are allowed, we have to search the maximum m in the array auto nm=mval.size(); auto nm=mval.size(); vector mcheck(nm,0); vector mcheck(nm,false); for (int i=0; i=0) && (m_cur0)&&(pair[j].r2.stride==1)) if ((p.r2.nph>0)&&(p.r2.stride==1)) memset(&map[pair[j].r2.ofs],0,pair[j].r2.nph*sizeof(double)); memset(&map[p.r2.ofs],0,p.r2.nph*sizeof(double)); else else for (ptrdiff_t i=0;i0)&&(pair[j].r2.stride==1)) if ((p.r2.nph>0)&&(p.r2.stride==1)) memset(&map[pair[j].r2.ofs],0,pair[j].r2.nph*sizeof(float)); memset(&map[p.r2.ofs],0,p.r2.nph*sizeof(float)); else else for (ptrdiff_t i=0;inm;++mi) for (size_t mi=0;minm;++mi) { { int m=ainfo->mval[mi]; auto m=ainfo->mval[mi]; ptrdiff_t mvstart = ainfo->mvstart[mi]; ptrdiff_t mvstart = ainfo->mvstart[mi]; ptrdiff_t stride = ainfo->stride; ptrdiff_t stride = ainfo->stride; if (flags&SHARP_DP) if (flags&SHARP_DP) for (int l=m;l<=ainfo->lmax;++l) for (size_t l=m;l<=ainfo->lmax;++l) ((dcmplx *)alm)[mvstart+l*stride]=0.; reinterpret_cast(alm)[mvstart+l*stride]=0.; else else for (int l=m;l<=ainfo->lmax;++l) for (size_t l=m;l<=ainfo->lmax;++l) ((fcmplx *)alm)[mvstart+l*stride]=0.; reinterpret_cast(alm)[mvstart+l*stride]=0.; } } } } ... @@ -356,15 +354,15 @@ MRUTIL_NOINLINE void sharp_job::init_output() ... @@ -356,15 +354,15 @@ MRUTIL_NOINLINE void sharp_job::init_output() { { if (flags&SHARP_ADD) return; if (flags&SHARP_ADD) return; if (type == SHARP_MAP2ALM) if (type == SHARP_MAP2ALM) for (int i=0; iclear_map((double *)map[i]) (flags&SHARP_DP) ? ginfo->clear_map(reinterpret_cast(map[i])) : ginfo->clear_map((float *)map[i]); : ginfo->clear_map(reinterpret_cast(map[i])); } } MRUTIL_NOINLINE void sharp_job::alloc_phase (int nm, int ntheta, vector &data) MRUTIL_NOINLINE void sharp_job::alloc_phase (size_t nm, size_t ntheta, vector &data) { { if (type==SHARP_MAP2ALM) if (type==SHARP_MAP2ALM) { { ... @@ -382,42 +380,42 @@ MRUTIL_NOINLINE void sharp_job::alloc_phase (int nm, int ntheta, vector ... @@ -382,42 +380,42 @@ MRUTIL_NOINLINE void sharp_job::alloc_phase (int nm, int ntheta, vector phase=data.data(); phase=data.data(); } } void sharp_job::alloc_almtmp (int lmax, vector &data) void sharp_job::alloc_almtmp (size_t lmax, vector &data) { { data.resize(nalm*(lmax+2)); data.resize(nalm*(lmax+2)); almtmp=data.data(); almtmp=data.data(); } } MRUTIL_NOINLINE void sharp_job::alm2almtmp (int lmax, int mi) MRUTIL_NOINLINE void sharp_job::alm2almtmp (size_t lmax, size_t mi) { { if (type!=SHARP_MAP2ALM) if (type!=SHARP_MAP2ALM) { { ptrdiff_t ofs=ainfo->mvstart[mi]; auto ofs=ainfo->mvstart[mi]; int stride=ainfo->stride; auto stride=ainfo->stride; int m=ainfo->mval[mi]; auto m=ainfo->mval[mi]; int lmin=(m(alm)[i][ofs+l*stride]; for (int i=0; i(alm)[i][ofs+l*stride]; for (int i=0; i(alm)[i][ofs+l*stride]*norm_l[l]; for (int i=0; i(alm)[i][ofs+l*stride])*norm_l[l]; for (int i=0; imval[mi], 0, for (size_t i=nalm*ainfo->mval[mi]; imval[mi])*sizeof(dcmplx)); almtmp[i]=0; } } MRUTIL_NOINLINE void sharp_job::almtmp2alm (int lmax, int mi) MRUTIL_NOINLINE void sharp_job::almtmp2alm (size_t lmax, size_t mi) { { if (type != SHARP_MAP2ALM) return; if (type != SHARP_MAP2ALM) return; ptrdiff_t ofs=ainfo->mvstart[mi]; auto ofs=ainfo->mvstart[mi]; int stride=ainfo->stride; auto stride=ainfo->stride; int m=ainfo->mval[mi]; auto m=ainfo->mval[mi]; int lmin=(m &ringtmp, int rstride) const vector &ringtmp, ptrdiff_t rstride) { { if (flags & SHARP_DP) if (flags & SHARP_DP) { { double **dmap = (double **)map; double **dmap = (double **)map; for (int i=0; i &ringtmp, int rstride) vector &ringtmp, ptrdiff_t rstride) { { if (flags & SHARP_DP) if (flags & SHARP_DP) for (int i=0; ipair[ith].r1,ringtmp,rstride); ring2ringtmp(ginfo->pair[ith].r1,ringtmp,rstride); for (int i=0; ipair[ith].r1, helper.ring2phase (ginfo->pair[ith].r1, &ringtmp[i*rstride],mmax,&phase[dim2+2*i],pstride,flags); &ringtmp[i*rstride],mmax,&phase[dim2+2*i],pstride,flags); if (ginfo->pair[ith].r2.nph>0) if (ginfo->pair[ith].r2.nph>0) { { ring2ringtmp(ginfo->pair[ith].r2,ringtmp,rstride); ring2ringtmp(ginfo->pair[ith].r2,ringtmp,rstride);