00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 char comb_lin_helmholtz_plusC[] = "$Header $" ;
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include <stdio.h>
00044 #include <stdlib.h>
00045 #include <math.h>
00046
00047 #include "matrice.h"
00048 #include "type_parite.h"
00049 #include "proto.h"
00050
00051
00052
00053 Matrice _cl_helmholtz_plus_pas_prevu (const Matrice& so) {
00054 cout << "CL Helmholtz plus not implemented" << endl ;
00055 abort() ;
00056 exit(-1) ;
00057 return so;
00058 }
00059
00060
00061
00062
00063
00064
00065
00066 Matrice _cl_helmholtz_plus_r_chebp (const Matrice &source) {
00067
00068 int n = source.get_dim(0) ;
00069 assert (n == source.get_dim(1)) ;
00070
00071 Matrice barre(source) ;
00072
00073 int dirac = 1 ;
00074 for (int i=0 ; i<n-2 ; i++) {
00075 for (int j=0 ; j<n ; j++)
00076 barre.set(i, j) = (1+dirac)*source(i, j)-source(i+2, j) ;
00077 if (i==0) dirac = 0 ;
00078 }
00079
00080 Matrice tilde(barre) ;
00081 for (int i=0 ; i<n-4 ; i++)
00082 for (int j=0 ; j<n ; j++)
00083 tilde.set(i, j) = barre(i, j)-barre(i+2, j) ;
00084
00085 Matrice res(tilde) ;
00086 for (int i=0 ; i<n-4 ; i++)
00087 for (int j=0 ; j<n ; j++)
00088 res.set(i, j) = tilde(i, j)-tilde(i+1, j) ;
00089
00090 return res ;
00091 }
00092
00093
00094
00095
00096
00097
00098 Matrice _cl_helmholtz_plus_r_cheb (const Matrice& source) {
00099
00100
00101 int n = source.get_dim(0) ;
00102 assert (n==source.get_dim(1)) ;
00103
00104 Matrice barre(source) ;
00105 int dirac = 1 ;
00106 for (int i=0 ; i<n-2 ; i++) {
00107 for (int j=0 ; j<n ; j++)
00108 barre.set(i, j) = ((1+dirac)*source(i, j)-source(i+2, j))
00109 /(i+1) ;
00110 if (i==0) dirac = 0 ;
00111 }
00112
00113 Matrice res(barre) ;
00114 for (int i=0 ; i<n-4 ; i++)
00115 for (int j=0 ; j<n ; j++)
00116 res.set(i, j) = barre(i, j)-barre(i+2, j) ;
00117
00118 return res ;
00119 }
00120
00121
00122
00123
00124
00125
00126 Matrice cl_helmholtz_plus (const Matrice &source, int base_r) {
00127
00128
00129 static Matrice (*cl_helmholtz_plus[MAX_BASE]) (const Matrice &) ;
00130 static int nap = 0 ;
00131
00132
00133 if (nap==0) {
00134 nap = 1 ;
00135 for (int i=0 ; i<MAX_BASE ; i++) {
00136 cl_helmholtz_plus[i] = _cl_helmholtz_plus_pas_prevu ;
00137 }
00138
00139 cl_helmholtz_plus[R_CHEB >> TRA_R] = _cl_helmholtz_plus_r_cheb ;
00140 cl_helmholtz_plus[R_CHEBP >> TRA_R] = _cl_helmholtz_plus_r_chebp ;
00141 }
00142
00143 Matrice res(cl_helmholtz_plus[base_r](source)) ;
00144 return res ;
00145 }
00146
00147
00148
00149
00150
00151
00152
00153 Tbl _cl_helmholtz_plus_pas_prevu (const Tbl &so) {
00154
00155 cout << "Linear combination for Helmholtz plus not implemented..." << endl ;
00156 abort() ;
00157 exit(-1) ;
00158 return so;
00159 }
00160
00161
00162
00163
00164
00165 Tbl _cl_helmholtz_plus_r_chebp (const Tbl& source) {
00166
00167 int n = source.get_dim(0) ;
00168
00169 Tbl barre(source) ;
00170 int dirac = 1 ;
00171 for (int i=0 ; i<n-2 ; i++) {
00172 barre.set(i) = (1+dirac)*source(i)-source(i+2) ;
00173 if (i==0) dirac = 0 ;
00174 }
00175
00176 Tbl tilde(barre) ;
00177 for (int i=0 ; i<n-4 ; i++)
00178 tilde.set(i) = barre(i)-barre(i+2) ;
00179
00180 Tbl res(tilde) ;
00181 for (int i=0 ; i<n-4 ; i++)
00182 res.set(i) = tilde(i)-tilde(i+1) ;
00183
00184 return res ;
00185 }
00186
00187
00188
00189
00190 Tbl _cl_helmholtz_plus_r_cheb (const Tbl& source) {
00191
00192 int n = source.get_dim(0) ;
00193
00194 Tbl barre(source) ;
00195 int dirac = 1 ;
00196 for (int i=0 ; i<n-2 ; i++) {
00197 barre.set(i) = ((1+dirac)*source(i)-source(i+2))
00198 /(i+1) ;
00199 if (i==0) dirac = 0 ;
00200 }
00201
00202 Tbl res(barre) ;
00203 for (int i=0 ; i<n-4 ; i++)
00204 res.set(i) = barre(i)-barre(i+2) ;
00205
00206 return res ;
00207 }
00208
00209
00210
00211
00212 Tbl cl_helmholtz_plus (const Tbl &source, int base_r) {
00213
00214
00215 static Tbl (*cl_helmholtz_plus[MAX_BASE])(const Tbl &) ;
00216 static int nap = 0 ;
00217
00218
00219 if (nap==0) {
00220 nap = 1 ;
00221 for (int i=0 ; i<MAX_BASE ; i++) {
00222 cl_helmholtz_plus[i] = _cl_helmholtz_plus_pas_prevu ;
00223 }
00224
00225 cl_helmholtz_plus[R_CHEB >> TRA_R] = _cl_helmholtz_plus_r_cheb ;
00226 cl_helmholtz_plus[R_CHEBP >> TRA_R] = _cl_helmholtz_plus_r_chebp ;
00227 }
00228
00229 Tbl res(cl_helmholtz_plus[base_r](source)) ;
00230 return res ;
00231 }