LevelS SHT library  3.50
sharp_core_inc0.c
Go to the documentation of this file.
1 /*
2  * This file is part of libsharp.
3  *
4  * libsharp 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  * libsharp 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 libsharp; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 /*
20  * libsharp is being developed at the Max-Planck-Institut fuer Astrophysik
21  * and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
22  * (DLR).
23  */
24 
25 /*! \file sharp_core_inc0.c
26  * Computational core
27  *
28  * Copyright (C) 2012-2018 Max-Planck-Society
29  * \author Martin Reinecke
30  */
31 
32 #include <complex.h>
33 #include <math.h>
34 #include <string.h>
35 #include "sharp_vecsupport.h"
36 #include "sharp_complex_hacks.h"
37 #include "sharp.h"
38 #include "sharp_core.h"
39 #include "c_utils.h"
40 
41 typedef complex double dcmplx;
42 
43 // must be in the range [0;6]
44 #define MAXJOB_SPECIAL 2
45 
46 #define XCONCATX(a,b) a##b
47 #define CONCATX(a,b) XCONCATX(a,b)
48 #define XCONCAT2(a,b) a##_##b
49 #define CONCAT2(a,b) XCONCAT2(a,b)
50 #define XCONCAT3(a,b,c) a##_##b##_##c
51 #define CONCAT3(a,b,c) XCONCAT3(a,b,c)
52 
53 #define nvec 1
54 #include "sharp_core_inchelper.c"
55 #undef nvec
56 
57 #define nvec 2
58 #include "sharp_core_inchelper.c"
59 #undef nvec
60 
61 #define nvec 3
62 #include "sharp_core_inchelper.c"
63 #undef nvec
64 
65 #define nvec 4
66 #include "sharp_core_inchelper.c"
67 #undef nvec
68 
69 #define nvec 5
70 #include "sharp_core_inchelper.c"
71 #undef nvec
72 
73 #define nvec 6
74 #include "sharp_core_inchelper.c"
75 #undef nvec
76 
77 void CONCATX(inner_loop,ARCH) (sharp_job *job, const int *ispair,const double *cth,
78  const double *sth, int llim, int ulim, sharp_Ylmgen_C *gen, int mi,
79  const int *mlim)
80  {
81  int njobs=job->ntrans, nv=job->flags&SHARP_NVMAX;
82  if (njobs<=MAXJOB_SPECIAL)
83  {
84  switch (njobs*16+nv)
85  {
86 #if ((MAXJOB_SPECIAL>=1)&&(SHARP_MAXTRANS>=1))
87  case 0x11:
88  CONCAT3(inner_loop,1,1) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
89  return;
90  case 0x12:
91  CONCAT3(inner_loop,2,1) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
92  return;
93  case 0x13:
94  CONCAT3(inner_loop,3,1) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
95  return;
96  case 0x14:
97  CONCAT3(inner_loop,4,1) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
98  return;
99  case 0x15:
100  CONCAT3(inner_loop,5,1) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
101  return;
102  case 0x16:
103  CONCAT3(inner_loop,6,1) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
104  return;
105 #endif
106 #if ((MAXJOB_SPECIAL>=2)&&(SHARP_MAXTRANS>=2))
107  case 0x21:
108  CONCAT3(inner_loop,1,2) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
109  return;
110  case 0x22:
111  CONCAT3(inner_loop,2,2) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
112  return;
113  case 0x23:
114  CONCAT3(inner_loop,3,2) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
115  return;
116  case 0x24:
117  CONCAT3(inner_loop,4,2) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
118  return;
119  case 0x25:
120  CONCAT3(inner_loop,5,2) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
121  return;
122  case 0x26:
123  CONCAT3(inner_loop,6,2) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
124  return;
125 #endif
126 #if ((MAXJOB_SPECIAL>=3)&&(SHARP_MAXTRANS>=3))
127  case 0x31:
128  CONCAT3(inner_loop,1,3) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
129  return;
130  case 0x32:
131  CONCAT3(inner_loop,2,3) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
132  return;
133  case 0x33:
134  CONCAT3(inner_loop,3,3) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
135  return;
136  case 0x34:
137  CONCAT3(inner_loop,4,3) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
138  return;
139  case 0x35:
140  CONCAT3(inner_loop,5,3) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
141  return;
142  case 0x36:
143  CONCAT3(inner_loop,6,3) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
144  return;
145 #endif
146 #if ((MAXJOB_SPECIAL>=4)&&(SHARP_MAXTRANS>=4))
147  case 0x41:
148  CONCAT3(inner_loop,1,4) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
149  return;
150  case 0x42:
151  CONCAT3(inner_loop,2,4) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
152  return;
153  case 0x43:
154  CONCAT3(inner_loop,3,4) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
155  return;
156  case 0x44:
157  CONCAT3(inner_loop,4,4) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
158  return;
159  case 0x45:
160  CONCAT3(inner_loop,5,4) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
161  return;
162  case 0x46:
163  CONCAT3(inner_loop,6,4) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
164  return;
165 #endif
166 #if ((MAXJOB_SPECIAL>=5)&&(SHARP_MAXTRANS>=5))
167  case 0x51:
168  CONCAT3(inner_loop,1,5) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
169  return;
170  case 0x52:
171  CONCAT3(inner_loop,2,5) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
172  return;
173  case 0x53:
174  CONCAT3(inner_loop,3,5) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
175  return;
176  case 0x54:
177  CONCAT3(inner_loop,4,5) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
178  return;
179  case 0x55:
180  CONCAT3(inner_loop,5,5) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
181  return;
182  case 0x56:
183  CONCAT3(inner_loop,6,5) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
184  return;
185 #endif
186 #if ((MAXJOB_SPECIAL>=6)&&(SHARP_MAXTRANS>=6))
187  case 0x61:
188  CONCAT3(inner_loop,1,6) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
189  return;
190  case 0x62:
191  CONCAT3(inner_loop,2,6) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
192  return;
193  case 0x63:
194  CONCAT3(inner_loop,3,6) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
195  return;
196  case 0x64:
197  CONCAT3(inner_loop,4,6) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
198  return;
199  case 0x65:
200  CONCAT3(inner_loop,5,6) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
201  return;
202  case 0x66:
203  CONCAT3(inner_loop,6,6) (job, ispair,cth,sth,llim,ulim,gen,mi,mlim);
204  return;
205 #endif
206  }
207  }
208 #if (SHARP_MAXTRANS>MAXJOB_SPECIAL)
209  else
210  {
211  switch (nv)
212  {
213  case 1:
214  CONCAT2(inner_loop,1)
215  (job, ispair,cth,sth,llim,ulim,gen,mi,mlim,job->ntrans);
216  return;
217  case 2:
218  CONCAT2(inner_loop,2)
219  (job, ispair,cth,sth,llim,ulim,gen,mi,mlim,job->ntrans);
220  return;
221  case 3:
222  CONCAT2(inner_loop,3)
223  (job, ispair,cth,sth,llim,ulim,gen,mi,mlim,job->ntrans);
224  return;
225  case 4:
226  CONCAT2(inner_loop,4)
227  (job, ispair,cth,sth,llim,ulim,gen,mi,mlim,job->ntrans);
228  return;
229  case 5:
230  CONCAT2(inner_loop,5)
231  (job, ispair,cth,sth,llim,ulim,gen,mi,mlim,job->ntrans);
232  return;
233  case 6:
234  CONCAT2(inner_loop,6)
235  (job, ispair,cth,sth,llim,ulim,gen,mi,mlim,job->ntrans);
236  return;
237  }
238  }
239 #endif
240  UTIL_FAIL("Incorrect vector parameters");
241  }
#define UTIL_FAIL(msg)

Generated on Mon Dec 10 2018 10:24:20 for LevelS SHT library