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