00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef PLANCK_ALM_MAP_TOOLS_H
00033 #define PLANCK_ALM_MAP_TOOLS_H
00034
00035 #include <vector>
00036 #include "cxxutils.h"
00037 #include "alm.h"
00038 #include "xcomplex.h"
00039
00040
00041 class ringinfo
00042 {
00043 public:
00044 double theta, phi0, weight, cth, sth;
00045 int nph, ofs;
00046
00047 ringinfo()
00048 : nph(0) {}
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 ringinfo (double theta_, double phi0_, double weight_, int nph_, int ofs_)
00059 : theta(theta_), phi0(phi0_), weight(weight_),
00060 cth(cos(theta)), sth(sin(theta)), nph(nph_), ofs(ofs_)
00061 {}
00062 };
00063
00064
00065 class ringpair
00066 {
00067 public:
00068 ringinfo r1, r2;
00069
00070
00071
00072 ringpair (const ringinfo &info)
00073 : r1(info) {}
00074
00075
00076
00077
00078 ringpair (const ringinfo &info1,const ringinfo &info2)
00079 : r1(info1), r2(info2)
00080 {
00081 planck_assert(approx(r1.theta,pi-r2.theta,1e-10), "invalid ringpair");
00082 }
00083 };
00084
00085 void info2pair(const std::vector<ringinfo> &info, std::vector<ringpair> &pair);
00086
00087 template<typename T> void map2alm (const std::vector<ringpair> &pair,
00088 const T *map, Alm<xcomplex<T> > &alm, bool add_alm);
00089
00090 template<typename T> void map2alm_pol
00091 (const std::vector<ringpair> &pair, const T *mapT, const T *mapQ,
00092 const T *mapU, Alm<xcomplex<T> > &almT, Alm<xcomplex<T> > &almG,
00093 Alm<xcomplex<T> > &almC, bool add_alm);
00094
00095 template<typename T> void map2alm_pol
00096 (const std::vector<ringpair> &pairT, const T *mapT,
00097 const std::vector<ringpair> &pairQ, const T *mapQ,
00098 const std::vector<ringpair> &pairU, const T *mapU,
00099 Alm<xcomplex<T> > &almT, Alm<xcomplex<T> > &almG,
00100 Alm<xcomplex<T> > &almC, bool add_alm);
00101
00102 template<typename T> void alm2map (const Alm<xcomplex<T> > &alm,
00103 const std::vector<ringpair> &pair, T *map);
00104
00105 template<typename T> void alm2map_pol
00106 (const Alm<xcomplex<T> > &almT, const Alm<xcomplex<T> > &almG,
00107 const Alm<xcomplex<T> > &almC, const std::vector<ringpair> &pair,
00108 T *mapT, T *mapQ, T *mapU);
00109
00110 template<typename T> void alm2map_der1 (const Alm<xcomplex<T> > &alm,
00111 const std::vector<ringpair> &pair, T *map, T *dth, T *dph);
00112
00113 #endif