ope_vorton_cl.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_cl_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_vorton/ope_vorton_cl.C,v 1.2 2007/04/24 15:52:55 p_grandclement Exp $" ;
00022 
00023 /*
00024  * $Id: ope_vorton_cl.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_cl.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 
00034 // Version Matrice --> Matrice
00035 
00036         //-------------------
00037            //-- Pas prevu   ----
00038           //-------------------
00039 
00040 Matrice _cl_vorton_pas_prevu (const Matrice& so, int) {
00041   cout << "CL vorton not implemented" << endl ;
00042   abort() ;
00043   exit(-1) ;
00044   return so;
00045 }
00046 
00047         //-------------------
00048            //--  R_CHEB   ------
00049           //-------------------
00050 
00051 Matrice _cl_vorton_r_cheb (const Matrice& source, int) {
00052 
00053   int n = source.get_dim(0) ;
00054   assert (n==source.get_dim(1)) ;
00055   
00056   Matrice barre(source) ;
00057   int dirac = 1 ;
00058   for (int i=0 ; i<n-2 ; i++) {
00059          for (int j=0 ; j<n ; j++)
00060         barre.set(i, j) = ((1+dirac)*source(i, j)-source(i+2, j))
00061                 /(i+1) ;
00062     if (i==0) dirac = 0 ;
00063    }
00064     
00065    Matrice res(barre) ;
00066    for (int i=0 ; i<n-4 ; i++)
00067     for (int j=0 ; j< n ; j++)
00068         res.set(i, j) = barre(i, j)-barre(i+2, j) ;
00069   return res ;
00070 }
00071 
00072             //-------------------
00073            //--  R_CHEBU   -----
00074           //-------------------
00075 
00076 Matrice _cl_vorton_r_chebu_trois (const Matrice &source) {
00077 
00078     int n = source.get_dim(0) ;
00079     assert (n == source.get_dim(1)) ; 
00080  
00081     Matrice barre(source) ;
00082     int dirac = 1 ;
00083     for (int i=0 ; i<n-2 ; i++) {
00084     for (int j=0 ; j<n ; j++)
00085          barre.set(i, j) = ((1+dirac)*source(i, j)-source(i+2, j)) ;
00086     if (i==0) dirac = 0 ;
00087     }
00088     
00089     Matrice tilde(barre) ;
00090     for (int i=0 ; i<n-4 ; i++)
00091     for (int j=0 ; j<n ; j++)
00092         tilde.set(i, j) = (barre(i, j)-barre(i+2, j)) ;
00093     
00094     Matrice res(tilde) ;
00095     for (int i=0 ; i<n-4 ; i++)
00096     for (int j=0 ; j<n ; j++)
00097         res.set(i, j) = (tilde(i, j)+tilde(i+1, j)) ;
00098 
00099     return res ;
00100 }
00101     
00102 Matrice _cl_vorton_r_chebu (const Matrice &source, int puis) {
00103     int n = source.get_dim(0) ;
00104     assert (n == source.get_dim(1)) ;
00105     
00106     Matrice res(n, n) ;
00107     res.set_etat_qcq() ;
00108     
00109     switch (puis) {
00110     case 3 :
00111         res = _cl_vorton_r_chebu_trois(source) ;
00112         break ;
00113     default :
00114         abort() ;
00115         exit(-1) ;
00116       }
00117 return res ;
00118 }
00119 
00120 
00121 void Ope_vorton::do_ope_cl() const {
00122   if (ope_mat == 0x0)
00123     do_ope_mat() ;
00124   
00125   if (ope_cl != 0x0)
00126     delete ope_cl ;
00127   
00128   // Routines de derivation
00129   static Matrice (*cl_vorton[MAX_BASE])(const Matrice&, int);
00130   static int nap = 0 ;
00131   
00132   // Premier appel
00133   if (nap==0) {
00134     nap = 1 ;
00135     for (int i=0 ; i<MAX_BASE ; i++) {
00136       cl_vorton[i] = _cl_vorton_pas_prevu ;
00137     }
00138     // Les routines existantes
00139     cl_vorton[R_CHEB >> TRA_R] = _cl_vorton_r_cheb ;
00140     cl_vorton[R_CHEBU >> TRA_R] = _cl_vorton_r_chebu ;
00141   }
00142   ope_cl = new Matrice(cl_vorton[base_r](*ope_mat, dzpuis)) ;
00143 }
00144 
00145 

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