LORENE
grille_val.C
1/*
2 * Methods for the class Grille_val, and its derivative classes.
3 *
4 * See the file grille_val.h for documentation
5 *
6 */
7
8/*
9 * Copyright (c) 2001 Jerome Novak
10 *
11 * This file is part of LORENE.
12 *
13 * LORENE is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * LORENE is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with LORENE; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 *
27 */
28
29
30char Grille_val_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valencia/grille_val.C,v 1.7 2014/10/13 08:53:48 j_novak Exp $" ;
31
32/*
33 * $Id: grille_val.C,v 1.7 2014/10/13 08:53:48 j_novak Exp $
34 * $Log: grille_val.C,v $
35 * Revision 1.7 2014/10/13 08:53:48 j_novak
36 * Lorene classes and functions now belong to the namespace Lorene.
37 *
38 * Revision 1.6 2013/07/15 13:14:41 j_novak
39 * Correcting copy constructor and operator =
40 *
41 * Revision 1.5 2008/02/18 13:53:48 j_novak
42 * Removal of special indentation instructions.
43 *
44 * Revision 1.4 2003/12/19 15:05:14 j_novak
45 * Trying to avoid shadowed variables
46 *
47 * Revision 1.3 2003/10/03 16:17:17 j_novak
48 * Corrected some const qualifiers
49 *
50 * Revision 1.2 2001/12/04 21:27:54 e_gourgoulhon
51 *
52 * All writing/reading to a binary file are now performed according to
53 * the big endian convention, whatever the system is big endian or
54 * small endian, thanks to the functions fwrite_be and fread_be
55 *
56 * Revision 1.1 2001/11/22 13:41:54 j_novak
57 * Added all source files for manipulating Valencia type objects and making
58 * interpolations to and from Meudon grids.
59 *
60 *
61 * $Header: /cvsroot/Lorene/C++/Source/Valencia/grille_val.C,v 1.7 2014/10/13 08:53:48 j_novak Exp $
62 *
63 */
64
65// Fichier includes
66#include "grille_val.h"
67#include "utilitaires.h"
68
69 //---------------//
70 // Constructeurs //
71 //---------------//
72
73// Fonction auxilliaire
74namespace Lorene {
75Tbl* Grille_val::fait_grille1D(const double rmin, const double rmax, const
76 int n)
77{
79 Tbl* resu = new Tbl(n) ;
80 double step = (rmax - rmin)/double(n-1) ;
81 resu->set_etat_qcq() ;
82 for (int i=0; i<n; i++) resu->set(i) = rmin + i*step ;
83 return resu ;
84}
85
86// Constructeur 1D
87Grille_val::Grille_val(const double izrmin, const double izrmax, const
88 int n1, const int fantome):
89 dim(n1), nfantome(fantome), type_t(SYM), type_p(SYM)
90{
91 assert (n1 > 0) ;
92 zrmin = new double(izrmin) ;
93 zrmax = new double(izrmax) ;
94 double amin = ((n1 + nfantome - 0.5)*izrmin -
95 (nfantome-0.5)*izrmax) / n1 ;
96 double amax = ((n1 + nfantome - 0.5)*izrmax -
97 (nfantome-0.5)*izrmin) / n1 ;
99 amin = ((n1 + nfantome)*izrmin - nfantome*izrmax) / n1 ;
100 amax = ((n1 + nfantome)*izrmax - nfantome*izrmin) / n1 ;
102}
103
104// Constructeur 2D
105Grille_val::Grille_val(const double izrmin, const double izrmax, const
106 int n2, const int n1, const int itype_t,
107 const int fantome):
108 dim(n2,n1), nfantome(fantome), type_t(itype_t), type_p(SYM)
109
110{
111 zrmin = new double(izrmin) ;
112 zrmax = new double(izrmax) ;
113 double amin = ((n1 + nfantome - 0.5)*izrmin -
114 (nfantome-0.5)*izrmax) / n1 ;
115 double amax = ((n1 + nfantome - 0.5)*izrmax -
116 (nfantome-0.5)*izrmin) / n1 ;
118 amin = ((n1 + nfantome)*izrmin - nfantome*izrmax) / n1 ;
119 amax = ((n1 + nfantome)*izrmax - nfantome*izrmin) / n1 ;
121
122}
123
124// Constructeur 3D
125Grille_val::Grille_val(const double izrmin, const double izrmax,
126 const int n3, const int n2, const int n1,
127 const int itype_t, const int itype_p,
128 const int fantome ): dim(n3,n2,n1), nfantome(fantome),
129 type_t(itype_t), type_p(itype_p)
130{
131 zrmin = new double(izrmin) ;
132 zrmax = new double(izrmax) ;
133 double amin = ((n1 + nfantome - 0.5)*izrmin -
134 (nfantome-0.5)*izrmax) / n1 ;
135 double amax = ((n1 + nfantome - 0.5)*izrmax -
136 (nfantome-0.5)*izrmin) / n1 ;
138 amin = ((n1 + nfantome)*izrmin - nfantome*izrmax) / n1 ;
139 amax = ((n1 + nfantome)*izrmax - nfantome*izrmin) / n1 ;
141}
142
143
144// Constructeur par recopie
146 nfantome(titi.nfantome), type_t(titi.type_t), type_p(titi.type_p)
147{
148 assert(titi.zr != 0x0) ;
149 assert(titi.zri != 0x0) ;
150 assert(titi.zrmin != 0x0) ;
151 assert(titi.zrmax != 0x0) ;
152 zr = new Tbl(*titi.zr) ;
153 zri = new Tbl(*titi.zri) ;
154 zrmin = new double(*titi.zrmin) ;
155 zrmax = new double(*titi.zrmax) ;
156
157}
158
159// Depuis un fichier
161
162 fread_be(&nfantome, sizeof(int), 1, fd) ;
163 fread_be(&type_t, sizeof(int), 1, fd) ;
164 fread_be(&type_p, sizeof(int), 1, fd) ;
165
166 double amin, amax ;
167 fread_be(&amin, sizeof(double), 1, fd) ;
168 fread_be(&amax, sizeof(double), 1, fd) ;
169 zrmin = new double(amin) ;
170 zrmax = new double(amax) ;
171 zr = new Tbl(fd) ;
172 zri = new Tbl(fd) ;
173
174}
175
176 //--------------//
177 // Destructeurs //
178 //--------------//
179
180// Destructeur
182
183 assert(zr != 0x0) ;
184 assert(zri != 0x0) ;
185 assert(zrmin != 0x0) ;
186 assert(zrmax != 0x0) ;
187 delete zr ;
188 delete zri ;
189 delete zrmin ;
190 delete zrmax ;
191
192}
193
194 //-------------//
195 // Affectation //
196 //-------------//
197
198// Depuis une autre Grille_val
200
201 dim = titi.dim ;
202 nfantome = titi.nfantome ;
203 type_t = titi.type_t ;
204 type_p = titi.type_p ;
205
206 assert(titi.zr != 0x0) ;
207 assert(titi.zri != 0x0) ;
208 assert(titi.zrmin != 0x0) ;
209 assert(titi.zrmax != 0x0) ;
210
211 for (int i=0; i<dim.dim[0]+2*nfantome; i++)
212 zr->t[i] = titi.zr->t[i] ;
213 for (int i=0; i<dim.dim[0] + 2*nfantome + 1; i++)
214 zri->t[i] = titi.zri->t[i] ;
215 *zrmin = *titi.zrmin ;
216 *zrmax = *titi.zrmax ;
217}
218
219 //------------//
220 // Sauvegarde //
221 //------------//
222
223// Sauve dans un fchier
225
226 dim.sauve(fd) ;
227 fwrite_be(&nfantome, sizeof(int), 1, fd) ;
228 fwrite_be(&type_t, sizeof(int), 1, fd) ;
229 fwrite_be(&type_p, sizeof(int), 1, fd) ;
230
231 fwrite_be(zrmin, sizeof(double), 1, fd) ;
232 fwrite_be(zrmax, sizeof(double), 1, fd) ;
233
234 zr->sauve(fd) ; zri->sauve(fd) ;
235
236}
237
238 //------------//
239 // Impression //
240 //------------//
241
242// Operateurs <<
244 titi >> o ;
245 return o ;
246}
247
249 int ndim = dim.ndim ;
250 int nfant = nfantome ;
251 o.precision(4);
252 o.setf(ios::showpoint);
253 o << "*** Grille_val " << ndim << "D" << " size: " ;
254 for (int i = 0; i<ndim-1; i++) {
255 o << dim.dim[ndim-1-i] ;
256 if (ndim-i == 3) o << " x " ;
257 if (ndim-i == 2) o << " x " ;
258 }
259 o << dim.dim[0] << endl ;
260 o << nfant << " hidden cells on each side " << endl ;
261 return o ;
262}
263
264 //------------------------------------//
265 // class Gval_cart //
266 //------------------------------------//
267
268/*********************************************************************
269 *
270 * Cartesian grid for Godunov-type integration schemes
271 *
272 *********************************************************************/
273
274 //---------------//
275 // Constructeurs //
276 //---------------//
277
278// Constructeur 1D
279Gval_cart::Gval_cart(const double izmin, const double izmax, const int nz,
280 const int fantome)
281 :Grille_val(izmin, izmax, nz, fantome),
282 xmin(0x0), xmax(0x0),
283 ymin(0x0), ymax(0x0),
284 x(0x0), xi(0x0),
285 y(0x0), yi(0x0){
286}
287
288// Constructeur 2D
289Gval_cart::Gval_cart(const double ixmin, const double ixmax, const
290 double izmin, const double izmax, const int nx,
291 const int nz, const int itype_t, const int fantome)
293 ymin(0x0), ymax(0x0),
294 y(0x0), yi(0x0)
295{
296 assert ( (type_t!=SYM) || (izmin >= double(0)) ) ;
297
298 xmin = new double(ixmin) ;
299 xmax = new double(ixmax) ;
300 double amin = ((nx + nfantome - 0.5)*ixmin -
301 (nfantome-0.5)*ixmax) / nx ;
302 double amax = ((nx + nfantome - 0.5)*ixmax -
303 (nfantome-0.5)*ixmin) / nx ;
305 amin = ((nx + nfantome)*ixmin - nfantome*ixmax) / nx ;
306 amax = ((nx + nfantome)*ixmax - nfantome*ixmin) / nx ;
308
309}
310
311// Constructeur 3D
312Gval_cart::Gval_cart(const double iymin, const double iymax,
313 const double ixmin, const double ixmax, const
314 double izmin, const double izmax, const int ny,
315 const int nx, const int nz, const int itype_t,
316 const int itype_p, const int fantome)
318{
319 assert ( (type_t!=SYM) || (izmin >= double(0)) ) ;
320 assert ( (type_p!=SYM) || (iymin >= double(0)) ) ;
321
322 xmin = new double(ixmin) ;
323 xmax = new double(ixmax) ;
324 double amin = ((nx + nfantome - 0.5)*ixmin -
325 (nfantome-0.5)*ixmax) / nx ;
326 double amax = ((nx + nfantome - 0.5)*ixmax -
327 (nfantome-0.5)*ixmin) / nx ;
329 amin = ((nx + nfantome)*ixmin - nfantome*ixmax) / nx ;
330 amax = ((nx + nfantome)*ixmax - nfantome*ixmin) / nx ;
332
333 ymin = new double(iymin) ;
334 ymax = new double(iymax) ;
335 amin = ((ny + nfantome - 0.5)*iymin -
336 (nfantome-0.5)*iymax) / ny ;
337 amax = ((ny + nfantome - 0.5)*iymax -
338 (nfantome-0.5)*iymin) / ny ;
340 amin = ((ny + nfantome)*iymin - nfantome*iymax) / ny ;
341 amax = ((ny + nfantome)*iymax - nfantome*iymin) / ny ;
343
344}
345
346// Constructeur par recopie
349{
350 if (titi.x != 0x0) x = new Tbl(*titi.x) ;
351 if (titi.xi != 0x0) xi = new Tbl(*titi.xi) ;
352 if (titi.xmin != 0x0) xmin = new double(*titi.xmin) ;
353 if (titi.xmax != 0x0) xmax = new double(*titi.xmax) ;
354 if (titi.y != 0x0) y = new Tbl(*titi.y) ;
355 if (titi.yi != 0x0) yi = new Tbl(*titi.yi) ;
356 if (titi.ymin != 0x0) ymin = new double(*titi.ymin) ;
357 if (titi.ymax != 0x0) ymax = new double(*titi.ymax) ;
358
359}
360
361// Depuis un fichier
363 : Grille_val(fd)
364{
365 double amin, amax ;
366 if (dim.ndim >= 2) {
367 fread_be(&amin, sizeof(double), 1, fd) ;
368 fread_be(&amax, sizeof(double), 1, fd) ;
369 xmin = new double(amin) ;
370 xmax = new double(amax) ;
371 x = new Tbl(fd) ;
372 xi = new Tbl(fd) ;
373 }
374 if (dim.ndim >= 3) {
375 fread_be(&amin, sizeof(double), 1, fd) ;
376 fread_be(&amax, sizeof(double), 1, fd) ;
377 ymin = new double(amin) ;
378 ymax = new double(amax) ;
379 y = new Tbl(fd) ;
380 yi = new Tbl(fd) ;
381 }
382}
383
384
385 //--------------//
386 // Destructeurs //
387 //--------------//
388
389// Destructeur
391
392 if (x != 0x0) delete x ;
393 if (xi != 0x0) delete xi ;
394 if (xmin != 0x0) delete xmin ;
395 if (xmax != 0x0) delete xmax ;
396 if (y != 0x0) delete y ;
397 if (yi != 0x0) delete yi ;
398 if (ymin != 0x0) delete ymin ;
399 if (ymax != 0x0) delete ymax ;
400
401}
402
403 //-------------//
404 // Affectation //
405 //-------------//
406
407// Depuis une autre Grille_val
409
411
412 if (titi.x != 0x0) *x = *titi.x ;
413 if (titi.xi != 0x0) *xi = *titi.xi ;
414 if (titi.xmin != 0x0) *xmin = *titi.xmin ;
415 if (titi.xmax != 0x0) *xmax = *titi.xmax ;
416 if (titi.y != 0x0) *y = *titi.y ;
417 if (titi.yi != 0x0) *yi = *titi.yi ;
418 if (titi.ymin != 0x0) *ymin = *titi.ymin ;
419 if (titi.ymax != 0x0) *ymax = *titi.ymax ;
420}
421
422 //------------//
423 // Sauvegarde //
424 //------------//
425
426// save onto a file
428
430
431 if (dim.ndim >= 2) {
432 fwrite_be(xmin, sizeof(double), 1, fd) ;
433 fwrite_be(xmax, sizeof(double), 1, fd) ;
434 x->sauve(fd) ; xi->sauve(fd) ;
435 }
436 if (dim.ndim >= 3) {
437 fwrite_be(ymin, sizeof(double), 1, fd) ;
438 fwrite_be(ymax, sizeof(double), 1, fd) ;
439 y->sauve(fd) ; yi->sauve(fd) ;
440 }
441
442}
443
444
445 //------------//
446 // Impression //
447 //------------//
448
449// Operateurs <<
451
452 int ndim = dim.ndim;
454
455 o << "*** Cartesian grid ***" << endl ;
456
457 switch (ndim) {
458
459 case 1 : {
460 o << "Z nodes: " << endl ;
461 for (int i=0; i<dim.dim[0]; i++) {
462 o << zr->set(i+nfantome) << " " ;
463 }
464 o << endl ;
465 break ;
466 }
467
468
469 case 2 : {
470 o << "X nodes: " << endl ;
471 for (int j=0 ; j<dim.dim[1] ; j++) {
472 o << " " << x->set(j+nfantome) ;
473 }
474 o << endl ;
475
476 o << "Z nodes: " << endl ;
477
478 for (int i=0 ; i<dim.dim[0] ; i++) {
479 o << " " << zr->set(i+nfantome) ;
480 }
481 o << endl ;
482 break ;
483 }
484
485 case 3 : {
486 o << "Y nodes: " << endl ;
487 for (int k=0 ; k<dim.dim[2] ; k++) {
488 o << " " << y->set(k+nfantome) ;
489 }
490 o << endl ;
491
492 o << "X nodes: " << endl ;
493 for (int j=0 ; j<dim.dim[1] ; j++) {
494 o << " " << x->set(j+nfantome) ;
495 }
496 o << endl ;
497
498 o << "Z nodes: " << endl ;
499
500 for (int i=0 ; i<dim.dim[0] ; i++) {
501 o << " " << zr->set(i+nfantome) ;
502 }
503 o << endl ;
504 break ;
505 }
506
507 default : {
508 cout << "operator>> Gval_cart : unexpected dimension !" << endl ;
509 cout << " ndim = " << ndim << endl ;
510 abort() ;
511 break ;
512 }
513 }
514
515 return o ;
516}
517 //------------------------------------//
518 // class Gval_spher //
519 //------------------------------------//
520
521/*********************************************************************
522 *
523 * Spherical grids for Godunov-type integration schemes
524 *
525 *********************************************************************/
526
527 //---------------//
528 // Constructeurs //
529 //---------------//
530
531// Constructeur 1D
532Gval_spher::Gval_spher(const double irmin, const double irmax, const int nr,
533 const int fantome)
534 :Grille_val(irmin, irmax, nr, fantome),
535 tet(0x0), teti(0x0),
536 phi(0x0), phii(0x0){
537 assert(irmin>=double(0)) ;
538}
539
540// Constructeur 2D
541Gval_spher::Gval_spher(const double irmin, const double irmax, const int nt,
542 const int nr, const int itype_t, const int fantome)
543 :Grille_val(irmin, irmax, nt, nr, itype_t, fantome),
544 phi(0x0), phii(0x0)
545{
546 assert (irmin >= double(0)) ;
547
548 double tetmin = 0. ;
549 double tetmax = (type_t == SYM ? M_PI_2 : M_PI) ;
550 double amin = ((nt + nfantome - 0.5)*tetmin -
551 (nfantome-0.5)*tetmax) / nt ;
552 double amax = ((nt + nfantome - 0.5)*tetmax -
553 (nfantome-0.5)*tetmin) / nt ;
554 tet = fait_grille1D(amin, amax, nt+2*fantome) ;
555 amin = ((nt + nfantome)*tetmin - nfantome*tetmax) / nt ;
556 amax = ((nt + nfantome)*tetmax - nfantome*tetmin) / nt ;
557 teti = fait_grille1D(amin, amax, nt+2*fantome+1) ;
558
559}
560
561// Constructeur 3D
562Gval_spher::Gval_spher(const double irmin, const double irmax, const int np,
563 const int nt, const int nr, const int itype_t,
564 const int itype_p, const int fantome)
565 :Grille_val(irmin, irmax, np, nt, nr, itype_t, itype_p, fantome)
566{
567 assert (irmin >= double(0)) ;
568
569
570 double tetmin = 0. ;
571 double tetmax = (type_t == SYM ? M_PI_2 : M_PI) ;
572 double amin = ((nt + nfantome - 0.5)*tetmin -
573 (nfantome-0.5)*tetmax) / nt ;
574 double amax = ((nt + nfantome - 0.5)*tetmax -
575 (nfantome-0.5)*tetmin) / nt ;
576 tet = fait_grille1D(amin, amax, nt+2*fantome) ;
577 amin = ((nt + nfantome)*tetmin - nfantome*tetmax) / nt ;
578 amax = ((nt + nfantome)*tetmax - nfantome*tetmin) / nt ;
579 teti = fait_grille1D(amin, amax, nt+2*fantome+1) ;
580
581 double phimin = 0. ;
582 double phimax = ( type_p == SYM ? M_PI : 2.*M_PI) ; //??? a verifier!
583 amin = ((np + nfantome - 0.5)*phimin -
584 (nfantome-0.5)*phimax) / np ;
585 amax = ((np + nfantome - 0.5)*phimax -
586 (nfantome-0.5)*phimin) / np ;
587 phi = fait_grille1D(amin, amax, np+2*fantome) ;
588 amin = ((np + nfantome)*phimin - nfantome*phimax) / np ;
589 amax = ((np + nfantome)*phimax - nfantome*phimin) / np ;
590 phii = fait_grille1D(amin, amax, np+2*fantome+1) ;
591
592}
593
594// Constructeur par recopie
596 :Grille_val(titi), tet(0x0), teti(0x0), phi(0x0), phii(0x0)
597{
598 if (titi.tet != 0x0) tet = new Tbl(*titi.tet) ;
599 if (titi.teti != 0x0) teti = new Tbl(*titi.teti) ;
600 if (titi.phi != 0x0) phi = new Tbl(*titi.phi) ;
601 if (titi.phii != 0x0) phii = new Tbl(*titi.phii) ;
602
603}
604
605// Depuis un fichier
607 : Grille_val(fd)
608{
609 if (dim.ndim >= 2) {
610 tet = new Tbl(fd) ;
611 teti = new Tbl(fd) ;
612 }
613 if (dim.ndim >= 3) {
614 phi = new Tbl(fd) ;
615 phii = new Tbl(fd) ;
616 }
617}
618
619 //--------------//
620 // Destructeurs //
621 //--------------//
622
623// Destructeur
625
626 if (tet != 0x0) delete tet ;
627 if (teti != 0x0) delete teti ;
628 if (phi != 0x0) delete phi ;
629 if (phii != 0x0) delete phii ;
630
631}
632
633 //-------------//
634 // Affectation //
635 //-------------//
636
637// Depuis une autre Grille_val
639
641
642 if (titi.tet != 0x0) {
643 if (tet == 0x0)
644 tet = new Tbl(*titi.tet) ;
645 else
646 *tet = *titi.tet ;
647 }
648 else {
649 if (tet != 0x0) delete tet ;
650 tet = 0x0 ;
651 }
652 if (titi.teti != 0x0) {
653 if (teti == 0x0)
654 teti = new Tbl(*titi.teti) ;
655 else
656 *teti = *titi.teti ;
657 }
658 else {
659 if (teti != 0x0) delete teti ;
660 teti = 0x0 ;
661 }
662 if (titi.phi != 0x0) {
663 if (phi == 0x0)
664 phi = new Tbl(*titi.phi) ;
665 else
666 *phi = *titi.phi ;
667 }
668 else {
669 if (phi != 0x0) delete phi ;
670 phi = 0x0 ;
671 }
672 if (titi.phii != 0x0) {
673 if (phii == 0x0)
674 phii = new Tbl(*titi.phii) ;
675 else
676 *phii = *titi.phii ;
677 }
678 else {
679 if (phii != 0x0) delete phii ;
680 phii = 0x0 ;
681 }
682}
683
684 //------------//
685 // Sauvegarde //
686 //------------//
687
688// save onto a file
690
692
693 if (dim.ndim >= 2) {
694 tet->sauve(fd) ;
695 teti->sauve(fd) ;
696 }
697 if (dim.ndim >= 3) {
698 phi->sauve(fd) ;
699 phii->sauve(fd) ;
700 }
701
702}
703
704 //------------//
705 // Impression //
706 //------------//
707
708// Operateurs <<
710
711 int ndim = dim.ndim;
713
714 o << "*** Spherical grid ***" << endl ;
715
716 switch (ndim) {
717
718 case 1 : {
719 o << "R nodes: " << endl ;
720 for (int i=0; i<dim.dim[0]; i++) {
721 o << zr->set(i+nfantome) << " " ;
722 }
723 o << endl ;
724 break ;
725 }
726
727
728 case 2 : {
729 o << "THETA nodes: " << endl ;
730 for (int j=0 ; j<dim.dim[1] ; j++) {
731 o << " " << tet->set(j+nfantome) ;
732 }
733 o << endl ;
734
735 o << "R nodes: " << endl ;
736
737 for (int i=0 ; i<dim.dim[0] ; i++) {
738 o << " " << zr->set(i+nfantome) ;
739 }
740 o << endl ;
741 break ;
742 }
743
744 case 3 : {
745 o << "PHI nodes: " << endl ;
746 for (int k=0 ; k<dim.dim[2] ; k++) {
747 o << " " << phi->set(k+nfantome) ;
748 }
749 o << endl ;
750
751 o << "THETA nodes: " << endl ;
752 for (int j=0 ; j<dim.dim[1] ; j++) {
753 o << " " << tet->set(j+nfantome) ;
754 }
755 o << endl ;
756
757 o << "R nodes: " << endl ;
758
759 for (int i=0 ; i<dim.dim[0] ; i++) {
760 o << " " << zr->set(i+nfantome) ;
761 }
762 o << endl ;
763 break ;
764 }
765
766 default : {
767 cout << "operator>> Gval_spher : unexpected dimension !" << endl ;
768 cout << " ndim = " << ndim << endl ;
769 abort() ;
770 break ;
771 }
772 }
773
774 return o ;
775}
776}
void sauve(FILE *) const
Save in a file.
Definition dim_tbl.C:185
int * dim
Array of dimensions (size: ndim).
Definition dim_tbl.h:102
int ndim
Number of dimensions of the Tbl: can be 1, 2 or 3.
Definition dim_tbl.h:101
Time evolution with partial storage (*** under development ***).
Definition evolution.h:371
Base class for Godunov-type grids.
Definition grille_val.h:94
int type_p
Type of symmetry in :
Definition grille_val.h:114
int nfantome
The number of hidden cells (same on each side)
Definition grille_val.h:104
double * zrmin
Lower boundary for z (or r ) direction
Definition grille_val.h:117
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition grille_val.C:248
virtual void sauve(FILE *) const
Save in a file.
Definition grille_val.C:224
Dim_tbl dim
The dimensions of the grid.
Definition grille_val.h:102
Tbl * zr
Arrays containing the values of coordinate z (or r) on the nodes
Definition grille_val.h:124
virtual ~Grille_val()
Destructor.
Definition grille_val.C:181
Tbl * fait_grille1D(const double rmin, const double rmax, const int n)
Auxilliary function used to allocate memory and construct 1D grid.
Definition grille_val.C:75
int type_t
Type of symmetry in :
Definition grille_val.h:109
Grille_val(const double, const double, const int n1, const int fantome=2)
Standard 1D constructor (the size is to be given without hidden cells)
Definition grille_val.C:87
void operator=(const Grille_val &)
Assignment to another Grille_val.
Definition grille_val.C:199
Tbl * zri
Arrays containing the values of coordinate z (or r) on the interfaces.
Definition grille_val.h:126
double * zrmax
Higher boundary for z (or r ) direction
Definition grille_val.h:120
Class for cartesian Godunov-type grids.
Definition grille_val.h:325
double * xmax
Higher boundary for x dimension.
Definition grille_val.h:335
double * xmin
Lower boundary for x dimension.
Definition grille_val.h:333
double * ymin
Lower boundary for y dimension.
Definition grille_val.h:337
virtual void sauve(FILE *) const
Save in a file.
Definition grille_val.C:427
double * ymax
Higher boundary for y dimension.
Definition grille_val.h:339
Tbl * y
Arrays containing the values of coordinate y on the nodes.
Definition grille_val.h:347
void operator=(const Gval_cart &)
Assignment to another Gval_cart.
Definition grille_val.C:408
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition grille_val.C:450
Tbl * xi
Arrays containing the values of coordinate x on the interfaces.
Definition grille_val.h:345
Gval_cart(const double izmin, const double izmax, const int n1, const int fantome=2)
Standard 1D constructor.
Definition grille_val.C:279
virtual ~Gval_cart()
Destructor.
Definition grille_val.C:390
Tbl * x
Arrays containing the values of coordinate x on the nodes.
Definition grille_val.h:343
Tbl * yi
Arrays containing the values of coordinate y on the interfaces.
Definition grille_val.h:349
Class for spherical Godunov-type grids.
Definition grille_val.h:579
void operator=(const Gval_spher &)
Assignment to another Gval_spher.
Definition grille_val.C:638
Tbl * phi
Arrays containing the values of coordinate on the nodes.
Definition grille_val.h:591
Tbl * teti
Arrays containing the values of coordinate on the interfaces.
Definition grille_val.h:589
virtual void sauve(FILE *) const
Save in a file.
Definition grille_val.C:689
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition grille_val.C:709
Tbl * phii
Arrays containing the values of coordinate on the interfaces.
Definition grille_val.h:593
Gval_spher(const double irmin, const double irmax, const int nr, const int fantome=2)
Standard 1D constructor.
Definition grille_val.C:532
virtual ~Gval_spher()
Destructor.
Definition grille_val.C:624
Tbl * tet
Arrays containing the values of coordinate on the nodes.
Definition grille_val.h:587
Basic array class.
Definition tbl.h:161
void sauve(FILE *) const
Save in a file.
Definition tbl.C:326
double & set(int i)
Read/write of a particular element (index i) (1D case)
Definition tbl.h:281
double * t
The array of double.
Definition tbl.h:173
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:69
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:70
Lorene prototypes.
Definition app_hor.h:64