LORENE
cftlegpp.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 en fonctions de Legendre associees sur le deuxieme indice
27  * (theta) d'un tableau 3-D representant une fonction symetrique par rapport
28  * au plan z=0 et invariante par le retournement (x, y, z) --> (-x, -y, z).
29  *
30  *
31  * Entree:
32  * -------
33  * int* deg : tableau du nombre effectif de degres de liberte dans chacune
34  * des 3 dimensions: le nombre de points de collocation
35  * en theta est nt = deg[1] et doit etre de la forme
36  * nt = 2^p 3^q 5^r + 1
37  * int* dimf : tableau du nombre d'elements de ff dans chacune des trois
38  * dimensions.
39  * On doit avoir dimf[1] >= deg[1] = nt.
40  *
41  * double* ff : tableau des valeurs de la fonction aux nt points de
42  * de collocation
43  *
44  * theta_l = pi/2 l/(nt-1) 0 <= l <= nt-1
45  *
46  * L'espace memoire correspondant a ce
47  * pointeur doit etre dimf[0]*dimf[1]*dimf[2] et doit
48  * etre alloue avant l'appel a la routine.
49  * Les valeurs de la fonction doivent etre stokees
50  * dans le tableau ff comme suit
51  * f( theta_l ) = ff[ dimf[1]*dimf[2] * k + i + dimf[2] * l ]
52  * ou k et i sont les indices correspondant a
53  * phi et r respectivement.
54  * NB: cette routine suppose que la transformation en phi a deja ete
55  * effectuee: ainsi m est un indice de Fourier, non un indice de
56  * point de collocation en phi.
57  *
58  * int* dimc : tableau du nombre d'elements de cf dans chacune des trois
59  * dimensions.
60  * On doit avoir dimc[1] >= deg[1] = nt.
61  * Sortie:
62  * -------
63  * double* cf : tableau des coefficients a_l du develop. en fonctions de
64  * Legendre associees P_n^m (n et m pairs) :
65  *
66  * f(theta) = som_{l=m/2}^{nt-1} a_l P_{2l}^m( cos(theta) )
67  *
68  * ou P_n^m(x) represente la fonction de Legendre associee
69  * de degre n et d'ordre m normalisee de facon a ce que
70  *
71  * int_0^pi [ P_n^m(cos(theta)) ]^2 sin(theta) dtheta = 1
72  *
73  * L'espace memoire correspondant au pointeur cfi doit etre
74  * nr*nt*(np+2) et doit avoir ete alloue avant
75  * l'appel a la routine.
76  * Le coefficient a_l (0 <= l <= nt-1) doit etre stoke dans le
77  * tableau cfi comme suit
78  * a_l = cfi[ nr*nt* k + i + nr* l ]
79  * ou k et i sont les indices correspondant a phi et r
80  * respectivement: m = 2 (k/2).
81  * NB: pour l < m/2, a_l = 0
82  *
83  * NB: Si le pointeur cf est egal a ff, la routine ne travaille que sur un
84  * seul tableau, qui constitue une entree/sortie.
85  *
86  */
87 
88 /*
89  * $Id: cftlegpp.C,v 1.7 2016/12/05 16:18:00 j_novak Exp $
90  * $Log: cftlegpp.C,v $
91  * Revision 1.7 2016/12/05 16:18:00 j_novak
92  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
93  *
94  * Revision 1.6 2014/10/13 08:53:10 j_novak
95  * Lorene classes and functions now belong to the namespace Lorene.
96  *
97  * Revision 1.5 2014/10/06 15:15:59 j_novak
98  * Modified #include directives to use c++ syntax.
99  *
100  * Revision 1.4 2005/02/18 13:14:10 j_novak
101  * Changing of malloc/free to new/delete + suppression of some unused variables
102  * (trying to avoid compilation warnings).
103  *
104  * Revision 1.3 2003/01/31 10:31:23 e_gourgoulhon
105  * Suppressed the directive #include <malloc.h> for malloc is defined
106  * in <stdlib.h>
107  *
108  * Revision 1.2 2002/10/16 14:36:52 j_novak
109  * Reorganization of #include instructions of standard C++, in order to
110  * use experimental version 3 of gcc.
111  *
112  * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon
113  * LORENE
114  *
115  * Revision 2.0 1999/02/22 15:46:39 hyc
116  * *** empty log message ***
117  *
118  *
119  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/cftlegpp.C,v 1.7 2016/12/05 16:18:00 j_novak Exp $
120  *
121  */
122 
123 // headers du C
124 #include <cassert>
125 #include <cstdlib>
126 
127 // headers bien de chez nous
128 #include "headcpp.h"
129 #include "proto.h"
130 namespace Lorene {
131 //*****************************************************************************
132 
133 void cftlegpp(const int* deg, const int* dimf, double* ff, const int* dimc,
134  double* cf)
135 {
136 
137 // Limitations de la routine:
138  assert(dimc[0]==deg[0]+2) ;
139  assert(dimc[1]==deg[1]) ;
140  assert(dimc[2]==deg[2]) ;
141 
142 
143  // Tableau de travail :
144  int taille = dimc[0]*dimc[1]*dimc[2] ;
145  double* cf_cs = new double[taille] ;
146 
147 //--------------------------------------------------------------
148 // 1/ Transformation esp. des configurations --> cos(2l theta)
149 //--------------------------------------------------------------
150 
151  cftcosp(deg, dimf, ff, dimc, cf_cs) ;
152 
153 //--------------------------------------------------------------
154 // 2/ Transformation cos(2l theta) ---> Legendre
155 //--------------------------------------------------------------
156 
157  chb_cosp_legpp(deg , cf_cs, cf) ;
158 
159  // Menage
160  delete [] cf_cs ;
161 }
162 }
Lorene prototypes.
Definition: app_hor.h:67