ope_vorton_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_vorton_solh_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_vorton/ope_vorton_solh.C,v 1.3 2007/05/06 10:48:14 p_grandclement Exp $" ;
00022 
00023 /*
00024  * $Id: ope_vorton_solh.C,v 1.3 2007/05/06 10:48:14 p_grandclement Exp $
00025  * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_vorton/ope_vorton_solh.C,v 1.3 2007/05/06 10:48:14 p_grandclement Exp $
00026  *
00027  */
00028 #include <math.h>
00029 #include <stdlib.h>
00030 
00031 #include "proto.h"
00032 #include "ope_elementary.h"
00033 
00034         //------------------------------------
00035         // Routine pour les cas non prevus --
00036         //------------------------------------
00037 Tbl _solh_vorton_pas_prevu (int, int, double, double, Tbl&) {
00038 
00039     cout << " Solution homogene pas prevue ..... : "<< endl ;
00040     exit(-1) ;
00041     Tbl res(1) ;
00042     return res;
00043 }
00044     
00045         //-------------------
00046            //--  R_CHEBU   -----
00047           //-------------------
00048 
00049 Tbl _solh_vorton_r_chebu (int n, int l, double alpha, double, Tbl& val_lim) {
00050 
00051   double l_one = -double(l) ;
00052   double rminus = -0.5/alpha ;
00053 
00054   Tbl res(n) ;
00055   res.set_etat_qcq() ;
00056   double* coloc = new double[n] ;
00057   
00058   int * deg = new int[3] ;
00059   deg[0] = 1 ; 
00060   deg[1] = 1 ;
00061   deg[2] = n ;
00062   
00063   //Construction de la premiere solution homogene :
00064   for (int i=0 ; i<n ; i++)
00065     coloc[i] = pow(1./alpha/(-cos(M_PI*i/(n-1))-1) , l_one) ;
00066     
00067   cfrcheb(deg, deg, coloc, deg, coloc) ;
00068   for (int i=0 ; i<n ;i++)
00069     res.set(i) = coloc[i] ;
00070 
00071   delete [] coloc ;
00072   delete [] deg ;
00073    
00074   val_lim.set(0,0) = pow(rminus, l_one) ;
00075   val_lim.set(0,1) = l_one*pow(rminus, l_one-1.) ;
00076   val_lim.set(0,2) = 0. ;
00077   val_lim.set(0,3) = 0. ;
00078   val_lim  /= sqrt(double(2)) ;
00079 
00080   return res ;
00081 }
00082 
00083 
00084         //-------------------
00085            //--  R_CHEB   ------
00086           //-------------------
00087 
00088 Tbl _solh_vorton_r_cheb (int n, int l, double alpha, double beta, Tbl& val_lim) {
00089 
00090 
00091   double l_one = double(l+1) ;
00092   double l_two = double(-l) ;
00093   double rminus = beta - alpha ;
00094   double rplus = beta + alpha ;
00095 
00096   Tbl res(2, n) ;
00097   res.set_etat_qcq() ;
00098   double* coloc = new double[n] ;
00099   
00100   int * deg = new int[3] ;
00101   deg[0] = 1 ; 
00102   deg[1] = 1 ;
00103   deg[2] = n ;
00104   
00105   //Construction de la premiere solution homogene :
00106   for (int i=0 ; i<n ; i++)
00107     coloc[i] = pow(alpha*(-cos(M_PI*i/(n-1))) + beta, l_one) ;
00108 
00109   cfrcheb(deg, deg, coloc, deg, coloc) ;
00110   for (int i=0 ; i<n ;i++)
00111     res.set(0, i) = coloc[i] ;
00112     
00113   // construction de la seconde solution homogene :
00114   for (int i=0 ; i<n ; i++) 
00115     coloc[i] = pow(alpha*(-cos(M_PI*i/(n-1))) + beta, l_two) ;
00116 
00117   cfrcheb(deg, deg, coloc, deg, coloc) ;
00118   for (int i=0 ; i<n ;i++)
00119     res.set(1, i) = coloc[i] ;  
00120         
00121   delete [] coloc ;
00122   delete [] deg ;
00123    
00124   val_lim.set(0,0) = pow(rminus, l_one) ;
00125   val_lim.set(0,1) = l_one*pow(rminus, l_one-1) ;
00126   val_lim.set(0,2) = pow(rplus, l_one) ;
00127   val_lim.set(0,3) = l_one*pow(rplus, l_one-1) ;
00128 
00129   val_lim.set(1,0) = pow(rminus, l_two) ;
00130   val_lim.set(1,1) = l_two*pow(rminus, l_two-1) ;
00131   val_lim.set(1,2) = pow(rplus, l_two) ;
00132   val_lim.set(1,3) = l_two*pow(rplus, l_two-1) ;
00133   val_lim  /= sqrt(double(2)) ;
00134 
00135   return res ;
00136 }
00137 
00138 
00139 Tbl Ope_vorton::get_solh () const {
00140 
00141   // Routines de derivation
00142   static Tbl (*solh_vorton[MAX_BASE]) (int, int, double, double, Tbl&) ;
00143   static int nap = 0 ;
00144   
00145   // Premier appel
00146   if (nap==0) {
00147     nap = 1 ;
00148     for (int i=0 ; i<MAX_BASE ; i++) {
00149       solh_vorton[i] = _solh_vorton_pas_prevu ;
00150     }
00151     // Les routines existantes
00152     solh_vorton[R_CHEB >> TRA_R] = _solh_vorton_r_cheb ;
00153     solh_vorton[R_CHEBU >> TRA_R] = _solh_vorton_r_chebu ;
00154   }
00155 
00156   Tbl val_lim (2 ,4) ;
00157   val_lim.set_etat_qcq() ;
00158   Tbl res(solh_vorton[base_r](nr,l_quant, alpha, beta, val_lim)) ;
00159 
00160 
00161   s_one_minus  = val_lim(0,0) ;
00162   ds_one_minus = val_lim(0,1) ;
00163   s_one_plus   = val_lim(0,2) ;
00164   ds_one_plus  = val_lim(0,3) ;
00165 
00166   if (res.get_ndim()>1) {
00167      s_two_minus  = val_lim(1,0) ;
00168      ds_two_minus = val_lim(1,1) ;
00169      s_two_plus   = val_lim(1,2) ;
00170      ds_two_plus  = val_lim(1,3) ;
00171   }
00172 
00173   return res ;
00174 }

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