LORENE
citlegip.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 inverse fonctions de Legendre associees sur le deuxieme indice
27  * (theta) d'un tableau 3-D representant une fonction antisymetrique par
28  * rapport au plan z=0 et symetrique par le retournement
29  * (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_j du develop. en fonctions de
42  * Legendre associees P_l^m (l impair, m pair)
43  *
44  * f(theta) =
45  * som_{j=m/2}^{nt-2} a_j P_{2j+1}^m( cos(theta) )
46  *
47  *
48  * avec m pair : m = 0, 2, ..., np.
49  *
50  * P_l^m(x) represente la fonction de Legendre associee
51  * de degre l et d'ordre m normalisee de facon a ce que
52  *
53  * int_0^pi [ P_l^m(cos(theta)) ]^2 sin(theta) dtheta = 1
54  *
55  * L'espace memoire correspondant au pointeur cfo doit etre
56  * nr*nt*(np+2) et doit avoir ete alloue avant
57  * l'appel a la routine.
58  * Le coefficient a_j (0 <= j <= nt-1) est stoke dans le
59  * tableau cfo comme suit
60  * a_j = cfo[ nr*nt* k + i + nr* j ]
61  * ou k et i sont les indices correspondant a phi et r
62  * respectivement: m = 2( k/2 ).
63  * NB: pour j < m/2 ou j = nt-1, a_j = 0
64  *
65  *
66  * int* dimf : tableau du nombre d'elements de ff dans chacune des trois
67  * dimensions.
68  * On doit avoir dimf[1] >= deg[1] = nt.
69  *
70  * Sortie:
71  * -------
72  * double* ff : tableau des valeurs de la fonction aux nt points de
73  * de collocation
74  *
75  * theta_l = pi/2 l/(nt-1) 0 <= l <= nt-1
76  *
77  * L'espace memoire correspondant a ce
78  * pointeur doit etre dimf[0]*dimf[1]*dimf[2] et doit
79  * avoir ete alloue avant l'appel a la routine.
80  * Les valeurs de la fonction sont stokees
81  * dans le tableau ff comme suit
82  * f( theta_l ) = ff[ dimf[1]*dimf[2] * k + i + dimf[2] * l ]
83  * ou k et i sont les indices correspondant a
84  * phi et r respectivement.
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: citlegip.C,v 1.4 2016/12/05 16:18:01 j_novak Exp $
93  * $Log: citlegip.C,v $
94  * Revision 1.4 2016/12/05 16:18:01 j_novak
95  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
96  *
97  * Revision 1.3 2014/10/13 08:53:12 j_novak
98  * Lorene classes and functions now belong to the namespace Lorene.
99  *
100  * Revision 1.2 2014/10/06 15:16:01 j_novak
101  * Modified #include directives to use c++ syntax.
102  *
103  * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon
104  * LORENE
105  *
106  * Revision 2.0 2000/10/04 14:41:12 eric
107  * *** empty log message ***
108  *
109  *
110  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/citlegip.C,v 1.4 2016/12/05 16:18:01 j_novak Exp $
111  *
112  */
113 
114 // headers du C
115 #include <cassert>
116 
117 // headers bien de chez nous
118 #include "proto.h"
119 namespace Lorene {
120 //*****************************************************************************
121 
122 void citlegip(const int* deg, const int* dimc, double* cf, const int* dimf,
123  double* ff)
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 Legendre ---> cos( (2j+1) theta)
138 //------------------------------------------------
139 
140  chb_legip_cosi(deg , cf, cf_cs) ;
141 
142 //--------------------------------------------------------------
143 // 2/ Transformation cos( (2j+1) theta) ---> esp. des configurations
144 //--------------------------------------------------------------
145 
146  citcosi(deg, dimc, cf_cs, dimf, ff) ;
147 
148  // Menage
149  delete [] cf_cs ;
150 
151 }
152 }
Lorene prototypes.
Definition: app_hor.h:67