ope_helmholtz_minus_pseudo_1d_solh.C

00001 /*
00002  *   Copyright (c) 2004 Philippe Grandclement
00003  *
00004  *   This file is part of LORENE.
00005  *
00006  *   LORENE is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License version 2
00008  *   as published by the Free Software Foundation.
00009  *
00010  *   LORENE is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with LORENE; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  */
00020 
00021 char ope_helmholtz_minus_pseudo_1d_solh_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_pseudo_1d/ope_helmholtz_minus_pseudo_1d_solh.C,v 1.2 2004/08/24 10:11:13 p_grandclement Exp $" ;
00022 
00023 /*
00024  * $Id: ope_helmholtz_minus_pseudo_1d_solh.C,v 1.2 2004/08/24 10:11:13 p_grandclement Exp $
00025  * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_pseudo_1d/ope_helmholtz_minus_pseudo_1d_solh.C,v 1.2 2004/08/24 10:11:13 p_grandclement Exp $
00026  *
00027  */
00028 #include <math.h>
00029 #include <stdlib.h>
00030 #include <gsl/gsl_sf_bessel.h>
00031 
00032 #include "proto.h"
00033 #include "ope_elementary.h"
00034 
00035         //------------------------------------
00036         // Routine pour les cas non prevus --
00037         //------------------------------------
00038 Tbl _solh_helmholtz_minus_pseudo_1d_pas_prevu (int, int, 
00039                            double, double, double) {
00040 
00041     cout << " Solution homogene pas prevue ..... : "<< endl ;
00042     exit(-1) ;
00043     Tbl res(1) ;
00044     return res;
00045 }
00046     
00047     
00048             //-------------------
00049            //--  R_CHEBU   -----
00050           //-------------------
00051     
00052 Tbl _solh_helmholtz_minus_pseudo_1d_r_chebu (int n, int l, 
00053                          double masse, 
00054                          double alpha, double) {
00055     
00056  
00057     Tbl res(n) ;
00058     res.set_etat_qcq() ;
00059     double* coloc = new double[n] ;
00060     
00061     int * deg = new int[3] ;
00062     deg[0] = 1 ; 
00063     deg[1] = 1 ;
00064     deg[2] = n ;
00065 
00066     for (int i=0 ; i<n-1 ; i++) {
00067       double air = 1./(alpha*(-1-cos(M_PI*i/(n-1)))) ;
00068       if ((l !=0) && (l!=1))
00069     coloc[i] = gsl_sf_bessel_kl_scaled (l-1, masse*air) / exp(masse*air) * air;
00070       else
00071     coloc[i] = exp(-masse*air) ;
00072     }
00073     coloc[n-1] = 0 ;
00074 
00075     cfrcheb(deg, deg, coloc, deg, coloc) ;
00076     for (int i=0 ; i<n ;i++)
00077       res.set(i) = coloc[i] ;
00078 
00079     delete [] coloc ;
00080     delete [] deg ;
00081     
00082     return res ;
00083 }
00084 
00085 
00086 Tbl Ope_helmholtz_minus_pseudo_1d::get_solh () const {
00087 
00088   // Routines de derivation
00089   static Tbl (*solh_helmholtz_minus_pseudo_1d[MAX_BASE]) (int, int, double, double, double) ;
00090   static int nap = 0 ;
00091   
00092   // Premier appel
00093   if (nap==0) {
00094     nap = 1 ;
00095     for (int i=0 ; i<MAX_BASE ; i++) {
00096       solh_helmholtz_minus_pseudo_1d[i] = _solh_helmholtz_minus_pseudo_1d_pas_prevu ;
00097     }
00098     // Les routines existantes
00099     solh_helmholtz_minus_pseudo_1d[R_CHEBU >> TRA_R] = _solh_helmholtz_minus_pseudo_1d_r_chebu ;
00100   }
00101   
00102   Tbl res(solh_helmholtz_minus_pseudo_1d[base_r](nr, l_quant, masse, alpha, beta)) ;
00103 
00104   // Un peu tricky...
00105   
00106   if (res.get_ndim() == 1) {
00107     Tbl val_lim (val_solp (res, alpha, base_r)) ;
00108     val_lim *= sqrt (double(2)) ;
00109 
00110     s_one_plus   = val_lim(0) ;
00111     s_one_minus  = val_lim(1) ; 
00112     ds_one_plus  = val_lim(2) ;
00113     ds_one_minus = val_lim(3) ;
00114 
00115   }
00116   else {
00117     Tbl auxi (nr) ;
00118     auxi.set_etat_qcq() ;
00119     for (int i=0 ; i<nr ; i++)
00120       auxi.set(i) = res(0,i) ;
00121 
00122     Tbl val_one  (val_solp (auxi, alpha, base_r)) ; 
00123     val_one *= sqrt (double(2)) ;
00124 
00125     s_one_plus   = val_one(0) ;
00126     s_one_minus  = val_one(1) ; 
00127     ds_one_plus  = val_one(2) ;
00128     ds_one_minus = val_one(3) ;
00129 
00130     for (int i=0 ; i<nr ; i++)
00131       auxi.set(i) = res(1,i) ;
00132 
00133     Tbl val_two  (val_solp (auxi, alpha, base_r)) ;
00134     val_two *= sqrt(double(2)) ;
00135 
00136     s_two_plus   = val_two(0) ;
00137     s_two_minus  = val_two(1) ; 
00138     ds_two_plus  = val_two(2) ;
00139     ds_two_minus = val_two(3) ;   
00140 
00141   }
00142   
00143   return res ;
00144 }

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