LevelS SHT library  3.50
sharp_ylmgen_c.h
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_ylmgen_c.h
26  * Code for efficient calculation of Y_lm(phi=0,theta)
27  *
28  * Copyright (C) 2005-2016 Max-Planck-Society
29  * \author Martin Reinecke
30  */
31 
32 #ifndef SHARP_YLMGEN_C_H
33 #define SHARP_YLMGEN_C_H
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 enum { sharp_minscale=0, sharp_limscale=1, sharp_maxscale=1 };
40 static const double sharp_fbig=0x1p+800,sharp_fsmall=0x1p-800;
41 static const double sharp_ftol=0x1p-60;
42 static const double sharp_fbighalf=0x1p+400;
43 
44 typedef struct { double f[2]; } sharp_ylmgen_dbl2;
45 typedef struct { double f[3]; } sharp_ylmgen_dbl3;
46 
47 typedef struct
48  {
49 /* for public use; immutable during lifetime */
50  int lmax, mmax, s;
51  double *cf;
52  double *powlimit;
53 
54 /* for public use; will typically change after call to Ylmgen_prepare() */
55  int m;
56 
57 /* used if s==0 */
58  double *mfac;
59  sharp_ylmgen_dbl2 *rf;
60 
61 /* used if s!=0 */
62  int sinPow, cosPow, preMinus_p, preMinus_m;
63  double *prefac;
64  int *fscale;
65  sharp_ylmgen_dbl3 *fx;
66 
67 /* internal usage only */
68 /* used if s==0 */
69  double *root, *iroot;
70 
71 /* used if s!=0 */
72  double *flm1, *flm2, *inv;
73  int mlo, mhi;
74  } sharp_Ylmgen_C;
75 
76 /*! Creates a generator which will calculate helper data for Y_lm calculation
77  up to \a l=l_max and \a m=m_max. */
78 void sharp_Ylmgen_init (sharp_Ylmgen_C *gen, int l_max, int m_max, int spin);
79 
80 /*! Deallocates a generator previously initialised by Ylmgen_init(). */
81 void sharp_Ylmgen_destroy (sharp_Ylmgen_C *gen);
82 
83 /*! Prepares the object for the calculation at \a m. */
84 void sharp_Ylmgen_prepare (sharp_Ylmgen_C *gen, int m);
85 
86 /*! Returns a pointer to an array with \a lmax+1 entries containing
87  normalisation factors that must be applied to Y_lm values computed for
88  \a spin. The array must be deallocated (using free()) by the user. */
89 double *sharp_Ylmgen_get_norm (int lmax, int spin);
90 
91 /*! Returns a pointer to an array with \a lmax+1 entries containing
92  normalisation factors that must be applied to Y_lm values computed for
93  first derivatives. The array must be deallocated (using free()) by the
94  user. */
95 double *sharp_Ylmgen_get_d1norm (int lmax);
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif
void sharp_Ylmgen_destroy(sharp_Ylmgen_C *gen)
double * sharp_Ylmgen_get_norm(int lmax, int spin)
double * sharp_Ylmgen_get_d1norm(int lmax)
void sharp_Ylmgen_prepare(sharp_Ylmgen_C *gen, int m)
void sharp_Ylmgen_init(sharp_Ylmgen_C *gen, int l_max, int m_max, int spin)

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