[LORENE] New display of spectral coefficients
Eric Gourgoulhon
Eric.Gourgoulhon at obspm.fr
Mon Oct 27 18:13:48 CET 2003
Dear All,
A new kind of display of the coefficients of spectral expansions
has been introduced in Lorene: instead of giving the coefficient
index (i,j,k), it shows the name of the basis function in
a "human readable" format, e.g.
T2 for the second order Chebyshev polynomial
cos3t for cos(3 theta)
sin2p for sin(2 phi)
P_2^1 for the associated Legendre function P_l^m(cos(theta)
with l=2 and m=1
etc...
This new display relies on the new methods of class Base_val:
*void Base_val::name_r(int l, int k, int j, int i, char* basename) **const
void Base_val::name_theta(int l, int k, int j, char* basename) const**
void Base_val::name_phi(int l, int k, char* basename) const
*These functions are used in the new method
*
void Mtbl_cf::display(double threshold = 1.e-7, int precision = 4,
ostream& ostr = cout) const*
which itself is used at the Valeur and Scalar levels:
*void Valeur::display_coef(double threshold = 1.e-7, int precision = 4,
ostream& ostr = cout) const*
*void Scalar::spectral_display(double threshold = 1.e-7, int precision = 4,
ostream& ostr = cout) const*
These new functions can be used instead of affiche_seuil.
Here is an example of usage:
#include <stdlib.h>
#include "tensor.h"
int main() {
// Construction of a multi-grid
Mg3d mgrid(2, 9, 5, 8, SYM, NONSYM, false) ;
// Construction of an affine mapping
double r_limits[] = {0., 1., 2.} ;
Map_af map(mgrid, r_limits) ;
// Construction of a scalar field
const Coord& x = map.x ;
const Coord& y = map.y ;
const Coord& z = map.z ;
Scalar uu(map) ;
uu = 1 + x + 2*y - z*z + x*y + x*x*y - z*z*y ;
uu.std_spectral_base() ; // sets the "standard" spectral basis
cout << "uu : " << endl ;
uu.spectral_display() ;
return EXIT_SUCCESS ;
}
The output is:
uu :
Spectral expansion (Mtbl_cf, threshold for display = 1e-07)
Bases of spectral expansions:
Domain #0 : r: R_CHEBPIM_P, theta: T_COSSIN_CP, phi: P_COSSIN
Domain #1 : r: R_CHEB , theta: T_COSSIN_CP, phi: P_COSSIN
--------- Domain no. 0 ------- nr x nt x np = 9 x 5 x 8 ------
# cos0p cos0t : 0.7500 T0 -0.2500 T2
# cos0p cos2t : -0.2500 T0 -0.2500 T2
# cos1p sin1t : 1.0000 T1
# sin1p sin1t : 1.953 T1 -0.01562 T3
# sin1p sin3t : -0.2344 T1 -0.07812 T3
# sin2p cos0t : 0.1250 T0 +0.1250 T2
# sin2p cos2t : -0.1250 T0 -0.1250 T2
# sin3p sin1t : 0.1406 T1 +0.04687 T3
# sin3p sin3t : -0.04688 T1 -0.01562 T3
--------- Domain no. 1 ------- nr x nt x np = 9 x 5 x 8 ------
# cos0p cos0t : -0.1875 T0 -0.7500 T1 -0.06250 T2
# cos0p cos2t : -1.187 T0 -0.7500 T1 -0.06250 T2
# cos1p sin1t : 1.500 T0 +0.5000 T1
# sin1p sin1t : 2.754 T0 +0.7832 T1 -0.03516 T2 -0.001953 T3
# sin1p sin3t : -1.230 T0 -1.084 T1 -0.1758 T2 -0.009766 T3
# sin2p cos0t : 0.5937 T0 +0.3750 T1 +0.03125 T2
# sin2p cos2t : -0.5938 T0 -0.3750 T1 -0.03125 T2
# sin3p sin1t : 0.7383 T0 +0.6504 T1 +0.1055 T2 +0.005859 T3
# sin3p sin3t : -0.2461 T0 -0.2168 T1 -0.03516 T2 -0.001953 T3
Best wishes,
Eric.
--
Eric Gourgoulhon
Laboratoire de l'Univers et de ses THeories (LUTH)
UMR 8102 du CNRS / Observatoire de Paris, F-92195 Meudon Cedex, France
tel: +33 1.45.07.74.33 (secretariat : +33 1.45.07.75.10)
e-mail: Eric.Gourgoulhon at obspm.fr WWW: http://www.luth.obspm.fr/
More information about the Lorene.list
mailing list