ope_poisson_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_poisson_pseudo_1d_cl_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_poisson_pseudo_1d/ope_poisson_pseudo_1d_cl.C,v 1.1 2004/08/24 09:14:48 p_grandclement Exp $" ;
00022 
00023 /*
00024  * $Id: ope_poisson_pseudo_1d_cl.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_cl.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 // Version Matrice --> Matrice
00035 Matrice _cl_poisson_pseudo_1d_pas_prevu (const Matrice & so) {
00036     cout << "Combinaison lineaire pas prevu..." << endl ;
00037     abort() ;
00038     exit(-1) ;
00039     return so;
00040 }
00041 
00042 
00043         //-------------------
00044            //--  R_CHEB   ------
00045           //-------------------
00046 
00047 Matrice _cl_poisson_pseudo_1d_r_cheb (const Matrice &source) {
00048    
00049   int n = source.get_dim(0) ;
00050   assert (n == source.get_dim(1)) ;
00051                 
00052   Matrice barre(source) ;
00053   int dirac = 1 ;
00054   for (int i=0 ; i<n-2 ; i++) {
00055     for (int j=0 ; j<n ; j++)
00056       barre.set(i, j) = ((1+dirac)*source(i, j)-source(i+2, j))
00057     /(i+1) ;
00058     if (i==0) dirac = 0 ;
00059   }
00060   
00061   Matrice res(barre) ;
00062   for (int i=0 ; i<n-4 ; i++)
00063     for (int j=0 ; j<n ; j++)
00064       res.set(i, j) = barre(i, j)-barre(i+2, j) ;
00065  
00066   return res ;
00067 }
00068     
00069     
00070         //-------------------
00071            //--  R_CHEBP   -----
00072           //-------------------
00073 
00074 
00075 Matrice _cl_poisson_pseudo_1d_r_chebp (const Matrice &source) {
00076     
00077   int n = source.get_dim(0) ;
00078   assert (n == source.get_dim(1)) ;
00079     
00080     Matrice barre(source) ;
00081   
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                 //-------------------
00103            //--  R_CHEBI   -----
00104           //-------------------
00105 
00106 
00107 Matrice _cl_poisson_pseudo_1d_r_chebi (const Matrice &source) {
00108     int n = source.get_dim(0) ;
00109   assert (n == source.get_dim(1)) ;
00110  
00111     Matrice barre(source) ;
00112    
00113     for (int i=0 ; i<n-2 ; i++)
00114     for (int j=0 ; j<n ; j++)
00115         barre.set(i, j) = source(i, j)-source(i+2, j) ;
00116 
00117     Matrice tilde(barre) ;
00118     for (int i=0 ; i<n-4 ; i++)
00119     for (int j=0 ; j<n ; j++)
00120         tilde.set(i, j) = barre(i, j)-barre(i+2, j) ;    
00121 
00122     Matrice res(tilde) ;
00123     for (int i=0 ; i<n-4 ; i++)
00124     for (int j=0 ; j<n ; j++)
00125         res.set(i, j) = tilde(i, j)-tilde(i+1, j) ;
00126     
00127     return res ;
00128 } 
00129   
00130 void Ope_poisson_pseudo_1d::do_ope_cl() const {
00131   if (ope_mat == 0x0)
00132     do_ope_mat() ;
00133   
00134   if (ope_cl != 0x0)
00135     delete ope_cl ;
00136   
00137   // Routines de derivation
00138   static Matrice (*cl_poisson_pseudo_1d[MAX_BASE])(const Matrice&);
00139   static int nap = 0 ;
00140   
00141   // Premier appel
00142   if (nap==0) {
00143     nap = 1 ;
00144     for (int i=0 ; i<MAX_BASE ; i++) {
00145       cl_poisson_pseudo_1d[i] = _cl_poisson_pseudo_1d_pas_prevu ;
00146     }
00147     // Les routines existantes
00148     cl_poisson_pseudo_1d[R_CHEBP >> TRA_R] = _cl_poisson_pseudo_1d_r_chebp ;
00149     cl_poisson_pseudo_1d[R_CHEBI >> TRA_R] = _cl_poisson_pseudo_1d_r_chebi ;
00150     cl_poisson_pseudo_1d[R_CHEB >> TRA_R] = _cl_poisson_pseudo_1d_r_cheb ;
00151   }
00152   ope_cl = new Matrice(cl_poisson_pseudo_1d[base_r](*ope_mat)) ;
00153 }
00154 
00155 

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