cftlegpp.C

00001 /*
00002  *   Copyright (c) 1999-2001 Eric Gourgoulhon
00003  *
00004  *   This file is part of LORENE.
00005  *
00006  *   LORENE is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   LORENE is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with LORENE; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 
00023 char cftlegpp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/cftlegpp.C,v 1.4 2005/02/18 13:14:10 j_novak Exp $" ;
00024 
00025 /*
00026  * Transformation en fonctions de Legendre associees sur le deuxieme indice
00027  *  (theta) d'un tableau 3-D representant une fonction symetrique par rapport
00028  *  au plan z=0 et invariante par le retournement (x, y, z) --> (-x, -y, z).
00029  *
00030  *
00031  * Entree:
00032  * -------
00033  *   int* deg   : tableau du nombre effectif de degres de liberte dans chacune 
00034  *        des 3 dimensions: le nombre de points de collocation
00035  *        en theta est  nt = deg[1] et doit etre de la forme
00036  *          nt = 2^p 3^q 5^r + 1 
00037  *   int* dimf  : tableau du nombre d'elements de ff dans chacune des trois 
00038  *            dimensions.
00039  *        On doit avoir  dimf[1] >= deg[1] = nt. 
00040  *
00041  *   double* ff : tableau des valeurs de la fonction aux nt points de
00042  *                        de collocation
00043  *
00044  *            theta_l =  pi/2 l/(nt-1)       0 <= l <= nt-1 
00045  *
00046  *            L'espace memoire correspondant a ce
00047  *                        pointeur doit etre dimf[0]*dimf[1]*dimf[2] et doit 
00048  *            etre alloue avant l'appel a la routine.    
00049  *            Les valeurs de la fonction doivent etre stokees
00050  *            dans le tableau ff comme suit
00051  *          f( theta_l ) = ff[ dimf[1]*dimf[2] * k + i + dimf[2] * l ]
00052  *           ou k et i sont les indices correspondant a
00053  *           phi et r respectivement.
00054  *  NB: cette routine suppose que la transformation en phi a deja ete
00055  *      effectuee: ainsi m est un indice de Fourier, non un indice de
00056  *      point de collocation en phi.
00057  *
00058  *   int* dimc  : tableau du nombre d'elements de cf dans chacune des trois 
00059  *            dimensions.
00060  *        On doit avoir  dimc[1] >= deg[1] = nt. 
00061  * Sortie:
00062  * -------
00063  *   double* cf :  tableau des coefficients a_l du develop. en fonctions de
00064  *          Legendre associees P_n^m (n et m pairs) : 
00065  *
00066  *      f(theta) =  som_{l=m/2}^{nt-1} a_l P_{2l}^m( cos(theta) )
00067  *            
00068  *          ou P_n^m(x) represente la fonction de Legendre associee
00069  *             de degre n et d'ordre m normalisee de facon a ce que
00070  *
00071  *          int_0^pi [ P_n^m(cos(theta)) ]^2  sin(theta) dtheta = 1
00072  *
00073  *          L'espace memoire correspondant au pointeur cfi doit etre 
00074  *              nr*nt*(np+2) et doit avoir ete alloue avant 
00075  *          l'appel a la routine.    
00076  *          Le coefficient a_l (0 <= l <= nt-1) doit etre stoke dans le 
00077  *          tableau cfi comme suit
00078  *                a_l = cfi[ nr*nt* k + i + nr* l ]
00079  *          ou k et i sont les indices correspondant a phi et r 
00080  *          respectivement: m = 2 (k/2).
00081  *          NB: pour l < m/2,  a_l = 0
00082  *
00083  * NB: Si le pointeur cf est egal a ff, la routine ne travaille que sur un 
00084  *     seul tableau, qui constitue une entree/sortie.
00085  *
00086  */
00087 
00088 /*
00089  * $Id: cftlegpp.C,v 1.4 2005/02/18 13:14:10 j_novak Exp $
00090  * $Log: cftlegpp.C,v $
00091  * Revision 1.4  2005/02/18 13:14:10  j_novak
00092  * Changing of malloc/free to new/delete + suppression of some unused variables
00093  * (trying to avoid compilation warnings).
00094  *
00095  * Revision 1.3  2003/01/31 10:31:23  e_gourgoulhon
00096  * Suppressed the directive #include <malloc.h> for malloc is defined
00097  * in <stdlib.h>
00098  *
00099  * Revision 1.2  2002/10/16 14:36:52  j_novak
00100  * Reorganization of #include instructions of standard C++, in order to
00101  * use experimental version 3 of gcc.
00102  *
00103  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00104  * LORENE
00105  *
00106  * Revision 2.0  1999/02/22  15:46:39  hyc
00107  * *** empty log message ***
00108  *
00109  *
00110  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/cftlegpp.C,v 1.4 2005/02/18 13:14:10 j_novak Exp $
00111  *
00112  */
00113 
00114 // headers du C
00115 #include <assert.h>
00116 #include <stdlib.h>
00117 
00118 // headers bien de chez nous
00119 #include "headcpp.h"
00120 #include "proto.h"
00121 //*****************************************************************************
00122 
00123 void cftlegpp(const int* deg, const int* dimf, double* ff, const int* dimc,
00124         double* cf)
00125 {
00126 
00127 // Limitations de la routine:
00128     assert(dimc[0]==deg[0]+2) ;
00129     assert(dimc[1]==deg[1]) ;
00130     assert(dimc[2]==deg[2]) ;
00131 
00132 
00133     // Tableau de travail :
00134     int taille = dimc[0]*dimc[1]*dimc[2] ;
00135     double* cf_cs =  new double[taille] ; 
00136 
00137 //--------------------------------------------------------------
00138 // 1/ Transformation esp. des configurations --> cos(2l theta)
00139 //--------------------------------------------------------------
00140 
00141     cftcosp(deg, dimf, ff, dimc, cf_cs) ;
00142 
00143 //--------------------------------------------------------------
00144 // 2/ Transformation  cos(2l theta) ---> Legendre 
00145 //--------------------------------------------------------------
00146 
00147     chb_cosp_legpp(deg , cf_cs, cf) ;
00148 
00149     // Menage
00150     delete [] cf_cs ;
00151 }

Generated on Tue Feb 7 01:35:15 2012 for LORENE by  doxygen 1.4.6