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