ope_poisson_pseudo_1d_non_dege.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_poisson_pseudo_1d_non_dege_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_poisson_pseudo_1d/ope_poisson_pseudo_1d_non_dege.C,v 1.1 2004/08/24 09:14:48 p_grandclement Exp $" ;
00022 
00023 /*
00024  * $Id: ope_poisson_pseudo_1d_non_dege.C,v 1.1 2004/08/24 09:14:48 p_grandclement Exp $
00025  * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_poisson_pseudo_1d/ope_poisson_pseudo_1d_non_dege.C,v 1.1 2004/08/24 09:14:48 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         //------------------------------------
00036         // Routine pour les cas non prevus --
00037         //-----------------------------------
00038 
00039 Matrice _poisson_pseudo_1d_non_dege_pas_prevu(const Matrice &lap, int) {
00040     cout << "Construction non degeneree pas prevue..." << endl ;
00041     abort() ;
00042     exit(-1) ;
00043     return lap ;
00044 }
00045 
00046 
00047 
00048             //-------------------
00049            //--  R_CHEB   -------
00050           //--------------------
00051 
00052 Matrice _poisson_pseudo_1d_non_dege_r_cheb (const Matrice &lap, int) {
00053     
00054     
00055   int n = lap.get_dim(0) ;
00056   
00057   Matrice res(n-2, n-2) ;
00058   res.set_etat_qcq() ;
00059   for (int i=0 ; i<n-2 ; i++)
00060     for (int j=0 ; j<n-2 ; j++)
00061       res.set(i, j) = lap(i, j+2) ;
00062   
00063   res.set_band(2, 2) ;
00064   res.set_lu() ;
00065 
00066   return res ;
00067 } 
00068 
00069 
00070 
00071 
00072             //------------------
00073            //--  R_CHEBP   ----
00074           //------------------
00075           
00076 Matrice _poisson_pseudo_1d_non_dege_r_chebp (const Matrice &lap, int l) {
00077     
00078   int n = lap.get_dim(0) ;
00079   assert (div(l, 2).rem == 0) ;
00080   
00081     
00082   if (l==0) {
00083     Matrice res(n-1, n-1) ;
00084     res.set_etat_qcq() ;
00085     for (int i=0 ; i<n-1 ; i++)
00086       for (int j=0 ; j<n-1 ; j++)
00087     res.set(i, j) = lap(i, j+1) ;
00088     res.set_band(3, 0) ;
00089     res.set_lu() ;
00090     
00091     return res ;
00092   }
00093     else {
00094     Matrice res(n-2, n-2) ;
00095     res.set_etat_qcq() ;
00096     for (int i=0 ;i<n-2 ; i++)
00097         for (int j=0 ; j<n-2 ; j++)
00098         res.set(i, j) = lap(i, j+2) ;
00099     
00100     res.set_band(2, 1) ;    
00101     res.set_lu() ;
00102 
00103     return res ;
00104     }
00105 }
00106     
00107 
00108             //-------------------
00109            //--  R_CHEBI   -----
00110           //-------------------
00111           
00112 Matrice _poisson_pseudo_1d_non_dege_r_chebi (const Matrice &lap, int l) {
00113     
00114   int n = lap.get_dim(0) ;
00115     
00116   assert (div(l, 2).rem == 1) ; 
00117     
00118   if (l==1) {
00119     Matrice res(n-1, n-1) ;
00120     res.set_etat_qcq() ;
00121     for (int i=0 ; i<n-1 ; i++)
00122       for (int j=0 ; j<n-1 ; j++)
00123     res.set(i, j) = lap(i, j+1) ;
00124     res.set_band(3, 0) ;
00125     res.set_lu() ;
00126     
00127     return res ;
00128   }
00129   else {
00130     Matrice res(n-2, n-2) ;
00131     res.set_etat_qcq() ;
00132     for (int i=0 ;i<n-2 ; i++)
00133       for (int j=0 ; j<n-2 ; j++)
00134     res.set(i, j) = lap(i, j+2) ;
00135     
00136     res.set_band(2, 1) ;    
00137     res.set_lu() ;
00138 
00139     return res ;
00140   }
00141 }
00142 
00143 
00144 void Ope_poisson_pseudo_1d::do_non_dege() const {
00145   if (ope_cl == 0x0)
00146     do_ope_cl() ;
00147   
00148   if (non_dege != 0x0)
00149     delete non_dege ;
00150   
00151   // Routines de derivation
00152   static Matrice (*poisson_pseudo_1d_non_dege[MAX_BASE])(const Matrice&, int);
00153   static int nap = 0 ;
00154   
00155   // Premier appel
00156   if (nap==0) {
00157     nap = 1 ;
00158     for (int i=0 ; i<MAX_BASE ; i++) {
00159       poisson_pseudo_1d_non_dege[i] = _poisson_pseudo_1d_non_dege_pas_prevu ;
00160     }
00161     // Les routines existantes
00162     poisson_pseudo_1d_non_dege[R_CHEB >> TRA_R] = 
00163       _poisson_pseudo_1d_non_dege_r_cheb ;
00164     poisson_pseudo_1d_non_dege[R_CHEBP >> TRA_R] = 
00165       _poisson_pseudo_1d_non_dege_r_chebp ;
00166     poisson_pseudo_1d_non_dege[R_CHEBI >> TRA_R] = 
00167       _poisson_pseudo_1d_non_dege_r_chebi ;
00168   }
00169   non_dege = new Matrice(poisson_pseudo_1d_non_dege[base_r](*ope_cl, l_quant)) ;
00170 }

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