LORENE
citlegmp.C
1 /*
2  * Copyright (c) 1999-2001 Eric Gourgoulhon
3  * 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 char citlegmp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/citlegmp.C,v 1.3 2014/10/13 08:53:12 j_novak Exp $" ;
25 
26 /*
27  * Transformation inverse fonctions de Legendre associees sur le deuxieme indice
28  * (theta) d'un tableau 3-D representant une fonction
29  * invariante par le retournement (x, y, z) --> (-x, -y, z).
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* dimc : tableau du nombre d'elements de cc dans chacune des trois
38  * dimensions.
39  * On doit avoir dimc[1] >= deg[1] = nt.
40  *
41  * double* cf : tableau des coefficients a_l du develop. en fonctions de
42  * Legendre associees P_n^m (m pair) :
43  *
44  * f(theta) = som_{l=m}^{nt-1} a_l P_l^m( cos(theta) )
45  *
46  * ou P_n^m(x) represente la fonction de Legendre associee
47  * de degre n et d'ordre m normalisee de facon a ce que
48  *
49  * int_0^pi [ P_n^m(cos(theta)) ]^2 sin(theta) dtheta = 1
50  *
51  * L'espace memoire correspondant au pointeur cfi doit etre
52  * nr*nt*(np+2) et doit avoir ete alloue avant
53  * l'appel a la routine.
54  * Le coefficient a_l (0 <= l <= nt-1) doit etre stoke dans le
55  * tableau cfi comme suit
56  * a_l = cfi[ nr*nt* k + i + nr* l ]
57  * ou k et i sont les indices correspondant a phi et r
58  * respectivement: m = 2( k/2) .
59  * NB: pour l < m, a_l = 0
60  *
61  * int* dimf : tableau du nombre d'elements de ff dans chacune des trois
62  * dimensions.
63  * On doit avoir dimf[1] >= deg[1] = nt.
64  *
65  * Sortie:
66  * -------
67  * double* ff : tableau des valeurs de la fonction aux nt points de
68  * de collocation
69  *
70  * theta_l = pi l/(nt-1) 0 <= l <= nt-1
71  *
72  * L'espace memoire correspondant a ce
73  * pointeur doit etre dimf[0]*dimf[1]*dimf[2] et doit
74  * avoir ete alloue avant l'appel a la routine.
75  * Les valeurs de la fonction sont stokees
76  * dans le tableau ff comme suit
77  * f( theta_l ) = ff[ dimf[1]*dimf[2] * k + i + dimf[2] * l ]
78  * ou k et i sont les indices correspondant a
79  * phi et r respectivement.
80  *
81  * NB: Si le pointeur cf est egal a ff, la routine ne travaille que sur un
82  * seul tableau, qui constitue une entree/sortie.
83  *
84  */
85 
86 /*
87  * $Id: citlegmp.C,v 1.3 2014/10/13 08:53:12 j_novak Exp $
88  * $Log: citlegmp.C,v $
89  * Revision 1.3 2014/10/13 08:53:12 j_novak
90  * Lorene classes and functions now belong to the namespace Lorene.
91  *
92  * Revision 1.2 2014/10/06 15:16:02 j_novak
93  * Modified #include directives to use c++ syntax.
94  *
95  * Revision 1.1 2009/10/13 13:49:36 j_novak
96  * New base T_LEG_MP.
97  *
98  *
99  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/citlegmp.C,v 1.3 2014/10/13 08:53:12 j_novak Exp $
100  *
101  */
102 
103 
104 // headers du C
105 #include <cassert>
106 #include <cstdlib>
107 
108 // headers bien de chez nous
109 #include "headcpp.h"
110 #include "proto.h"
111 namespace Lorene {
112 //*****************************************************************************
113 
114 void citlegmp(const int* deg, const int* dimc, double* cf, const int* dimf,
115  double* ff)
116 {
117 
118  // Limitations de la routine:
119  assert(dimc[0]==deg[0]+2) ;
120  assert(dimc[1]==deg[1]) ;
121  assert(dimc[2]==deg[2]) ;
122 
123 
124  // Tableau de travail :
125  int taille = dimc[0]*dimc[1]*dimc[2] ;
126  double* cf_cs = new double[taille] ;
127 
128 //-----------------------------------------------
129 // 1/ Transformation Legendre ---> cos(l theta)
130 //-----------------------------------------------
131 
132  chb_legmp_cos(deg , cf, cf_cs) ;
133 
134 //--------------------------------------------------------------
135 // 2/ Transformation cos(l theta) ---> esp. des configurations
136 //--------------------------------------------------------------
137 
138  citcos(deg, dimc, cf_cs, dimf, ff) ;
139 
140  // Menage
141  delete [] cf_cs ;
142 
143 }
144 }
Lorene
Lorene prototypes.
Definition: app_hor.h:64