00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
00025
00026
00027
00028 #include <math.h>
00029 #include <stdlib.h>
00030
00031 #include "proto.h"
00032 #include "ope_elementary.h"
00033
00034
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
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
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
00112 static Matrice (*cl_helmholtz_minus_pseudo_1d[MAX_BASE])(const Matrice&, int);
00113 static int nap = 0 ;
00114
00115
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
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