/* * Copyright (c) 1999-2001 Eric Gourgoulhon * Copyright (c) 2009 Jerome Novak * * This file is part of LORENE. * * LORENE is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LORENE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LORENE; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ char chb_legmi_sin_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/chb_legmi_sin.C,v 1.3 2014/10/13 08:53:11 j_novak Exp $" ; /* * Calcule les coefficients du developpement (suivant theta) * en sin(j theta) * a partir des coefficients du developpement en fonctions * associees de Legendre P_l^m(cos(theta)) (m impair) * pour une une fonction 3-D antisymetrique par le retournement * (x, y, z) --> (-x, -y, z). * * Entree: * ------- * const int* deg : tableau du nombre effectif de degres de liberte dans chacune * des 3 dimensions: * deg[0] = np : nombre de points de collocation en phi * deg[1] = nt : nombre de points de collocation en theta * deg[2] = nr : nombre de points de collocation en r * * const double* cfi : tableau des coefficients a_j du develop. en fonctions de * Legendre associees P_n^m: * * f(theta) = * som_{l=m}^{nt-2} a_j P_j^m( cos(theta) ) * * (m impair) * * ou P_l^m(x) represente la fonction de Legendre associee * de degre l et d'ordre m normalisee de facon a ce que * * int_0^pi [ P_l^m(cos(theta)) ]^2 sin(theta) dtheta = 1 * * L'espace memoire correspondant au pointeur cfi doit etre * nr*nt*(np+2) et doit avoir ete alloue avant * l'appel a la routine. * Le coefficient a_j (0 <= j <= nt-1) doit etre stoke dans le * tableau cfi comme suit * a_j = cfi[ nr*nt* k + i + nr* j ] * ou k et i sont les indices correspondant a phi et r * respectivement: m = 2 (k/2). * NB: pour j #include // Headers Lorene #include "headcpp.h" #include "proto.h" namespace Lorene { //****************************************************************************** void chb_legmi_sin(const int* deg , const double* cfi, double* cfo) { int k2, l, j, i, m ; // Nombres de degres de liberte en phi et theta : int np = deg[0] ; int nt = deg[1] ; int nr = deg[2] ; assert(np < 4*nt) ; assert( cfi != cfo ) ; // Tableau de travail double* som = new double[nr] ; // Recherche de la matrice de passage Legendre --> cos/sin double* bb = mat_legmi_sin(np, nt) ; // Increment en m pour la matrice bb : int mbb = nt * nt ; // Pointeurs de travail : double* resu = cfo ; const double* cc = cfi ; // Increment en phi : int ntnr = nt * nr ; // Indice courant en phi : int k = 0 ; // Cas k=0 (m=1 : cos(phi)) // ------------------------ //... premier coef en j=0 mis a zero: for (i=0; i= 3 // ---------- for (m=3; m < np ; m+=2) { for (k2=0; k2 < 2; k2++) { // k2=0 : cos(m phi) ; k2=1 : sin(m phi) // Boucle sur l'indice j du developpement en sin( (2j+1) theta) //... premier coef en j=0 mis a zero: for (i=0; i