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