ope_helmholtz_minus_pseudo_1d_mat.C

00001 /*
00002  *   Copyright (c) 2003 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_mat_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_pseudo_1d/ope_helmholtz_minus_pseudo_1d_mat.C,v 1.1 2004/08/24 09:14:46 p_grandclement Exp $" ;
00022 
00023 /*
00024  * $Id: ope_helmholtz_minus_pseudo_1d_mat.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_mat.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         //-----------------------------------
00035         // Routine pour les cas non prevus --
00036         //-----------------------------------
00037 
00038 Matrice _helmholtz_minus_pseudo_1d_mat_pas_prevu(int, int, double, double, 
00039                          double, int) {
00040     cout << "Operateur pas prevu..." << endl ;
00041     abort() ;
00042     exit(-1) ;
00043     Matrice res(1, 1) ;
00044     return res;
00045 }
00046 
00047 
00048 
00049            //-------------------------
00050            //--   CAS R_CHEBU    -----
00051            //-------------------------
00052 
00053 Matrice _helmholtz_minus_pseudo_1d_mat_r_chebu_deux(int,int,double, double) ;
00054 
00055 Matrice _helmholtz_minus_pseudo_1d_mat_r_chebu( int n, int l, double masse, 
00056                         double alpha, double, int puis) {
00057   Matrice res(n-2, n-2) ; 
00058   res.set_etat_qcq() ;
00059   switch (puis) {
00060   case 2 :
00061     res = _helmholtz_minus_pseudo_1d_mat_r_chebu_deux (n, l,masse, alpha) ;
00062     break ;
00063   default :
00064     abort() ;
00065     exit(-1) ;
00066   }
00067   return res ;
00068 }
00069 
00070     //Cas ou dzpuis = 2
00071 Matrice _helmholtz_minus_pseudo_1d_mat_r_chebu_deux (int n, int l, double masse, 
00072                              double alpha) {
00073         
00074 
00075   Matrice res(n-2, n-2) ;
00076   res.set_etat_qcq() ;
00077   double* vect = new double[n] ;
00078   double* vect_bis = new double[n] ;
00079   double* vect_dd = new double[n] ;
00080   double* vect_d = new double[n] ;
00081   
00082   for (int i=0 ; i<n-2 ; i++) {
00083     for (int j=0 ; j<n ; j++)
00084       vect[j] = 0 ;
00085     vect[i] = 2*i+3 ;
00086     vect[i+1] = -4*i-4 ;
00087     vect[i+2] = 2*i+1 ;
00088 
00089     // Der sec.
00090     for (int j=0 ; j<n ; j++)
00091       vect_bis[j] = vect[j] ;
00092     
00093     d2sdx2_1d (n, &vect_bis, R_CHEBU) ;  // appel dans le cas unsurr
00094     mult2_xm1_1d_cheb (n, vect_bis, vect_dd) ; // multiplication par (x-1)^2
00095     
00096     // Der simple
00097     for (int j=0 ; j<n ; j++)
00098       vect_bis[j] = vect[j] ;
00099 
00100     dsdx_1d (n, &vect_bis, R_CHEBU) ;  // appel dans le cas unsurr
00101     mult_xm1_1d_cheb (n, vect_bis, vect_d) ; // multiplication par (x-1)
00102     
00103     // Mass term
00104     for (int j=0 ; j<n ; j++)
00105       vect_bis[j] = vect[j] ;
00106     sx2_1d (n, &vect_bis, R_CHEBU) ;
00107     
00108     for (int j=0 ; j<n-2 ; j++)
00109       res.set(j,i) = vect_dd[j] + 2*vect_d[j] - l*(l-1)*vect[j] - masse*masse/alpha/alpha*vect_bis[j] ; 
00110   }
00111 
00112   delete [] vect ;
00113   delete [] vect_bis ;
00114   delete [] vect_dd ;
00115   
00116   return res ;
00117 } 
00118 
00119 
00120     
00121 void Ope_helmholtz_minus_pseudo_1d::do_ope_mat() const {
00122   if (ope_mat != 0x0) 
00123     delete ope_mat ;
00124 
00125   // Routines de derivation
00126   static Matrice (*helmholtz_minus_pseudo_1d_mat[MAX_BASE])(int, int, double, 
00127                              double, double, int);
00128   static int nap = 0 ;
00129   
00130   // Premier appel
00131   if (nap==0) {
00132     nap = 1 ;
00133     for (int i=0 ; i<MAX_BASE ; i++) {
00134       helmholtz_minus_pseudo_1d_mat[i] = _helmholtz_minus_pseudo_1d_mat_pas_prevu ;
00135     }
00136     // Les routines existantes
00137     helmholtz_minus_pseudo_1d_mat[R_CHEBU >> TRA_R] = _helmholtz_minus_pseudo_1d_mat_r_chebu ;
00138   }
00139   ope_mat = new Matrice(helmholtz_minus_pseudo_1d_mat[base_r](nr, l_quant, masse, 
00140                                alpha, beta, dzpuis)) ;
00141 }

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