Lorene::Mg3d Class Reference
Spectral representation.

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.
| 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.
| 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.
| Mg3d (FILE *fd, bool read_base=false)
| Constructor from a file (see `sauve(FILE*)`).
| Mg3d (const Mg3d &)
| Copy constructor (private and not implemented to make `Mg3d` a non-copyable class).
| ~Mg3d ()
| Destructor.
int | get_nzone () const
| Returns the number of domains.
int | get_nr (int l) const
| Returns the number of points in the radial direction ( ) in domain no. l.
int | get_nt (int l) const
| Returns the number of points in the co-latitude direction ( ) in domain no. l.
int | get_np (int l) const
| Returns the number of points in the azimuthal direction ( ) in domain no. l.
int | get_type_r (int l) const
| Returns the type of sampling in the radial direction in domain no.
int | get_type_t () const
| Returns the type of sampling in the direction: `SYM` : : symmetry with respect to the equatorial plane `NONSYM` : : no symmetry with respect to the equatorial plane.
int | get_type_p () const
| Returns the type of sampling in the direction: `SYM` : : symmetry with respect to the transformation `NONSYM` : : no symmetry with respect to the transformation .
const Grille3d * | get_grille3d (int l) const
| Returns a pointer on the 3D mono-grid for domain no. l.
int | get_colloc_r (int l) const
| Returns the type of collocation points used in domain no.
const Mg3d * | get_angu () const
| Returns the pointer on the associated angular grid.
const Mg3d * | get_angu_1dom () const
| Returns the pointer on the associated mono-domain angular grid.
const Mg3d * | get_radial () const
| Returns the pointer on the associated radial grid.
const Mg3d * | get_twice () const
| Returns the pointer on the grid which has twice the number of points in each dimension (for desaliasing).
const Mg3d * | plus_half () const
| Returns the pointer on the grid which has 50% more points in r dimension (for desaliasing).
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 direction (for tensor rotations).
bool | operator== (const Mg3d &) const
| Comparison operator (egality).
void | sauve (FILE *fd, bool save_base=false) const
| Saves into a file.
bool | operator!= (const Mg3d &) const
| Operator !=.
Base_val | std_base_scal () const
| Returns the standard spectral bases for a scalar.
Base_val | std_base_scal_odd () const
| Returns the standard odd spectral bases for a scalar.
Base_val ** | std_base_vect_cart () const
| Returns the standard spectral bases for the Cartesian components of a vector.
Base_val ** | std_base_vect_spher () const
| Returns the standard spectral bases for the spherical components of a vector.
Base_val ** | pseudo_base_vect_cart () const
| Returns the standard spectral bases for the Cartesian components of a pseudo-vector.
Base_val ** | pseudo_base_vect_spher () const
| Returns the standard spectral bases for the spherical components of a pseudo-vector.

## Protected Member Functions

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

## Protected Attributes

int | nzone
| Number of domains (zones).
int * | nr
| Array (size: `nzone`) of nb. of points in r ( ).
int * | nt
| Array (size: `nzone`) of nb. of points in .
int * | np
| Array (size: `nzone`) of nb. of points in .
int * | type_r
| Array (size: `nzone`) of type of sampling in r ( ) (`RARE`,`FIN`, c UNSURR).
int | type_t
| Type of sampling in (`SYM`, `NONSYM`).
int | type_p
| Type of sampling in (`SYM`, `NONSYM`).
int * | colloc_r
| Array (size: `nzone`) of type of collocation points in r ( ) and related decompoisition bases (`BASE_CHEB`, `BASE_LEG`, `BASE_JAC02` ).
Grille3d ** | g
| Array (size: `nzone`) of pointers on the `Grille3d's`.
Mg3d * | g_angu
| Pointer on the associated angular grid.
Mg3d * | g_angu_1dom
| Pointer on the associated angular grid with only one domain.
Mg3d * | g_radial
| Pointer on the associated radial grid.
Mg3d * | g_twice
| Pointer on the grid which has twice the number of points in each dimension (for desaliasing).
Mg3d * | g_plus_half
| Pointer on the grid which has 50% more points in r dimension (for desaliasing).
Mg3d * | g_non_axi
| Pointer on the grid which has at least 4 points in the direction and at least 5 in the direction (for tensor rotations).

## Private Member Functions

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

## Friends

ostream & | operator<< (ostream &o, const Mg3d &g)
| Display.

## 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 direction is not identical in all the zones. This holds for the type of sampling (symmetry) too.

Version
  #$Id: grilles.h,v 1.23 2014/10/13 08:52:35 j_novak Exp $#

Definition at line 273 of file grilles.h.

## Constructor & Destructor Documentation

## Mg3d() [1/5]

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 -direction
  typt | [input] Type of sampling in -direction
  nbp[] | [input] Array (size: `nz`) of NDF in -direction
  typp | [input] Type of sampling in -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 158 of file mg3d.C.

References colloc_r, g, np, nr, nt, nzone, set_deriv_0x0(), type_p, type_r, and type_t.

## Mg3d() [2/5]

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: , rarefied sampling (type `RARE`) near the origin;
domains of indices will be shells: , dense sampling (type `FIN`) near -1 and 1;
if `compact` == true, the domains of index `l` = `nz-1` will be the outermost compactified shell: , 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 -direction in each domain
  nbp | [input] Number of degree of freedom (NDF) in -direction in each domain
  typt | [input] Type of sampling in -direction: `SYM` for a sampling in (symmetry with respect to the equatorial plane), `NONSYM` for a sampling in
  typp | [input] Type of sampling in -direction: `SYM` for a sampling in (symmetry with respect to a translation in ) `NONSYM` for a sampling in
  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 204 of file mg3d.C.

References colloc_r, g, np, nr, nt, nzone, set_deriv_0x0(), type_p, type_r, and type_t.

## Mg3d() [3/5]

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 , 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 -direction in each domain
  nbp | [input] Number of degree of freedom (NDF) in -direction in each domain
  typt | [input] Type of sampling in -direction: `SYM` for a sampling in (symmetry with respect to the equatorial plane), `NONSYM` for a sampling in
  typp | [input] Type of sampling in -direction: `SYM` for a sampling in (symmetry with respect to a translation in ) `NONSYM` for a sampling in

Definition at line 262 of file mg3d.C.

References colloc_r, g, np, nr, nt, nzone, set_deriv_0x0(), type_p, type_r, and type_t.

## Mg3d() [4/5]

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 313 of file mg3d.C.

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

## Mg3d() [5/5]

Lorene::Mg3d::Mg3d | ( | const Mg3d & |  | ) |

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

References Mg3d().

## ~Mg3d()

Lorene::Mg3d::~Mg3d | ( |  | ) |

Destructor.

Definition at line 351 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 445 of file mg3d.C.

References g_angu, g_angu_1dom, g_non_axi, g_plus_half, 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 473 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 494 of file mg3d.C.

References g_angu_1dom, Mg3d(), np, nt, type_p, and type_t.

## 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 511 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 500 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 direction and at least 5 in the direction (for tensor rotations).

Definition at line 615 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 ( ) in domain no. l.

Definition at line 462 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 ( ) in domain no. l.

Definition at line 452 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 ( ) in domain no. l.

Definition at line 457 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 448 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 518 of file mg3d.C.

References colloc_r, 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 539 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 direction:
`SYM` : : symmetry with respect to the transformation
`NONSYM` : : no symmetry with respect to the transformation .

Definition at line 495 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` : : rarefied at the origin
`FIN` : : dense at the two extremities
`UNSURR` : : dense at the two extremities, in view of using as radial variable

Definition at line 474 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 direction:
`SYM` : : symmetry with respect to the equatorial plane
`NONSYM` : : no symmetry with respect to the equatorial plane.

Definition at line 485 of file grilles.h.

References type_t.

## operator!=()

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

Operator !=.

Definition at line 420 of file mg3d.C.

References colloc_r, Mg3d(), 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).

References Mg3d().

## operator==()

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

Comparison operator (egality).

Definition at line 646 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(), Mg3d(), 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 587 of file mg3d.C.

References colloc_r, g_plus_half, 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 794 of file mg3d_std_base.C.

References Lorene::Base_val::b, colloc_r, get_nzone(), get_type_r(), nzone, P_COSSIN, P_COSSIN_I, P_COSSIN_P, R_CHEB, R_CHEBP, R_CHEBPI_P, R_CHEBPIM_I, R_CHEBPIM_P, R_CHEBU, T_COS, T_COS_P, T_COSSIN_C, T_COSSIN_CI, T_COSSIN_CP, T_SIN, T_SIN_P, type_p, and type_t.

## 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 1114 of file mg3d_std_base.C.

References Lorene::Base_val::b, colloc_r, get_nzone(), get_type_r(), nzone, P_COSSIN, P_COSSIN_P, R_CHEB, R_CHEBP, R_CHEBPI_I, R_CHEBPI_P, R_CHEBPIM_P, R_CHEBU, T_COS, T_COS_I, T_COSSIN_C, T_COSSIN_CI, T_COSSIN_S, T_COSSIN_SI, T_COSSIN_SP, T_SIN, T_SIN_I, T_SIN_P, type_p, and type_t.

## 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 371 of file mg3d.C.

References Lorene::arrete(), 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 458 of file mg3d.C.

References g_angu, g_angu_1dom, g_non_axi, g_plus_half, 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 101 of file mg3d_std_base.C.

References Lorene::Base_val::b, colloc_r, nzone, type_p, type_r, and type_t.

## 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 131 of file mg3d_std_base.C.

References Lorene::Base_val::b, colloc_r, nzone, type_p, type_r, and type_t.

## 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 177 of file mg3d_std_base.C.

References Lorene::Base_val::b, colloc_r, get_nzone(), get_type_r(), nzone, P_COSSIN, P_COSSIN_I, P_COSSIN_P, R_CHEB, R_CHEBI, R_CHEBPI_P, R_CHEBPIM_I, R_CHEBPIM_P, R_CHEBU, T_COS, T_COS_I, T_COSSIN_C, T_COSSIN_CI, T_COSSIN_CP, T_SIN, T_SIN_I, type_p, and type_t.

## 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 499 of file mg3d_std_base.C.

References Lorene::Base_val::b, colloc_r, get_nzone(), get_type_r(), nzone, P_COSSIN, P_COSSIN_P, R_CHEB, R_CHEBI, R_CHEBPI_I, R_CHEBPI_P, R_CHEBPIM_I, R_CHEBU, T_COS, T_COS_P, T_COSSIN_C, T_COSSIN_CP, T_COSSIN_S, T_COSSIN_SI, T_COSSIN_SP, T_SIN, T_SIN_I, T_SIN_P, type_p, and type_t.

## Friends And Related Symbol Documentation

## operator<<

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

friend

Display.

Definition at line 399 of file mg3d.C.

References g, Mg3d(), and operator<<.

## Member Data Documentation

## colloc_r

int* Lorene::Mg3d::colloc_r

protected

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

Definition at line 299 of file grilles.h.

## g

Grille3d** Lorene::Mg3d::g

protected

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

Definition at line 302 of file grilles.h.

## g_angu

Mg3d* Lorene::Mg3d::g_angu

mutable protected

Pointer on the associated angular grid.

Definition at line 304 of file grilles.h.

## g_angu_1dom

Mg3d* Lorene::Mg3d::g_angu_1dom

mutable protected

Pointer on the associated angular grid with only one domain.

Definition at line 306 of file grilles.h.

## g_non_axi

Mg3d* Lorene::Mg3d::g_non_axi

mutable protected

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

Definition at line 323 of file grilles.h.

## g_plus_half

Mg3d* Lorene::Mg3d::g_plus_half

mutable protected

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

Definition at line 317 of file grilles.h.

## g_radial

Mg3d* Lorene::Mg3d::g_radial

mutable protected

Pointer on the associated radial grid.

Definition at line 307 of file grilles.h.

## g_twice

Mg3d* Lorene::Mg3d::g_twice

mutable protected

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

Definition at line 312 of file grilles.h.

## np

int* Lorene::Mg3d::np

protected

Array (size: `nzone`) of nb. of points in .

Definition at line 282 of file grilles.h.

## nr

int* Lorene::Mg3d::nr

protected

Array (size: `nzone`) of nb. of points in r ( ).

Definition at line 280 of file grilles.h.

## nt

int* Lorene::Mg3d::nt

protected

Array (size: `nzone`) of nb. of points in .

Definition at line 281 of file grilles.h.

## nzone

int Lorene::Mg3d::nzone

protected

Number of domains (zones).

Definition at line 278 of file grilles.h.

## type_p

int Lorene::Mg3d::type_p

protected

Type of sampling in (`SYM`, `NONSYM`).

Definition at line 293 of file grilles.h.

## type_r

int* Lorene::Mg3d::type_r

protected

Array (size: `nzone`) of type of sampling in r ( ) (`RARE`,`FIN`, c UNSURR).

Definition at line 287 of file grilles.h.

## type_t

int Lorene::Mg3d::type_t

protected

Type of sampling in (`SYM`, `NONSYM`).

Definition at line 290 of file grilles.h.

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

- grilles.h
- mg3d.C
- mg3d_std_base.C