grilles.h
/*
* Definition of Lorene classes Grille3d and Mg3d
*
*/
/*
* Copyright (c) 1999-2000 Jean-Alain Marck
* Copyright (c) 1999-2001 Eric Gourgoulhon
*
* This file is part of LORENE.
*
* LORENE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* LORENE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LORENE; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __GRILLES_H_
#define __GRILLES_H_
/*
* $Id: grilles.h,v 1.23 2014/10/13 08:52:35 j_novak Exp $
* $Log: grilles.h,v $
* Revision 1.23 2014/10/13 08:52:35 j_novak
* Lorene classes and functions now belong to the namespace Lorene.
*
* Revision 1.22 2014/10/06 15:09:39 j_novak
* Modified #include directives to use c++ syntax.
*
* Revision 1.21 2013/06/05 15:00:26 j_novak
* Suppression of all classes derived from Grille3d. Now Grille3d is no
* longer an abstract class. r-samplings are only one of RARE, FIN or
* UNSURR (FINJAC has been removed). Instead, Mg3d possesses a new member
* colloc_r[nzone] defining the type of collocation points (spectral
* bases) in each domain.
*
* Revision 1.20 2013/01/11 15:44:53 j_novak
* Addition of Legendre bases (part 2).
*
* Revision 1.19 2012/01/17 10:10:15 j_penner
* added a constructor in which the nucleus and outer domain are both of type FIN
*
* Revision 1.18 2008/10/29 08:17:51 jl_cornou
* Standard spectral bases for pseudo vectors added
*
* Revision 1.17 2008/02/18 13:53:37 j_novak
* Removal of special indentation instructions.
*
* Revision 1.16 2007/12/11 15:28:05 jl_cornou
* Jacobi(0,2) polynomials partially implemented
*
* Revision 1.15 2006/05/17 13:17:02 j_novak
* New member g_angu_1dom, the one-domain angular grid associated with the
* current grid.
*
* Revision 1.14 2005/10/25 08:56:34 p_grandclement
* addition of std_spectral_base in the case of odd functions near the origin
*
* Revision 1.13 2005/10/07 08:47:20 j_novak
* Addition of the pointer g_non_axi on a grid, with at least 5 points in the
* theta direction and 4 in the phi one (for tensor rotations).
*
* Revision 1.12 2005/03/25 14:54:04 e_gourgoulhon
* Corrected documentation.
*
* Revision 1.11 2004/07/06 13:36:27 j_novak
* Added methods for desaliased product (operator |) only in r direction.
*
* Revision 1.10 2004/06/22 08:49:56 p_grandclement
* Addition of everything needed for using the logarithmic mapping
*
* Revision 1.9 2004/03/22 13:12:41 j_novak
* Modification of comments to use doxygen instead of doc++
*
* Revision 1.8 2003/06/20 14:16:57 f_limousin
* Add the operator== to compare two Mg3d
*
* Revision 1.7 2003/06/18 08:45:26 j_novak
* In class Mg3d: added the member get_radial, returning only a radial grid
* For dAlembert solver: the way the coefficients of the operator are defined has been changed.
*
* Revision 1.6 2002/10/16 14:36:29 j_novak
* Reorganization of #include instructions of standard C++, in order to
* use experimental version 3 of gcc.
*
* Revision 1.5 2002/08/13 08:02:45 j_novak
* Handling of spherical vector/tensor components added in the classes
* Mg3d and Tenseur. Minor corrections for the class Metconf.
*
* Revision 1.4 2002/06/17 14:05:16 j_novak
* friend functions are now also declared outside the class definition
*
* Revision 1.3 2001/12/12 09:23:46 e_gourgoulhon
* Parameter compact added to the simplified constructor of class Mg3d
*
* Revision 1.2 2001/12/11 06:47:42 e_gourgoulhon
* Simplified constructor for class Mg3d
*
* Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
* LORENE
*
* Revision 2.10 2001/06/13 14:23:40 eric
* Les fonctions Mg3d::del_deriv() et Mg3d::set_deriv_0x0() ne sont plus
* virtuelles puisque Mg3d n'a aucune classe derivee.
*
* Revision 2.9 2001/05/26 13:24:49 eric
* Ajout du membre g_twice (grille double pour le desaliasing)
* Modif de la declaration de g_angu (pointeur mutable)
* g_twice et g_angu ne sont calcules que si necessaire (cad si
* on appelle la fonction get_twice() ou get_angu()).
*
* Revision 2.8 1999/11/16 14:15:57 eric
* Ajout de la fonction Mg3d::get_angu().
*
* Revision 2.7 1999/10/12 14:54:11 eric
* Ajout du membre Base_val std_base_scal() const.
*
* Revision 2.6 1999/10/01 10:35:42 eric
* Amelioration des commentaires.
*
* Revision 2.5 1999/09/30 14:58:00 eric
* Operator!= declare const/
*
* Revision 2.4 1999/09/30 14:11:43 eric
* sauve et std_base_vect_cart declarees const.
*
* Revision 2.3 1999/09/30 12:52:38 eric
* Depoussierage.
* Documentation.
*
* Revision 2.2 1999/09/24 14:23:24 eric
* Declaration de methodes const.
*
* Revision 2.1 1999/09/14 15:24:04 phil
* ajout de std_base_vect_cart
*
* Revision 2.0 1999/02/15 10:41:51 hyc
* *** empty log message ***
*
* Revision 2.1 1999/02/15 09:59:50 hyc
* *** empty log message ***
*
* Revision 2.0 1998/12/01 14:28:00 hyc
* Version 2
*
*
* $Header: /cvsroot/Lorene/C++/Include/grilles.h,v 1.23 2014/10/13 08:52:35 j_novak Exp $
*
*/
// Classes utilisees
// Fichiers includes
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include "headcpp.h"
#include "type_parite.h"
namespace Lorene {
class Base_val ;
//-------------//
// Mono-grille //
//-------------//
// Classe de base
class Grille3d {
protected:
const int nr ;
const int nt ;
const int np ;
int type_r ;
int type_t ;
int type_p ;
int base_r ;
public:
double* x ;
double* tet ;
double* phi ;
Grille3d(int n_r, int n_t, int n_p, int typer, int typet,
int typep, int baser) ;
Grille3d(const Grille3d& ) ;
void operator=(const Grille3d& ) ;
public:
virtual ~Grille3d() ;
public:
int get_nr() const {return nr ;} ;
int get_nt() const {return nt ;} ;
int get_np() const {return np ;} ;
int get_type_r() const {return type_r ;} ;
int get_type_t() const {return type_t ;} ;
int get_type_p() const {return type_p ;} ;
int get_base_r() const {return base_r ;} ;
protected:
void compute_radial_grid() ;
};
//---------------//
// Multi-grilles //
//---------------//
class Mg3d {
// Data
// ----
protected:
int nzone ;
int* nr ;
int* nt ;
int* np ;
int* type_r ;
int type_t ;
int type_p ;
int* colloc_r ;
Grille3d** g ;
mutable Mg3d* g_angu ;
mutable Mg3d* g_angu_1dom ;
mutable Mg3d* g_radial ;
mutable Mg3d* g_twice ;
mutable Mg3d* g_plus_half ;
mutable Mg3d* g_non_axi ;
// Constructors - Destructor
// -------------------------
public:
Mg3d(int nz, int nbr[], int typr[], int nbt[], int typt, int nbp[],
int typp, int* base_r = 0x0) ;
Mg3d(int nz, int nbr, int nbt, int nbp, int typt, int typp,
bool compact, bool legendre=false) ;
Mg3d(int nz, int nbr, int nbt, int nbp, int typt, int typp) ;
Mg3d(FILE* fd, bool read_base=false) ;
public:
Mg3d(const Mg3d& ) ;
public:
~Mg3d() ;
// Assignement
// -----------
private:
void operator=(const Mg3d& ) ;
// Extraction of information
// -------------------------
public:
int get_nzone() const {
return nzone ;
} ;
int get_nr(int l) const {
assert(l>=0 && l<nzone) ;
return nr[l] ;
} ;
int get_nt(int l) const {
assert(l>=0 && l<nzone) ;
return nt[l] ;
} ;
int get_np(int l) const {
assert(l>=0 && l<nzone) ;
return np[l] ;
} ;
int get_type_r(int l) const {
assert(l>=0 && l<nzone) ;
return type_r[l] ;
} ;
int get_type_t() const {
return type_t ;
} ;
int get_type_p() const {
return type_p ;
} ;
const Grille3d* get_grille3d(int l) const {
assert(l>=0 && l<nzone) ;
return g[l] ;
} ;
int get_colloc_r(int l) const {
assert(l>=0 && l<nzone) ;
return colloc_r[l] ;
}
const Mg3d* get_angu() const ;
const Mg3d* get_angu_1dom() const ;
const Mg3d* get_radial() const ;
const Mg3d* get_twice() const ;
const Mg3d* plus_half() const ;
const Mg3d* get_non_axi() const ;
bool operator==(const Mg3d& ) const ;
// Outputs
// -------
public:
void sauve(FILE* fd, bool save_base=false) const ;
friend ostream& operator<<(ostream& , const Mg3d & ) ;
// Management of derived quantities
// --------------------------------
protected:
void del_deriv() const ;
void set_deriv_0x0() const ;
// Miscellaneous
// -------------
public:
bool operator!=(const Mg3d & ) const ;
Base_val std_base_scal() const ;
Base_val std_base_scal_odd() const ;
Base_val** std_base_vect_cart() const ;
Base_val** std_base_vect_spher() const ;
Base_val** pseudo_base_vect_cart() const ;
Base_val** pseudo_base_vect_spher() const ;
};
ostream& operator<<(ostream& , const Mg3d & ) ;
//======================================
// One domain standard bases definitions
//======================================
int std_base_scal_1z(int type_r, int type_t, int type_p) ;
int std_base_scal_odd_1z(int type_r, int type_t, int type_p) ;
int leg_base_scal_1z(int type_r, int type_t, int type_p) ;
int leg_base_scal_odd_1z(int type_r, int type_t, int type_p) ;
int jac02_base_scal_1z(int type_r, int type_t, int type_p) ;
int jac02_base_scal_odd_1z(int type_r, int type_t, int type_p) ;
}
#endif
Lorene::Base_val
Bases of the spectral expansions.
Definition base_val.h:322
Lorene::Grille3d
3D grid class in one domain.
Definition grilles.h:194
Lorene::Grille3d::get_type_r
int get_type_r() const
Returns type_r.
Definition grilles.h:237
Lorene::Grille3d::operator=
void operator=(const Grille3d &)
Assignement operator.
Lorene::Grille3d::nt
const int nt
Number of points in .
Definition grilles.h:197
Lorene::Grille3d::get_nt
int get_nt() const
Returns nt.
Definition grilles.h:232
Lorene::Grille3d::x
double * x
Array of values of at the nr collocation points.
Definition grilles.h:209
Lorene::Grille3d::phi
double * phi
Array of values of at the np collocation points.
Definition grilles.h:213
Lorene::Grille3d::type_p
int type_p
Type of sampling in (SYM,NONSYM).
Definition grilles.h:203
Lorene::Grille3d::tet
double * tet
Array of values of at the nt collocation points.
Definition grilles.h:211
Lorene::Grille3d::~Grille3d
virtual ~Grille3d()
Destructor.
Definition grille3d.C:166
Lorene::Grille3d::base_r
int base_r
Type of radial spectral basis (BASE_CHEB, BASE_LEG, BASE_JAC02 ).
Definition grilles.h:205
Lorene::Grille3d::type_t
int type_t
Type of sampling in (SYM,NONSYM).
Definition grilles.h:202
Lorene::Grille3d::Grille3d
Grille3d(const Grille3d &)
Copy constructor.
Lorene::Grille3d::compute_radial_grid
void compute_radial_grid()
Computes the collocation point coordinates in the radial direction.
Definition grille3d.C:172
Lorene::Grille3d::np
const int np
Number of points in .
Definition grilles.h:198
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::Grille3d::get_type_t
int get_type_t() const
Returns type_t.
Definition grilles.h:239
Lorene::Grille3d::get_np
int get_np() const
Returns np.
Definition grilles.h:234
Lorene::Grille3d::nr
const int nr
Number of points in r ( ).
Definition grilles.h:196
Lorene::Grille3d::type_r
int type_r
Type of sampling in r ( ) (RARE,FIN,UNSURR ).
Definition grilles.h:201
Lorene::Grille3d::get_nr
int get_nr() const
Returns nr.
Definition grilles.h:230
Lorene::Grille3d::get_base_r
int get_base_r() const
Returns base_r.
Definition grilles.h:243
Lorene::Grille3d::get_type_p
int get_type_p() const
Returns type_p.
Definition grilles.h:241
Lorene::Mg3d
Multi-domain grid.
Definition grilles.h:273
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_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::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::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::Mg3d::operator<<
friend ostream & operator<<(ostream &, const Mg3d &)
Display.
Definition mg3d.C:399
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::Mg3d::g_radial
Mg3d * g_radial
Pointer on the associated radial grid.
Definition grilles.h:307
Lorene::Mg3d::get_angu
const Mg3d * get_angu() const
Returns the pointer on the associated angular grid.
Definition mg3d.C:473
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_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::Mg3d::~Mg3d
~Mg3d()
Destructor.
Definition mg3d.C:351
Lorene::Mg3d::type_t
int type_t
Type of sampling in (SYM, NONSYM).
Definition grilles.h:290
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::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::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::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::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::operator!=
bool operator!=(const Mg3d &) const
Operator !=.
Definition mg3d.C:420
Lorene::Mg3d::type_p
int type_p
Type of sampling in (SYM, NONSYM).
Definition grilles.h:293
Lorene::Mg3d::nt
int * nt
Array (size: nzone) of nb. of points in .
Definition grilles.h:281
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::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::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::nr
int * nr
Array (size: nzone) of nb. of points in r ( ).
Definition grilles.h:280
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::Mg3d::operator=
void operator=(const Mg3d &)
Assignement operator (private and not implemented to make Mg3d a non-copyable class).
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::del_deriv
void del_deriv() const
Deletes all the derived quantities (g_radial , g_angu, g_twice, ...).
Definition mg3d.C:445
Lorene::Mg3d::get_radial
const Mg3d * get_radial() const
Returns the pointer on the associated radial grid.
Definition mg3d.C:518
Lorene::Mg3d::get_nzone
int get_nzone() const
Returns the number of domains.
Definition grilles.h:448
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::g_angu
Mg3d * g_angu
Pointer on the associated angular grid.
Definition grilles.h:304
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::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::nzone
int nzone
Number of domains (zones).
Definition grilles.h:278
Lorene::Mg3d::g
Grille3d ** g
Array (size: nzone) of pointers on the Grille3d's.
Definition grilles.h:302
Lorene::Mg3d::operator==
bool operator==(const Mg3d &) const
Comparison operator (egality).
Definition mg3d.C:646
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::Mg3d::Mg3d
Mg3d(const Mg3d &)
Copy constructor (private and not implemented to make Mg3d a non-copyable class).
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::Mg3d::sauve
void sauve(FILE *fd, bool save_base=false) const
Saves into a file.
Definition mg3d.C:371
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::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::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::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::Mg3d::np
int * np
Array (size: nzone) of nb. of points in .
Definition grilles.h:282
Lorene
Lorene prototypes.
Definition app_hor.h:64