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