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