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