LORENE
Lorene::Mg3d Class Reference

Multi-domain grid. More...

#include <grilles.h>

Public Member Functions

 Mg3d (int nz, int nbr[], int typr[], int nbt[], int typt, int nbp[], int typp, int *base_r=0x0)
 General constructor. More...
 
 Mg3d (int nz, int nbr, int nbt, int nbp, int typt, int typp, bool compact, bool legendre=false)
 Simplified constructor for a standard multi-grid. More...
 
 Mg3d (int nz, int nbr, int nbt, int nbp, int typt, int typp)
 Simplified constructor for a standard multi-grid only with shells and Chebyshev. More...
 
 Mg3d (const string &filename)
 Constructor from a formatted file, given by its name (string). More...
 
 Mg3d (FILE *fd, bool read_base=false)
 Constructor from a file (see sauve(FILE*)). More...
 
 Mg3d (const Mg3d &)
 Copy constructor (private and not implemented to make Mg3d a non-copyable class) More...
 
 ~Mg3d ()
 Destructor. More...
 
int get_nzone () const
 Returns the number of domains. More...
 
int get_nr (int l) const
 Returns the number of points in the radial direction ( $\xi$) in domain no. l. More...
 
int get_nt (int l) const
 Returns the number of points in the co-latitude direction ( $\theta$) in domain no. l. More...
 
int get_np (int l) const
 Returns the number of points in the azimuthal direction ( $\phi$) in domain no. l. More...
 
int get_type_r (int l) const
 Returns the type of sampling in the radial direction in domain no. More...
 
int get_type_t () const
 Returns the type of sampling in the $\theta$ direction:
SYM : $\theta\in[0,\pi/2]$ : symmetry with respect to the equatorial plane
NONSYM : $\theta\in[0,\pi]$ : no symmetry with respect to the equatorial plane. More...
 
int get_type_p () const
 Returns the type of sampling in the $\phi$ direction:
SYM : $\phi\in[0,\pi[$ : symmetry with respect to the transformation $ \phi \mapsto \phi + \pi$
NONSYM : $\phi\in[0,2\pi[$ : no symmetry with respect to the transformation $ \phi \mapsto \phi + \pi$
More...
 
const Grille3dget_grille3d (int l) const
 Returns a pointer on the 3D mono-grid for domain no. l. More...
 
int get_colloc_r (int l) const
 Returns the type of collocation points used in domain no. More...
 
const Mg3dget_angu () const
 Returns the pointer on the associated angular grid. More...
 
const Mg3dget_angu_1dom () const
 Returns the pointer on the associated mono-domain angular grid. More...
 
const Mg3dget_radial () const
 Returns the pointer on the associated radial grid. More...
 
const Mg3dget_twice () const
 Returns the pointer on the grid which has twice the number of points in each dimension (for desaliasing). More...
 
const Mg3dplus_half () const
 Returns the pointer on the grid which has 50% more points in r dimension (for desaliasing). More...
 
const Mg3dplus_half_angu () const
 Returns the pointer on the grid which has 50% more points in and dimension (for desaliasing). More...
 
const Mg3dget_non_axi () const
 Returns the pointer on the grid which has at least 4 points in the $\phi$ direction and at least 5 in the $\theta$ direction (for tensor rotations). More...
 
bool operator== (const Mg3d &) const
 Comparison operator (egality) More...
 
void sauve (FILE *fd, bool save_base=false) const
 Saves into a file. More...
 
bool operator!= (const Mg3d &) const
 Operator !=. More...
 
Base_val std_base_scal () const
 Returns the standard spectral bases for a scalar. More...
 
Base_val std_base_scal_odd () const
 Returns the standard odd spectral bases for a scalar. More...
 
Base_val ** std_base_vect_cart () const
 Returns the standard spectral bases for the Cartesian components of a vector. More...
 
Base_val ** std_base_vect_spher () const
 Returns the standard spectral bases for the spherical components of a vector. More...
 
Base_val ** pseudo_base_vect_cart () const
 Returns the standard spectral bases for the Cartesian components of a pseudo-vector. More...
 
Base_val ** pseudo_base_vect_spher () const
 Returns the standard spectral bases for the spherical components of a pseudo-vector. More...
 

Protected Member Functions

void del_deriv () const
 Deletes all the derived quantities (g_radial , g_angu, g_twice, ...) More...
 
void set_deriv_0x0 () const
 Sets to 0x0 all the pointers on derived quantities (g_radial , g_angu, g_twice, ... More...
 

Protected Attributes

int nzone
 Number of domains (zones) More...
 
int * nr
 Array (size: nzone) of nb. of points in r ( $\xi$) More...
 
int * nt
 Array (size: nzone) of nb. of points in $\theta$. More...
 
int * np
 Array (size: nzone) of nb. of points in $\phi$. More...
 
int * type_r
 Array (size: nzone) of type of sampling in r ( $\xi$) (RARE,FIN, UNSURR) More...
 
int type_t
 Type of sampling in $\theta$ (SYM, NONSYM) More...
 
int type_p
 Type of sampling in $\phi$ (SYM, NONSYM) More...
 
int * colloc_r
 Array (size: nzone) of type of collocation points in r ( $\xi$) and related decompoisition bases (BASE_CHEB, BASE_LEG, BASE_JAC02 ). More...
 
Grille3d ** g
 Array (size: nzone) of pointers on the Grille3d's. More...
 
Mg3dg_angu
 Pointer on the associated angular grid. More...
 
Mg3dg_angu_1dom
 Pointer on the associated angular grid with only one domain. More...
 
Mg3dg_radial
 Pointer on the associated radial grid. More...
 
Mg3dg_twice
 Pointer on the grid which has twice the number of points in each dimension (for desaliasing). More...
 
Mg3dg_plus_half
 Pointer on the grid which has 50% more points in r dimension (for desaliasing). More...
 
Mg3dg_plus_half_angu
 Pointer on the grid which has 50% more points in and dimension (for desaliasing). More...
 
Mg3dg_non_axi
 Pointer on the grid which has at least 4 points in the $\phi$ direction and at least 5 in the $\theta$ direction (for tensor rotations). More...
 

Private Member Functions

void operator= (const Mg3d &)
 Assignement operator (private and not implemented to make Mg3d a non-copyable class) More...
 

Friends

ostream & operator<< (ostream &, const Mg3d &)
 Display. More...
 

Detailed Description

Multi-domain grid.

()

A multi-domain grid is a set of 3D grids for the implementation of the multi-domain spectral method described in Bonazzola, Gourgoulhon & Marck, Phys. Rev. D 58, 104020 (1998). Each domain is represented by a 3D mono grid (Grille3d) and is called a zone. For each direction, the Number of Degrees of Freedom (NDF) is a priori independent of the zone. However, some methods or routines may refuse to work if the NDF of some $(\theta, \phi)$ direction is not identical in all the zones. This holds for the type of sampling (symmetry) too.

Version
#$Id: grilles.h,v 1.25 2023/05/24 09:48:50 g_servignat Exp $#

Definition at line 279 of file grilles.h.

Constructor & Destructor Documentation

◆ Mg3d() [1/6]

Lorene::Mg3d::Mg3d ( int  nz,
int  nbr[],
int  typr[],
int  nbt[],
int  typt,
int  nbp[],
int  typp,
int *  base_r = 0x0 
)

General constructor.

Parameters
nz[input] Number of domains (zones).
nbr[][input] Array (size: nz ) of number of degree of freedom (NDF) in r-direction
typr[][input] Array (size: nz ) of type of sampling in r -direction
nbt[][input] Array (size: nz ) of NDF in $\theta$-direction
typt[input] Type of sampling in $\theta$-direction
nbp[][input] Array (size: nz) of NDF in $\phi$-direction
typp[input] Type of sampling in $\phi$-direction
base_r[input] Types of r bases in each domain, to define the collocation points: BASE_CHEB , BASE_LEG or BASE_JAC02. If the pointer is null, BASE_CHEB is set.

Definition at line 172 of file mg3d.C.

References colloc_r, and type_r.

◆ Mg3d() [2/6]

Lorene::Mg3d::Mg3d ( int  nz,
int  nbr,
int  nbt,
int  nbp,
int  typt,
int  typp,
bool  compact,
bool  legendre = false 
)

Simplified constructor for a standard multi-grid.

This provides a multi-grid with the same number of degrees of freedom in all the domains.
The domain of index l = 0 will be a nucleus: $\xi\in [0,1]$, rarefied sampling (type RARE) near the origin;
domains of indices $ 1 \le {\tt l} \le {\tt nz}-2$ will be shells: $\xi\in [-1,1]$, dense sampling (type FIN) near -1 and 1;
if compact == true, the domains of index l = nz-1 will be the outermost compactified shell: $\xi\in [-1,1]$, dense sampling (type UNSURR) near -1 and 1 for a 1/r discretization.

Parameters
nz[input] Number of domains (zones).
nbr[input] Number of degree of freedom (NDF) in r -direction in each domain
nbt[input] Number of degree of freedom (NDF) in $\theta$-direction in each domain
nbp[input] Number of degree of freedom (NDF) in $\phi$-direction in each domain
typt[input] Type of sampling in $\theta$-direction:
SYM for a sampling in $[0,\pi/2]$ (symmetry with respect to the equatorial plane),
NONSYM for a sampling in $[0,\pi]$
typp[input] Type of sampling in $\phi$-direction:
SYM for a sampling in $[0,\pi[$ (symmetry with respect to a $\pi$ translation in $\phi$)
NONSYM for a sampling in $[0,2\pi[$
compact[input] true for the last domain to have a 1/r sampling (UNSURR ) instead of a r sampling (FIN ).
legendre[input] true if the nucleus and shells have Legendre-type collocation points. If false, Chebyshev ones shall be used.

Definition at line 218 of file mg3d.C.

References colloc_r, and type_r.

◆ Mg3d() [3/6]

Lorene::Mg3d::Mg3d ( int  nz,
int  nbr,
int  nbt,
int  nbp,
int  typt,
int  typp 
)

Simplified constructor for a standard multi-grid only with shells and Chebyshev.

This provides a multi-grid with the same number of degrees of freedom in all the domains.
ALL DOMAINS ARE TREATED AS SHELLS $\xi\in [-1,1]$, dense sampling (type FIN) near -1 and 1;
and only Chebyshev bases are considered.

Parameters
nz[input] Number of domains (zones).
nbr[input] Number of degree of freedom (NDF) in r -direction in each domain
nbt[input] Number of degree of freedom (NDF) in $\theta$-direction in each domain
nbp[input] Number of degree of freedom (NDF) in $\phi$-direction in each domain
typt[input] Type of sampling in $\theta$-direction:
SYM for a sampling in $[0,\pi/2]$ (symmetry with respect to the equatorial plane),
NONSYM for a sampling in $[0,\pi]$
typp[input] Type of sampling in $\phi$-direction:
SYM for a sampling in $[0,\pi[$ (symmetry with respect to a $\pi$ translation in $\phi$)
NONSYM for a sampling in $[0,2\pi[$

Definition at line 276 of file mg3d.C.

References colloc_r, and type_r.

◆ Mg3d() [4/6]

Lorene::Mg3d::Mg3d ( const string &  filename)
explicit

Constructor from a formatted file, given by its name (string).

Definition at line 324 of file mg3d.C.

References nzone, Lorene::search_file(), and type_t.

◆ Mg3d() [5/6]

Lorene::Mg3d::Mg3d ( FILE *  fd,
bool  read_base = false 
)

Constructor from a file (see sauve(FILE*)).

If the boolean flag read_base is false (default) the spectral basis is not saved, for compatibility with older versions. If it is set to true , the basis is saved.

Definition at line 442 of file mg3d.C.

References colloc_r, Lorene::fread_be(), g, np, nr, nt, nzone, type_p, type_r, and type_t.

◆ Mg3d() [6/6]

Lorene::Mg3d::Mg3d ( const Mg3d )

Copy constructor (private and not implemented to make Mg3d a non-copyable class)

◆ ~Mg3d()

Lorene::Mg3d::~Mg3d ( )

Destructor.

Definition at line 480 of file mg3d.C.

References colloc_r, del_deriv(), g, np, nr, nt, nzone, and type_r.

Member Function Documentation

◆ del_deriv()

void Lorene::Mg3d::del_deriv ( ) const
protected

Deletes all the derived quantities (g_radial , g_angu, g_twice, ...)

Definition at line 574 of file mg3d.C.

References g_angu, g_angu_1dom, g_non_axi, g_plus_half, g_plus_half_angu, g_radial, g_twice, and set_deriv_0x0().

◆ get_angu()

const Mg3d * Lorene::Mg3d::get_angu ( ) const

Returns the pointer on the associated angular grid.

Definition at line 604 of file mg3d.C.

References colloc_r, g_angu, Mg3d(), np, nt, nzone, type_p, type_r, and type_t.

◆ get_angu_1dom()

const Mg3d * Lorene::Mg3d::get_angu_1dom ( ) const

Returns the pointer on the associated mono-domain angular grid.

This angular grid corresponds to the first domain (index 0).

Definition at line 625 of file mg3d.C.

References g_angu_1dom, np, and nt.

◆ get_colloc_r()

int Lorene::Mg3d::get_colloc_r ( int  l) const
inline

Returns the type of collocation points used in domain no.

l. This type depends on the spectral decomposition basis:

  • BASE_CHEB : Chebyshev basis and collocation points
  • BASE_LEG : Legendre basis and collocation points
  • BASE_JAC02 : Jacobi (0,2) polynomials

Definition at line 528 of file grilles.h.

References colloc_r, and nzone.

◆ get_grille3d()

const Grille3d* Lorene::Mg3d::get_grille3d ( int  l) const
inline

Returns a pointer on the 3D mono-grid for domain no. l.

Definition at line 517 of file grilles.h.

References g, and nzone.

◆ get_non_axi()

const Mg3d * Lorene::Mg3d::get_non_axi ( ) const

Returns the pointer on the grid which has at least 4 points in the $\phi$ direction and at least 5 in the $\theta$ direction (for tensor rotations).

Definition at line 784 of file mg3d.C.

References colloc_r, g_non_axi, Mg3d(), np, nr, nt, nzone, type_p, type_r, and type_t.

◆ get_np()

int Lorene::Mg3d::get_np ( int  l) const
inline

Returns the number of points in the azimuthal direction ( $\phi$) in domain no. l.

Definition at line 479 of file grilles.h.

References np, and nzone.

◆ get_nr()

int Lorene::Mg3d::get_nr ( int  l) const
inline

Returns the number of points in the radial direction ( $\xi$) in domain no. l.

Definition at line 469 of file grilles.h.

References nr, and nzone.

◆ get_nt()

int Lorene::Mg3d::get_nt ( int  l) const
inline

Returns the number of points in the co-latitude direction ( $\theta$) in domain no. l.

Definition at line 474 of file grilles.h.

References nt, and nzone.

◆ get_nzone()

int Lorene::Mg3d::get_nzone ( ) const
inline

Returns the number of domains.

Definition at line 465 of file grilles.h.

References nzone.

◆ get_radial()

const Mg3d * Lorene::Mg3d::get_radial ( ) const

Returns the pointer on the associated radial grid.

Definition at line 649 of file mg3d.C.

References g_radial, Mg3d(), nr, nzone, and type_r.

◆ get_twice()

const Mg3d * Lorene::Mg3d::get_twice ( ) const

Returns the pointer on the grid which has twice the number of points in each dimension (for desaliasing).

Definition at line 670 of file mg3d.C.

References colloc_r, g_twice, Mg3d(), np, nr, nt, nzone, type_p, type_r, and type_t.

◆ get_type_p()

int Lorene::Mg3d::get_type_p ( ) const
inline

Returns the type of sampling in the $\phi$ direction:
SYM : $\phi\in[0,\pi[$ : symmetry with respect to the transformation $ \phi \mapsto \phi + \pi$
NONSYM : $\phi\in[0,2\pi[$ : no symmetry with respect to the transformation $ \phi \mapsto \phi + \pi$

Definition at line 512 of file grilles.h.

References type_p.

◆ get_type_r()

int Lorene::Mg3d::get_type_r ( int  l) const
inline

Returns the type of sampling in the radial direction in domain no.

l :
RARE : $\xi\in[0,1]$ : rarefied at the origin
FIN : $\xi\in[-1,1]$ : dense at the two extremities
UNSURR : $\xi\in[-1,1]$ : dense at the two extremities, in view of using $u=1/r$ as radial variable

Definition at line 491 of file grilles.h.

References nzone, and type_r.

◆ get_type_t()

int Lorene::Mg3d::get_type_t ( ) const
inline

Returns the type of sampling in the $\theta$ direction:
SYM : $\theta\in[0,\pi/2]$ : symmetry with respect to the equatorial plane
NONSYM : $\theta\in[0,\pi]$ : no symmetry with respect to the equatorial plane.

Definition at line 502 of file grilles.h.

References type_t.

◆ operator!=()

bool Lorene::Mg3d::operator!= ( const Mg3d titi) const

Operator !=.

Definition at line 549 of file mg3d.C.

References colloc_r, np, nr, nt, nzone, type_p, type_r, and type_t.

◆ operator=()

void Lorene::Mg3d::operator= ( const Mg3d )
private

Assignement operator (private and not implemented to make Mg3d a non-copyable class)

◆ operator==()

bool Lorene::Mg3d::operator== ( const Mg3d mgi) const

Comparison operator (egality)

Definition at line 815 of file mg3d.C.

References colloc_r, get_colloc_r(), get_np(), get_nr(), get_nt(), get_nzone(), get_type_p(), get_type_r(), get_type_t(), np, nr, nt, nzone, type_p, type_r, and type_t.

◆ plus_half()

const Mg3d * Lorene::Mg3d::plus_half ( ) const

Returns the pointer on the grid which has 50% more points in r dimension (for desaliasing).

Definition at line 718 of file mg3d.C.

References colloc_r, g_plus_half, Mg3d(), np, nr, nt, nzone, type_p, type_r, and type_t.

◆ plus_half_angu()

const Mg3d * Lorene::Mg3d::plus_half_angu ( ) const

Returns the pointer on the grid which has 50% more points in and dimension (for desaliasing).

Definition at line 746 of file mg3d.C.

References colloc_r, g_plus_half_angu, Mg3d(), np, nr, nt, nzone, type_p, type_r, and type_t.

◆ pseudo_base_vect_cart()

Base_val ** Lorene::Mg3d::pseudo_base_vect_cart ( ) const

Returns the standard spectral bases for the Cartesian components of a pseudo-vector.

Definition at line 797 of file mg3d_std_base.C.

References colloc_r, get_nzone(), and nzone.

◆ pseudo_base_vect_spher()

Base_val ** Lorene::Mg3d::pseudo_base_vect_spher ( ) const

Returns the standard spectral bases for the spherical components of a pseudo-vector.

Definition at line 1117 of file mg3d_std_base.C.

References colloc_r, get_nzone(), and nzone.

◆ sauve()

void Lorene::Mg3d::sauve ( FILE *  fd,
bool  save_base = false 
) const

Saves into a file.

By default, if save_base is false, the spectral decomposition basis colloc_r is not saved (for compatibility reasons). If save_base is true, then colloc_r is save, too. The same value for the flag read_base must be given in the contructor reading the file.

Definition at line 500 of file mg3d.C.

References colloc_r, Lorene::fwrite_be(), np, nr, nt, nzone, type_p, type_r, and type_t.

◆ set_deriv_0x0()

void Lorene::Mg3d::set_deriv_0x0 ( ) const
protected

Sets to 0x0 all the pointers on derived quantities (g_radial , g_angu, g_twice, ...

)

Definition at line 588 of file mg3d.C.

References g_angu, g_angu_1dom, g_non_axi, g_plus_half, g_plus_half_angu, g_radial, and g_twice.

◆ std_base_scal()

Base_val Lorene::Mg3d::std_base_scal ( ) const

Returns the standard spectral bases for a scalar.

Definition at line 104 of file mg3d_std_base.C.

References colloc_r, and nzone.

◆ std_base_scal_odd()

Base_val Lorene::Mg3d::std_base_scal_odd ( ) const

Returns the standard odd spectral bases for a scalar.

Definition at line 134 of file mg3d_std_base.C.

References colloc_r, and nzone.

◆ std_base_vect_cart()

Base_val ** Lorene::Mg3d::std_base_vect_cart ( ) const

Returns the standard spectral bases for the Cartesian components of a vector.

Definition at line 180 of file mg3d_std_base.C.

References colloc_r, get_nzone(), and nzone.

◆ std_base_vect_spher()

Base_val ** Lorene::Mg3d::std_base_vect_spher ( ) const

Returns the standard spectral bases for the spherical components of a vector.

Definition at line 502 of file mg3d_std_base.C.

References colloc_r, get_nzone(), and nzone.

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  o,
const Mg3d g 
)
friend

Display.

Definition at line 528 of file mg3d.C.

Member Data Documentation

◆ colloc_r

int* Lorene::Mg3d::colloc_r
protected

Array (size: nzone) of type of collocation points in r ( $\xi$) and related decompoisition bases (BASE_CHEB, BASE_LEG, BASE_JAC02 ).

Definition at line 305 of file grilles.h.

◆ g

Grille3d** Lorene::Mg3d::g
protected

Array (size: nzone) of pointers on the Grille3d's.

Definition at line 308 of file grilles.h.

◆ g_angu

Mg3d* Lorene::Mg3d::g_angu
mutableprotected

Pointer on the associated angular grid.

Definition at line 310 of file grilles.h.

◆ g_angu_1dom

Mg3d* Lorene::Mg3d::g_angu_1dom
mutableprotected

Pointer on the associated angular grid with only one domain.

Definition at line 312 of file grilles.h.

◆ g_non_axi

Mg3d* Lorene::Mg3d::g_non_axi
mutableprotected

Pointer on the grid which has at least 4 points in the $\phi$ direction and at least 5 in the $\theta$ direction (for tensor rotations).

Definition at line 334 of file grilles.h.

◆ g_plus_half

Mg3d* Lorene::Mg3d::g_plus_half
mutableprotected

Pointer on the grid which has 50% more points in r dimension (for desaliasing).

Definition at line 323 of file grilles.h.

◆ g_plus_half_angu

Mg3d* Lorene::Mg3d::g_plus_half_angu
mutableprotected

Pointer on the grid which has 50% more points in and dimension (for desaliasing).

Definition at line 328 of file grilles.h.

◆ g_radial

Mg3d* Lorene::Mg3d::g_radial
mutableprotected

Pointer on the associated radial grid.

Definition at line 313 of file grilles.h.

◆ g_twice

Mg3d* Lorene::Mg3d::g_twice
mutableprotected

Pointer on the grid which has twice the number of points in each dimension (for desaliasing).

Definition at line 318 of file grilles.h.

◆ np

int* Lorene::Mg3d::np
protected

Array (size: nzone) of nb. of points in $\phi$.

Definition at line 288 of file grilles.h.

◆ nr

int* Lorene::Mg3d::nr
protected

Array (size: nzone) of nb. of points in r ( $\xi$)

Definition at line 286 of file grilles.h.

◆ nt

int* Lorene::Mg3d::nt
protected

Array (size: nzone) of nb. of points in $\theta$.

Definition at line 287 of file grilles.h.

◆ nzone

int Lorene::Mg3d::nzone
protected

Number of domains (zones)

Definition at line 284 of file grilles.h.

◆ type_p

int Lorene::Mg3d::type_p
protected

Type of sampling in $\phi$ (SYM, NONSYM)

Definition at line 299 of file grilles.h.

◆ type_r

int* Lorene::Mg3d::type_r
protected

Array (size: nzone) of type of sampling in r ( $\xi$) (RARE,FIN, UNSURR)

Definition at line 293 of file grilles.h.

◆ type_t

int Lorene::Mg3d::type_t
protected

Type of sampling in $\theta$ (SYM, NONSYM)

Definition at line 296 of file grilles.h.


The documentation for this class was generated from the following files: