som_phi.C

00001 /*
00002  *   Copyright (c) 1999-2000 Jean-Alain Marck
00003  *   Copyright (c) 1999-2001 Philippe Grandclement
00004  *   Copyright (c) 1999-2002 Eric Gourgoulhon
00005  *
00006  *   This file is part of LORENE.
00007  *
00008  *   LORENE is free software; you can redistribute it and/or modify
00009  *   it under the terms of the GNU General Public License as published by
00010  *   the Free Software Foundation; either version 2 of the License, or
00011  *   (at your option) any later version.
00012  *
00013  *   LORENE is distributed in the hope that it will be useful,
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *   GNU General Public License for more details.
00017  *
00018  *   You should have received a copy of the GNU General Public License
00019  *   along with LORENE; if not, write to the Free Software
00020  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 
00025 char som_phi_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/som_phi.C,v 1.3 2002/10/16 14:36:58 j_novak Exp $" ;
00026 
00027 /*
00028  * Ensemble des routine pour la sommation directe en phi
00029  * 
00030  *   SYNOPSYS:
00031  *     double som_phi_XX
00032  *  (double* ti, int np, double phi, double* xo)
00033  *
00034  *   ATTENTION: np est le nombre reel de points.
00035  *      on suppose que ti contient les n+2 
00036  *      avec les 0 qu'il faut.
00037  * 
00038  */
00039 
00040 /*
00041  * $Id: som_phi.C,v 1.3 2002/10/16 14:36:58 j_novak Exp $
00042  * $Log: som_phi.C,v $
00043  * Revision 1.3  2002/10/16 14:36:58  j_novak
00044  * Reorganization of #include instructions of standard C++, in order to
00045  * use experimental version 3 of gcc.
00046  *
00047  * Revision 1.2  2002/05/05 16:21:28  e_gourgoulhon
00048  * Error message (for unknown basis) in English.
00049  *
00050  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00051  * LORENE
00052  *
00053  * Revision 2.2  2000/09/08  16:07:02  eric
00054  * Ajout de la base P_COSSIN_I
00055  *
00056  * Revision 2.1  2000/03/06  09:34:58  eric
00057  * Suppression des #include inutiles.
00058  *
00059  * Revision 2.0  1999/04/12  15:43:21  phil
00060  * *** empty log message ***
00061  *
00062  *
00063  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/som_phi.C,v 1.3 2002/10/16 14:36:58 j_novak Exp $
00064  *
00065  */
00066 
00067 // Headers C
00068 #include <stdlib.h>
00069 #include <math.h>
00070 
00071 #include "headcpp.h"
00072 
00073 void som_phi_pas_prevu
00074     (double*, const int, const double, double*) {
00075     cout << "Mtbl_cf::val_point: phi basis not implemented yet ! "
00076          << endl ;
00077     abort () ;
00078 }
00079 
00080 void som_phi_cossin
00081     (double* ti, const int np, const double phi, double* xo) {
00082     
00083     *xo = ti[0] ;   // premier element
00084 
00085     // Sommation sur les cosinus et les sinus
00086     for (int k=2 ; k<np-1 ; k +=2 ) {
00087     int m = k/2 ;
00088     *xo += ti[k] * cos(m * phi) ;
00089     *xo += ti[k+1] * sin(m * phi) ;
00090     }
00091     *xo += ti[np] * cos(np/2 * phi) ;
00092 }
00093 
00094 void som_phi_cossin_p
00095     (double* ti, const int np, const double phi, double* xo) {
00096     
00097     *xo = ti[0] ;   // premier element
00098 
00099     // Sommation sur les cosinus et les sinus
00100     for (int k=2 ; k<np-1 ; k +=2 ) {
00101     int m = 2*(k/2) ;
00102     *xo += ti[k] * cos(m * phi) ;
00103     *xo += ti[k+1] * sin(m * phi) ;
00104     }
00105     *xo += ti[np] * cos(np * phi) ;
00106 }
00107 
00108 void som_phi_cossin_i
00109     (double* ti, const int np, const double phi, double* xo) {
00110     
00111     *xo = ti[0] * cos(phi) + ti[2] * sin(phi) ; 
00112 
00113     // Sommation sur les harmoniques d'ordre m >= 3 : 
00114     for (int k=3 ; k<np ; k +=2 ) {
00115     int m = k ;
00116     *xo += ti[k] * cos(m * phi) ;
00117     *xo += ti[k+1] * sin(m * phi) ;
00118     }
00119 
00120 }

Generated on Tue Feb 7 01:35:19 2012 for LORENE by  doxygen 1.4.6