ope_helmholtz_minus_pseudo_1d_solp.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_solp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_pseudo_1d/ope_helmholtz_minus_pseudo_1d_solp.C,v 1.1 2004/08/24 09:14:46 p_grandclement Exp $" ;
00022 
00023 /*
00024  * $Id: ope_helmholtz_minus_pseudo_1d_solp.C,v 1.1 2004/08/24 09:14:46 p_grandclement Exp $
00025  * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_pseudo_1d/ope_helmholtz_minus_pseudo_1d_solp.C,v 1.1 2004/08/24 09:14:46 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 // Version Tbl --> Tbl a 1D pour la source 
00035 //--------------------------------------------------
00036 
00037 
00038 Tbl _cl_helmholtz_minus_pseudo_1d_pas_prevu (const Tbl & source, int) {
00039      cout << "Combinaison lineaire pas prevue..." << endl ;
00040     abort() ;
00041     exit(-1) ;
00042     return source;
00043 }
00044 
00045 
00046 
00047 
00048         //-------------------
00049            //--  R_CHEBU   -----
00050           //-------------------
00051 Tbl _cl_helmholtz_minus_pseudo_1d_r_chebu_deux(const Tbl&) ;
00052 
00053 Tbl _cl_helmholtz_minus_pseudo_1d_r_chebu (const Tbl &source, int puis) {
00054 
00055     int n=source.get_dim(0) ;
00056     Tbl res(n) ;
00057     res.set_etat_qcq() ;
00058     
00059     switch(puis) {
00060     case 2 :
00061         res = _cl_helmholtz_minus_pseudo_1d_r_chebu_deux(source) ;
00062         break ;
00063     
00064     default :
00065         abort() ;
00066         exit(-1) ;    
00067     }
00068    return res ;
00069 }
00070 
00071 // Cas dzpuis = 2 ;
00072 Tbl _cl_helmholtz_minus_pseudo_1d_r_chebu_deux (const Tbl &source) {
00073 
00074   Tbl barre(source) ;
00075   int n = source.get_dim(0) ;
00076     
00077   int dirac = 1 ;
00078   for (int i=0 ; i<n-2 ; i++) {
00079     barre.set(i) = ((1+dirac)*source(i)-source(i+2)) ;
00080     if (i==0) dirac = 0 ;
00081   }
00082   
00083   Tbl tilde(barre) ;
00084   for (int i=0 ; i<n-4 ; i++)
00085     tilde.set(i) = (barre(i)-barre(i+2)) ;
00086   
00087   Tbl bis(tilde) ;
00088   for (int i=0 ; i<n-4 ; i++)
00089     bis.set(i) = (tilde(i)+tilde(i+1)) ;
00090   
00091   Tbl res(bis) ;
00092   for (int i=0 ; i<n-4 ; i++)
00093     res.set(i) = (bis(i)-bis(i+1)) ;
00094   
00095   return res ;
00096 }
00097 
00098 
00099         //----------------------------
00100            //- Routine a appeler        ---
00101           //------------------------------
00102 
00103 Tbl cl_helmholtz_minus_pseudo_1d (const Tbl &source, int puis, int base_r) {
00104         // Routines de derivation
00105     static Tbl (*cl_helmholtz_minus_pseudo_1d[MAX_BASE])(const Tbl &, int) ;
00106     static int nap = 0 ;
00107 
00108         // Premier appel
00109     if (nap==0) {
00110     nap = 1 ;
00111     for (int i=0 ; i<MAX_BASE ; i++) {
00112         cl_helmholtz_minus_pseudo_1d[i] = _cl_helmholtz_minus_pseudo_1d_pas_prevu ;
00113     }
00114         // Les routines existantes
00115     cl_helmholtz_minus_pseudo_1d[R_CHEBU >> TRA_R] = _cl_helmholtz_minus_pseudo_1d_r_chebu ;
00116 
00117     }
00118     
00119     Tbl res(cl_helmholtz_minus_pseudo_1d[base_r](source, puis)) ;
00120     return res ;
00121 }
00122 
00123 
00124         //------------------------------------
00125         // Routine pour les cas non prevus --
00126         //------------------------------------
00127 Tbl _solp_helmholtz_minus_pseudo_1d_pas_prevu (const Matrice &, const Matrice &,
00128                 double,  double, const Tbl &, int) {
00129     cout << " Solution homogene pas prevue ..... : "<< endl ;
00130     abort() ;
00131     exit(-1) ;
00132     Tbl res(1) ;
00133     return res;
00134 }
00135     
00136             //-------------------
00137            //--  R_CHEBU   -----
00138           //-------------------
00139 Tbl _solp_helmholtz_minus_pseudo_1d_r_chebu_deux (const Matrice&, const Matrice&, 
00140                    const Tbl&) ;
00141 
00142 Tbl _solp_helmholtz_minus_pseudo_1d_r_chebu (const Matrice &lap, const Matrice &nondege, 
00143                  double, double, 
00144                  const Tbl &source, int puis) {
00145     int n = lap.get_dim(0) ;
00146     Tbl res(n+2) ;
00147     res.set_etat_qcq() ;
00148     
00149     switch (puis) {
00150     case 2 :
00151         res = _solp_helmholtz_minus_pseudo_1d_r_chebu_deux 
00152           (lap, nondege, source) ;
00153         break ;
00154     default :
00155         abort() ;
00156         exit(-1) ;
00157     }
00158 return res ;
00159 }
00160     
00161 // Cas dzpuis = 2 ;
00162 Tbl _solp_helmholtz_minus_pseudo_1d_r_chebu_deux (const Matrice &lap, const Matrice &nondege, 
00163                    const Tbl &source) {
00164   
00165   int n = lap.get_dim(0)+2 ;      
00166   int dege = n-nondege.get_dim(0) ;
00167   assert (dege == 3) ;
00168 
00169   Tbl source_cl (cl_helmholtz_minus_pseudo_1d(source, 2, R_CHEBU)) ;
00170   
00171   Tbl so(n-dege) ;
00172   so.set_etat_qcq() ;
00173   for (int i=0 ; i<n-dege ; i++)
00174     so.set(i) = source_cl(i);
00175   
00176   Tbl sol (nondege.inverse(so)) ;
00177 
00178   Tbl res(n) ;
00179   res.annule_hard() ;
00180   for (int i=1 ; i<n-2 ; i++) {
00181     res.set(i) += sol(i-1)*(2*i+3) ;
00182     res.set(i+1) += -sol(i-1)*(4*i+4) ;
00183     res.set(i+2) += sol(i-1)*(2*i+1) ;
00184   }
00185 
00186   return res ;
00187 }
00188 
00189 
00190 Tbl Ope_helmholtz_minus_pseudo_1d::get_solp (const Tbl& so) const {
00191 
00192   if (non_dege == 0x0)
00193     do_non_dege() ;
00194 
00195   // Routines de derivation
00196   static Tbl (*solp_helmholtz_minus_pseudo_1d[MAX_BASE]) (const Matrice&, const Matrice&,
00197                        double, double,const Tbl&, int) ;
00198   static int nap = 0 ;
00199   
00200   // Premier appel
00201   if (nap==0) {
00202     nap = 1 ;
00203     for (int i=0 ; i<MAX_BASE ; i++) {
00204       solp_helmholtz_minus_pseudo_1d[i] = _solp_helmholtz_minus_pseudo_1d_pas_prevu ;
00205     }
00206     // Les routines existantes
00207     solp_helmholtz_minus_pseudo_1d[R_CHEBU >> TRA_R] = _solp_helmholtz_minus_pseudo_1d_r_chebu ;
00208   }
00209   
00210   Tbl res(solp_helmholtz_minus_pseudo_1d[base_r] (*ope_cl, *non_dege, 
00211                           alpha, beta, so, dzpuis)) ;
00212 
00213   Tbl valeurs (val_solp (res, alpha, base_r)) ;
00214   valeurs *= sqrt(double(2)) ;
00215   
00216   sp_plus = valeurs(0) ;
00217   sp_minus = valeurs(1) ;
00218   dsp_plus = valeurs(2) ;
00219   dsp_minus = valeurs(3) ;
00220 
00221  
00222   return res ;
00223 }

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