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 citlegmp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/citlegmp.C,v 1.1 2009/10/13 13:49:36 j_novak Exp $" ; 00025 00026 /* 00027 * Transformation inverse fonctions de Legendre associees sur le deuxieme indice 00028 * (theta) d'un tableau 3-D representant une fonction 00029 * invariante par le retournement (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_l du develop. en fonctions de 00042 * Legendre associees P_n^m (m pair) : 00043 * 00044 * f(theta) = som_{l=m}^{nt-1} a_l P_l^m( cos(theta) ) 00045 * 00046 * ou P_n^m(x) represente la fonction de Legendre associee 00047 * de degre n et d'ordre m normalisee de facon a ce que 00048 * 00049 * int_0^pi [ P_n^m(cos(theta)) ]^2 sin(theta) dtheta = 1 00050 * 00051 * L'espace memoire correspondant au pointeur cfi doit etre 00052 * nr*nt*(np+2) et doit avoir ete alloue avant 00053 * l'appel a la routine. 00054 * Le coefficient a_l (0 <= l <= nt-1) doit etre stoke dans le 00055 * tableau cfi comme suit 00056 * a_l = cfi[ nr*nt* k + i + nr* l ] 00057 * ou k et i sont les indices correspondant a phi et r 00058 * respectivement: m = 2( k/2) . 00059 * NB: pour l < m, a_l = 0 00060 * 00061 * int* dimf : tableau du nombre d'elements de ff dans chacune des trois 00062 * dimensions. 00063 * On doit avoir dimf[1] >= deg[1] = nt. 00064 * 00065 * Sortie: 00066 * ------- 00067 * double* ff : tableau des valeurs de la fonction aux nt points de 00068 * de collocation 00069 * 00070 * theta_l = pi l/(nt-1) 0 <= l <= nt-1 00071 * 00072 * L'espace memoire correspondant a ce 00073 * pointeur doit etre dimf[0]*dimf[1]*dimf[2] et doit 00074 * avoir ete alloue avant l'appel a la routine. 00075 * Les valeurs de la fonction sont stokees 00076 * dans le tableau ff comme suit 00077 * f( theta_l ) = ff[ dimf[1]*dimf[2] * k + i + dimf[2] * l ] 00078 * ou k et i sont les indices correspondant a 00079 * phi et r respectivement. 00080 * 00081 * NB: Si le pointeur cf est egal a ff, la routine ne travaille que sur un 00082 * seul tableau, qui constitue une entree/sortie. 00083 * 00084 */ 00085 00086 /* 00087 * $Id: citlegmp.C,v 1.1 2009/10/13 13:49:36 j_novak Exp $ 00088 * $Log: citlegmp.C,v $ 00089 * Revision 1.1 2009/10/13 13:49:36 j_novak 00090 * New base T_LEG_MP. 00091 * 00092 * 00093 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/citlegmp.C,v 1.1 2009/10/13 13:49:36 j_novak Exp $ 00094 * 00095 */ 00096 00097 00098 // headers du C 00099 #include <assert.h> 00100 #include <stdlib.h> 00101 00102 // headers bien de chez nous 00103 #include "headcpp.h" 00104 #include "proto.h" 00105 //***************************************************************************** 00106 00107 void citlegmp(const int* deg, const int* dimc, double* cf, const int* dimf, 00108 double* ff) 00109 { 00110 00111 // Limitations de la routine: 00112 assert(dimc[0]==deg[0]+2) ; 00113 assert(dimc[1]==deg[1]) ; 00114 assert(dimc[2]==deg[2]) ; 00115 00116 00117 // Tableau de travail : 00118 int taille = dimc[0]*dimc[1]*dimc[2] ; 00119 double* cf_cs = new double[taille] ; 00120 00121 //----------------------------------------------- 00122 // 1/ Transformation Legendre ---> cos(l theta) 00123 //----------------------------------------------- 00124 00125 chb_legmp_cos(deg , cf, cf_cs) ; 00126 00127 //-------------------------------------------------------------- 00128 // 2/ Transformation cos(l theta) ---> esp. des configurations 00129 //-------------------------------------------------------------- 00130 00131 citcos(deg, dimc, cf_cs, dimf, ff) ; 00132 00133 // Menage 00134 delete [] cf_cs ; 00135 00136 }
1.4.6