ope_helmholtz_minus_pseudo_1d_cl.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_cl_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_pseudo_1d/ope_helmholtz_minus_pseudo_1d_cl.C,v 1.1 2004/08/24 10:22:41 p_grandclement Exp $" ;
00022 
00023 /*
00024  * $Id: ope_helmholtz_minus_pseudo_1d_cl.C,v 1.1 2004/08/24 10:22:41 p_grandclement Exp $
00025  * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_pseudo_1d/ope_helmholtz_minus_pseudo_1d_cl.C,v 1.1 2004/08/24 10:22:41 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 Matrice _cl_helmholtz_minus_pseudo_1d_pas_prevu (const Matrice & source, int) {
00036     cout << "Combinaison lineaire pas prevue..." << endl ;
00037     abort() ;
00038     exit(-1) ;
00039     return source;
00040 }
00041 
00042 
00043         //-------------------
00044            //--  R_CHEBU   -----
00045           //-------------------
00046 
00047 Matrice _cl_helmholtz_minus_pseudo_1d_r_chebu_deux (const Matrice&) ;
00048 
00049 
00050 Matrice _cl_helmholtz_minus_pseudo_1d_r_chebu (const Matrice &source, int puis) {
00051     int n = source.get_dim(0) ;
00052     assert (n == source.get_dim(1)) ;
00053     
00054     Matrice res(n, n) ;
00055     res.set_etat_qcq() ;
00056     
00057     switch (puis) {
00058     case 2 :
00059         res = _cl_helmholtz_minus_pseudo_1d_r_chebu_deux(source) ;
00060         break ;
00061     default :
00062         abort() ;
00063         exit(-1) ;
00064     }
00065     
00066     return res ;
00067 }
00068 
00069 
00070 //Cas dzpuis == 2
00071 Matrice _cl_helmholtz_minus_pseudo_1d_r_chebu_deux (const Matrice &source) {
00072 
00073   int n = source.get_dim(0) ;
00074   assert (n == source.get_dim(1)) ;
00075     
00076   Matrice barre(source) ;
00077   int dirac = 1 ;
00078   for (int i=0 ; i<n-2 ; i++) {
00079     for (int j=0 ; j<n ; j++)
00080       barre.set(i, j) = ((1+dirac)*source(i, j)-source(i+2, j)) ;
00081     if (i==0) dirac = 0 ;
00082   }
00083    
00084   Matrice tilde(barre) ;
00085   for (int i=0 ; i<n-4 ; i++)
00086     for (int j=0 ; j<n ; j++)
00087       tilde.set(i, j) = (barre(i, j)-barre(i+2, j)) ;
00088   
00089   Matrice bis(tilde) ;
00090   for (int i=0 ; i<n-4 ; i++)
00091     for (int j=0 ; j<n ; j++)
00092       bis.set(i, j) = (tilde(i, j)+tilde(i+1, j)) ;
00093 
00094   Matrice res (bis) ;
00095   for (int i=0 ; i<n-4 ; i++)
00096     for (int j=0 ; j<n ; j++)
00097       res.set(i, j) = (bis(i, j)-bis(i+1, j)) ;
00098 
00099   
00100 
00101   return res ;
00102 }
00103 
00104 void Ope_helmholtz_minus_pseudo_1d::do_ope_cl() const {
00105   if (ope_mat == 0x0)
00106     do_ope_mat() ;
00107 
00108   if (ope_cl != 0x0)
00109     delete ope_cl ;
00110   
00111   // Routines de derivation
00112   static Matrice (*cl_helmholtz_minus_pseudo_1d[MAX_BASE])(const Matrice&, int);
00113   static int nap = 0 ;
00114   
00115   // Premier appel
00116   if (nap==0) {
00117     nap = 1 ;
00118     for (int i=0 ; i<MAX_BASE ; i++) {
00119       cl_helmholtz_minus_pseudo_1d[i] = _cl_helmholtz_minus_pseudo_1d_pas_prevu ;
00120     }
00121     // Les routines existantes
00122     cl_helmholtz_minus_pseudo_1d[R_CHEBU >> TRA_R] = _cl_helmholtz_minus_pseudo_1d_r_chebu ;
00123   }
00124   ope_cl = new Matrice(cl_helmholtz_minus_pseudo_1d[base_r](*ope_mat, dzpuis)) ;
00125 }
00126 
00127 

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