133#include "utilitaires.h"
142Map::Map(
const Mg3d& mgi) : mg(&mgi),
143 ori_x(0), ori_y(0), ori_z(0), rot_phi(0),
145 "Mapping orthonormal spherical basis"),
146 bvect_cart(rot_phi,
"Mapping Cartesian basis"),
160Map::Map(
const Map& mp) : mg(mp.mg),
161 ori_x(mp.ori_x), ori_y(mp.ori_y), ori_z(mp.ori_z),
164 "Mapping orthonormal spherical basis"),
165 bvect_cart(rot_phi,
"Mapping Cartesian basis"),
179Map::Map(
const Mg3d& mgi, FILE* fd) : mg(&mgi),
181 "Mapping orthonormal spherical basis"),
188 if (*mg != *mg_tmp) {
189 cout <<
"Map::Map(const Mg3d&, FILE*): grid not consistent !"
195 fread_be(&ori_x,
sizeof(
double), 1, fd) ;
196 fread_be(&ori_y,
sizeof(
double), 1, fd) ;
197 fread_be(&ori_z,
sizeof(
double), 1, fd) ;
198 fread_be(&rot_phi,
sizeof(
double), 1, fd) ;
227void Map::sauve(FILE* fd)
const {
231 fwrite_be(&ori_x,
sizeof(
double), 1, fd) ;
232 fwrite_be(&ori_y,
sizeof(
double), 1, fd) ;
233 fwrite_be(&ori_z,
sizeof(
double), 1, fd) ;
234 fwrite_be(&rot_phi,
sizeof(
double), 1, fd) ;
242ostream& operator<<(ostream& o,
const Map & cv) {
243 o <<
"Absolute coordinates of the mapping origin: " << endl ;
244 o <<
" X_0, Y_0, Z_0 : " << cv.get_ori_x() <<
" "
245 << cv.get_ori_y() <<
" " << cv.get_ori_z() << endl ;
246 o <<
"Rotation angle between the x-axis and X-axis : "
247 << cv.get_rot_phi() << endl ;
256void Map::set_ori(
double xo,
double yo,
double zo) {
261 bvect_spher.
set_ori(ori_x, ori_y, ori_z) ;
266void Map::set_rot_phi(
double newphi) {
279void Map::reset_coord() {
305void Map::convert_absolute(
double xx,
double yy,
double zz,
306 double& rr,
double& theta,
double& pphi)
const {
310 double x1 = xx - ori_x ;
311 double y1 = yy - ori_y ;
312 double z1 = zz - ori_z ;
315 double rho2 = x1*x1 + y1*y1 ;
316 double rho =
sqrt( rho2 ) ;
317 rr =
sqrt(rho2 + z1*z1) ;
318 theta = atan2(rho, z1) ;
319 pphi = atan2(y1, x1) - rot_phi ;
320 if (pphi < 0) pphi += 2*M_PI ;
void set_rot_phi(double rot_phi_i)
Sets a new value to the angle rot_phi between the x –axis and the absolute frame X –axis.
void set_ori(double xa0, double ya0, double za0)
Sets a new origin.
void set_rot_phi(double rot_phi_i)
Sets a new value to the angle rot_phi between the x –axis and the absolute frame X –axis.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
void del_t() const
Logical destructor (deletes the Mtbl member *c ).
Flat metric for tensor calculation.
Cmp sqrt(const Cmp &)
Square root.
Base_vect_spher bvect_spher
Base class for coordinate mappings.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
Map_af * p_mp_angu
Pointer on the "angular" mapping.
virtual void reset_coord()
Resets all the member Coords.
Coord z
z coordinate centered on the grid
Metric_flat * p_flat_met_spher
Pointer onto the flat metric associated with the spherical coordinates and with components expressed ...
Base_vect_cart bvect_cart
Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
Metric_flat * p_flat_met_cart
Pointer onto the flat metric associated with the Cartesian coordinates and with components expressed ...
Cmp * p_cmp_zero
The null Cmp.
Coord y
y coordinate centered on the grid
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Coord phi
coordinate centered on the grid
Coord tet
coordinate centered on the grid
Coord x
x coordinate centered on the grid
Coord xa
Absolute x coordinate.
Coord za
Absolute z coordinate.
Coord r
r coordinate centered on the grid
Coord ya
Absolute y coordinate.