healpix_tables.cc

00001 /*
00002  *  This file is part of Healpix_cxx.
00003  *
00004  *  Healpix_cxx is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  Healpix_cxx is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with Healpix_cxx; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017  *
00018  *  For more information about HEALPix, see http://healpix.sourceforge.net
00019  */
00020 
00021 /*
00022  *  Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
00023  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
00024  *  (DLR).
00025  */
00026 
00027 /*
00028  *  Copyright (C) 2011 Max-Planck-Society
00029  *  Author: Martin Reinecke
00030  */
00031 
00032 #include "healpix_tables.h"
00033 #include "string_utils.h"
00034 
00035 using namespace std;
00036 
00037 const nside_dummy SET_NSIDE=nside_dummy();
00038 
00039 Healpix_Ordering_Scheme string2HealpixScheme (const string &inp)
00040   {
00041   string tmp=trim(inp);
00042   if (equal_nocase(tmp,"RING")) return RING;
00043   if (equal_nocase(tmp,"NESTED")) return NEST;
00044   planck_fail ("bad Healpix ordering scheme '"+tmp+
00045                "': expected 'RING' or 'NESTED'");
00046   }
00047 
00048 const uint16 Healpix_Tables::utab[] = {
00049 #define Z(a) 0x##a##0, 0x##a##1, 0x##a##4, 0x##a##5
00050 #define Y(a) Z(a##0), Z(a##1), Z(a##4), Z(a##5)
00051 #define X(a) Y(a##0), Y(a##1), Y(a##4), Y(a##5)
00052 X(0),X(1),X(4),X(5)
00053 #undef X
00054 #undef Y
00055 #undef Z
00056 };
00057 
00058 const uint16 Healpix_Tables::ctab[] = {
00059 #define Z(a) a,a+1,a+256,a+257
00060 #define Y(a) Z(a),Z(a+2),Z(a+512),Z(a+514)
00061 #define X(a) Y(a),Y(a+4),Y(a+1024),Y(a+1028)
00062 X(0),X(8),X(2048),X(2056)
00063 #undef X
00064 #undef Y
00065 #undef Z
00066 };
00067 
00068 const int Healpix_Tables::jrll[] = { 2,2,2,2,3,3,3,3,4,4,4,4 },
00069           Healpix_Tables::jpll[] = { 1,3,5,7,0,2,4,6,1,3,5,7 };
00070 
00071 const uint8 Healpix_Tables::peano_subpix[2][8][4] =
00072   { { {0,1,3,2}, {3,0,2,1}, {2,3,1,0}, {1,2,0,3},
00073       {0,3,1,2}, {1,0,2,3}, {2,1,3,0}, {3,2,0,1} },
00074     { {0,1,3,2}, {1,3,2,0}, {3,2,0,1}, {2,0,1,3},
00075       {0,2,3,1}, {1,0,2,3}, {3,1,0,2}, {2,3,1,0} } };
00076 const uint8 Healpix_Tables::peano_subpath[2][8][4] =
00077   { { {4,0,6,0}, {7,5,1,1}, {2,4,2,6}, {3,3,7,5},
00078       {0,2,4,4}, {5,1,5,3}, {6,6,0,2}, {1,7,3,7} },
00079     { {4,0,0,6}, {5,1,1,7}, {6,2,2,4}, {7,3,3,5},
00080       {0,4,4,2}, {1,5,5,3}, {2,6,6,0}, {3,7,7,1} } };
00081 const uint8 Healpix_Tables::peano_face2path[2][12] =
00082   { { 2,5,2,5,3,6,3,6,2,3,2,3 }, { 2,6,2,3,3,5,2,6,2,3,3,5 } };
00083 const uint8 Healpix_Tables::peano_face2face[2][12] =
00084   { { 0,5,6,11,10,1,4,7,2,3,8,9 }, { 0,5,8,9,6,1,2,7,10,11,4,3 } };
00085 
00086 const int Healpix_Tables::nb_xoffset[] = { -1,-1, 0, 1, 1, 1, 0,-1 },
00087           Healpix_Tables::nb_yoffset[] = {  0, 1, 1, 1, 0,-1,-1,-1 };
00088 const int Healpix_Tables::nb_facearray[][12] =
00089   { {  8, 9,10,11,-1,-1,-1,-1,10,11, 8, 9 },   // S
00090     {  5, 6, 7, 4, 8, 9,10,11, 9,10,11, 8 },   // SE
00091     { -1,-1,-1,-1, 5, 6, 7, 4,-1,-1,-1,-1 },   // E
00092     {  4, 5, 6, 7,11, 8, 9,10,11, 8, 9,10 },   // SW
00093     {  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 },   // center
00094     {  1, 2, 3, 0, 0, 1, 2, 3, 5, 6, 7, 4 },   // NE
00095     { -1,-1,-1,-1, 7, 4, 5, 6,-1,-1,-1,-1 },   // W
00096     {  3, 0, 1, 2, 3, 0, 1, 2, 4, 5, 6, 7 },   // NW
00097     {  2, 3, 0, 1,-1,-1,-1,-1, 0, 1, 2, 3 } }; // N
00098 const int Healpix_Tables::nb_swaparray[][3] =
00099   { { 0,0,3 },   // S
00100     { 0,0,6 },   // SE
00101     { 0,0,0 },   // E
00102     { 0,0,5 },   // SW
00103     { 0,0,0 },   // center
00104     { 5,0,0 },   // NE
00105     { 0,0,0 },   // W
00106     { 6,0,0 },   // NW
00107     { 3,0,0 } }; // N
00108 
00109 const int Healpix_Tables::swap_clen[] =
00110   { 0,7,5,4,12,10,13,18,14,19,18,17,27,21 };
00111 const int Healpix_Tables::swap_cycle[] =
00112   { 0,1,8,12,16,21,40,
00113     0,1,2,40,114,
00114     0,4,160,263,
00115     0,4,30,49,51,87,526,1027,1105,1387,1807,2637,
00116     0,8,10,18,39,74,146,307,452,4737,
00117     0,1,2,7,9,17,80,410,1526,1921,32859,33566,38931,
00118     0,5,6,10,12,24,27,95,372,494,924,1409,3492,4248,9137,66043,103369,156899,
00119     0,1,2,3,4,45,125,351,697,24337,102940,266194,341855,419857,
00120     0,1,2,3,9,16,1705,2082,2126,8177,12753,15410,52642,80493,83235,88387,99444,
00121       1675361,2495125,
00122     0,2,6,8,9,11,20,50,93,152,183,2137,13671,44794,486954,741908,4803258,
00123       5692573,
00124     0,1,5,6,44,53,470,2847,3433,4906,13654,14710,400447,1797382,2744492,
00125       18775974,23541521,
00126     0,4,9,10,16,33,83,117,318,451,5759,10015,128975,171834,211256,347608,
00127       1278690,2154097,2590798,3427694,5581717,21012301,27023976,72522811,
00128       95032729,139166747,171822389,
00129     0,5,10,267,344,363,2968,3159,9083,18437,76602,147614,1246902,1593138,
00130       2035574,6529391,9511830,11340287,29565945,281666026,677946848 };

Generated on Wed Apr 24 11:31:18 2013 for Healpix C++