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