[LORENE] Access to individual points in Scalar
Eric Gourgoulhon
eric.gourgoulhon at obspm.fr
Sat Feb 21 18:49:57 CET 2004
Dear all,
It is quite rare to manipulate directly the values
of a Scalar at individual points. This might happen
however for specific purposes (for instance taking
the value of a field at the grid center). There are
three methods offering access to individual points:
double Scalar::val_grid_point(int l, int k, int j, int i) const
double Scalar::val_point(double r, double theta, double phi) const
double& Scalar::set_grid_point(int l, int k, int j, int i)
The first two methods are for reading a value, without
modifying the field (hence the qualifier 'const'):
val_grid_point returns the value of the scalar field at a point
of the spectral grid, defined by the indices
(l,k,j,i) (l=domain, k=phi, j=theta, i=r)
val_point returns the value of the scalar field at any point
(r,theta,phi), not necessarily a grid point. This value
is obtained by a computation (evaluation of the spectral
series at the given point), contrary to val_grid_point
which simply returns the value stored in the Mtbl of the
Valeur va.
The third method, set_grid_point, returns a writable
reference to the value at the grid point of index
(l,k,j,i). It can therefore be used to modify the
scalar field; for example:
a.set_grid_point(l,k,j,i) = 2 ;
Note that, for efficiency purpose, this method does
note call Scalar::del_deriv() to say that the
the derived quantities (d/dr, etc...) are no longer
up to date. Therefore Scalar::del_deriv() must be
called explicitely by the user, after all the
set_grid_point.
Note also that the methods Scalar::val_grid_point
and Scalar::set_grid_point were named respectively
Scalar::point and Scalar::set_point. The names have
been changed (sorry for the inconvenience...), for
two reasons:
1/ "val_grid_point" is logically analogous to "val_point",
(althought very different from the computational point
of view)
2/ in classes Tensor and Scalar, most methods are
independent (in their interface) from the spectral
methods. The few methods which have a meaning only
for the specific underlying numerical method are
singled out by the terms "_spectral_" or "_grid_"
in their names (e.g. Scalar::set_spectral_base
or Scalar_val_grid_point).
Bon code !
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