202 #include "utilitaires.h" 221 alpha =
new double[nzone] ;
222 beta =
new double[nzone] ;
224 for (
int l=0 ; l<nzone ; l++) {
227 alpha[l] = bornes[l+1] - bornes[l] ;
228 beta[l] = bornes[l] ;
233 alpha[l] = (bornes[l+1] - bornes[l]) * .5 ;
234 beta[l] = (bornes[l+1] + bornes[l]) * .5 ;
239 double umax = 1./bornes[l] ;
240 double umin = 1./bornes[l+1] ;
241 alpha[l] = (umin - umax) * .5 ;
242 beta[l] = (umin + umax) * .5 ;
247 cout <<
"Map_af::Map_af: unkown type_r ! " << endl ;
266 alpha =
new double[nzone] ;
267 beta =
new double[nzone] ;
269 for (
int l=0 ; l<nzone ; l++) {
272 alpha[l] = bornes(l+1) - bornes(l) ;
273 beta[l] = bornes(l) ;
278 alpha[l] = (bornes(l+1) - bornes(l)) * .5 ;
279 beta[l] = (bornes(l+1) + bornes(l)) * .5 ;
284 assert (l==nzone-1) ;
285 double umax = 1./bornes(l) ;
287 alpha[l] = (umin - umax) * .5 ;
288 beta[l] = (umin + umax) * .5 ;
293 cout <<
"Map_af::Map_af: unkown type_r ! " << endl ;
312 alpha =
new double[nzone] ;
313 beta =
new double[nzone] ;
315 for (
int l=0; l<nzone; l++){
327 ifstream parfile(filename.c_str()) ;
329 string message =
"Unable to open file " ;
330 message += filename ;
331 throw ios_base::failure(message);
334 string tmp_str =
"Definition of the Map_af" ;
336 string mesg =
"No data found to contruct an object Map_af in " ;
338 throw invalid_argument(mesg) ;
340 parfile.ignore(1000,
'\n') ;
345 parfile >> nz ; parfile.ignore(1000,
'\n') ;
347 string mesg =
"Wrong number of domains for Map_af in " ;
349 throw(invalid_argument(mesg)) ;
353 for (
int i=0; i<nz; i++) {
354 parfile >> bornes.
set(i) ;
355 parfile.ignore(1000,
'\n') ;
358 string last_boundary ;
359 parfile >> last_boundary ;
361 if (last_boundary.compare(
"infinity") == 0) {
362 bornes.
set(nz) = __infinity ;
364 string mesg = filename
365 +
": infinite outer boundary can be set only in the ced case." ;
366 throw(invalid_argument(mesg)) ;
372 rout = stod(last_boundary) ;
374 catch(invalid_argument& ia) {
375 cerr <<
"Map_af constructor from a file, invalid argument in file\n" 376 << last_boundary << endl ;
379 bornes.
set(nz) = rout ;
381 string mesg = filename
382 +
": the ced grid type cannot accept a finite outer radius." ;
383 throw(invalid_argument(mesg)) ;
389 alpha =
new double[nz] ;
390 beta =
new double[nz] ;
392 for (
int l=0 ; l<nz ; l++) {
395 alpha[l] = bornes(l+1) - bornes(l) ;
396 beta[l] = bornes(l) ;
401 alpha[l] = (bornes(l+1) - bornes(l)) * .5 ;
402 beta[l] = (bornes(l+1) + bornes(l)) * .5 ;
408 double umax = 1./bornes(l) ;
410 alpha[l] = (umin - umax) * .5 ;
411 beta[l] = (umin + umax) * .5 ;
416 cout <<
"Map_af::Map_af: unkown type_r ! " << endl ;
431 alpha =
new double[nz] ;
432 beta =
new double[nz] ;
452 alpha =
new double[nz] ;
453 beta =
new double[nz] ;
458 if( (mp0 == 0x0) && (mp1 == 0x0) ) {
459 cout <<
"Map_af::Map_af(const Map& ) : unkown mapping type !" 465 assert( mp1 == 0x0 ) ;
466 for (
int l=0; l<nz; l++){
474 assert( mp0 == 0x0 ) ;
475 for (
int l=0; l<nz; l++){
509 assert(mpi.
mg ==
mg) ;
533 r.
set(
this, map_af_fait_r) ;
534 tet.
set(
this, map_af_fait_tet) ;
535 phi.
set(
this, map_af_fait_phi) ;
536 sint.
set(
this, map_af_fait_sint) ;
537 cost.
set(
this, map_af_fait_cost) ;
538 sinp.
set(
this, map_af_fait_sinp) ;
539 cosp.
set(
this, map_af_fait_cosp) ;
541 x.
set(
this, map_af_fait_x) ;
542 y.
set(
this, map_af_fait_y) ;
543 z.
set(
this, map_af_fait_z) ;
545 xa.
set(
this, map_af_fait_xa) ;
546 ya.
set(
this, map_af_fait_ya) ;
547 za.
set(
this, map_af_fait_za) ;
550 xsr.
set(
this, map_af_fait_xsr) ;
551 dxdr.
set(
this, map_af_fait_dxdr) ;
552 drdt.
set(
this, map_af_fait_drdt) ;
569 double precis = 1e-10 ;
588 for (
int i=0 ; i<nz ; i++) {
591 if ((i!=0) && (i!=nz-1))
634 ost <<
"Affine mapping (class Map_af)" << endl ;
636 for (
int l=0; l<nz; l++) {
637 ost <<
" Domain #" << l <<
" : alpha_l = " <<
alpha[l]
638 <<
" , beta_l = " <<
beta[l] << endl ;
641 ost << endl <<
" Values of r at the outer boundary of each domain [km] :" 644 for (
int l=0; l<nz; l++) {
645 ost <<
" " <<
val_r(l, 1., 0., 0.) / km ;
649 ost <<
" Coord r : " ;
650 for (
int l=0; l<nz; l++) {
652 ost <<
" " << (+
r)(l, 0, 0, nrm1) / km ;
668 for (
int l=0; l<nz; l++) {
692 cout <<
"Map_af::resize can be applied only to a shell !" << endl ;
698 double n_alpha = 0.5 * ( (lambda + 1.) *
alpha[l] +
699 (lambda - 1.) *
beta[l] ) ;
701 double n_beta = 0.5 * ( (lambda - 1.) *
alpha[l] +
702 (lambda + 1.) *
beta[l] ) ;
709 assert(l<mg->get_nzone()-1) ;
723 alpha[lp1] = n_alpha ;
747 double asauve =
alpha[1] ;
749 beta[1] = (1+fact)/2.*
beta[1]+ (1-fact)/2. * asauve ;
760 assert(l<mg->get_nzone()) ;
771 assert(l<mg->get_nzone()) ;
787 double Rb =
val_r_jk(l_zone, 1., 0, 0) ;
801 const char* f = __FILE__ ;
806 Cmp& uu,
double lambda)
const {
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.