LORENE
cftleg.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 cftleg_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/cftleg.C,v 1.4 2014/10/13 08:53:09 j_novak Exp $" ;
24
25/*
26 * Transformation en 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* dimf : tableau du nombre d'elements de ff dans chacune des trois
36 * dimensions.
37 * On doit avoir dimf[1] >= deg[1] = nt.
38 *
39 * double* ff : tableau des valeurs de la fonction aux nt points de
40 * de collocation
41 *
42 * theta_l = pi l/(nt-1) 0 <= l <= nt-1
43 *
44 * L'espace memoire correspondant a ce
45 * pointeur doit etre dimf[0]*dimf[1]*dimf[2] et doit
46 * etre alloue avant l'appel a la routine.
47 * Les valeurs de la fonction doivent etre stokees
48 * dans le tableau ff comme suit
49 * f( theta_l ) = ff[ dimf[1]*dimf[2] * m + k + dimf[2] * l ]
50 * ou m et k sont les indices correspondant a
51 * phi et r respectivement.
52 * NB: cette routine suppose que la transformation en phi a deja ete
53 * effectuee: ainsi m est un indice de Fourier, non un indice de
54 * point de collocation en phi.
55 *
56 * int* dimc : tableau du nombre d'elements de cf dans chacune des trois
57 * dimensions.
58 * On doit avoir dimc[1] >= deg[1] = nt.
59 * Sortie:
60 * -------
61 * double* cf : tableau des coefficients a_l du develop. en fonctions de
62 * Legendre associees P_n^m:
63 *
64 * pour m pair: f(theta) =
65 * som_{l=m}^{nt-1} a_l P_{l}^m( cos(theta) )
66 *
67 * pour m impair: f(theta) =
68 * som_{l=m}^{nt-1} a_l P_{l}^m( cos(theta) )
69 *
70 * ou P_n^m(x) represente la fonction de Legendre associee
71 * de degre n et d'ordre m normalisee de facon a ce que
72 *
73 * int_0^pi [ P_n^m(cos(theta)) ]^2 sin(theta) dtheta = 1
74 *
75 * L'espace memoire correspondant au pointeur cfi doit etre
76 * nr*nt*(np+2) et doit avoir ete alloue avant
77 * l'appel a la routine.
78 * Le coefficient a_l (0 <= l <= nt-1) doit etre stoke dans le
79 * tableau cfi comme suit
80 * a_l = cfi[ nr*nt* k + i + nr* l ]
81 * ou k et i sont les indices correspondant a phi et r
82 * respectivement: m = k/2.
83 * NB: pour m pair et l < m, a_l = 0
84 * pour m impair et l < m, a_l = 0
85 *
86 * NB: Si le pointeur cf est egal a ff, la routine ne travaille que sur un
87 * seul tableau, qui constitue une entree/sortie.
88 *
89 */
90
91/*
92 * $Id: cftleg.C,v 1.4 2014/10/13 08:53:09 j_novak Exp $
93 * $Log: cftleg.C,v $
94 * Revision 1.4 2014/10/13 08:53:09 j_novak
95 * Lorene classes and functions now belong to the namespace Lorene.
96 *
97 * Revision 1.3 2014/10/06 15:15:59 j_novak
98 * Modified #include directives to use c++ syntax.
99 *
100 * Revision 1.2 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.1 2004/11/23 15:13:50 m_forot
105 * Added the bases for the cases without any equatorial symmetry
106 * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
107 *
108 *
109 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/cftleg.C,v 1.4 2014/10/13 08:53:09 j_novak Exp $
110 *
111 */
112
113// headers du C
114#include <cassert>
115#include <cstdlib>
116
117// headers bien de chez nous
118#include "headcpp.h"
119#include "proto.h"
120namespace Lorene {
121//*****************************************************************************
122
123void cftleg(const int* deg, const int* dimf, double* ff, const int* dimc,
124 double* cf)
125{
126
127// Limitations de la routine:
128 assert(dimc[0]==deg[0]+2) ;
129 assert(dimc[1]==deg[1]) ;
130 assert(dimc[2]==deg[2]) ;
131
132
133 // Tableau de travail :
134 int taille = dimc[0]*dimc[1]*dimc[2] ;
135 double* cf_cs = new double[taille] ;
136
137//--------------------------------------------------------------
138// 1/ Transformation esp. des configurations --> cos(l theta)/sin(l theta)
139//--------------------------------------------------------------
140
141 cftcossinc(deg, dimf, ff, dimc, cf_cs) ;
142
143//--------------------------------------------------------------
144// 2/ Transformation cos(l theta)/sin(l theta) ---> Legendre
145//--------------------------------------------------------------
146
147 chb_cossinc_leg(deg , cf_cs, cf) ;
148
149 // Menage
150 delete [] cf_cs ;
151}
152}
Lorene prototypes.
Definition app_hor.h:64