LORENE
citleg.C
1 /*
2  * Copyright (c) 1999-2001 Eric Gourgoulhon
3  *
4  * This file is part of LORENE.
5  *
6  * LORENE is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * LORENE is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with LORENE; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 
23 
24 
25 /*
26  * Transformation inverse fonctions de Legendre associees sur le deuxieme indice
27  * (theta) d'un tableau 3-D representant une fonction sans symetrie.
28  *
29  * Entree:
30  * -------
31  * int* deg : tableau du nombre effectif de degres de liberte dans chacune
32  * des 3 dimensions: le nombre de points de collocation
33  * en theta est nt = deg[1] et doit etre de la forme
34  * nt = 2^p 3^q 5^r + 1
35  * int* dimc : tableau du nombre d'elements de cc dans chacune des trois
36  * dimensions.
37  * On doit avoir dimc[1] >= deg[1] = nt.
38  *
39  * double* cf : tableau des coefficients a_l du develop. en fonctions de
40  * Legendre associees P_n^m:
41  *
42  * pour m pair: f(theta) =
43  * som_{l=m}^{nt-1} a_l P_{l}^m( cos(theta) )
44  *
45  * pour m impair: f(theta) =
46  * som_{l=m}^{nt-1} a_l P_{l}^m( cos(theta) )
47  *
48  * ou P_n^m(x) represente la fonction de Legendre associee
49  * de degre n et d'ordre m normalisee de facon a ce que
50  *
51  * int_0^pi [ P_n^m(cos(theta)) ]^2 sin(theta) dtheta = 1
52  *
53  * L'espace memoire correspondant au pointeur cfi doit etre
54  * nr*nt*(np+2) et doit avoir ete alloue avant
55  * l'appel a la routine.
56  * Le coefficient a_l (0 <= l <= nt-1) doit etre stoke dans le
57  * tableau cfi comme suit
58  * a_l = cfi[ nr*nt* k + i + nr* l ]
59  * ou k et i sont les indices correspondant a phi et r
60  * respectivement: m = k/2.
61  * NB: pour m pair et l < m, a_l = 0
62  * pour m impair et l < m, a_l = 0
63  *
64  * int* dimf : tableau du nombre d'elements de ff dans chacune des trois
65  * dimensions.
66  * On doit avoir dimf[1] >= deg[1] = nt.
67  *
68  * Sortie:
69  * -------
70  * double* ff : tableau des valeurs de la fonction aux nt points de
71  * de collocation
72  *
73  * theta_l = pi l/(nt-1) 0 <= l <= nt-1
74  *
75  * L'espace memoire correspondant a ce
76  * pointeur doit etre dimf[0]*dimf[1]*dimf[2] et doit
77  * avoir ete alloue avant l'appel a la routine.
78  * Les valeurs de la fonction sont stokees
79  * dans le tableau ff comme suit
80  * f( theta_l ) = ff[ dimf[1]*dimf[2] * j + k + dimf[2] * l ]
81  * ou j et k sont les indices correspondant a
82  * phi et r respectivement.
83  *
84  * NB: Si le pointeur cf est egal a ff, la routine ne travaille que sur un
85  * seul tableau, qui constitue une entree/sortie.
86  *
87  */
88 
89 /*
90  * $Id: citleg.C,v 1.5 2016/12/05 16:18:01 j_novak Exp $
91  * $Log: citleg.C,v $
92  * Revision 1.5 2016/12/05 16:18:01 j_novak
93  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
94  *
95  * Revision 1.4 2014/10/13 08:53:11 j_novak
96  * Lorene classes and functions now belong to the namespace Lorene.
97  *
98  * Revision 1.3 2014/10/06 15:16:01 j_novak
99  * Modified #include directives to use c++ syntax.
100  *
101  * Revision 1.2 2005/02/18 13:14:12 j_novak
102  * Changing of malloc/free to new/delete + suppression of some unused variables
103  * (trying to avoid compilation warnings).
104  *
105  * Revision 1.1 2004/11/23 15:13:50 m_forot
106  * Added the bases for the cases without any equatorial symmetry
107  * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
108  *
109  *
110  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/citleg.C,v 1.5 2016/12/05 16:18:01 j_novak Exp $
111  *
112  */
113 
114 
115 // headers du C
116 #include <cstdlib>
117 #include <cassert>
118 
119 // headers bien de chez nous
120 #include "headcpp.h"
121 #include "proto.h"
122 namespace Lorene {
123 //*****************************************************************************
124 
125 void citleg(const int* deg, const int* dimc, double* cf, const int* dimf,
126  double* ff)
127 {
128 
129  // Limitations de la routine:
130  assert(dimc[0]==deg[0]+2) ;
131  assert(dimc[1]==deg[1]) ;
132  assert(dimc[2]==deg[2]) ;
133 
134 
135  // Tableau de travail :
136  int taille = dimc[0]*dimc[1]*dimc[2] ;
137  double* cf_cs = new double[taille] ;
138 
139 //--------------------------------------------------------------
140 // 1/ Transformation Legendre ---> cos(l theta)/sin(l theta)
141 //--------------------------------------------------------------
142 
143  chb_leg_cossinc(deg , cf, cf_cs) ;
144 
145 //--------------------------------------------------------------
146 // 2/ Transformation cos(l theta)/sin(l theta) ---> esp. des configurations
147 //--------------------------------------------------------------
148 
149  citcossinc(deg, dimc, cf_cs, dimf, ff) ;
150 
151  // Menage
152  delete [] cf_cs ;
153 
154 }
155 }
Lorene prototypes.
Definition: app_hor.h:67