cftleg.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 cftleg_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/cftleg.C,v 1.2 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 sans symetrie.
00028  *
00029  * Entree:
00030  * -------
00031  *   int* deg   : tableau du nombre effectif de degres de liberte dans chacune 
00032  *        des 3 dimensions: le nombre de points de collocation
00033  *        en theta est  nt = deg[1] et doit etre de la forme
00034  *          nt = 2^p 3^q 5^r + 1 
00035  *   int* dimf  : tableau du nombre d'elements de ff dans chacune des trois 
00036  *            dimensions.
00037  *        On doit avoir  dimf[1] >= deg[1] = nt. 
00038  *
00039  *   double* ff : tableau des valeurs de la fonction aux nt points de
00040  *                        de collocation
00041  *
00042  *            theta_l =  pi l/(nt-1)       0 <= l <= nt-1 
00043  *
00044  *            L'espace memoire correspondant a ce
00045  *                        pointeur doit etre dimf[0]*dimf[1]*dimf[2] et doit 
00046  *            etre alloue avant l'appel a la routine.    
00047  *            Les valeurs de la fonction doivent etre stokees
00048  *            dans le tableau ff comme suit
00049  *          f( theta_l ) = ff[ dimf[1]*dimf[2] * m + k + dimf[2] * l ]
00050  *           ou m et k sont les indices correspondant a
00051  *           phi et r respectivement.
00052  *  NB: cette routine suppose que la transformation en phi a deja ete
00053  *      effectuee: ainsi m est un indice de Fourier, non un indice de
00054  *      point de collocation en phi.
00055  *
00056  *   int* dimc  : tableau du nombre d'elements de cf dans chacune des trois 
00057  *            dimensions.
00058  *        On doit avoir  dimc[1] >= deg[1] = nt. 
00059  * Sortie:
00060  * -------
00061  *   double* cf :  tableau des coefficients a_l du develop. en fonctions de
00062  *          Legendre associees P_n^m:
00063  *
00064  *  pour m pair:    f(theta) = 
00065  *              som_{l=m}^{nt-1} a_l P_{l}^m( cos(theta) )
00066  *            
00067  *  pour m impair:  f(theta) = 
00068  *              som_{l=m}^{nt-1} a_l P_{l}^m( cos(theta) )
00069  *
00070  *          ou P_n^m(x) represente la fonction de Legendre associee
00071  *             de degre n et d'ordre m normalisee de facon a ce que
00072  *
00073  *          int_0^pi [ P_n^m(cos(theta)) ]^2  sin(theta) dtheta = 1
00074  *
00075  *          L'espace memoire correspondant au pointeur cfi doit etre 
00076  *              nr*nt*(np+2) et doit avoir ete alloue avant 
00077  *          l'appel a la routine.    
00078  *          Le coefficient a_l (0 <= l <= nt-1) doit etre stoke dans le 
00079  *          tableau cfi comme suit
00080  *                a_l = cfi[ nr*nt* k + i + nr* l ]
00081  *          ou k et i sont les indices correspondant a phi et r 
00082  *          respectivement: m = k/2.
00083  *          NB: pour m pair et l < m,  a_l = 0
00084  *          pour m impair et l < m,  a_l = 0
00085  *
00086  * NB: Si le pointeur cf est egal a ff, la routine ne travaille que sur un 
00087  *     seul tableau, qui constitue une entree/sortie.
00088  *
00089  */
00090 
00091 /*
00092  * $Id: cftleg.C,v 1.2 2005/02/18 13:14:10 j_novak Exp $
00093  * $Log: cftleg.C,v $
00094  * Revision 1.2  2005/02/18 13:14:10  j_novak
00095  * Changing of malloc/free to new/delete + suppression of some unused variables
00096  * (trying to avoid compilation warnings).
00097  *
00098  * Revision 1.1  2004/11/23 15:13:50  m_forot
00099  * Added the bases for the cases without any equatorial symmetry
00100  * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
00101  *
00102  *
00103  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/cftleg.C,v 1.2 2005/02/18 13:14:10 j_novak Exp $
00104  *
00105  */
00106 
00107 // headers du C
00108 #include <assert.h>
00109 #include <stdlib.h>
00110 
00111 // headers bien de chez nous
00112 #include "headcpp.h"
00113 #include "proto.h"
00114 //*****************************************************************************
00115 
00116 void cftleg(const int* deg, const int* dimf, double* ff, const int* dimc,
00117         double* cf)
00118 {
00119 
00120 // Limitations de la routine:
00121     assert(dimc[0]==deg[0]+2) ;
00122     assert(dimc[1]==deg[1]) ;
00123     assert(dimc[2]==deg[2]) ;
00124 
00125 
00126     // Tableau de travail :
00127     int taille = dimc[0]*dimc[1]*dimc[2] ;
00128     double* cf_cs =  new double[taille] ; 
00129 
00130 //--------------------------------------------------------------
00131 // 1/ Transformation esp. des configurations --> cos(l theta)/sin(l theta) 
00132 //--------------------------------------------------------------
00133 
00134     cftcossinc(deg, dimf, ff, dimc, cf_cs) ;
00135 
00136 //--------------------------------------------------------------
00137 // 2/ Transformation  cos(l theta)/sin(l theta) ---> Legendre 
00138 //--------------------------------------------------------------
00139 
00140     chb_cossinc_leg(deg , cf_cs, cf) ;
00141 
00142     // Menage
00143     delete [] cf_cs ;
00144 }

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