LORENE
map_af.C
1/*
2 * Methods of class Map_af
3 *
4 * (see file map.h for documentation)
5 *
6 */
7
8/*
9 * Copyright (c) 1999-2003 Eric Gourgoulhon
10 * Copyright (c) 1999-2001 Philippe Grandclement
11 *
12 * This file is part of LORENE.
13 *
14 * LORENE is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * LORENE is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with LORENE; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
29
30
31
32
33/*
34 * $Id: map_af.C,v 1.25 2023/05/26 15:39:31 g_servignat Exp $
35 * $Log: map_af.C,v $
36 * Revision 1.25 2023/05/26 15:39:31 g_servignat
37 * Added c_est_pas_fait() to poisson_angu(Cmp)
38 *
39 * Revision 1.24 2023/01/04 10:23:37 j_novak
40 * Removed spurious output.
41 *
42 * Revision 1.23 2022/09/30 14:44:03 j_novak
43 * Improved treatment of outer boundary in constructor from a file
44 *
45 * Revision 1.22 2020/01/27 11:00:19 j_novak
46 * New include <stdexcept> to be compatible with older versions of g++
47 *
48 * Revision 1.21 2018/12/05 15:43:45 j_novak
49 * New Map_af constructor from a formatted file.
50 *
51 * Revision 1.20 2016/12/05 16:17:56 j_novak
52 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
53 *
54 * Revision 1.19 2014/10/13 08:53:02 j_novak
55 * Lorene classes and functions now belong to the namespace Lorene.
56 *
57 * Revision 1.18 2014/10/06 15:13:11 j_novak
58 * Modified #include directives to use c++ syntax.
59 *
60 * Revision 1.17 2013/06/05 15:10:42 j_novak
61 * Suppression of FINJAC sampling in r. This Jacobi(0,2) base is now
62 * available by setting colloc_r to BASE_JAC02 in the Mg3d constructor.
63 *
64 * Revision 1.16 2012/01/17 15:34:35 j_penner
65 * *** empty log message ***
66 *
67 * Revision 1.15 2012/01/17 10:31:32 j_penner
68 * added access to computational coordinate xi
69 *
70 * Revision 1.14 2008/09/29 13:23:51 j_novak
71 * Implementation of the angular mapping associated with an affine
72 * mapping. Things must be improved to take into account the domain index.
73 *
74 * Revision 1.13 2008/08/19 06:42:00 j_novak
75 * Minor modifications to avoid warnings with gcc 4.3. Most of them concern
76 * cast-type operations, and constant strings that must be defined as const char*
77 *
78 * Revision 1.12 2007/12/21 11:05:33 j_novak
79 * Put back the constructor from a Mg3d and a Tbl (it had disappeared?).
80 *
81 * Revision 1.11 2007/12/20 09:11:04 jl_cornou
82 * Correction of an error in op_sxpun about Jacobi(0,2) polynomials
83 *
84 * Revision 1.10 2007/12/11 15:28:14 jl_cornou
85 * Jacobi(0,2) polynomials partially implemented
86 *
87 * Revision 1.9 2006/04/25 07:21:59 p_grandclement
88 * Various changes for the NS_BH project
89 *
90 * Revision 1.8 2005/08/29 15:10:18 p_grandclement
91 * Addition of things needed :
92 * 1) For BBH with different masses
93 * 2) Provisory files for the mixted binaries (Bh and NS) : THIS IS NOT
94 * WORKING YET !!!
95 *
96 * Revision 1.7 2004/12/02 09:33:06 p_grandclement
97 * *** empty log message ***
98 *
99 * Revision 1.6 2004/03/25 10:29:23 j_novak
100 * All LORENE's units are now defined in the namespace Unites (in file unites.h).
101 *
102 * Revision 1.5 2004/01/29 08:50:03 p_grandclement
103 * Modification of Map::operator==(const Map&) and addition of the surface
104 * integrales using Scalar.
105 *
106 * Revision 1.4 2003/10/15 10:33:11 e_gourgoulhon
107 * Added new Coord's : drdt, srdrdp.
108 *
109 * Revision 1.3 2002/10/16 14:36:41 j_novak
110 * Reorganization of #include instructions of standard C++, in order to
111 * use experimental version 3 of gcc.
112 *
113 * Revision 1.2 2001/12/04 21:27:53 e_gourgoulhon
114 *
115 * All writing/reading to a binary file are now performed according to
116 * the big endian convention, whatever the system is big endian or
117 * small endian, thanks to the functions fwrite_be and fread_be
118 *
119 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
120 * LORENE
121 *
122 * Revision 2.23 2001/02/28 11:04:05 eric
123 * 1ere version testee de resize.
124 *
125 * Revision 2.22 2001/02/26 17:29:22 eric
126 * Ajout de la fonction resize.
127 *
128 * Revision 2.21 2001/01/10 11:03:13 phil
129 * ajout de homothetie interne
130 *
131 * Revision 2.20 2000/01/24 17:09:13 eric
132 * suppression de la fonction convert.
133 * suppression du constructeur par convertion d'un Map_et.
134 * ajout du constructeur par conversion d'un Map.
135 *
136 * Revision 2.19 2000/01/24 16:42:48 eric
137 * Dans operator=(const Map_af& ), appel de set_rot_phi.
138 * Ajout de la fonction convert(const Map& ).
139 *
140 * Revision 2.18 1999/12/21 16:27:26 eric
141 * Ajout du constructeur par conversion Map_af::Map_af(const Map_et&).
142 * Ajout des fonctions Map_af::set_alpha et Map_af::set_beta.
143 *
144 * Revision 2.17 1999/12/17 09:14:43 eric
145 * Amelioration de l'affichage.
146 *
147 * Revision 2.16 1999/12/06 13:12:23 eric
148 * Introduction de la fonction homothetie.
149 *
150 * Revision 2.15 1999/11/25 16:28:53 eric
151 * Le calcul des derivees partielles est transfere dans le fichier
152 * map_af_deriv.C.
153 *
154 * Revision 2.14 1999/11/24 14:32:54 eric
155 * Les prototypes des fonctions de constructions des coords sont desormais
156 * dans map.h.
157 * Introduction des fonctions get_alpha() et get_beta().
158 * /
159 *
160 * Revision 2.13 1999/11/22 10:36:14 eric
161 * Introduction de la fonction set_coord().
162 * Fonction del_coord() rebaptisee reset_coord().
163 *
164 * Revision 2.12 1999/10/27 08:46:29 eric
165 * Introduction de Cmp::va a la place de *(Cmp::c).
166 *
167 * Revision 2.11 1999/10/15 09:23:10 eric
168 * *** empty log message ***
169 *
170 * Revision 2.10 1999/10/15 09:16:23 eric
171 * Changement prototypes: const.
172 *
173 * Revision 2.9 1999/10/14 14:27:05 eric
174 * Depoussierage.
175 *
176 * Revision 2.8 1999/04/12 12:54:05 phil
177 * *** empty log message ***
178 *
179 * Revision 2.7 1999/04/12 12:09:03 phil
180 * Mise a jour des bases dans dsdr()
181 *
182 * Revision 2.6 1999/03/04 13:11:48 eric
183 * Ajout des Coord representant les derivees du changement de variable.
184 *
185 * Revision 2.5 1999/03/03 11:19:08 hyc
186 * *** empty log message ***
187 *
188 *
189 * $Header: /cvsroot/Lorene/C++/Source/Map/map_af.C,v 1.25 2023/05/26 15:39:31 g_servignat Exp $
190 *
191 */
192
193// headers C++
194#include <stdexcept>
195
196// headers C
197#include <cmath>
198
199// headers Lorene
200#include "cmp.h"
201#include "nbr_spx.h"
202#include "utilitaires.h"
203#include "proto.h"
204#include "unites.h"
205
206 //---------------//
207 // Constructeurs //
208 //---------------//
209
210// Constructor from a grid
211// -----------------------
212namespace Lorene {
213Map_af::Map_af(const Mg3d& mgrille, const double* bornes) : Map_radial(mgrille)
214{
215 // Les coordonnees et les derivees du changement de variable
216 set_coord() ;
217
218 // Les bornes
219 int nzone = mg->get_nzone() ;
220
221 alpha = new double[nzone] ;
222 beta = new double[nzone] ;
223
224 for (int l=0 ; l<nzone ; l++) {
225 switch (mg->get_type_r(l)) {
226 case RARE: {
227 alpha[l] = bornes[l+1] - bornes[l] ;
228 beta[l] = bornes[l] ;
229 break ;
230 }
231
232 case FIN: {
233 alpha[l] = (bornes[l+1] - bornes[l]) * .5 ;
234 beta[l] = (bornes[l+1] + bornes[l]) * .5 ;
235 break ;
236 }
237
238 case UNSURR: {
239 double umax = 1./bornes[l] ;
240 double umin = 1./bornes[l+1] ;
241 alpha[l] = (umin - umax) * .5 ; // u est une fonction decroissante
242 beta[l] = (umin + umax) * .5 ; // de l'indice i en r
243 break ;
244 }
245
246 default: {
247 cout << "Map_af::Map_af: unkown type_r ! " << endl ;
248 abort () ;
249 break ;
250 }
251
252 }
253 } // Fin de la boucle sur zone
254}
255
256// Constructor from a grid
257// -----------------------
258Map_af::Map_af(const Mg3d& mgrille, const Tbl& bornes) : Map_radial(mgrille)
259{
260 // Les coordonnees et les derivees du changement de variable
261 set_coord() ;
262
263 // Les bornes
264 int nzone = mg->get_nzone() ;
265
266 alpha = new double[nzone] ;
267 beta = new double[nzone] ;
268
269 for (int l=0 ; l<nzone ; l++) {
270 switch (mg->get_type_r(l)) {
271 case RARE: {
272 alpha[l] = bornes(l+1) - bornes(l) ;
273 beta[l] = bornes(l) ;
274 break ;
275 }
276
277 case FIN: {
278 alpha[l] = (bornes(l+1) - bornes(l)) * .5 ;
279 beta[l] = (bornes(l+1) + bornes(l)) * .5 ;
280 break ;
281 }
282
283 case UNSURR: {
284 assert (l==nzone-1) ;
285 double umax = 1./bornes(l) ;
286 double umin = 0 ;
287 alpha[l] = (umin - umax) * .5 ; // u est une fonction decroissante
288 beta[l] = (umin + umax) * .5 ; // de l'indice i en r
289 break ;
290 }
291
292 default: {
293 cout << "Map_af::Map_af: unkown type_r ! " << endl ;
294 abort () ;
295 break ;
296 }
297
298 }
299 } // Fin de la boucle sur zone
300}
301
302// Copy constructor
303// ----------------
305{
306 // Les coordonnees et les derivees du changement de variable
307 set_coord() ;
308
309 // Les bornes
310 int nzone = mg->get_nzone() ;
311
312 alpha = new double[nzone] ;
313 beta = new double[nzone] ;
314
315 for (int l=0; l<nzone; l++){
316 alpha[l] = mp.alpha[l] ;
317 beta[l] = mp.beta[l] ;
318 }
319}
320
321 // Constructor from a formatted file
322 //-----------------------------------
323 Map_af::Map_af(const Mg3d& mgrille, const string& filename) : Map_radial(mgrille)
324{
325 // Opening of the file
326 //---------------------
327 ifstream parfile(filename.c_str()) ;
328 if (!parfile) {
329 string message = "Unable to open file " ;
330 message += filename ;
331 throw ios_base::failure(message);
332 };
333
334 string tmp_str = "Definition of the Map_af" ;
335 if (!search_file(parfile, tmp_str)) {
336 string mesg = "No data found to contruct an object Map_af in " ;
337 mesg += filename ;
338 throw invalid_argument(mesg) ;
339 }
340 parfile.ignore(1000, '\n') ;
341
342 // Number of domains
343 //---------------------
344 int nz ;
345 parfile >> nz ; parfile.ignore(1000, '\n') ; // Number of domains
346 if (mg->get_nzone() != nz) {
347 string mesg = "Wrong number of domains for Map_af in " ;
348 mesg += filename ;
349 throw(invalid_argument(mesg)) ;
350 }
351 Tbl bornes(nz+1) ;
352 bornes.set_etat_qcq() ;
353 for (int i=0; i<nz; i++) {
354 parfile >> bornes.set(i) ;
355 parfile.ignore(1000, '\n') ;
356 }
357
358 string last_boundary ;
359 parfile >> last_boundary ;
360
361 if (last_boundary.compare("infinity") == 0) {
362 bornes.set(nz) = __infinity ;
363 if (mgrille.get_type_r(nz-1) != UNSURR) {
364 string mesg = filename
365 + ": infinite outer boundary can be set only in the ced case." ;
366 throw(invalid_argument(mesg)) ;
367 }
368 }
369 else {
370 double rout = 0. ;
371 try {
372 rout = stod(last_boundary) ;
373 }
374 catch(invalid_argument& ia) {
375 cerr << "Map_af constructor from a file, invalid argument in file\n"
376 << last_boundary << endl ;
377 abort() ;
378 }
379 bornes.set(nz) = rout ;
380 if (mgrille.get_type_r(nz-1) == UNSURR) {
381 string mesg = filename
382 + ": the ced grid type cannot accept a finite outer radius." ;
383 throw(invalid_argument(mesg)) ;
384 }
385 }
386
387 set_coord() ;
388
389 alpha = new double[nz] ;
390 beta = new double[nz] ;
391
392 for (int l=0 ; l<nz ; l++) {
393 switch (mg->get_type_r(l)) {
394 case RARE: {
395 alpha[l] = bornes(l+1) - bornes(l) ;
396 beta[l] = bornes(l) ;
397 break ;
398 }
399
400 case FIN: {
401 alpha[l] = (bornes(l+1) - bornes(l)) * .5 ;
402 beta[l] = (bornes(l+1) + bornes(l)) * .5 ;
403 break ;
404 }
405
406 case UNSURR: {
407 assert (l==nz-1) ;
408 double umax = 1./bornes(l) ;
409 double umin = 0 ;
410 alpha[l] = (umin - umax) * .5 ; // u est une fonction decroissante
411 beta[l] = (umin + umax) * .5 ; // de l'indice i en r
412 break ;
413 }
414
415 default: {
416 cout << "Map_af::Map_af: unkown type_r ! " << endl ;
417 abort () ;
418 break ;
419 }
420
421 }
422 } // Fin de la boucle sur zone
423}
424
425
426// Constructor from file
427// ---------------------
428Map_af::Map_af(const Mg3d& mgi, FILE* fd) : Map_radial(mgi, fd)
429{
430 int nz = mg->get_nzone() ;
431 alpha = new double[nz] ;
432 beta = new double[nz] ;
433 fread_be(alpha, sizeof(double), nz, fd) ;
434 fread_be(beta, sizeof(double), nz, fd) ;
435
436 // Les coordonnees et les derivees du changement de variable
437 set_coord() ;
438}
439
440
441
442// Constructor from a Map
443// -----------------------
444Map_af::Map_af(const Map& mpi) : Map_radial(*(mpi.get_mg()))
445{
446 // Les coordonnees et les derivees du changement de variable
447 set_coord() ;
448
449 // Les bornes
450 int nz = mg->get_nzone() ;
451
452 alpha = new double[nz] ;
453 beta = new double[nz] ;
454
455 const Map_af* mp0 = dynamic_cast<const Map_af*>(&mpi) ;
456 const Map_et* mp1 = dynamic_cast<const Map_et*>(&mpi) ;
457
458 if( (mp0 == 0x0) && (mp1 == 0x0) ) {
459 cout << "Map_af::Map_af(const Map& ) : unkown mapping type !"
460 << endl ;
461 abort() ;
462 }
463
464 if (mp0 != 0x0) {
465 assert( mp1 == 0x0 ) ;
466 for (int l=0; l<nz; l++){
467 alpha[l] = mp0->get_alpha()[l] ;
468 beta[l] = mp0->get_beta()[l] ;
469 }
470 }
471
472
473 if (mp1 != 0x0) {
474 assert( mp0 == 0x0 ) ;
475 for (int l=0; l<nz; l++){
476 alpha[l] = mp1->get_alpha()[l] ;
477 beta[l] = mp1->get_beta()[l] ;
478 }
479 }
480
481
482 set_ori( mpi.get_ori_x(), mpi.get_ori_y(), mpi.get_ori_z() ) ;
483
484 set_rot_phi( mpi.get_rot_phi() ) ;
485
486}
487
488
489
490
491 //--------------//
492 // Destructeurs //
493 //--------------//
494
496 delete [] alpha ;
497 delete [] beta ;
498}
499
500 //-------------//
501 // Assignement //
502 //-------------//
503
504// From another Map_af
505// -------------------
506
507void Map_af::operator=(const Map_af & mpi) {
508
509 assert(mpi.mg == mg) ;
510
511 set_ori( mpi.ori_x, mpi.ori_y, mpi.ori_z ) ;
512
513 set_rot_phi( mpi.rot_phi ) ;
514
515 for (int l = 0; l<mg->get_nzone(); l++) {
516 alpha[l] = mpi.alpha[l] ;
517 beta[l] = mpi.beta[l] ;
518 }
519
520 reset_coord() ;
521}
522
523
524
525
526 //-------------------------------------------------//
527 // Assignement of the Coord building functions //
528 //-------------------------------------------------//
529
531
532 // ... Coord's introduced by the base class Map :
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) ;
540
541 x.set(this, map_af_fait_x) ;
542 y.set(this, map_af_fait_y) ;
543 z.set(this, map_af_fait_z) ;
544
545 xa.set(this, map_af_fait_xa) ;
546 ya.set(this, map_af_fait_ya) ;
547 za.set(this, map_af_fait_za) ;
548
549 // ... Coord's introduced by the base class Map_radial :
550 xsr.set(this, map_af_fait_xsr) ;
551 dxdr.set(this, map_af_fait_dxdr) ;
552 drdt.set(this, map_af_fait_drdt) ;
553 stdrdp.set(this, map_af_fait_stdrdp) ;
554 srdrdt.set(this, map_af_fait_srdrdt) ;
555 srstdrdp.set(this, map_af_fait_srstdrdp) ;
556 sr2drdt.set(this, map_af_fait_sr2drdt) ;
557 sr2stdrdp.set(this, map_af_fait_sr2stdrdp) ;
558 d2rdx2.set(this, map_af_fait_d2rdx2) ;
559 lapr_tp.set(this, map_af_fait_lapr_tp) ;
560 d2rdtdx.set(this, map_af_fait_d2rdtdx) ;
561 sstd2rdpdx.set(this, map_af_fait_sstd2rdpdx) ;
562 sr2d2rdt2.set(this, map_af_fait_sr2d2rdt2) ;
563
564}
565// Comparison operator :
566bool Map_af::operator==(const Map& mpi) const {
567
568 // Precision of the comparison
569 double precis = 1e-10 ;
570 bool resu = true ;
571
572 // Dynamic cast pour etre sur meme Map...
573 const Map_af* mp0 = dynamic_cast<const Map_af*>(&mpi) ;
574 if (mp0 == 0x0)
575 resu = false ;
576 else {
577 if (*mg != *(mpi.get_mg()))
578 resu = false ;
579
580 if (fabs(ori_x-mpi.get_ori_x()) > precis) resu = false ;
581 if (fabs(ori_y-mpi.get_ori_y()) > precis) resu = false ;
582 if (fabs(ori_z-mpi.get_ori_z()) > precis) resu = false ;
583
584 if (bvect_spher != mpi.get_bvect_spher()) resu = false ;
585 if (bvect_cart != mpi.get_bvect_cart()) resu = false ;
586
587 int nz = mg->get_nzone() ;
588 for (int i=0 ; i<nz ; i++) {
589 if (fabs(alpha[i]-mp0->alpha[i])/fabs(alpha[i]) > precis)
590 resu = false ;
591 if ((i!=0) && (i!=nz-1))
592 if (fabs(beta[i]-mp0->beta[i])/fabs(beta[i]) > precis)
593 resu = false ;
594 }
595 }
596
597 return resu ;
598}
599
600 //--------------------------------------//
601 // Extraction of the mapping parameters //
602 //--------------------------------------//
603
604const double* Map_af::get_alpha() const {
605 return alpha ;
606}
607
608const double* Map_af::get_beta() const {
609 return beta ;
610}
611
612 //------------//
613 // Sauvegarde //
614 //------------//
615
616void Map_af::sauve(FILE* fd) const {
617
618 Map_radial::sauve(fd) ;
619
620 int nz = mg->get_nzone() ;
621 fwrite_be(alpha, sizeof(double), nz, fd) ;
622 fwrite_be(beta, sizeof(double), nz, fd) ;
623
624}
625
626 //------------//
627 // Impression //
628 //------------//
629
630ostream & Map_af::operator>>(ostream & ost) const {
631
632 using namespace Unites ;
633
634 ost << "Affine mapping (class Map_af)" << endl ;
635 int nz = mg->get_nzone() ;
636 for (int l=0; l<nz; l++) {
637 ost << " Domain #" << l << " : alpha_l = " << alpha[l]
638 << " , beta_l = " << beta[l] << endl ;
639 }
640
641 ost << endl << " Values of r at the outer boundary of each domain [km] :"
642 << endl ;
643 ost << " val_r : " ;
644 for (int l=0; l<nz; l++) {
645 ost << " " << val_r(l, 1., 0., 0.) / km ;
646 }
647 ost << endl ;
648
649 ost << " Coord r : " ;
650 for (int l=0; l<nz; l++) {
651 int nrm1 = mg->get_nr(l) - 1 ;
652 ost << " " << (+r)(l, 0, 0, nrm1) / km ;
653 }
654 ost << endl ;
655
656 return ost ;
657}
658
659 //------------------//
660 // Homothetie //
661 //------------------//
662
663
664void Map_af::homothetie(double fact) {
665
666 int nz = mg->get_nzone() ;
667
668 for (int l=0; l<nz; l++) {
669 if (mg->get_type_r(l) == UNSURR) {
670 alpha[l] /= fact ;
671 beta[l] /= fact ;
672 }
673 else {
674 alpha[l] *= fact ;
675 beta[l] *= fact ;
676 }
677 }
678
679 reset_coord() ;
680
681}
682
683 //----------------------------//
684 // Rescaling of one domain //
685 //----------------------------//
686
687void Map_af::resize(int l, double lambda) {
688
689 // Protections
690 // -----------
691 if (mg->get_type_r(l) != FIN) {
692 cout << "Map_af::resize can be applied only to a shell !" << endl ;
693 abort() ;
694 }
695
696 // New values of alpha and beta in domain l :
697 // ----------------------------------------
698 double n_alpha = 0.5 * ( (lambda + 1.) * alpha[l] +
699 (lambda - 1.) * beta[l] ) ;
700
701 double n_beta = 0.5 * ( (lambda - 1.) * alpha[l] +
702 (lambda + 1.) * beta[l] ) ;
703
704 alpha[l] = n_alpha ;
705 beta[l] = n_beta ;
706
707 // New values of alpha and beta in domain l+1 :
708 // ------------------------------------------
709 assert(l<mg->get_nzone()-1) ;
710 int lp1 = l + 1 ;
711
712 if (mg->get_type_r(lp1) == UNSURR) { // compactified case
713
714 alpha[lp1] = - 0.5 / ( alpha[l] + beta[l] ) ;
715 beta[lp1] = - alpha[lp1] ;
716
717 }
718 else{ // non-compactified case
719
720 assert( mg->get_type_r(lp1) == FIN ) ;
721 n_alpha = 0.5 * ( alpha[lp1] - alpha[l] + beta[lp1] - beta[l] ) ;
722 n_beta = 0.5 * ( alpha[lp1] + alpha[l] + beta[lp1] + beta[l] ) ;
723 alpha[lp1] = n_alpha ;
724 beta[lp1] = n_beta ;
725 }
726
727 // The coords are no longer up to date :
728 reset_coord() ;
729
730}
731
732
733
734
735
736 //---------------------------//
737 // Homothetie partielle //
738 //-------------------------//
739
740
741void Map_af::homothetie_interne(double fact) {
742
743 // Dans le noyau
744 alpha[0] *= fact ;
745
746 // Dans la premiere coquille :
747 double asauve = alpha[1] ;
748 alpha[1] = (1-fact)/2.*beta[1] + (1+fact)/2. * alpha[1] ;
749 beta[1] = (1+fact)/2.*beta[1]+ (1-fact)/2. * asauve ;
750
751 reset_coord() ;
752}
753 //------------------------------------------//
754 // Modification of the mapping parameters //
755 //------------------------------------------//
756
757void Map_af::set_alpha(double alpha0, int l) {
758
759 assert(l>=0) ;
760 assert(l<mg->get_nzone()) ;
761
762 alpha[l] = alpha0 ;
763
764 reset_coord() ;
765
766}
767
768void Map_af::set_beta(double beta0, int l) {
769
770 assert(l>=0) ;
771 assert(l<mg->get_nzone()) ;
772
773 beta[l] = beta0 ;
774
775 reset_coord() ;
776
777}
778
779 //------------------------------------//
780 // Angular part of the mapping //
781 //------------------------------------//
782
783const Map_af& Map_af::mp_angu(int l_zone) const {
784//## the handling of l_zone must be improved
785 if (p_mp_angu == 0x0) {
786 const Mg3d& g_angu = (*get_mg()->get_angu_1dom()) ;
787 double Rb = val_r_jk(l_zone, 1., 0, 0) ;
788 Tbl rlim(2) ;
789 rlim.set_etat_qcq() ;
790 rlim.set(0) = Rb ;
791 rlim.set(1) = Rb ;
792 p_mp_angu = new Map_af(g_angu, rlim) ;
793 }
794 return *p_mp_angu ;
795}
796
797// To be done
798//-----------
799
800void Map_af::adapt(const Cmp&, const Param&, int) {
801 const char* f = __FILE__ ;
802 c_est_pas_fait(f) ;
803}
804
805void Map_af::poisson_angu(const Cmp& source, Param& par,
806 Cmp& uu, double lambda) const {
807 c_est_pas_fait("Map_af::poisson_angu(Cmp)") ;
808 }
809
810
811
812}
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition cmp.h:446
virtual ostream & operator>>(ostream &) const
Operator >>.
Definition map_af.C:630
const double * get_beta() const
Returns the pointer on the array beta.
Definition map_af.C:608
const double * get_alpha() const
Returns the pointer on the array alpha.
Definition map_af.C:604
void set_beta(double beta0, int l)
Modifies the value of in domain no. l.
Definition map_af.C:768
virtual void adapt(const Cmp &ent, const Param &par, int nbr=0)
Adaptation of the mapping to a given scalar field.
Definition map_af.C:800
void set_coord()
Assignment of the building functions to the member Coords.
Definition map_af.C:530
Map_af(const Mg3d &mgrille, const double *r_limits)
Standard Constructor.
Definition map_af.C:213
virtual ~Map_af()
Destructor.
Definition map_af.C:495
virtual void sauve(FILE *) const
Save in a file.
Definition map_af.C:616
double * beta
Array (size: mg->nzone ) of the values of in each domain.
Definition map.h:2050
virtual void operator=(const Map_af &)
Assignment to another affine mapping.
Definition map_af.C:507
void homothetie_interne(double lambda)
Sets a new radial scale at the bondary between the nucleus and the first shell.
Definition map_af.C:741
virtual void homothetie(double lambda)
Sets a new radial scale.
Definition map_af.C:664
virtual void poisson_angu(const Scalar &source, Param &par, Scalar &uu, double lambda=0) const
Computes the solution of the generalized angular Poisson equation.
double * alpha
Array (size: mg->nzone ) of the values of in each domain.
Definition map.h:2048
virtual bool operator==(const Map &) const
Comparison operator (egality).
Definition map_af.C:566
void set_alpha(double alpha0, int l)
Modifies the value of in domain no. l.
Definition map_af.C:757
virtual void resize(int l, double lambda)
Rescales the outer boundary of one domain.
Definition map_af.C:687
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.
Definition map_af.C:783
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.
Definition map.h:2770
const double * get_alpha() const
Returns a pointer on the array alpha (values of in each domain).
Definition map_et.C:1049
const double * get_beta() const
Returns a pointer on the array beta (values of in each domain).
Definition map_et.C:1053
Coord d2rdx2
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1634
Coord sr2drdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1615
Coord srstdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1607
Coord d2rdtdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1655
Coord sstd2rdpdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1663
virtual void reset_coord()
Resets all the member Coords.
Definition map_radial.C:129
Coord lapr_tp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1646
Coord sr2stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1623
Coord drdt
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED).
Definition map.h:1583
Coord srdrdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1599
Map_radial(const Mg3d &mgrid)
Constructor from a grid (protected to make Map_radial an abstract class).
Definition map_radial.C:92
Coord xsr
in the nucleus; \ 1/R in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1564
virtual void sauve(FILE *) const
Save in a file.
Definition map_radial.C:119
Coord dxdr
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1575
Coord sr2d2rdt2
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1672
Coord stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED).
Definition map.h:1591
Multi-domain grid.
Definition grilles.h:279
const Mg3d * get_angu_1dom() const
Returns the pointer on the associated mono-domain angular grid.
Definition mg3d.C:625
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Definition grilles.h:491
Parameter storage.
Definition param.h:125
Basic array class.
Definition tbl.h:161
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition tbl.C:364
double & set(int i)
Read/write of a particular element (index i) (1D case).
Definition tbl.h:281
Base_vect_spher bvect_spher
Base class for coordinate mappings.
Definition map.h:701
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.
Definition fread_be.C:72
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.
Definition misc.C:53
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.
Definition fwrite_be.C:73
Lorene prototypes.
Definition app_hor.h:67
Map_af * p_mp_angu
Pointer on the "angular" mapping.
Definition map.h:727
Coord z
z coordinate centered on the grid
Definition map.h:740
Base_vect_cart bvect_cart
Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
Definition map.h:709
Coord cost
Definition map.h:734
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition map.h:777
Coord y
y coordinate centered on the grid
Definition map.h:739
Coord cosp
Definition map.h:736
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Definition map.C:142
Coord phi
coordinate centered on the grid
Definition map.h:732
Coord tet
coordinate centered on the grid
Definition map.h:731
void set_rot_phi(double phi0)
Sets a new rotation angle.
Coord x
x coordinate centered on the grid
Definition map.h:738
Coord xa
Absolute x coordinate.
Definition map.h:742
Coord za
Absolute z coordinate.
Definition map.h:744
void set_ori(double xa0, double ya0, double za0)
Sets a new origin.
Coord sinp
Definition map.h:735
Coord r
r coordinate centered on the grid
Definition map.h:730
Coord ya
Absolute y coordinate.
Definition map.h:743
Coord sint
Definition map.h:733
Standard units of space, time and mass.