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 
172 namespace Lorene {
173 class Base_val ;
174 
175  //-------------//
176  // Mono-grille //
177  //-------------//
178 
179 // Classe de base
194 class 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 ;
204  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 
220  Grille3d(const Grille3d& ) ;
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 
273 class 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 
302  Grille3d** g ;
303 
304  mutable Mg3d* g_angu ;
305  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 
600  Base_val** pseudo_base_vect_cart() const ;
601 
605  Base_val** pseudo_base_vect_spher() const ;
606 
607 };
608 ostream& operator<<(ostream& , const Mg3d & ) ;
609 
610 
611 //======================================
612 // One domain standard bases definitions
613 //======================================
614 int std_base_scal_1z(int type_r, int type_t, int type_p) ;
615 int std_base_scal_odd_1z(int type_r, int type_t, int type_p) ;
616 int leg_base_scal_1z(int type_r, int type_t, int type_p) ;
617 int leg_base_scal_odd_1z(int type_r, int type_t, int type_p) ;
618 int jac02_base_scal_1z(int type_r, int type_t, int type_p) ;
619 int jac02_base_scal_odd_1z(int type_r, int type_t, int type_p) ;
620 
621 }
622 #endif
Lorene::Grille3d::get_base_r
int get_base_r() const
Returns base_r.
Definition: grilles.h:243
Lorene::Mg3d::g_angu
Mg3d * g_angu
Pointer on the associated angular grid.
Definition: grilles.h:304
Lorene::Grille3d
3D grid class in one domain.
Definition: grilles.h:194
Lorene::Mg3d::operator!=
bool operator!=(const Mg3d &) const
Operator !=.
Definition: mg3d.C:420
Lorene::Mg3d::~Mg3d
~Mg3d()
Destructor.
Definition: mg3d.C:351
Lorene::Base_val
Bases of the spectral expansions.
Definition: base_val.h:322
Lorene::Mg3d::get_np
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition: grilles.h:462
Lorene::Mg3d::type_t
int type_t
Type of sampling in (SYM, NONSYM)
Definition: grilles.h:290
Lorene::Mg3d::type_p
int type_p
Type of sampling in (SYM, NONSYM)
Definition: grilles.h:293
Lorene::Grille3d::type_r
int type_r
Type of sampling in r ( ) (RARE,FIN,UNSURR )
Definition: grilles.h:201
Lorene::Mg3d
Multi-domain grid.
Definition: grilles.h:273
Lorene::Mg3d::operator==
bool operator==(const Mg3d &) const
Comparison operator (egality)
Definition: mg3d.C:646
Lorene::Grille3d::Grille3d
Grille3d(int n_r, int n_t, int n_p, int typer, int typet, int typep, int baser)
Constructor.
Definition: grille3d.C:122
Lorene::Mg3d::np
int * np
Array (size: nzone) of nb. of points in .
Definition: grilles.h:282
Lorene::Mg3d::get_nt
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:457
Lorene
Lorene prototypes.
Definition: app_hor.h:64
Lorene::Mg3d::get_angu
const Mg3d * get_angu() const
Returns the pointer on the associated angular grid.
Definition: mg3d.C:473
Lorene::Grille3d::np
const int np
Number of points in .
Definition: grilles.h:198
Lorene::Mg3d::operator=
void operator=(const Mg3d &)
Assignement operator (private and not implemented to make Mg3d a non-copyable class)
Lorene::Mg3d::std_base_scal_odd
Base_val std_base_scal_odd() const
Returns the standard odd spectral bases for a scalar.
Definition: mg3d_std_base.C:131
Lorene::Grille3d::type_p
int type_p
Type of sampling in (SYM,NONSYM)
Definition: grilles.h:203
Lorene::Grille3d::get_np
int get_np() const
Returns np.
Definition: grilles.h:234
Lorene::Mg3d::g
Grille3d ** g
Array (size: nzone) of pointers on the Grille3d's.
Definition: grilles.h:302
Lorene::Grille3d::nt
const int nt
Number of points in .
Definition: grilles.h:197
Lorene::Grille3d::get_type_r
int get_type_r() const
Returns type_r.
Definition: grilles.h:237
Lorene::Mg3d::get_type_r
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Definition: grilles.h:474
Lorene::Grille3d::tet
double * tet
Array of values of at the nt collocation points.
Definition: grilles.h:211
Lorene::Grille3d::type_t
int type_t
Type of sampling in (SYM,NONSYM)
Definition: grilles.h:202
Lorene::Mg3d::nr
int * nr
Array (size: nzone) of nb. of points in r ( )
Definition: grilles.h:280
Lorene::Mg3d::nt
int * nt
Array (size: nzone) of nb. of points in .
Definition: grilles.h:281
Lorene::Grille3d::get_type_p
int get_type_p() const
Returns type_p.
Definition: grilles.h:241
Lorene::Mg3d::nzone
int nzone
Number of domains (zones)
Definition: grilles.h:278
Lorene::Mg3d::colloc_r
int * colloc_r
Array (size: nzone) of type of collocation points in r ( ) and related decompoisition bases (BASE_CHE...
Definition: grilles.h:299
Lorene::Mg3d::pseudo_base_vect_cart
Base_val ** pseudo_base_vect_cart() const
Returns the standard spectral bases for the Cartesian components of a pseudo-vector.
Definition: mg3d_std_base.C:794
Lorene::Mg3d::g_angu_1dom
Mg3d * g_angu_1dom
Pointer on the associated angular grid with only one domain.
Definition: grilles.h:306
Lorene::Mg3d::get_type_t
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
Lorene::Grille3d::nr
const int nr
Number of points in r ( )
Definition: grilles.h:196
Lorene::Mg3d::del_deriv
void del_deriv() const
Deletes all the derived quantities (g_radial , g_angu, g_twice, ...)
Definition: mg3d.C:445
Lorene::Mg3d::get_non_axi
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
Lorene::Grille3d::~Grille3d
virtual ~Grille3d()
Destructor.
Definition: grille3d.C:166
Lorene::Mg3d::get_angu_1dom
const Mg3d * get_angu_1dom() const
Returns the pointer on the associated mono-domain angular grid.
Definition: mg3d.C:494
Lorene::Mg3d::sauve
void sauve(FILE *fd, bool save_base=false) const
Saves into a file.
Definition: mg3d.C:371
Lorene::Mg3d::g_twice
Mg3d * g_twice
Pointer on the grid which has twice the number of points in each dimension (for desaliasing).
Definition: grilles.h:312
Lorene::Mg3d::get_nzone
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:448
Lorene::Mg3d::get_nr
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:452
Lorene::Mg3d::g_plus_half
Mg3d * g_plus_half
Pointer on the grid which has 50% more points in r dimension (for desaliasing).
Definition: grilles.h:317
Lorene::Grille3d::get_nt
int get_nt() const
Returns nt
Definition: grilles.h:232
Lorene::Mg3d::pseudo_base_vect_spher
Base_val ** pseudo_base_vect_spher() const
Returns the standard spectral bases for the spherical components of a pseudo-vector.
Definition: mg3d_std_base.C:1114
Lorene::Mg3d::std_base_vect_cart
Base_val ** std_base_vect_cart() const
Returns the standard spectral bases for the Cartesian components of a vector.
Definition: mg3d_std_base.C:177
Lorene::Mg3d::get_grille3d
const Grille3d * get_grille3d(int l) const
Returns a pointer on the 3D mono-grid for domain no. l.
Definition: grilles.h:500
Lorene::Mg3d::get_type_p
int get_type_p() const
Returns the type of sampling in the direction: SYM : : symmetry with respect to the transformatio...
Definition: grilles.h:495
Lorene::Mg3d::g_radial
Mg3d * g_radial
Pointer on the associated radial grid.
Definition: grilles.h:307
Lorene::Grille3d::operator=
void operator=(const Grille3d &)
Assignement operator.
Lorene::Grille3d::base_r
int base_r
Type of radial spectral basis (BASE_CHEB, BASE_LEG, BASE_JAC02 )
Definition: grilles.h:205
Lorene::Mg3d::set_deriv_0x0
void set_deriv_0x0() const
Sets to 0x0 all the pointers on derived quantities (g_radial , g_angu, g_twice, .....
Definition: mg3d.C:458
Lorene::Mg3d::g_non_axi
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
Lorene::Mg3d::get_colloc_r
int get_colloc_r(int l) const
Returns the type of collocation points used in domain no.
Definition: grilles.h:511
Lorene::Grille3d::compute_radial_grid
void compute_radial_grid()
Computes the collocation point coordinates in the radial direction.
Definition: grille3d.C:172
Lorene::Mg3d::plus_half
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
Lorene::Grille3d::x
double * x
Array of values of at the nr collocation points.
Definition: grilles.h:209
Lorene::Mg3d::get_twice
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
Lorene::Mg3d::std_base_vect_spher
Base_val ** std_base_vect_spher() const
Returns the standard spectral bases for the spherical components of a vector.
Definition: mg3d_std_base.C:499
Lorene::Mg3d::get_radial
const Mg3d * get_radial() const
Returns the pointer on the associated radial grid.
Definition: mg3d.C:518
Lorene::Mg3d::type_r
int * type_r
Array (size: nzone) of type of sampling in r ( ) (RARE,FIN, c UNSURR)
Definition: grilles.h:287
Lorene::Grille3d::get_type_t
int get_type_t() const
Returns type_t.
Definition: grilles.h:239
Lorene::Mg3d::std_base_scal
Base_val std_base_scal() const
Returns the standard spectral bases for a scalar.
Definition: mg3d_std_base.C:101
Lorene::Mg3d::Mg3d
Mg3d(int nz, int nbr[], int typr[], int nbt[], int typt, int nbp[], int typp, int *base_r=0x0)
General constructor.
Definition: mg3d.C:158
Lorene::Mg3d::operator<<
friend ostream & operator<<(ostream &, const Mg3d &)
Display.
Definition: mg3d.C:399
Lorene::Grille3d::get_nr
int get_nr() const
Returns nr.
Definition: grilles.h:230
Lorene::Grille3d::phi
double * phi
Array of values of at the np collocation points.
Definition: grilles.h:213