ope_vorton_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_vorton_mat_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_vorton/ope_vorton_mat.C,v 1.2 2007/04/24 15:52:55 p_grandclement Exp $" ;
00022 
00023 /*
00024  * $Id: ope_vorton_mat.C,v 1.2 2007/04/24 15:52:55 p_grandclement Exp $
00025  * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_vorton/ope_vorton_mat.C,v 1.2 2007/04/24 15:52:55 p_grandclement Exp $
00026  *
00027  */
00028 #include <math.h>
00029 #include <stdlib.h>
00030 
00031 #include "proto.h"
00032 #include "ope_elementary.h"
00033 #include "diff.h"
00034 
00035 
00036                       //-----------------------------------
00037                      // Routine pour les cas non prevus -- 
00038                      //-----------------------------------
00039 
00040 Matrice _vorton_mat_pas_prevu(int, double, double, int, int) {
00041   cout << "Vorton : base not implemented..." << endl ;
00042   abort() ;
00043   exit(-1) ;
00044   Matrice res(1, 1) ;
00045   return res;
00046 }
00047                     //-------------------------
00048             //--   CAS R_CHEBU   -----
00049             //------------------------
00050 
00051 Matrice _vorton_mat_r_chebu_trois (int n, int lq) {
00052 
00053 
00054     Diff_xdsdx2 xdd(R_CHEBU, n) ;
00055     Diff_dsdx d(R_CHEBU, n) ;
00056     Diff_sx sx(R_CHEBU, n) ;
00057 
00058     return (xdd+2*d-lq*(lq+1)*sx) ;
00059 }
00060 
00061 Matrice _vorton_mat_r_chebu (int n, double, double, int lq, int dz) {
00062     Matrice res(n, n) ;
00063     res.set_etat_qcq() ;
00064     switch (dz) {
00065     case 3 :
00066         res = _vorton_mat_r_chebu_trois (n, lq) ;
00067         break ;
00068     default :
00069         abort() ;
00070         exit(-1) ;
00071     }
00072     return res ;
00073 }
00074 
00075 
00076 
00077                     //-------------------------
00078             //--   CAS R_CHEB   -----
00079             //------------------------
00080 
00081 Matrice _vorton_mat_r_cheb (int n, double alpha, double beta, int lq, int) {
00082        Diff_dsdx2 d2(R_CHEB, n) ;
00083        Diff_xdsdx2 xd2(R_CHEB, n) ;
00084        Diff_x2dsdx2 x2d2(R_CHEB, n) ;
00085        Diff_dsdx d1(R_CHEB, n) ;
00086        Diff_xdsdx xd1(R_CHEB, n) ;
00087        Diff_id id(R_CHEB, n) ;
00088 
00089        double echelle = beta/alpha ;
00090        return (x2d2 + (2*echelle)*xd2 + (echelle*echelle)*d2 - (lq*(lq+1))*id) ;
00091 }
00092 
00093 void Ope_vorton::do_ope_mat() const {
00094   if (ope_mat != 0x0) 
00095     delete ope_mat ;
00096 
00097   // Routines de derivation
00098   static Matrice (*vorton_mat[MAX_BASE])(int, double, double, int, int);
00099   static int nap = 0 ;
00100   
00101   // Premier appel
00102   if (nap==0) {
00103     nap = 1 ;
00104     for (int i=0 ; i<MAX_BASE ; i++) {
00105       vorton_mat[i] = _vorton_mat_pas_prevu ;
00106     }
00107     // Les routines existantes
00108     vorton_mat[R_CHEB >> TRA_R] = _vorton_mat_r_cheb ;
00109     vorton_mat[R_CHEBU >> TRA_R] = _vorton_mat_r_chebu ;
00110   }
00111   ope_mat = new Matrice(vorton_mat[base_r](nr, alpha, beta, l_quant, dzpuis)) ;
00112 }

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