LORENE
xpundsdx_1d.C
1 /*
2  * Copyright (c) 1999-2001 Philippe Grandclement
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 xpundsdx_1d_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/xpundsdx_1d.C,v 1.3 2014/10/13 08:53:27 j_novak Exp $" ;
24 
25 /*
26  * $Id: xpundsdx_1d.C,v 1.3 2014/10/13 08:53:27 j_novak Exp $
27  * $Log: xpundsdx_1d.C,v $
28  * Revision 1.3 2014/10/13 08:53:27 j_novak
29  * Lorene classes and functions now belong to the namespace Lorene.
30  *
31  * Revision 1.2 2014/10/06 15:16:07 j_novak
32  * Modified #include directives to use c++ syntax.
33  *
34  * Revision 1.1 2007/12/11 15:42:23 jl_cornou
35  * Premiere version des fonctions liees aux polynomes de Jacobi(0,2)
36  *
37  * Revision 1.2 2002/10/16 14:37:11 j_novak
38  * Reorganization of #include instructions of standard C++, in order to
39  * use experimental version 3 of gcc.
40  *
41  * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon
42  * LORENE
43  *
44  * Revision 2.0 1999/10/11 09:55:46 phil
45  * *** empty log message ***
46  *
47  *
48  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/xpundsdx_1d.C,v 1.3 2014/10/13 08:53:27 j_novak Exp $
49  *
50  */
51 
52  // Includes
53 #include <cstdlib>
54 
55 #include "headcpp.h"
56 #include "type_parite.h"
57 
58 
59 
60  //----------------------------------
61  // Routine pour les cas non prevus --
62  //----------------------------------
63 
64 namespace Lorene {
65 void _xpundsdx_1d_pas_prevu(int nr, double* tb, double *xo) {
66  cout << "xpundsdx pas prevu..." << endl ;
67  cout << "Nombre de points : " << nr << endl ;
68  cout << "Valeurs : " << tb << " " << xo <<endl ;
69  abort() ;
70  exit(-1) ;
71 }
72 
73 
74  //---------------
75  // cas R_JACO02 -
76  //---------------
77 
78 void _xpundsdx_1d_r_jaco02(int nr, double* tb, double *xo) {
79 
80  double somme ;
81  for (int j = 0 ; j < nr-1 ; j++ ) {
82  somme = j*tb[j] ;
83  for (int n = j+1 ; n < nr ; n++ ) {
84  somme+=(2*j+3)*tb[n];
85  } // Fin de la boucle auxiliaire
86  xo[j]=somme ;
87  } // Fin de la boucle sur R
88  xo[nr-1] = (nr-1)*tb[nr-1] ;
89 }
90 
91  // ---------------------
92  // La routine a appeler
93  //----------------------
94 
95 
96 void xpundsdx_1d(int nr, double** tb, int base_r)
97 {
98 
99  // Routines de derivation
100  static void (*xpundsdx_1d[MAX_BASE])(int, double*, double *) ;
101  static int nap = 0 ;
102 
103  // Premier appel
104  if (nap==0) {
105  nap = 1 ;
106  for (int i=0 ; i<MAX_BASE ; i++) {
107  xpundsdx_1d[i] = _xpundsdx_1d_pas_prevu ;
108  }
109  // Les routines existantes
110  xpundsdx_1d[R_JACO02 >> TRA_R] = _xpundsdx_1d_r_jaco02 ;
111  }
112 
113  double *result = new double[nr] ;
114 
115  xpundsdx_1d[base_r](nr, *tb, result) ;
116 
117  delete [] (*tb) ;
118  (*tb) = result ;
119 }
120 }
#define MAX_BASE
Nombre max. de bases differentes.
Definition: type_parite.h:144
#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
Lorene prototypes.
Definition: app_hor.h:64