31char map_af_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Map/map_af.C,v 1.19 2014/10/13 08:53:02 j_novak Exp $" ;
180#include "utilitaires.h"
197 int nzone = mg->get_nzone() ;
199 alpha =
new double[nzone] ;
200 beta =
new double[nzone] ;
202 for (
int l=0 ; l<nzone ; l++) {
203 switch (mg->get_type_r(l)) {
205 alpha[l] = bornes[l+1] - bornes[l] ;
206 beta[l] = bornes[l] ;
211 alpha[l] = (bornes[l+1] - bornes[l]) * .5 ;
212 beta[l] = (bornes[l+1] + bornes[l]) * .5 ;
217 double umax = 1./bornes[l] ;
218 double umin = 1./bornes[l+1] ;
219 alpha[l] = (umin - umax) * .5 ;
220 beta[l] = (umin + umax) * .5 ;
225 cout <<
"Map_af::Map_af: unkown type_r ! " << endl ;
242 int nzone = mg->get_nzone() ;
244 alpha =
new double[nzone] ;
245 beta =
new double[nzone] ;
247 for (
int l=0 ; l<nzone ; l++) {
248 switch (mg->get_type_r(l)) {
250 alpha[l] = bornes(l+1) - bornes(l) ;
251 beta[l] = bornes(l) ;
256 alpha[l] = (bornes(l+1) - bornes(l)) * .5 ;
257 beta[l] = (bornes(l+1) + bornes(l)) * .5 ;
262 assert (l==nzone-1) ;
263 double umax = 1./bornes(l) ;
265 alpha[l] = (umin - umax) * .5 ;
266 beta[l] = (umin + umax) * .5 ;
271 cout <<
"Map_af::Map_af: unkown type_r ! " << endl ;
288 int nzone = mg->get_nzone() ;
290 alpha =
new double[nzone] ;
291 beta =
new double[nzone] ;
293 for (
int l=0; l<nzone; l++){
303 int nz = mg->get_nzone() ;
304 alpha =
new double[nz] ;
305 beta =
new double[nz] ;
323 int nz = mg->get_nzone() ;
325 alpha =
new double[nz] ;
326 beta =
new double[nz] ;
331 if( (mp0 == 0x0) && (mp1 == 0x0) ) {
332 cout <<
"Map_af::Map_af(const Map& ) : unkown mapping type !"
338 assert( mp1 == 0x0 ) ;
339 for (
int l=0; l<nz; l++){
347 assert( mp0 == 0x0 ) ;
348 for (
int l=0; l<nz; l++){
355 set_ori( mpi.get_ori_x(), mpi.get_ori_y(), mpi.get_ori_z() ) ;
382 assert(mpi.mg == mg) ;
384 set_ori( mpi.ori_x, mpi.ori_y, mpi.ori_z ) ;
388 for (
int l = 0; l<mg->get_nzone(); l++) {
406 r.set(
this, map_af_fait_r) ;
407 tet.set(
this, map_af_fait_tet) ;
408 phi.set(
this, map_af_fait_phi) ;
409 sint.set(
this, map_af_fait_sint) ;
410 cost.set(
this, map_af_fait_cost) ;
411 sinp.set(
this, map_af_fait_sinp) ;
412 cosp.set(
this, map_af_fait_cosp) ;
414 x.set(
this, map_af_fait_x) ;
415 y.set(
this, map_af_fait_y) ;
416 z.set(
this, map_af_fait_z) ;
418 xa.set(
this, map_af_fait_xa) ;
419 ya.set(
this, map_af_fait_ya) ;
420 za.set(
this, map_af_fait_za) ;
423 xsr.set(
this, map_af_fait_xsr) ;
424 dxdr.set(
this, map_af_fait_dxdr) ;
425 drdt.set(
this, map_af_fait_drdt) ;
426 stdrdp.set(
this, map_af_fait_stdrdp) ;
427 srdrdt.set(
this, map_af_fait_srdrdt) ;
428 srstdrdp.set(
this, map_af_fait_srstdrdp) ;
429 sr2drdt.set(
this, map_af_fait_sr2drdt) ;
430 sr2stdrdp.set(
this, map_af_fait_sr2stdrdp) ;
431 d2rdx2.set(
this, map_af_fait_d2rdx2) ;
432 lapr_tp.set(
this, map_af_fait_lapr_tp) ;
433 d2rdtdx.set(
this, map_af_fait_d2rdtdx) ;
434 sstd2rdpdx.set(
this, map_af_fait_sstd2rdpdx) ;
435 sr2d2rdt2.set(
this, map_af_fait_sr2d2rdt2) ;
442 double precis = 1e-10 ;
450 if (*mg != *(mpi.get_mg()))
453 if (fabs(ori_x-mpi.get_ori_x()) > precis) resu = false ;
454 if (fabs(ori_y-mpi.get_ori_y()) > precis) resu = false ;
455 if (fabs(ori_z-mpi.get_ori_z()) > precis) resu = false ;
457 if (
bvect_spher != mpi.get_bvect_spher()) resu = false ;
458 if (
bvect_cart != mpi.get_bvect_cart()) resu = false ;
460 int nz = mg->get_nzone() ;
461 for (
int i=0 ; i<nz ; i++) {
464 if ((i!=0) && (i!=nz-1))
493 int nz = mg->get_nzone() ;
507 ost <<
"Affine mapping (class Map_af)" << endl ;
508 int nz = mg->get_nzone() ;
509 for (
int l=0; l<nz; l++) {
510 ost <<
" Domain #" << l <<
" : alpha_l = " <<
alpha[l]
511 <<
" , beta_l = " <<
beta[l] << endl ;
514 ost << endl <<
" Values of r at the outer boundary of each domain [km] :"
517 for (
int l=0; l<nz; l++) {
518 ost <<
" " <<
val_r(l, 1., 0., 0.) / km ;
522 ost <<
" Coord r : " ;
523 for (
int l=0; l<nz; l++) {
524 int nrm1 = mg->get_nr(l) - 1 ;
525 ost <<
" " << (+
r)(l, 0, 0, nrm1) / km ;
539 int nz = mg->get_nzone() ;
541 for (
int l=0; l<nz; l++) {
542 if (mg->get_type_r(l) == UNSURR) {
564 if (mg->get_type_r(l) != FIN) {
565 cout <<
"Map_af::resize can be applied only to a shell !" << endl ;
571 double n_alpha = 0.5 * ( (lambda + 1.) *
alpha[l] +
572 (lambda - 1.) *
beta[l] ) ;
574 double n_beta = 0.5 * ( (lambda - 1.) *
alpha[l] +
575 (lambda + 1.) *
beta[l] ) ;
582 assert(l<mg->get_nzone()-1) ;
585 if (mg->get_type_r(lp1) == UNSURR) {
593 assert( mg->get_type_r(lp1) == FIN ) ;
596 alpha[lp1] = n_alpha ;
620 double asauve =
alpha[1] ;
622 beta[1] = (1+fact)/2.*
beta[1]+ (1-fact)/2. * asauve ;
633 assert(l<mg->get_nzone()) ;
644 assert(l<mg->get_nzone()) ;
660 double Rb =
val_r_jk(l_zone, 1., 0, 0) ;
674 const char* f = __FILE__ ;
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
virtual ostream & operator>>(ostream &) const
Operator >>.
const double * get_beta() const
Returns the pointer on the array beta.
const double * get_alpha() const
Returns the pointer on the array alpha.
void set_beta(double beta0, int l)
Modifies the value of in domain no. l.
virtual void adapt(const Cmp &ent, const Param &par, int nbr=0)
Adaptation of the mapping to a given scalar field.
void set_coord()
Assignment of the building functions to the member Coords.
Map_af(const Mg3d &mgrille, const double *r_limits)
Standard Constructor.
virtual ~Map_af()
Destructor.
virtual void sauve(FILE *) const
Save in a file.
double * beta
Array (size: mg->nzone ) of the values of in each domain.
virtual void operator=(const Map_af &)
Assignment to another affine mapping.
void homothetie_interne(double lambda)
Sets a new radial scale at the bondary between the nucleus and the first shell.
virtual void homothetie(double lambda)
Sets a new radial scale.
double * alpha
Array (size: mg->nzone ) of the values of in each domain.
virtual bool operator==(const Map &) const
Comparison operator (egality).
void set_alpha(double alpha0, int l)
Modifies the value of in domain no. l.
virtual void resize(int l, double lambda)
Rescales the outer boundary of one domain.
virtual double val_r_jk(int l, double xi, int j, int k) const
Returns the value of the radial coordinate r for a given and a given collocation point in in a give...
virtual const Map_af & mp_angu(int) const
Returns the "angular" mapping for the outside of domain l_zone.
virtual double val_r(int l, double xi, double theta, double pphi) const
Returns the value of the radial coordinate r for a given in a given domain.
Radial mapping of rather general form.
const double * get_alpha() const
Returns a pointer on the array alpha (values of in each domain).
const double * get_beta() const
Returns a pointer on the array beta (values of in each domain).
Coord d2rdx2
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord sr2drdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord srstdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord d2rdtdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord sstd2rdpdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
virtual void reset_coord()
Resets all the member Coords.
Coord lapr_tp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord sr2stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord drdt
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED).
Coord srdrdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Map_radial(const Mg3d &mgrid)
Constructor from a grid (protected to make Map_radial an abstract class).
Coord xsr
in the nucleus; \ 1/R in the non-compactified shells; \ in the compactified outer domain.
virtual void sauve(FILE *) const
Save in a file.
Coord dxdr
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord sr2d2rdt2
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED).
const Mg3d * get_angu_1dom() const
Returns the pointer on the associated mono-domain angular grid.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
double & set(int i)
Read/write of a particular element (index i) (1D case).
Base_vect_spher bvect_spher
Base class for coordinate mappings.
void c_est_pas_fait(const char *)
Helpful function to say something is not implemented yet.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
Map_af * p_mp_angu
Pointer on the "angular" mapping.
Coord z
z coordinate centered on the grid
Base_vect_cart bvect_cart
Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
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
void set_rot_phi(double phi0)
Sets a new rotation angle.
Coord x
x coordinate centered on the grid
Coord xa
Absolute x coordinate.
Coord za
Absolute z coordinate.
void set_ori(double xa0, double ya0, double za0)
Sets a new origin.
Coord r
r coordinate centered on the grid
Coord ya
Absolute y coordinate.
Standard units of space, time and mass.