LORENE
grilles.h
1/*
2 * Definition of Lorene classes Grille3d and Mg3d
3 *
4 */
5
6/*
7 * Copyright (c) 1999-2000 Jean-Alain Marck
8 * Copyright (c) 1999-2001 Eric Gourgoulhon
9 *
10 * This file is part of LORENE.
11 *
12 * LORENE is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * LORENE is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with LORENE; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28
29#ifndef __GRILLES_H_
30#define __GRILLES_H_
31
32/*
33 * $Id: grilles.h,v 1.23 2014/10/13 08:52:35 j_novak Exp $
34 * $Log: grilles.h,v $
35 * Revision 1.23 2014/10/13 08:52:35 j_novak
36 * Lorene classes and functions now belong to the namespace Lorene.
37 *
38 * Revision 1.22 2014/10/06 15:09:39 j_novak
39 * Modified #include directives to use c++ syntax.
40 *
41 * Revision 1.21 2013/06/05 15:00:26 j_novak
42 * Suppression of all classes derived from Grille3d. Now Grille3d is no
43 * longer an abstract class. r-samplings are only one of RARE, FIN or
44 * UNSURR (FINJAC has been removed). Instead, Mg3d possesses a new member
45 * colloc_r[nzone] defining the type of collocation points (spectral
46 * bases) in each domain.
47 *
48 * Revision 1.20 2013/01/11 15:44:53 j_novak
49 * Addition of Legendre bases (part 2).
50 *
51 * Revision 1.19 2012/01/17 10:10:15 j_penner
52 * added a constructor in which the nucleus and outer domain are both of type FIN
53 *
54 * Revision 1.18 2008/10/29 08:17:51 jl_cornou
55 * Standard spectral bases for pseudo vectors added
56 *
57 * Revision 1.17 2008/02/18 13:53:37 j_novak
58 * Removal of special indentation instructions.
59 *
60 * Revision 1.16 2007/12/11 15:28:05 jl_cornou
61 * Jacobi(0,2) polynomials partially implemented
62 *
63 * Revision 1.15 2006/05/17 13:17:02 j_novak
64 * New member g_angu_1dom, the one-domain angular grid associated with the
65 * current grid.
66 *
67 * Revision 1.14 2005/10/25 08:56:34 p_grandclement
68 * addition of std_spectral_base in the case of odd functions near the origin
69 *
70 * Revision 1.13 2005/10/07 08:47:20 j_novak
71 * Addition of the pointer g_non_axi on a grid, with at least 5 points in the
72 * theta direction and 4 in the phi one (for tensor rotations).
73 *
74 * Revision 1.12 2005/03/25 14:54:04 e_gourgoulhon
75 * Corrected documentation.
76 *
77 * Revision 1.11 2004/07/06 13:36:27 j_novak
78 * Added methods for desaliased product (operator |) only in r direction.
79 *
80 * Revision 1.10 2004/06/22 08:49:56 p_grandclement
81 * Addition of everything needed for using the logarithmic mapping
82 *
83 * Revision 1.9 2004/03/22 13:12:41 j_novak
84 * Modification of comments to use doxygen instead of doc++
85 *
86 * Revision 1.8 2003/06/20 14:16:57 f_limousin
87 * Add the operator== to compare two Mg3d
88 *
89 * Revision 1.7 2003/06/18 08:45:26 j_novak
90 * In class Mg3d: added the member get_radial, returning only a radial grid
91 * For dAlembert solver: the way the coefficients of the operator are defined has been changed.
92 *
93 * Revision 1.6 2002/10/16 14:36:29 j_novak
94 * Reorganization of #include instructions of standard C++, in order to
95 * use experimental version 3 of gcc.
96 *
97 * Revision 1.5 2002/08/13 08:02:45 j_novak
98 * Handling of spherical vector/tensor components added in the classes
99 * Mg3d and Tenseur. Minor corrections for the class Metconf.
100 *
101 * Revision 1.4 2002/06/17 14:05:16 j_novak
102 * friend functions are now also declared outside the class definition
103 *
104 * Revision 1.3 2001/12/12 09:23:46 e_gourgoulhon
105 * Parameter compact added to the simplified constructor of class Mg3d
106 *
107 * Revision 1.2 2001/12/11 06:47:42 e_gourgoulhon
108 * Simplified constructor for class Mg3d
109 *
110 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
111 * LORENE
112 *
113 * Revision 2.10 2001/06/13 14:23:40 eric
114 * Les fonctions Mg3d::del_deriv() et Mg3d::set_deriv_0x0() ne sont plus
115 * virtuelles puisque Mg3d n'a aucune classe derivee.
116 *
117 * Revision 2.9 2001/05/26 13:24:49 eric
118 * Ajout du membre g_twice (grille double pour le desaliasing)
119 * Modif de la declaration de g_angu (pointeur mutable)
120 * g_twice et g_angu ne sont calcules que si necessaire (cad si
121 * on appelle la fonction get_twice() ou get_angu()).
122 *
123 * Revision 2.8 1999/11/16 14:15:57 eric
124 * Ajout de la fonction Mg3d::get_angu().
125 *
126 * Revision 2.7 1999/10/12 14:54:11 eric
127 * Ajout du membre Base_val std_base_scal() const.
128 *
129 * Revision 2.6 1999/10/01 10:35:42 eric
130 * Amelioration des commentaires.
131 *
132 * Revision 2.5 1999/09/30 14:58:00 eric
133 * Operator!= declare const/
134 *
135 * Revision 2.4 1999/09/30 14:11:43 eric
136 * sauve et std_base_vect_cart declarees const.
137 *
138 * Revision 2.3 1999/09/30 12:52:38 eric
139 * Depoussierage.
140 * Documentation.
141 *
142 * Revision 2.2 1999/09/24 14:23:24 eric
143 * Declaration de methodes const.
144 *
145 * Revision 2.1 1999/09/14 15:24:04 phil
146 * ajout de std_base_vect_cart
147 *
148 * Revision 2.0 1999/02/15 10:41:51 hyc
149 * *** empty log message ***
150 *
151 * Revision 2.1 1999/02/15 09:59:50 hyc
152 * *** empty log message ***
153 *
154 * Revision 2.0 1998/12/01 14:28:00 hyc
155 * Version 2
156 *
157 *
158 * $Header: /cvsroot/Lorene/C++/Include/grilles.h,v 1.23 2014/10/13 08:52:35 j_novak Exp $
159 *
160 */
161
162// Classes utilisees
163
164// Fichiers includes
165#include <cassert>
166#include <cstdio>
167#include <cstdlib>
168#include "headcpp.h"
169
170#include "type_parite.h"
171
172namespace Lorene {
173class Base_val ;
174
175 //-------------//
176 // Mono-grille //
177 //-------------//
178
179// Classe de base
194class Grille3d {
195 protected:
196 const int nr ;
197 const int nt ;
198 const int np ;
199
201 int type_r ;
202 int type_t ;
203 int type_p ;
205 int base_r ;
206
207 public:
209 double* x ;
211 double* tet ;
213 double* phi ;
214
216 Grille3d(int n_r, int n_t, int n_p, int typer, int typet,
217 int typep, int baser) ;
218
221
223 void operator=(const Grille3d& ) ;
224
225 public:
226 virtual ~Grille3d() ;
227
228 public:
230 int get_nr() const {return nr ;} ;
232 int get_nt() const {return nt ;} ;
234 int get_np() const {return np ;} ;
235
237 int get_type_r() const {return type_r ;} ;
239 int get_type_t() const {return type_t ;} ;
241 int get_type_p() const {return type_p ;} ;
243 int get_base_r() const {return base_r ;} ;
244
245 protected:
247 void compute_radial_grid() ;
248};
249
250
251
252 //---------------//
253 // Multi-grilles //
254 //---------------//
255
273class Mg3d {
274
275 // Data
276 // ----
277 protected:
278 int nzone ;
279
280 int* nr ;
281 int* nt ;
282 int* np ;
283
287 int* type_r ;
288
290 int type_t ;
291
293 int type_p ;
294
299 int* colloc_r ;
300
303
304 mutable Mg3d* g_angu ;
306 mutable Mg3d* g_angu_1dom ;
307 mutable Mg3d* g_radial ;
308
312 mutable Mg3d* g_twice ;
313
317 mutable Mg3d* g_plus_half ;
318
323 mutable Mg3d* g_non_axi ;
324
325 // Constructors - Destructor
326 // -------------------------
327
328 public:
329
346 Mg3d(int nz, int nbr[], int typr[], int nbt[], int typt, int nbp[],
347 int typp, int* base_r = 0x0) ;
348
387 Mg3d(int nz, int nbr, int nbt, int nbp, int typt, int typp,
388 bool compact, bool legendre=false) ;
389
415 Mg3d(int nz, int nbr, int nbt, int nbp, int typt, int typp) ;
416
422 Mg3d(FILE* fd, bool read_base=false) ;
423
424 public:
429 Mg3d(const Mg3d& ) ;
430
431 public:
432
433 ~Mg3d() ;
434
435 // Assignement
436 // -----------
437 private:
442 void operator=(const Mg3d& ) ;
443
444 // Extraction of information
445 // -------------------------
446 public:
448 int get_nzone() const {
449 return nzone ;
450 } ;
452 int get_nr(int l) const {
453 assert(l>=0 && l<nzone) ;
454 return nr[l] ;
455 } ;
457 int get_nt(int l) const {
458 assert(l>=0 && l<nzone) ;
459 return nt[l] ;
460 } ;
462 int get_np(int l) const {
463 assert(l>=0 && l<nzone) ;
464 return np[l] ;
465 } ;
466
474 int get_type_r(int l) const {
475 assert(l>=0 && l<nzone) ;
476 return type_r[l] ;
477 } ;
478
485 int get_type_t() const {
486 return type_t ;
487 } ;
488
495 int get_type_p() const {
496 return type_p ;
497 } ;
498
500 const Grille3d* get_grille3d(int l) const {
501 assert(l>=0 && l<nzone) ;
502 return g[l] ;
503 } ;
504
511 int get_colloc_r(int l) const {
512 assert(l>=0 && l<nzone) ;
513 return colloc_r[l] ;
514 }
515
517 const Mg3d* get_angu() const ;
518
522 const Mg3d* get_angu_1dom() const ;
523
525 const Mg3d* get_radial() const ;
526
530 const Mg3d* get_twice() const ;
531
535 const Mg3d* plus_half() const ;
536
541 const Mg3d* get_non_axi() const ;
542
544 bool operator==(const Mg3d& ) const ;
545
546
547
548 // Outputs
549 // -------
550 public:
558 void sauve(FILE* fd, bool save_base=false) const ;
559
560 friend ostream& operator<<(ostream& , const Mg3d & ) ;
561
562 // Management of derived quantities
563 // --------------------------------
564 protected:
568 void del_deriv() const ;
569
573 void set_deriv_0x0() const ;
574
575
576 // Miscellaneous
577 // -------------
578 public:
579 bool operator!=(const Mg3d & ) const ;
580
582 Base_val std_base_scal() const ;
583
585 Base_val std_base_scal_odd() const ;
586
590 Base_val** std_base_vect_cart() const ;
591
595 Base_val** std_base_vect_spher() const ;
596
601
606
607};
608ostream& operator<<(ostream& , const Mg3d & ) ;
609
610
611//======================================
612// One domain standard bases definitions
613//======================================
614int std_base_scal_1z(int type_r, int type_t, int type_p) ;
615int std_base_scal_odd_1z(int type_r, int type_t, int type_p) ;
616int leg_base_scal_1z(int type_r, int type_t, int type_p) ;
617int leg_base_scal_odd_1z(int type_r, int type_t, int type_p) ;
618int jac02_base_scal_1z(int type_r, int type_t, int type_p) ;
619int jac02_base_scal_odd_1z(int type_r, int type_t, int type_p) ;
620
621}
622#endif
Bases of the spectral expansions.
Definition base_val.h:322
3D grid class in one domain.
Definition grilles.h:194
int get_type_r() const
Returns type_r.
Definition grilles.h:237
void operator=(const Grille3d &)
Assignement operator.
const int nt
Number of points in .
Definition grilles.h:197
int get_nt() const
Returns nt
Definition grilles.h:232
double * x
Array of values of at the nr collocation points.
Definition grilles.h:209
double * phi
Array of values of at the np collocation points.
Definition grilles.h:213
int type_p
Type of sampling in (SYM,NONSYM)
Definition grilles.h:203
double * tet
Array of values of at the nt collocation points.
Definition grilles.h:211
virtual ~Grille3d()
Destructor.
Definition grille3d.C:166
int base_r
Type of radial spectral basis (BASE_CHEB, BASE_LEG, BASE_JAC02 )
Definition grilles.h:205
int type_t
Type of sampling in (SYM,NONSYM)
Definition grilles.h:202
Grille3d(const Grille3d &)
Copy constructor.
void compute_radial_grid()
Computes the collocation point coordinates in the radial direction.
Definition grille3d.C:172
const int np
Number of points in .
Definition grilles.h:198
int get_type_t() const
Returns type_t.
Definition grilles.h:239
int get_np() const
Returns np.
Definition grilles.h:234
const int nr
Number of points in r ( )
Definition grilles.h:196
int type_r
Type of sampling in r ( ) (RARE,FIN,UNSURR )
Definition grilles.h:201
int get_nr() const
Returns nr.
Definition grilles.h:230
int get_base_r() const
Returns base_r.
Definition grilles.h:243
int get_type_p() const
Returns type_p.
Definition grilles.h:241
Multi-domain grid.
Definition grilles.h:273
Base_val ** std_base_vect_spher() const
Returns the standard spectral bases for the spherical components of a vector.
const Mg3d * get_twice() const
Returns the pointer on the grid which has twice the number of points in each dimension (for desaliasi...
Definition mg3d.C:539
const Mg3d * plus_half() const
Returns the pointer on the grid which has 50% more points in r dimension (for desaliasing).
Definition mg3d.C:587
int get_colloc_r(int l) const
Returns the type of collocation points used in domain no.
Definition grilles.h:511
int * type_r
Array (size: nzone) of type of sampling in r ( ) (RARE,FIN, c UNSURR)
Definition grilles.h:287
Mg3d * g_radial
Pointer on the associated radial grid.
Definition grilles.h:307
const Mg3d * get_angu() const
Returns the pointer on the associated angular grid.
Definition mg3d.C:473
Mg3d * g_twice
Pointer on the grid which has twice the number of points in each dimension (for desaliasing).
Definition grilles.h:312
int get_type_t() const
Returns the type of sampling in the direction: SYM : : symmetry with respect to the equatorial pl...
Definition grilles.h:485
~Mg3d()
Destructor.
Definition mg3d.C:351
int type_t
Type of sampling in (SYM, NONSYM)
Definition grilles.h:290
const Mg3d * get_angu_1dom() const
Returns the pointer on the associated mono-domain angular grid.
Definition mg3d.C:494
friend ostream & operator<<(ostream &, const Mg3d &)
Display.
Definition mg3d.C:399
Mg3d * g_non_axi
Pointer on the grid which has at least 4 points in the direction and at least 5 in the direction (f...
Definition grilles.h:323
void set_deriv_0x0() const
Sets to 0x0 all the pointers on derived quantities (g_radial , g_angu, g_twice, .....
Definition mg3d.C:458
Base_val std_base_scal_odd() const
Returns the standard odd spectral bases for a scalar.
const Grille3d * get_grille3d(int l) const
Returns a pointer on the 3D mono-grid for domain no. l.
Definition grilles.h:500
bool operator!=(const Mg3d &) const
Operator !=.
Definition mg3d.C:420
int type_p
Type of sampling in (SYM, NONSYM)
Definition grilles.h:293
int * nt
Array (size: nzone) of nb. of points in .
Definition grilles.h:281
Base_val ** pseudo_base_vect_spher() const
Returns the standard spectral bases for the spherical components of a pseudo-vector.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition grilles.h:462
int get_type_p() const
Returns the type of sampling in the direction: SYM : : symmetry with respect to the transformatio...
Definition grilles.h:495
int * nr
Array (size: nzone) of nb. of points in r ( )
Definition grilles.h:280
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition grilles.h:457
void operator=(const Mg3d &)
Assignement operator (private and not implemented to make Mg3d a non-copyable class)
Base_val ** pseudo_base_vect_cart() const
Returns the standard spectral bases for the Cartesian components of a pseudo-vector.
void del_deriv() const
Deletes all the derived quantities (g_radial , g_angu, g_twice, ...)
Definition mg3d.C:445
const Mg3d * get_radial() const
Returns the pointer on the associated radial grid.
Definition mg3d.C:518
int get_nzone() const
Returns the number of domains.
Definition grilles.h:448
Mg3d * g_angu_1dom
Pointer on the associated angular grid with only one domain.
Definition grilles.h:306
Mg3d * g_angu
Pointer on the associated angular grid.
Definition grilles.h:304
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition grilles.h:452
int nzone
Number of domains (zones)
Definition grilles.h:278
Grille3d ** g
Array (size: nzone) of pointers on the Grille3d's.
Definition grilles.h:302
bool operator==(const Mg3d &) const
Comparison operator (egality)
Definition mg3d.C:646
Mg3d * g_plus_half
Pointer on the grid which has 50% more points in r dimension (for desaliasing).
Definition grilles.h:317
Mg3d(const Mg3d &)
Copy constructor (private and not implemented to make Mg3d a non-copyable class)
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Definition grilles.h:474
void sauve(FILE *fd, bool save_base=false) const
Saves into a file.
Definition mg3d.C:371
Base_val std_base_scal() const
Returns the standard spectral bases for a scalar.
Base_val ** std_base_vect_cart() const
Returns the standard spectral bases for the Cartesian components of a vector.
int * colloc_r
Array (size: nzone) of type of collocation points in r ( ) and related decompoisition bases (BASE_CHE...
Definition grilles.h:299
const Mg3d * get_non_axi() const
Returns the pointer on the grid which has at least 4 points in the direction and at least 5 in the ...
Definition mg3d.C:615
int * np
Array (size: nzone) of nb. of points in .
Definition grilles.h:282
Lorene prototypes.
Definition app_hor.h:64