1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
|
/*
* Copyright (c) 1999-2000 Jean-Alain Marck
* Copyright (c) 1999-2001 Eric Gourgoulhon
* Copyright (c) 1999-2001 Philippe Grandclement
*
* 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 op_sxpun_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/op_sxpun.C,v 1.6 2014/10/13 08:53:26 j_novak Exp $" ;
/*
* Ensemble des routines de base de division par rapport a x+1
* (Utilisation interne)
*
* void _sx_XXXX(Tbl * t, int & b)
* t pointeur sur le Tbl d'entree-sortie
* b base spectrale
*
*/
/*
* $Id: op_sxpun.C,v 1.6 2014/10/13 08:53:26 j_novak Exp $
* $Log: op_sxpun.C,v $
* Revision 1.6 2014/10/13 08:53:26 j_novak
* Lorene classes and functions now belong to the namespace Lorene.
*
* Revision 1.5 2014/10/06 15:16:06 j_novak
* Modified #include directives to use c++ syntax.
*
* Revision 1.4 2008/08/19 06:42:00 j_novak
* Minor modifications to avoid warnings with gcc 4.3. Most of them concern
* cast-type operations, and constant strings that must be defined as const char*
*
* Revision 1.3 2007/12/21 13:59:02 j_novak
* Suppression of call to pow(-1, something).
*
* Revision 1.2 2007/12/20 09:11:08 jl_cornou
* Correction of an error in op_sxpun about Jacobi(0,2) polynomials
*
* Revision 1.1 2007/12/11 15:42:23 jl_cornou
* Premiere version des fonctions liees aux polynomes de Jacobi(0,2)
*
* Revision 1.2 2004/11/23 15:16:01 m_forot
*
* Added the bases for the cases without any equatorial symmetry
* (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
*
* Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon
* LORENE
*
* Revision 2.5 2000/09/07 12:50:48 phil
* *** empty log message ***
*
* Revision 2.4 2000/02/24 16:42:59 eric
* Initialisation a zero du tableau xo avant le calcul.
*
* Revision 2.3 1999/11/15 16:39:17 eric
* Tbl::dim est desormais un Dim_tbl et non plus un Dim_tbl*.
*
* Revision 2.2 1999/10/18 13:40:11 eric
* Suppression de la routine _sx_r_chebu car doublon avec _sxm1_cheb.
*
* Revision 2.1 1999/09/13 11:35:42 phil
* gestion des cas k==1 et k==np
*
* Revision 2.0 1999/04/26 14:59:42 phil
* *** empty log message ***
*
*
* $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/op_sxpun.C,v 1.6 2014/10/13 08:53:26 j_novak Exp $
*
*/
// Fichier includes
#include "tbl.h"
#include <cmath>
//-----------------------------------
// Routine pour les cas non prevus --
//-----------------------------------
namespace Lorene {
void _sxpun_pas_prevu(Tbl * tb, int& base) {
cout << "sxpun pas prevu..." << endl ;
cout << "Tbl: " << tb << " base: " << base << endl ;
abort () ;
exit(-1) ;
}
//-------------
// Identite ---
//-------------
void _sxpun_identite(Tbl* , int& ) {
return ;
}
//--------------
// cas R_JACO02-
//--------------
void _sxpun_r_jaco02(Tbl* tb, int&)
{
// Peut-etre rien a faire ?
if (tb->get_etat() == ETATZERO) {
return ;
}
// Pour le confort
int nr = (tb->dim).dim[0] ; // Nombre
int nt = (tb->dim).dim[1] ; // de points
int np = (tb->dim).dim[2] ; // physiques REELS
np = np - 2 ; // Nombre de points physiques
// pt. sur le tableau de double resultat
double* xo = new double [tb->get_taille()];
// Initialisation a zero :
for (int i=0; i<tb->get_taille(); i++) {
xo[i] = 0 ;
}
// On y va...
double* xi = tb->t ;
double* xci = xi ; // Pointeurs
double* xco = xo ; // courants
int borne_phi = np + 1 ;
if (np == 1) {
borne_phi = 1 ;
}
for (int k=0 ; k< borne_phi ; k++)
if (k==1) {
xci += nr*nt ;
xco += nr*nt ;
}
else {
for (int j=0 ; j<nt ; j++) {
xco[nr-1] = 0 ;
double somme ;
for (int i = 0 ; i < nr-1 ; i++) {
somme = 0 ;
for (int m = i+1 ; m < nr ; m++) {
int signe = ((m-1-i)%2 == 0 ? 1 : -1) ;
somme += signe*((m+1)*(m+2)/double((i+1)*(i+2))-(i+1)*(i+2)/double((m+1)*(m+2)))*xci[m] ;
}
xco[i] = (2*i+3)/double(4)*somme ;
}
xci += nr ;
xco += nr ;
} // Fin de la boucle sur theta
} // Fin de la boucle sur phi
// On remet les choses la ou il faut
delete [] tb->t ;
tb->t = xo ;
// base de developpement
// inchangée
}
}
|