00001 /* 00002 * Copyright (c) 1999-2001 Eric Gourgoulhon 00003 * 2009 Jerome Novak 00004 * 00005 * This file is part of LORENE. 00006 * 00007 * LORENE is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * LORENE is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with LORENE; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 */ 00022 00023 00024 char cftlegmp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/cftlegmp.C,v 1.1 2009/10/13 13:49:36 j_novak Exp $" ; 00025 00026 /* 00027 * Transformation en fonctions de Legendre associees sur le deuxieme indice 00028 * (theta) d'un tableau 3-D representant une fonction symetrique invariante 00029 * par le retournement (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 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_l du develop. en fonctions de 00065 * Legendre associees P_n^m (m pair) : 00066 * 00067 * f(theta) = som_{l=m}^{nt-1} a_l P_l^m( cos(theta) ) 00068 * 00069 * ou P_n^m(x) represente la fonction de Legendre associee 00070 * de degre n et d'ordre m normalisee de facon a ce que 00071 * 00072 * int_0^pi [ P_n^m(cos(theta)) ]^2 sin(theta) dtheta = 1 00073 * 00074 * L'espace memoire correspondant au pointeur cfi doit etre 00075 * nr*nt*(np+2) et doit avoir ete alloue avant 00076 * l'appel a la routine. 00077 * Le coefficient a_l (0 <= l <= nt-1) doit etre stoke dans le 00078 * tableau cfi comme suit 00079 * a_l = cfi[ nr*nt* k + i + nr* l ] 00080 * ou k et i sont les indices correspondant a phi et r 00081 * respectivement: m = 2 (k/2). 00082 * NB: pour l < m, a_l = 0 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: cftlegmp.C,v 1.1 2009/10/13 13:49:36 j_novak Exp $ 00091 * $Log: cftlegmp.C,v $ 00092 * Revision 1.1 2009/10/13 13:49:36 j_novak 00093 * New base T_LEG_MP. 00094 * 00095 * 00096 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/cftlegmp.C,v 1.1 2009/10/13 13:49:36 j_novak Exp $ 00097 * 00098 */ 00099 00100 // headers du C 00101 #include <assert.h> 00102 #include <stdlib.h> 00103 00104 // headers bien de chez nous 00105 #include "headcpp.h" 00106 #include "proto.h" 00107 //***************************************************************************** 00108 00109 void cftlegmp(const int* deg, const int* dimf, double* ff, const int* dimc, 00110 double* cf) 00111 { 00112 00113 // Limitations de la routine: 00114 assert(dimc[0]==deg[0]+2) ; 00115 assert(dimc[1]==deg[1]) ; 00116 assert(dimc[2]==deg[2]) ; 00117 00118 00119 // Tableau de travail : 00120 int taille = dimc[0]*dimc[1]*dimc[2] ; 00121 double* cf_cs = new double[taille] ; 00122 00123 //-------------------------------------------------------------- 00124 // 1/ Transformation esp. des configurations --> cos(2l theta) 00125 //-------------------------------------------------------------- 00126 00127 cftcos(deg, dimf, ff, dimc, cf_cs) ; 00128 00129 //-------------------------------------------------------------- 00130 // 2/ Transformation cos(2l theta) ---> Legendre 00131 //-------------------------------------------------------------- 00132 00133 chb_cos_legmp(deg , cf_cs, cf) ; 00134 00135 // Menage 00136 delete [] cf_cs ; 00137 }
1.4.6