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-2014 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_arr2[] = {
00072         0, 35, 65, 66, 68,  5,103,  6,110,109, 15, 44, 72,  9,107, 10,
00073        31,126, 60,125, 81, 16, 82, 51,123, 88, 26, 25,119, 84, 22, 21,
00074        42, 75, 41,104, 12, 47, 77, 78, 38, 71, 37,100, 98, 97,  3, 32,
00075        53, 54,116, 87, 57, 58,120, 91, 19,114, 48,113, 93, 28, 94, 63,
00076        64,  1, 99,  2, 46, 79, 45,108,  4, 39, 69, 70,  8, 43, 73, 74,
00077        85, 20, 86, 55,115, 80, 18, 17, 89, 24, 90, 59, 61, 62,124, 95,
00078       106,105, 11, 40,102,101,  7, 36, 76, 13,111, 14, 34, 67, 33, 96,
00079       127, 92, 30, 29, 27,122, 56,121, 49, 50,112, 83, 23,118, 52,117,
00080 
00081       128,194,195,161,196,133,135,230,204,141,143,238,171,233,232,138,
00082       149,212,214,183,221,159,158,252,217,155,154,248,178,243,241,144,
00083       175,237,236,142,235,170,168,201,227,162,160,193,132,198,199,165,
00084       186,251,249,152,242,176,177,211,246,180,181,215,157,220,222,191,
00085       192,129,131,226,136,202,203,169,140,206,207,173,231,166,164,197,
00086       213,151,150,244,145,208,210,179,153,216,218,187,254,188,189,223,
00087       239,174,172,205,167,229,228,134,163,225,224,130,200,137,139,234,
00088       250,184,185,219,190,255,253,156,182,247,245,148,209,147,146,240 };
00089 const uint8 Healpix_Tables::peano_arr[] =
00090       { 16, 1,27, 2,31,20, 6, 5,10,19, 9,24,13,14,28,23,
00091          0,11,17,18,21, 4,22,15,26,25, 3, 8, 7,30,12,29,
00092         48,33,35,58,53,39,38,60,59,42,40,49,62,44,45,55,
00093         32,50,51,41,37,52,54,47,43,57,56,34,46,63,61,36 };
00094 const uint8 Healpix_Tables::peano_face2path[2][12] =
00095   { { 2,5,2,5,3,6,3,6,2,3,2,3 }, { 2,6,2,3,3,5,2,6,2,3,3,5 } };
00096 const uint8 Healpix_Tables::peano_face2face[2][12] =
00097   { { 0,5,6,11,10,1,4,7,2,3,8,9 }, { 0,5,8,9,6,1,2,7,10,11,4,3 } };
00098 
00099 const int Healpix_Tables::nb_xoffset[] = { -1,-1, 0, 1, 1, 1, 0,-1 },
00100           Healpix_Tables::nb_yoffset[] = {  0, 1, 1, 1, 0,-1,-1,-1 };
00101 const int Healpix_Tables::nb_facearray[][12] =
00102   { {  8, 9,10,11,-1,-1,-1,-1,10,11, 8, 9 },   // S
00103     {  5, 6, 7, 4, 8, 9,10,11, 9,10,11, 8 },   // SE
00104     { -1,-1,-1,-1, 5, 6, 7, 4,-1,-1,-1,-1 },   // E
00105     {  4, 5, 6, 7,11, 8, 9,10,11, 8, 9,10 },   // SW
00106     {  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 },   // center
00107     {  1, 2, 3, 0, 0, 1, 2, 3, 5, 6, 7, 4 },   // NE
00108     { -1,-1,-1,-1, 7, 4, 5, 6,-1,-1,-1,-1 },   // W
00109     {  3, 0, 1, 2, 3, 0, 1, 2, 4, 5, 6, 7 },   // NW
00110     {  2, 3, 0, 1,-1,-1,-1,-1, 0, 1, 2, 3 } }; // N
00111 const int Healpix_Tables::nb_swaparray[][3] =
00112   { { 0,0,3 },   // S
00113     { 0,0,6 },   // SE
00114     { 0,0,0 },   // E
00115     { 0,0,5 },   // SW
00116     { 0,0,0 },   // center
00117     { 5,0,0 },   // NE
00118     { 0,0,0 },   // W
00119     { 6,0,0 },   // NW
00120     { 3,0,0 } }; // N
00121 
00122 const int Healpix_Tables::swap_clen[] =
00123   { 0,7,5,4,12,10,13,18,14,19,18,17,27,21 };
00124 const int Healpix_Tables::swap_cycle[] =
00125   { 0,1,8,12,16,21,40,
00126     0,1,2,40,114,
00127     0,4,160,263,
00128     0,4,30,49,51,87,526,1027,1105,1387,1807,2637,
00129     0,8,10,18,39,74,146,307,452,4737,
00130     0,1,2,7,9,17,80,410,1526,1921,32859,33566,38931,
00131     0,5,6,10,12,24,27,95,372,494,924,1409,3492,4248,9137,66043,103369,156899,
00132     0,1,2,3,4,45,125,351,697,24337,102940,266194,341855,419857,
00133     0,1,2,3,9,16,1705,2082,2126,8177,12753,15410,52642,80493,83235,88387,99444,
00134       1675361,2495125,
00135     0,2,6,8,9,11,20,50,93,152,183,2137,13671,44794,486954,741908,4803258,
00136       5692573,
00137     0,1,5,6,44,53,470,2847,3433,4906,13654,14710,400447,1797382,2744492,
00138       18775974,23541521,
00139     0,4,9,10,16,33,83,117,318,451,5759,10015,128975,171834,211256,347608,
00140       1278690,2154097,2590798,3427694,5581717,21012301,27023976,72522811,
00141       95032729,139166747,171822389,
00142     0,5,10,267,344,363,2968,3159,9083,18437,76602,147614,1246902,1593138,
00143       2035574,6529391,9511830,11340287,29565945,281666026,677946848 };

Generated on Thu Oct 8 14:48:52 2015 for Healpix C++