LORENE
som_phi.C
1 /*
2  * Copyright (c) 1999-2000 Jean-Alain Marck
3  * Copyright (c) 1999-2001 Philippe Grandclement
4  * Copyright (c) 1999-2002 Eric Gourgoulhon
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 routine pour la sommation directe en phi
29  *
30  * SYNOPSYS:
31  * double som_phi_XX
32  * (double* ti, int np, double phi, double* xo)
33  *
34  * ATTENTION: np est le nombre reel de points.
35  * on suppose que ti contient les n+2
36  * avec les 0 qu'il faut.
37  *
38  */
39 
40 /*
41  * $Id: som_phi.C,v 1.6 2016/12/05 16:18:08 j_novak Exp $
42  * $Log: som_phi.C,v $
43  * Revision 1.6 2016/12/05 16:18:08 j_novak
44  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
45  *
46  * Revision 1.5 2014/10/13 08:53:26 j_novak
47  * Lorene classes and functions now belong to the namespace Lorene.
48  *
49  * Revision 1.4 2014/10/06 15:16:06 j_novak
50  * Modified #include directives to use c++ syntax.
51  *
52  * Revision 1.3 2002/10/16 14:36:58 j_novak
53  * Reorganization of #include instructions of standard C++, in order to
54  * use experimental version 3 of gcc.
55  *
56  * Revision 1.2 2002/05/05 16:21:28 e_gourgoulhon
57  * Error message (for unknown basis) in English.
58  *
59  * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon
60  * LORENE
61  *
62  * Revision 2.2 2000/09/08 16:07:02 eric
63  * Ajout de la base P_COSSIN_I
64  *
65  * Revision 2.1 2000/03/06 09:34:58 eric
66  * Suppression des #include inutiles.
67  *
68  * Revision 2.0 1999/04/12 15:43:21 phil
69  * *** empty log message ***
70  *
71  *
72  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/som_phi.C,v 1.6 2016/12/05 16:18:08 j_novak Exp $
73  *
74  */
75 
76 // Headers C
77 #include <cstdlib>
78 #include <cmath>
79 
80 #include "headcpp.h"
81 
82 namespace Lorene {
83 
84 void som_phi_pas_prevu
85  (double*, const int, const double, double*) {
86  cout << "Mtbl_cf::val_point: phi basis not implemented yet ! "
87  << endl ;
88  abort () ;
89 }
90 
91 void som_phi_cossin
92  (double* ti, const int np, const double phi, double* xo) {
93 
94  *xo = ti[0] ; // premier element
95 
96  // Sommation sur les cosinus et les sinus
97  for (int k=2 ; k<np-1 ; k +=2 ) {
98  int m = k/2 ;
99  *xo += ti[k] * cos(m * phi) ;
100  *xo += ti[k+1] * sin(m * phi) ;
101  }
102  *xo += ti[np] * cos(np/2 * phi) ;
103 }
104 
105 void som_phi_cossin_p
106  (double* ti, const int np, const double phi, double* xo) {
107 
108  *xo = ti[0] ; // premier element
109 
110  // Sommation sur les cosinus et les sinus
111  for (int k=2 ; k<np-1 ; k +=2 ) {
112  int m = 2*(k/2) ;
113  *xo += ti[k] * cos(m * phi) ;
114  *xo += ti[k+1] * sin(m * phi) ;
115  }
116  *xo += ti[np] * cos(np * phi) ;
117 }
118 
119 void som_phi_cossin_i
120  (double* ti, const int np, const double phi, double* xo) {
121 
122  *xo = ti[0] * cos(phi) + ti[2] * sin(phi) ;
123 
124  // Sommation sur les harmoniques d'ordre m >= 3 :
125  for (int k=3 ; k<np ; k +=2 ) {
126  int m = k ;
127  *xo += ti[k] * cos(m * phi) ;
128  *xo += ti[k+1] * sin(m * phi) ;
129  }
130 
131 }
132 }
Lorene prototypes.
Definition: app_hor.h:67
Cmp cos(const Cmp &)
Cosine.
Definition: cmp_math.C:97
Cmp sin(const Cmp &)
Sine.
Definition: cmp_math.C:72