205 #include "utilitaires.h" 224 alpha =
new double[nzone] ;
225 beta =
new double[nzone] ;
227 for (
int l=0 ; l<nzone ; l++) {
230 alpha[l] = bornes[l+1] - bornes[l] ;
231 beta[l] = bornes[l] ;
236 alpha[l] = (bornes[l+1] - bornes[l]) * .5 ;
237 beta[l] = (bornes[l+1] + bornes[l]) * .5 ;
242 double umax = 1./bornes[l] ;
243 double umin = 1./bornes[l+1] ;
244 alpha[l] = (umin - umax) * .5 ;
245 beta[l] = (umin + umax) * .5 ;
250 cout <<
"Map_af::Map_af: unkown type_r ! " << endl ;
269 alpha =
new double[nzone] ;
270 beta =
new double[nzone] ;
272 for (
int l=0 ; l<nzone ; l++) {
275 alpha[l] = bornes(l+1) - bornes(l) ;
276 beta[l] = bornes(l) ;
281 alpha[l] = (bornes(l+1) - bornes(l)) * .5 ;
282 beta[l] = (bornes(l+1) + bornes(l)) * .5 ;
287 assert (l==nzone-1) ;
288 double umax = 1./bornes(l) ;
290 alpha[l] = (umin - umax) * .5 ;
291 beta[l] = (umin + umax) * .5 ;
296 cout <<
"Map_af::Map_af: unkown type_r ! " << endl ;
315 alpha =
new double[nzone] ;
316 beta =
new double[nzone] ;
318 for (
int l=0; l<nzone; l++){
330 ifstream parfile(filename.c_str()) ;
332 string message =
"Unable to open file " ;
333 message += filename ;
334 throw ios_base::failure(message);
337 string tmp_str =
"Definition of the Map_af" ;
339 string mesg =
"No data found to contruct an object Map_af in " ;
341 throw invalid_argument(mesg) ;
343 parfile.ignore(1000,
'\n') ;
348 parfile >> nz ; parfile.ignore(1000,
'\n') ;
350 string mesg =
"Wrong number of domains for Map_af in " ;
352 throw(invalid_argument(mesg)) ;
356 for (
int i=0; i<nz; i++) {
357 parfile >> bornes.
set(i) ;
358 parfile.ignore(1000,
'\n') ;
361 string last_boundary ;
362 parfile >> last_boundary ;
364 if (last_boundary.compare(
"infinity") == 0) {
365 bornes.
set(nz) = __infinity ;
367 string mesg = filename
368 +
": infinite outer boundary can be set only in the ced case." ;
369 throw(invalid_argument(mesg)) ;
375 rout = stod(last_boundary) ;
377 catch(invalid_argument& ia) {
378 cerr <<
"Map_af constructor from a file, invalid argument in file\n" 379 << last_boundary << endl ;
382 bornes.
set(nz) = rout ;
384 string mesg = filename
385 +
": the ced grid type cannot accept a finite outer radius." ;
386 throw(invalid_argument(mesg)) ;
392 alpha =
new double[nz] ;
393 beta =
new double[nz] ;
395 for (
int l=0 ; l<nz ; l++) {
398 alpha[l] = bornes(l+1) - bornes(l) ;
399 beta[l] = bornes(l) ;
404 alpha[l] = (bornes(l+1) - bornes(l)) * .5 ;
405 beta[l] = (bornes(l+1) + bornes(l)) * .5 ;
411 double umax = 1./bornes(l) ;
413 alpha[l] = (umin - umax) * .5 ;
414 beta[l] = (umin + umax) * .5 ;
419 cout <<
"Map_af::Map_af: unkown type_r ! " << endl ;
434 alpha =
new double[nz] ;
435 beta =
new double[nz] ;
455 alpha =
new double[nz] ;
456 beta =
new double[nz] ;
461 if( (mp0 == 0x0) && (mp1 == 0x0) ) {
462 cout <<
"Map_af::Map_af(const Map& ) : unkown mapping type !" 468 assert( mp1 == 0x0 ) ;
469 for (
int l=0; l<nz; l++){
477 assert( mp0 == 0x0 ) ;
478 for (
int l=0; l<nz; l++){
512 assert(mpi.
mg ==
mg) ;
536 r.
set(
this, map_af_fait_r) ;
537 tet.
set(
this, map_af_fait_tet) ;
538 phi.
set(
this, map_af_fait_phi) ;
539 sint.
set(
this, map_af_fait_sint) ;
540 cost.
set(
this, map_af_fait_cost) ;
541 sinp.
set(
this, map_af_fait_sinp) ;
542 cosp.
set(
this, map_af_fait_cosp) ;
544 x.
set(
this, map_af_fait_x) ;
545 y.
set(
this, map_af_fait_y) ;
546 z.
set(
this, map_af_fait_z) ;
548 xa.
set(
this, map_af_fait_xa) ;
549 ya.
set(
this, map_af_fait_ya) ;
550 za.
set(
this, map_af_fait_za) ;
553 xsr.
set(
this, map_af_fait_xsr) ;
554 dxdr.
set(
this, map_af_fait_dxdr) ;
555 drdt.
set(
this, map_af_fait_drdt) ;
572 double precis = 1e-10 ;
591 for (
int i=0 ; i<nz ; i++) {
594 if ((i!=0) && (i!=nz-1))
637 ost <<
"Affine mapping (class Map_af)" << endl ;
639 for (
int l=0; l<nz; l++) {
640 ost <<
" Domain #" << l <<
" : alpha_l = " <<
alpha[l]
641 <<
" , beta_l = " <<
beta[l] << endl ;
644 ost << endl <<
" Values of r at the outer boundary of each domain [km] :" 647 for (
int l=0; l<nz; l++) {
648 ost <<
" " <<
val_r(l, 1., 0., 0.) / km ;
652 ost <<
" Coord r : " ;
653 for (
int l=0; l<nz; l++) {
655 ost <<
" " << (+
r)(l, 0, 0, nrm1) / km ;
671 for (
int l=0; l<nz; l++) {
695 cout <<
"Map_af::resize can be applied only to a shell !" << endl ;
701 double n_alpha = 0.5 * ( (lambda + 1.) *
alpha[l] +
702 (lambda - 1.) *
beta[l] ) ;
704 double n_beta = 0.5 * ( (lambda - 1.) *
alpha[l] +
705 (lambda + 1.) *
beta[l] ) ;
712 assert(l<mg->get_nzone()-1) ;
726 alpha[lp1] = n_alpha ;
750 double asauve =
alpha[1] ;
752 beta[1] = (1+fact)/2.*
beta[1]+ (1-fact)/2. * asauve ;
763 assert(l<mg->get_nzone()) ;
774 assert(l<mg->get_nzone()) ;
790 double Rb =
val_r_jk(l_zone, 1., 0, 0) ;
804 const char* f = __FILE__ ;
Coord xa
Absolute x coordinate.
void set_coord()
Assignment of the building functions to the member Coords.
virtual void sauve(FILE *) const
Save in a file.
Coord d2rdx2
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 sr2stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
const double * get_alpha() const
Returns the pointer on the array alpha.
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)
void set_rot_phi(double phi0)
Sets a new rotation angle.
virtual void homothetie(double lambda)
Sets a new radial scale.
double * alpha
Array (size: mg->nzone ) of the values of in each domain.
double get_ori_y() const
Returns the y coordinate of the origin.
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
Standard units of space, time and mass.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
double & set(int i)
Read/write of a particular element (index i) (1D case)
Coord sr2drdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Base class for coordinate mappings.
double get_ori_x() const
Returns the x coordinate of the origin.
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.
virtual const Map_af & mp_angu(int) const
Returns the "angular" mapping for the outside of domain l_zone.
virtual void operator=(const Map_af &)
Assignment to another affine mapping.
Map_af * p_mp_angu
Pointer on the "angular" mapping.
virtual bool operator==(const Map &) const
Comparison operator (egality)
double get_rot_phi() const
Returns the angle between the x –axis and X –axis.
void set(const Map *mp, Mtbl *(*construct)(const Map *))
Semi-constructor from a mapping and a method.
Coord srstdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer 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...
Coord tet
coordinate centered on the grid
virtual ostream & operator>>(ostream &) const
Operator >>
void set_ori(double xa0, double ya0, double za0)
Sets a new origin.
Coord phi
coordinate centered on the grid
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_beta(double beta0, int l)
Modifies the value of in domain no. l.
virtual ~Map_af()
Destructor.
Map_af(const Mg3d &mgrille, const double *r_limits)
Standard Constructor.
Coord stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED)...
bool search_file(ifstream &infile, const string &pattern)
A function that searches for a pattern in a file and places the file stream after the found pattern...
Coord dxdr
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
double ori_y
Absolute coordinate y of the origin.
const double * get_beta() const
Returns the pointer on the array beta.
double ori_z
Absolute coordinate z of the origin.
Base class for pure radial mappings.
double * beta
Array (size: mg->nzone ) of the values of in each domain.
int get_nzone() const
Returns the number of domains.
Coord sstd2rdpdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
virtual void sauve(FILE *) const
Save in a file.
void set_alpha(double alpha0, int l)
Modifies the value of in domain no. l.
Coord xsr
in the nucleus; \ 1/R in the non-compactified shells; \ in the compactified outer domain...
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.
Coord drdt
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED)...
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 get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Coord ya
Absolute y coordinate.
const Mg3d * mg
Pointer on the multi-grid Mgd3 on which this is defined.
double ori_x
Absolute coordinate x of the origin.
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
virtual void poisson_angu(const Scalar &source, Param &par, Scalar &uu, double lambda=0) const
Computes the solution of the generalized angular Poisson equation.
void c_est_pas_fait(const char *)
Helpful function to say something is not implemented yet.
Coord y
y coordinate centered on the grid
Coord za
Absolute z coordinate.
Coord lapr_tp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord x
x coordinate centered on the grid
Base_vect_spher bvect_spher
Orthonormal vectorial basis associated with the coordinates of the mapping.
double get_ori_z() const
Returns the z coordinate of the origin.
virtual void reset_coord()
Resets all the member Coords.
void homothetie_interne(double lambda)
Sets a new radial scale at the bondary between the nucleus and the first shell.
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Coord srdrdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
const Mg3d * get_angu_1dom() const
Returns the pointer on the associated mono-domain angular grid.
virtual void adapt(const Cmp &ent, const Param &par, int nbr=0)
Adaptation of the mapping to a given scalar field.
virtual void resize(int l, double lambda)
Rescales the outer boundary of one domain.
Coord z
z coordinate centered on the grid
double rot_phi
Angle between the x –axis and X –axis.
Base_vect_cart bvect_cart
Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
Coord r
r coordinate centered on the grid
Coord d2rdtdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.