citlegip.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 citlegip_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/citlegip.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $" ;
00024 
00025 /*
00026  * Transformation inverse fonctions de Legendre associees sur le deuxieme indice
00027  *  (theta) d'un tableau 3-D representant une fonction antisymetrique par 
00028  *  rapport au plan z=0 et symetrique par le retournement 
00029  *  (x, y, z) --> (-x, -y, z).
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* dimc  : tableau du nombre d'elements de cc dans chacune des trois 
00038  *            dimensions.
00039  *        On doit avoir  dimc[1] >= deg[1] = nt. 
00040  *
00041  *   double* cf :  tableau des coefficients a_j du develop. en fonctions de
00042  *          Legendre associees P_l^m (l impair, m pair)
00043  *
00044  *          f(theta) = 
00045  *              som_{j=m/2}^{nt-2} a_j P_{2j+1}^m( cos(theta) )
00046  *            
00047  *      
00048  *          avec m pair :  m = 0, 2, ..., np.         
00049  *
00050  *          P_l^m(x) represente la fonction de Legendre associee
00051  *             de degre l et d'ordre m normalisee de facon a ce que
00052  *
00053  *          int_0^pi [ P_l^m(cos(theta)) ]^2  sin(theta) dtheta = 1
00054  *
00055  *          L'espace memoire correspondant au pointeur cfo doit etre 
00056  *              nr*nt*(np+2) et doit avoir ete alloue avant 
00057  *          l'appel a la routine.    
00058  *          Le coefficient a_j (0 <= j <= nt-1) est stoke dans le 
00059  *          tableau cfo comme suit
00060  *                a_j = cfo[ nr*nt* k + i + nr* j ]
00061  *          ou k et i sont les indices correspondant a phi et r 
00062  *          respectivement: m = 2( k/2 ).
00063  *          NB: pour j < m/2 ou j = nt-1,  a_j = 0
00064  *
00065  *
00066  *   int* dimf  : tableau du nombre d'elements de ff dans chacune des trois 
00067  *            dimensions.
00068  *        On doit avoir  dimf[1] >= deg[1] = nt. 
00069  *
00070  * Sortie:
00071  * -------
00072  *   double* ff : tableau des valeurs de la fonction aux nt points de
00073  *                        de collocation
00074  *
00075  *            theta_l =  pi/2 l/(nt-1)       0 <= l <= nt-1 
00076  *
00077  *            L'espace memoire correspondant a ce
00078  *                        pointeur doit etre dimf[0]*dimf[1]*dimf[2] et doit 
00079  *            avoir ete alloue avant l'appel a la routine.   
00080  *            Les valeurs de la fonction sont stokees
00081  *            dans le tableau ff comme suit
00082  *          f( theta_l ) = ff[ dimf[1]*dimf[2] * k + i + dimf[2] * l ]
00083  *           ou k et i sont les indices correspondant a
00084  *           phi et r respectivement.
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: citlegip.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $
00093  * $Log: citlegip.C,v $
00094  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00095  * LORENE
00096  *
00097  * Revision 2.0  2000/10/04  14:41:12  eric
00098  * *** empty log message ***
00099  *
00100  *
00101  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/citlegip.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $
00102  *
00103  */
00104 
00105 // headers du C
00106 #include <assert.h>
00107 
00108 // headers bien de chez nous
00109 #include "proto.h"
00110 //*****************************************************************************
00111 
00112 void citlegip(const int* deg, const int* dimc, double* cf, const int* dimf,
00113            double* ff)
00114 {
00115 
00116     // Limitations de la routine:
00117     assert(dimc[0]==deg[0]+2) ;
00118     assert(dimc[1]==deg[1]) ;
00119     assert(dimc[2]==deg[2]) ;
00120 
00121 
00122     // Tableau de travail :
00123     int taille = dimc[0]*dimc[1]*dimc[2] ;
00124     double* cf_cs =  new double[taille] ;   
00125 
00126 //------------------------------------------------
00127 // 1/ Transformation Legendre ---> cos( (2j+1) theta)
00128 //------------------------------------------------
00129 
00130     chb_legip_cosi(deg , cf, cf_cs) ;  
00131 
00132 //--------------------------------------------------------------
00133 // 2/ Transformation cos( (2j+1) theta) ---> esp. des configurations
00134 //--------------------------------------------------------------
00135 
00136     citcosi(deg, dimc, cf_cs, dimf, ff) ;
00137 
00138     // Menage
00139     delete [] cf_cs ; 
00140     
00141 }

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