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