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