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