Healpix C++  3.83
healpix_tables.cc
1 /*
2  * This file is part of Healpix_cxx.
3  *
4  * Healpix_cxx is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * Healpix_cxx is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Healpix_cxx; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * For more information about HEALPix, see http://healpix.sourceforge.net
19  */
20 
21 /*
22  * Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
23  * and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
24  * (DLR).
25  */
26 
27 /*
28  * Copyright (C) 2011-2014 Max-Planck-Society
29  * Author: Martin Reinecke
30  */
31 
32 #include "healpix_tables.h"
33 #include "string_utils.h"
34 
35 using namespace std;
36 
37 const nside_dummy SET_NSIDE=nside_dummy();
38 
39 Healpix_Ordering_Scheme string2HealpixScheme (const string &inp)
40  {
41  string tmp=trim(inp);
42  if (equal_nocase(tmp,"RING")) return RING;
43  if (equal_nocase(tmp,"NESTED")) return NEST;
44  planck_fail ("bad Healpix ordering scheme '"+tmp+
45  "': expected 'RING' or 'NESTED'");
46  }
47 
48 const uint16 Healpix_Tables::utab[] = {
49 #define Z(a) 0x##a##0, 0x##a##1, 0x##a##4, 0x##a##5
50 #define Y(a) Z(a##0), Z(a##1), Z(a##4), Z(a##5)
51 #define X(a) Y(a##0), Y(a##1), Y(a##4), Y(a##5)
52 X(0),X(1),X(4),X(5)
53 #undef X
54 #undef Y
55 #undef Z
56 };
57 
58 const uint16 Healpix_Tables::ctab[] = {
59 #define Z(a) a,a+1,a+256,a+257
60 #define Y(a) Z(a),Z(a+2),Z(a+512),Z(a+514)
61 #define X(a) Y(a),Y(a+4),Y(a+1024),Y(a+1028)
62 X(0),X(8),X(2048),X(2056)
63 #undef X
64 #undef Y
65 #undef Z
66 };
67 
68 const int Healpix_Tables::jrll[] = { 2,2,2,2,3,3,3,3,4,4,4,4 },
69  Healpix_Tables::jpll[] = { 1,3,5,7,0,2,4,6,1,3,5,7 };
70 
71 const uint8 Healpix_Tables::peano_arr2[] = {
72  0, 35, 65, 66, 68, 5,103, 6,110,109, 15, 44, 72, 9,107, 10,
73  31,126, 60,125, 81, 16, 82, 51,123, 88, 26, 25,119, 84, 22, 21,
74  42, 75, 41,104, 12, 47, 77, 78, 38, 71, 37,100, 98, 97, 3, 32,
75  53, 54,116, 87, 57, 58,120, 91, 19,114, 48,113, 93, 28, 94, 63,
76  64, 1, 99, 2, 46, 79, 45,108, 4, 39, 69, 70, 8, 43, 73, 74,
77  85, 20, 86, 55,115, 80, 18, 17, 89, 24, 90, 59, 61, 62,124, 95,
78  106,105, 11, 40,102,101, 7, 36, 76, 13,111, 14, 34, 67, 33, 96,
79  127, 92, 30, 29, 27,122, 56,121, 49, 50,112, 83, 23,118, 52,117,
80 
81  128,194,195,161,196,133,135,230,204,141,143,238,171,233,232,138,
82  149,212,214,183,221,159,158,252,217,155,154,248,178,243,241,144,
83  175,237,236,142,235,170,168,201,227,162,160,193,132,198,199,165,
84  186,251,249,152,242,176,177,211,246,180,181,215,157,220,222,191,
85  192,129,131,226,136,202,203,169,140,206,207,173,231,166,164,197,
86  213,151,150,244,145,208,210,179,153,216,218,187,254,188,189,223,
87  239,174,172,205,167,229,228,134,163,225,224,130,200,137,139,234,
88  250,184,185,219,190,255,253,156,182,247,245,148,209,147,146,240 };
89 const uint8 Healpix_Tables::peano_arr[] =
90  { 16, 1,27, 2,31,20, 6, 5,10,19, 9,24,13,14,28,23,
91  0,11,17,18,21, 4,22,15,26,25, 3, 8, 7,30,12,29,
92  48,33,35,58,53,39,38,60,59,42,40,49,62,44,45,55,
93  32,50,51,41,37,52,54,47,43,57,56,34,46,63,61,36 };
94 const uint8 Healpix_Tables::peano_face2path[2][12] =
95  { { 2,5,2,5,3,6,3,6,2,3,2,3 }, { 2,6,2,3,3,5,2,6,2,3,3,5 } };
96 const uint8 Healpix_Tables::peano_face2face[2][12] =
97  { { 0,5,6,11,10,1,4,7,2,3,8,9 }, { 0,5,8,9,6,1,2,7,10,11,4,3 } };
98 
99 const int Healpix_Tables::nb_xoffset[] = { -1,-1, 0, 1, 1, 1, 0,-1 },
100  Healpix_Tables::nb_yoffset[] = { 0, 1, 1, 1, 0,-1,-1,-1 };
101 const int Healpix_Tables::nb_facearray[][12] =
102  { { 8, 9,10,11,-1,-1,-1,-1,10,11, 8, 9 }, // S
103  { 5, 6, 7, 4, 8, 9,10,11, 9,10,11, 8 }, // SE
104  { -1,-1,-1,-1, 5, 6, 7, 4,-1,-1,-1,-1 }, // E
105  { 4, 5, 6, 7,11, 8, 9,10,11, 8, 9,10 }, // SW
106  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 }, // center
107  { 1, 2, 3, 0, 0, 1, 2, 3, 5, 6, 7, 4 }, // NE
108  { -1,-1,-1,-1, 7, 4, 5, 6,-1,-1,-1,-1 }, // W
109  { 3, 0, 1, 2, 3, 0, 1, 2, 4, 5, 6, 7 }, // NW
110  { 2, 3, 0, 1,-1,-1,-1,-1, 0, 1, 2, 3 } }; // N
111 const int Healpix_Tables::nb_swaparray[][3] =
112  { { 0,0,3 }, // S
113  { 0,0,6 }, // SE
114  { 0,0,0 }, // E
115  { 0,0,5 }, // SW
116  { 0,0,0 }, // center
117  { 5,0,0 }, // NE
118  { 0,0,0 }, // W
119  { 6,0,0 }, // NW
120  { 3,0,0 } }; // N
121 
122 const int Healpix_Tables::swap_clen[] =
123  { 0,7,5,4,12,10,13,18,14,19,18,17,27,21 };
124 const int Healpix_Tables::swap_cycle[] =
125  { 0,1,8,12,16,21,40,
126  0,1,2,40,114,
127  0,4,160,263,
128  0,4,30,49,51,87,526,1027,1105,1387,1807,2637,
129  0,8,10,18,39,74,146,307,452,4737,
130  0,1,2,7,9,17,80,410,1526,1921,32859,33566,38931,
131  0,5,6,10,12,24,27,95,372,494,924,1409,3492,4248,9137,66043,103369,156899,
132  0,1,2,3,4,45,125,351,697,24337,102940,266194,341855,419857,
133  0,1,2,3,9,16,1705,2082,2126,8177,12753,15410,52642,80493,83235,88387,99444,
134  1675361,2495125,
135  0,2,6,8,9,11,20,50,93,152,183,2137,13671,44794,486954,741908,4803258,
136  5692573,
137  0,1,5,6,44,53,470,2847,3433,4906,13654,14710,400447,1797382,2744492,
138  18775974,23541521,
139  0,4,9,10,16,33,83,117,318,451,5759,10015,128975,171834,211256,347608,
140  1278690,2154097,2590798,3427694,5581717,21012301,27023976,72522811,
141  95032729,139166747,171822389,
142  0,5,10,267,344,363,2968,3159,9083,18437,76602,147614,1246902,1593138,
143  2035574,6529391,9511830,11340287,29565945,281666026,677946848 };
Healpix_Ordering_Scheme

Generated on Wed Nov 13 2024 12:18:30 for Healpix C++