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 cftlegpi_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/cftlegpi.C,v 1.2 2002/10/16 14:36:52 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 3-D symetrique 00028 * par rapport au plan equatorial z = 0 et antisymetrique par le retournement 00029 * (x, y, z) --> (-x, -y, z). 00030 * 00031 * 00032 * Entree: 00033 * ------- 00034 * int* deg : tableau du nombre effectif de degres de liberte dans chacune 00035 * des 3 dimensions: le nombre de points de collocation 00036 * en theta est nt = deg[1] et doit etre de la forme 00037 * nt = 2^p 3^q 5^r + 1 00038 * int* dimf : tableau du nombre d'elements de ff dans chacune des trois 00039 * dimensions. 00040 * On doit avoir dimf[1] >= deg[1] = nt. 00041 * 00042 * double* ff : tableau des valeurs de la fonction aux nt points de 00043 * de collocation 00044 * 00045 * theta_l = pi/2 l/(nt-1) 0 <= l <= nt-1 00046 * 00047 * L'espace memoire correspondant a ce 00048 * pointeur doit etre dimf[0]*dimf[1]*dimf[2] et doit 00049 * etre alloue avant l'appel a la routine. 00050 * Les valeurs de la fonction doivent etre stokees 00051 * dans le tableau ff comme suit 00052 * f( theta_l ) = ff[ dimf[1]*dimf[2] * k + i + dimf[2] * l ] 00053 * ou k et i sont les indices correspondant a 00054 * phi et r respectivement. 00055 * NB: cette routine suppose que la transformation en phi a deja ete 00056 * effectuee: ainsi m est un indice de Fourier, non un indice de 00057 * point de collocation en phi. 00058 * 00059 * int* dimc : tableau du nombre d'elements de cf dans chacune des trois 00060 * dimensions. 00061 * On doit avoir dimc[1] >= deg[1] = nt. 00062 * Sortie: 00063 * ------- 00064 * double* cf : tableau des coefficients a_j du develop. en fonctions de 00065 * Legendre associees P_l^m (l impair, m impair) 00066 * 00067 * f(theta) = 00068 * som_{l=(m-1)/2}^{nt-2} a_j P_{2j+1}^m( cos(theta) ) 00069 * 00070 * avec m impair. 00071 * 00072 * P_l^m(x) represente la fonction de Legendre associee 00073 * de degre l et d'ordre m normalisee de facon a ce que 00074 * 00075 * int_0^pi [ P_l^m(cos(theta)) ]^2 sin(theta) dtheta = 1 00076 * 00077 * L'espace memoire correspondant au pointeur cfo doit etre 00078 * nr*nt*(np+2) et doit avoir ete alloue avant 00079 * l'appel a la routine. 00080 * Le coefficient a_j (0 <= j <= nt-1) est stoke dans le 00081 * tableau cfo comme suit 00082 * a_j = cfo[ nr*nt* k + i + nr* j ] 00083 * ou k et i sont les indices correspondant a phi et r 00084 * respectivement: m = 2( k/2 ). 00085 * NB: pour j<(m-1)/2, a_j = 0 00086 * 00087 * 00088 * NB: Si le pointeur cf est egal a ff, la routine ne travaille que sur un 00089 * seul tableau, qui constitue une entree/sortie. 00090 * 00091 */ 00092 00093 /* 00094 * $Id: cftlegpi.C,v 1.2 2002/10/16 14:36:52 j_novak Exp $ 00095 * $Log: cftlegpi.C,v $ 00096 * Revision 1.2 2002/10/16 14:36:52 j_novak 00097 * Reorganization of #include instructions of standard C++, in order to 00098 * use experimental version 3 of gcc. 00099 * 00100 * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon 00101 * LORENE 00102 * 00103 * Revision 2.0 2000/10/04 14:41:04 eric 00104 * *** empty log message *** 00105 * 00106 * 00107 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/cftlegpi.C,v 1.2 2002/10/16 14:36:52 j_novak Exp $ 00108 * 00109 */ 00110 00111 // headers du C 00112 #include <assert.h> 00113 00114 // headers bien de chez nous 00115 #include "headcpp.h" 00116 #include "proto.h" 00117 //***************************************************************************** 00118 00119 void cftlegpi(const int* deg, const int* dimf, double* ff, const int* dimc, 00120 double* cf) 00121 { 00122 00123 // Limitations de la routine: 00124 assert(dimc[0]==deg[0]+2) ; 00125 assert(dimc[1]==deg[1]) ; 00126 assert(dimc[2]==deg[2]) ; 00127 00128 00129 // Tableau de travail : 00130 int taille = dimc[0]*dimc[1]*dimc[2] ; 00131 double* cf_cs = new double[taille] ; 00132 00133 //-------------------------------------------------------------- 00134 // 1/ Transformation esp. des configurations --> sin((2j+1) theta) 00135 //-------------------------------------------------------------- 00136 00137 cftsini(deg, dimf, ff, dimc, cf_cs) ; 00138 00139 //-------------------------------------------------------------- 00140 // 2/ Transformation sin((2j+1) theta) ---> Legendre 00141 //-------------------------------------------------------------- 00142 00143 chb_sini_legpi(deg , cf_cs, cf) ; 00144 00145 // Menage 00146 delete [] cf_cs ; 00147 }
1.4.6