prepa_poisson.C

00001 /*
00002  *   Copyright (c) 1999-2001 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 as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   LORENE is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with LORENE; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 
00023 char prepa_poisson_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/prepa_poisson.C,v 1.7 2008/02/18 13:53:43 j_novak Exp $" ;
00024 
00025 /*
00026  * $Id: prepa_poisson.C,v 1.7 2008/02/18 13:53:43 j_novak Exp $
00027  * $Log: prepa_poisson.C,v $
00028  * Revision 1.7  2008/02/18 13:53:43  j_novak
00029  * Removal of special indentation instructions.
00030  *
00031  * Revision 1.6  2007/12/12 12:30:48  jl_cornou
00032  * *** empty log message ***
00033  *
00034  * Revision 1.5  2004/02/20 10:55:23  j_novak
00035  * The versions dzpuis 5 -> 3 has been improved and polished. Should be
00036  * operational now...
00037  *
00038  * Revision 1.4  2004/02/06 10:53:54  j_novak
00039  * New dzpuis = 5 -> dzpuis = 3 case (not ready yet).
00040  *
00041  * Revision 1.3  2003/01/31 08:49:58  e_gourgoulhon
00042  * Increased the number nmax of stored matrices from 100 to 200.
00043  *
00044  * Revision 1.2  2002/10/16 14:37:12  j_novak
00045  * Reorganization of #include instructions of standard C++, in order to
00046  * use experimental version 3 of gcc.
00047  *
00048  * Revision 1.1.1.1  2001/11/20 15:19:28  e_gourgoulhon
00049  * LORENE
00050  *
00051  * Revision 2.17  2000/05/22  13:40:27  phil
00052  * ajout du cas dzpuis == 3
00053  *
00054  * Revision 2.16  2000/01/18  14:15:31  phil
00055  * enleve assert sur nobre de points min en r
00056  *
00057  * Revision 2.15  2000/01/04  19:00:21  phil
00058  * Double nmax
00059  *
00060  * Revision 2.14  1999/10/12  09:38:16  phil
00061  * passage en const Matrice &
00062  *
00063  * Revision 2.13  1999/10/11  14:29:25  phil
00064  * & -> &&
00065  *
00066  * Revision 2.12  1999/09/30  09:20:19  phil
00067  * remplacement des && en &
00068  *
00069  * Revision 2.11  1999/09/17  15:24:46  phil
00070  * correction definition de NMAX
00071  *
00072  * Revision 2.10  1999/06/23  12:34:44  phil
00073  * ajout de dzpuis = 2
00074  *
00075  * Revision 2.9  1999/04/28  10:47:12  phil
00076  * augmentation de NMAX a 50
00077  *
00078  * Revision 2.8  1999/04/19  14:28:47  phil
00079  * *** empty log message ***
00080  *
00081  * Revision 2.7  1999/04/19  14:05:32  phil
00082  * *** empty log message ***
00083  *
00084  * Revision 2.6  1999/04/16  13:18:37  phil
00085  * *** empty log message ***
00086  *
00087  * Revision 2.5  1999/04/16  13:16:24  phil
00088  * *** empty log message ***
00089  *
00090  * Revision 2.4  1999/04/14  13:56:42  phil
00091  * Sauvegarde des Matrices deja calculees
00092  *
00093  * Revision 2.3  1999/04/07  14:38:05  phil
00094  * *** empty log message ***
00095  *
00096  * Revision 2.2  1999/04/07  14:26:22  phil
00097  * *** empty log message ***
00098  *
00099  * Revision 2.1  1999/04/07  14:24:14  phil
00100  * Les matrices sont passees par reference
00101  *
00102  * Revision 2.0  1999/04/07  14:11:07  phil
00103  * *** empty log message ***
00104  *
00105  *
00106  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/prepa_poisson.C,v 1.7 2008/02/18 13:53:43 j_novak Exp $
00107  *
00108  */
00109 
00110 //fichiers includes
00111 #include <stdio.h>
00112 #include <stdlib.h>
00113 #include <math.h>
00114 
00115 #include "matrice.h"
00116 #include "type_parite.h"
00117 #include "proto.h"
00118 
00119 /*
00120  * Fonctions supprimant le nombre de colonnes (les premieres)
00121   et de lignes (les dernieres) a l'operateur renvoye par laplacien_mat, de facon
00122   a ce qu'il ne soit plus degenere. Ceci doit etre fait apres les combinaisons
00123   lineaires. La mise a bandes et la decomposition LU sont egalement effectuees ici
00124   
00125   
00126   Entree : lap :  resultat de laplacien_mat
00127         l : associe a lap
00128         puis : puissance dans la ZEC
00129         base_r : base de developpement
00130         
00131   Sortie : renvoie un operateur non degenere ....
00132  */
00133  
00134  
00135 
00136 
00137         //------------------------------------
00138         // Routine pour les cas non prevus --
00139         //-----------------------------------
00140 
00141 Matrice _prepa_nondege_pas_prevu(const Matrice &lap, int l, double echelle, int puis) {
00142     cout << "Construction non degeneree pas prevue..." << endl ;
00143     cout << "l : " << l << endl ;
00144     cout << "lap : " << lap << endl ;
00145     cout << "echelle : " << echelle << endl ;
00146     cout << " puis : " << puis << endl ;
00147     abort() ;
00148     exit(-1) ;
00149     Matrice res(1, 1) ;
00150     return res;
00151 }
00152 
00153 
00154 
00155             //-------------------
00156            //--  R_CHEB   -------
00157           //--------------------
00158 
00159 Matrice _prepa_nondege_r_cheb (const Matrice &lap, int l, double echelle, int) {
00160     
00161     
00162     int n = lap.get_dim(0) ;
00163     
00164    const int nmax = 200 ; // Nombre de Matrices stockees
00165    static Matrice* tab[nmax] ;  // les matrices calculees
00166    static int nb_dejafait = 0 ; // nbre de matrices calculees
00167    static int l_dejafait[nmax] ;
00168    static int nr_dejafait[nmax] ;
00169    static double vieux_echelle = 0;
00170    
00171    // Si on a change l'echelle : on detruit tout :
00172    if (vieux_echelle != echelle) {
00173        for (int i=0 ; i<nb_dejafait ; i++) {
00174        l_dejafait[i] = -1 ;
00175        nr_dejafait[i] = -1 ;
00176        delete tab[i] ;   
00177        }
00178     vieux_echelle = echelle ;
00179      nb_dejafait = 0 ;
00180    }
00181       
00182    int indice = -1 ;
00183    
00184    // On determine si la matrice a deja ete calculee :
00185    for (int conte=0 ; conte<nb_dejafait ; conte ++)
00186     if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00187     indice = conte ;
00188     
00189    // Calcul a faire : 
00190    if (indice  == -1) {
00191        if (nb_dejafait >= nmax) {
00192        cout << "_prepa_nondege_r_cheb : trop de matrices" << endl ;
00193        abort() ;
00194        exit (-1) ;
00195        }
00196        
00197         
00198     l_dejafait[nb_dejafait] = l ;
00199     nr_dejafait[nb_dejafait] = n ;
00200     
00201     
00202     //assert (l<n) ;
00203     
00204     Matrice res(n-2, n-2) ;
00205     res.set_etat_qcq() ;
00206     for (int i=0 ; i<n-2 ; i++)
00207     for (int j=0 ; j<n-2 ; j++)
00208         res.set(i, j) = lap(i, j+2) ;
00209     
00210     res.set_band(2, 2) ;
00211     res.set_lu() ;
00212     tab[nb_dejafait] = new Matrice(res) ;
00213     nb_dejafait ++ ;
00214     return res ;
00215     } 
00216     
00217     // Cas ou le calcul a deja ete effectue :
00218     else
00219     return *tab[indice] ;  
00220 }
00221 
00222 
00223             //-------------------
00224            //--  R_JACO02  -----
00225           //-------------------
00226 
00227 Matrice _prepa_nondege_r_jaco02 (const Matrice &lap, int l, double echelle, int) {
00228     
00229     
00230     int n = lap.get_dim(0) ;
00231     
00232    const int nmax = 200 ; // Nombre de Matrices stockees
00233    static Matrice* tab[nmax] ;  // les matrices calculees
00234    static int nb_dejafait = 0 ; // nbre de matrices calculees
00235    static int l_dejafait[nmax] ;
00236    static int nr_dejafait[nmax] ;
00237    static double vieux_echelle = 0;
00238    
00239    // Si on a change l'echelle : on detruit tout :
00240    if (vieux_echelle != echelle) {
00241        for (int i=0 ; i<nb_dejafait ; i++) {
00242        l_dejafait[i] = -1 ;
00243        nr_dejafait[i] = -1 ;
00244        delete tab[i] ;   
00245        }
00246     vieux_echelle = echelle ;
00247      nb_dejafait = 0 ;
00248    }
00249       
00250    int indice = -1 ;
00251    
00252    // On determine si la matrice a deja ete calculee :
00253    for (int conte=0 ; conte<nb_dejafait ; conte ++)
00254     if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00255     indice = conte ;
00256     
00257    // Calcul a faire : 
00258    if (indice  == -1) {
00259        if (nb_dejafait >= nmax) {
00260        cout << "_prepa_nondege_r_jaco02 : trop de matrices" << endl ;
00261        abort() ;
00262        exit (-1) ;
00263        }
00264        
00265         
00266     l_dejafait[nb_dejafait] = l ;
00267     nr_dejafait[nb_dejafait] = n ;
00268     
00269     
00270     //assert (l<n) ;
00271     
00272     Matrice res(n-2, n-2) ;
00273     res.set_etat_qcq() ;
00274     for (int i=0 ; i<n-2 ; i++)
00275     for (int j=0 ; j<n-2 ; j++)
00276         res.set(i, j) = lap(i, j+2) ;
00277     
00278     res.set_band(2, 2) ;
00279     res.set_lu() ;
00280     tab[nb_dejafait] = new Matrice(res) ;
00281     nb_dejafait ++ ;
00282     return res ;
00283     } 
00284     
00285     // Cas ou le calcul a deja ete effectue :
00286     else
00287     return *tab[indice] ;  
00288 }
00289 
00290             //------------------
00291            //--  R_CHEBP   ----
00292           //------------------
00293           
00294 Matrice _prepa_nondege_r_chebp (const Matrice &lap, int l, double, int) {
00295     
00296     int n = lap.get_dim(0) ;
00297     
00298        
00299    const int nmax = 200 ; // Nombre de Matrices stockees
00300    static Matrice* tab[nmax] ;  // les matrices calculees
00301    static int nb_dejafait = 0 ; // nbre de matrices calculees
00302    static int l_dejafait[nmax] ;
00303    static int nr_dejafait[nmax] ;
00304     
00305    int indice = -1 ;
00306    
00307    // On determine si la matrice a deja ete calculee :
00308    for (int conte=0 ; conte<nb_dejafait ; conte ++)
00309     if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00310     indice = conte ;
00311     
00312    // Calcul a faire : 
00313    if (indice  == -1) {
00314        if (nb_dejafait >= nmax) {
00315        cout << "_prepa_nondege_r_chebp : trop de matrices" << endl ;
00316        abort() ;
00317        exit (-1) ;
00318        }
00319        
00320         
00321     l_dejafait[nb_dejafait] = l ;
00322     nr_dejafait[nb_dejafait] = n ;
00323     
00324     assert (div(l, 2).rem == 0) ;
00325   //  assert (l<=2*n-2) ;
00326     
00327     if (l==0) {
00328     Matrice res(n-1, n-1) ;
00329     res.set_etat_qcq() ;
00330     for (int i=0 ; i<n-1 ; i++)
00331         for (int j=0 ; j<n-1 ; j++)
00332         res.set(i, j) = lap(i, j+1) ;
00333     res.set_band(3, 0) ;
00334     res.set_lu() ;
00335     tab[nb_dejafait] = new Matrice(res) ;
00336     nb_dejafait ++ ;
00337     return res ;
00338     }
00339     else {
00340     Matrice res(n-2, n-2) ;
00341     res.set_etat_qcq() ;
00342     for (int i=0 ;i<n-2 ; i++)
00343         for (int j=0 ; j<n-2 ; j++)
00344         res.set(i, j) = lap(i, j+2) ;
00345     
00346     res.set_band(2, 1) ;    
00347     res.set_lu() ;
00348     tab[nb_dejafait] = new Matrice(res) ;
00349     nb_dejafait ++ ;
00350     return res ;
00351      }
00352     }
00353     // Cas ou le calcul a deja ete effectue :
00354     else
00355     return *tab[indice] ;
00356 }
00357 
00358 
00359 
00360 
00361             //-------------------
00362            //--  R_CHEBI   -----
00363           //-------------------
00364           
00365 Matrice _prepa_nondege_r_chebi (const Matrice &lap, int l, double, int) {
00366     
00367     int n = lap.get_dim(0) ;
00368        
00369    const int nmax = 200 ; // Nombre de Matrices stockees
00370    static Matrice* tab[nmax] ;  // les matrices calculees
00371    static int nb_dejafait = 0 ; // nbre de matrices calculees
00372    static int l_dejafait[nmax] ;
00373    static int nr_dejafait[nmax] ;
00374     
00375    int indice = -1 ;
00376    
00377    // On determine si la matrice a deja ete calculee :
00378    for (int conte=0 ; conte<nb_dejafait ; conte ++)
00379     if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00380     indice = conte ;
00381     
00382    // Calcul a faire : 
00383    if (indice  == -1) {
00384        if (nb_dejafait >= nmax) {
00385        cout << "_prepa_nondege_r_chebi : trop de matrices" << endl ;
00386        abort() ;
00387        exit (-1) ;
00388        }
00389        
00390         
00391     l_dejafait[nb_dejafait] = l ;
00392     nr_dejafait[nb_dejafait] = n ;
00393     
00394     
00395     assert (div(l, 2).rem == 1) ;
00396   //  assert (l<=2*n-1) ;
00397     
00398     if (l==1) {
00399     Matrice res(n-1, n-1) ;
00400     res.set_etat_qcq() ;
00401     for (int i=0 ; i<n-1 ; i++)
00402         for (int j=0 ; j<n-1 ; j++)
00403         res.set(i, j) = lap(i, j+1) ;
00404     res.set_band(3, 0) ;
00405     res.set_lu() ;
00406     tab[nb_dejafait] = new Matrice(res) ;
00407     nb_dejafait ++ ;
00408     return res ;
00409     }
00410     else {
00411     Matrice res(n-2, n-2) ;
00412     res.set_etat_qcq() ;
00413     for (int i=0 ;i<n-2 ; i++)
00414         for (int j=0 ; j<n-2 ; j++)
00415         res.set(i, j) = lap(i, j+2) ;
00416     
00417     res.set_band(2, 1) ;
00418     res.set_lu() ;
00419     tab[nb_dejafait] = new Matrice(res) ;
00420     nb_dejafait ++ ;
00421     return res ;
00422     } 
00423     }
00424     // Cas ou le calcul a deja ete effectue :
00425     else
00426     return *tab[indice] ;
00427 }
00428 
00429 
00430 
00431 
00432             //-------------------
00433            //--  R_CHEBU   -----
00434           //-------------------
00435           
00436           
00437 Matrice _prepa_nondege_r_chebu (const Matrice &lap, int l, double, int puis) {
00438 
00439     switch (puis) {
00440     case 5 :
00441         return _prepa_nondege_r_chebu_cinq (lap, l) ;
00442     case 4 :
00443         return _prepa_nondege_r_chebu_quatre (lap, l) ;
00444     case 3 :
00445         return _prepa_nondege_r_chebu_trois (lap, l) ;
00446     case 2 :
00447         return _prepa_nondege_r_chebu_deux (lap, l) ;
00448     default :
00449         abort() ;
00450         exit(-1) ;
00451         return Matrice(0, 0) ;
00452     }
00453 }
00454 
00455 // Cas dzpuis = 4 ;
00456 Matrice _prepa_nondege_r_chebu_quatre (const Matrice &lap, int l) {
00457     
00458     int n = lap.get_dim(0) ;
00459     
00460    const int nmax = 200; // Nombre de Matrices stockees
00461    static Matrice* tab[nmax] ;  // les matrices calculees
00462    static int nb_dejafait = 0 ; // nbre de matrices calculees
00463    static int l_dejafait[nmax] ;
00464    static int nr_dejafait[nmax] ;
00465     
00466    int indice = -1 ;
00467    
00468    // On determine si la matrice a deja ete calculee :
00469    for (int conte=0 ; conte<nb_dejafait ; conte ++)
00470     if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00471     indice = conte ;
00472     
00473    // Calcul a faire : 
00474    if (indice  == -1) {
00475        if (nb_dejafait >= nmax) {
00476        cout << "_prepa_nondege_r_chebu : trop de matrices" << endl ;
00477        abort() ;
00478        exit (-1) ;
00479        }
00480        
00481         
00482     l_dejafait[nb_dejafait] = l ;
00483     nr_dejafait[nb_dejafait] = n ;
00484     
00485   //  assert (l<=n-2) ;
00486     
00487     if (l==0) {
00488     Matrice res(n-2, n-2) ;
00489     res.set_etat_qcq() ;
00490     for (int i=0 ; i<n-2 ; i++)
00491         for (int j=0 ; j<n-2 ; j++)
00492         res.set(i, j) = lap(i, j+2) ;
00493     res.set_band(3, 0) ;
00494     res.set_lu() ;
00495     tab[nb_dejafait] = new Matrice(res) ;
00496     nb_dejafait ++ ;
00497     return res ;
00498     }
00499     else {
00500     Matrice res(n-3, n-3) ;
00501     res.set_etat_qcq() ;
00502     for (int i=0 ;i<n-3 ; i++)
00503         for (int j=0 ; j<n-3 ; j++)
00504         res.set(i, j) = lap(i, j+3) ;
00505     
00506     res.set_band(2, 1) ;
00507     res.set_lu() ;
00508     tab[nb_dejafait] = new Matrice(res) ;
00509     nb_dejafait ++ ;
00510     return res ;
00511     } 
00512     }
00513     // Cas ou le calcul a deja ete effectue :
00514     else
00515     return *tab[indice] ;
00516 }
00517 // Cas dzpuis = 3 ;
00518 Matrice _prepa_nondege_r_chebu_trois (const Matrice &lap, int l) {
00519     
00520     int n = lap.get_dim(0) ;
00521     
00522    const int nmax = 200; // Nombre de Matrices stockees
00523    static Matrice* tab[nmax] ;  // les matrices calculees
00524    static int nb_dejafait = 0 ; // nbre de matrices calculees
00525    static int l_dejafait[nmax] ;
00526    static int nr_dejafait[nmax] ;
00527     
00528    int indice = -1 ;
00529    
00530    // On determine si la matrice a deja ete calculee :
00531    for (int conte=0 ; conte<nb_dejafait ; conte ++)
00532     if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00533     indice = conte ;
00534     
00535    // Calcul a faire : 
00536    if (indice  == -1) {
00537        if (nb_dejafait >= nmax) {
00538        cout << "_prepa_nondege_r_chebu_trois : trop de matrices" << endl ;
00539        abort() ;
00540        exit (-1) ;
00541        }
00542        
00543     l_dejafait[nb_dejafait] = l ;
00544     nr_dejafait[nb_dejafait] = n ;
00545     
00546     Matrice res(n-2, n-2) ;
00547     res.set_etat_qcq() ;
00548     for (int i=0 ; i<n-2 ; i++)
00549     for (int j=0 ; j<n-2 ; j++)
00550         res.set(i, j) = lap(i, j+2) ;
00551     res.set_band(2, 1) ;
00552     res.set_lu() ;
00553     tab[nb_dejafait] = new Matrice(res) ;
00554     nb_dejafait ++ ;
00555     return res ;
00556     }
00557     // Cas ou le calcul a deja ete effectue :
00558     else
00559     return *tab[indice] ;
00560 }
00561 
00562 // Cas dzpuis = 2 ;
00563 Matrice _prepa_nondege_r_chebu_deux (const Matrice &lap, int l) {
00564     
00565    int n = lap.get_dim(0) ;
00566     
00567    const int nmax = 200; // Nombre de Matrices stockees
00568    static Matrice* tab[nmax] ;  // les matrices calculees
00569    static int nb_dejafait = 0 ; // nbre de matrices calculees
00570    static int l_dejafait[nmax] ;
00571    static int nr_dejafait[nmax] ;
00572     
00573    int indice = -1 ;
00574    
00575    // On determine si la matrice a deja ete calculee :
00576    for (int conte=0 ; conte<nb_dejafait ; conte ++)
00577     if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00578     indice = conte ;
00579     
00580    // Calcul a faire : 
00581    if (indice  == -1) {
00582        if (nb_dejafait >= nmax) {
00583        cout << "_prepa_nondege_r_chebu : trop de matrices" << endl ;
00584        abort() ;
00585        exit (-1) ;
00586        }
00587        
00588         
00589     l_dejafait[nb_dejafait] = l ;
00590     nr_dejafait[nb_dejafait] = n ;
00591     
00592   //  assert (l<=n-2) ;
00593     
00594     if (l==0) {
00595     Matrice res(n-2, n-2) ;
00596     res.set_etat_qcq() ;
00597     for (int i=0 ;i<n-2 ; i++)
00598         for (int j=0 ; j<n-2 ; j++)
00599         res.set(i, j) = lap(i, j+2) ;
00600     res.set_band(3, 2) ;
00601     res.set_lu() ;
00602     tab[nb_dejafait] = new Matrice(res) ;
00603     nb_dejafait ++ ;
00604     return res ;
00605     }
00606     else {
00607     Matrice res(n-1, n-1) ;
00608     res.set_etat_qcq() ;
00609     for (int i=0 ;i<n-1 ; i++)
00610         for (int j=0 ; j<n-1 ; j++)
00611         res.set(i, j) = lap(i, j+1) ;
00612     res.set_band(4, 1) ;
00613     res.set_lu() ;
00614     tab[nb_dejafait] = new Matrice(res) ;
00615     nb_dejafait ++ ;
00616     return res ;
00617     }
00618     }
00619     // Cas ou le calcul a deja ete effectue :
00620     else
00621     return *tab[indice] ;
00622 }
00623 
00624 // Cas dzpuis = 5 ;
00625 Matrice _prepa_nondege_r_chebu_cinq (const Matrice &lap, int l) {
00626     
00627    int n = lap.get_dim(0) ;
00628     
00629    const int nmax = 200; // Nombre de Matrices stockees
00630    static Matrice* tab[nmax] ;  // les matrices calculees
00631    static int nb_dejafait = 0 ; // nbre de matrices calculees
00632    static int l_dejafait[nmax] ;
00633    static int nr_dejafait[nmax] ;
00634     
00635    int indice = -1 ;
00636    
00637    // On determine si la matrice a deja ete calculee :
00638    for (int conte=0 ; conte<nb_dejafait ; conte ++)
00639     if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00640     indice = conte ;
00641     
00642    // Calcul a faire : 
00643    if (indice  == -1) {
00644        if (nb_dejafait >= nmax) {
00645        cout << "_prepa_nondege_r_chebu : trop de matrices" << endl ;
00646        abort() ;
00647        exit (-1) ;
00648        }
00649        
00650         
00651     l_dejafait[nb_dejafait] = l ;
00652     nr_dejafait[nb_dejafait] = n ;
00653     
00654   //  assert (l<=n-2) ;
00655     
00656      if (l<2) {
00657        tab[nb_dejafait] = new Matrice(lap) ;
00658        tab[nb_dejafait]->set_band(5,0) ;
00659        tab[nb_dejafait]->set_lu()  ;
00660        nb_dejafait++ ;
00661        return *tab[nb_dejafait-1] ;
00662      }
00663      else {
00664        Matrice res(n-1, n-1) ;
00665        res.set_etat_qcq() ;
00666        for (int i=0 ;i<n-1 ; i++)
00667      for (int j=0 ; j<n-1 ; j++)
00668        res.set(i, j) = lap(i, j+1) ;
00669        res.set_band(4, 1) ;
00670        res.set_lu() ;
00671        tab[nb_dejafait] = new Matrice(res) ;
00672        nb_dejafait ++ ;
00673        return res ;
00674      }
00675     
00676    }
00677    // Cas ou le calcul a deja ete effectue :
00678    else
00679      return *tab[indice] ;
00680 }
00681 
00682             //-------------------
00683            //--  Fonction   ----
00684           //-------------------
00685           
00686 
00687 Matrice prepa_nondege(const Matrice &lap, int l, double echelle, int puis, int base_r)
00688 {
00689 
00690         // Routines de derivation
00691     static Matrice (*prepa_nondege[MAX_BASE])(const Matrice&, int, double, int) ;
00692     static int nap = 0 ;
00693 
00694         // Premier appel
00695     if (nap==0) {
00696     nap = 1 ;
00697     for (int i=0 ; i<MAX_BASE ; i++) {
00698         prepa_nondege[i] = _prepa_nondege_pas_prevu ;
00699     }
00700         // Les routines existantes
00701     prepa_nondege[R_CHEB >> TRA_R] = _prepa_nondege_r_cheb ;
00702     prepa_nondege[R_CHEBU >> TRA_R] = _prepa_nondege_r_chebu ;
00703     prepa_nondege[R_CHEBP >> TRA_R] = _prepa_nondege_r_chebp ;
00704     prepa_nondege[R_CHEBI >> TRA_R] = _prepa_nondege_r_chebi ;
00705     prepa_nondege[R_JACO02 >> TRA_R] = _prepa_nondege_r_jaco02 ;
00706     }
00707     
00708     Matrice res(prepa_nondege[base_r](lap, l, echelle, puis)) ;
00709     return res ;
00710 }
00711 

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