LORENE
Lorene::Mtbl Class Reference

Multi-domain array. More...

#include <mtbl.h>

Public Member Functions

 Mtbl (const Mg3d &mgrid)
 Constructor. More...
 
 Mtbl (const Mg3d *p_mgrid)
 Constructor. More...
 
 Mtbl (const Mg3d &, FILE *)
 Constructor from a file (see sauve(FILE*)) More...
 
 Mtbl (const Coord &c)
 Constructor from a Coord. More...
 
 Mtbl (const Mtbl &a)
 Copy constructor. More...
 
 ~Mtbl ()
 Destructor. More...
 
void operator= (const Mtbl &)
 Assignement to another Mtbl. More...
 
void operator= (double)
 Assignement to a double. More...
 
void operator= (int)
 Assignement to a int. More...
 
void set_etat_nondef ()
 Sets the logical state to ETATNONDEF (undefined). More...
 
void set_etat_zero ()
 Sets the logical state to ETATZERO (zero). More...
 
void set_etat_qcq ()
 Sets the logical state to ETATQCQ (ordinary state). More...
 
void annule_hard ()
 Sets the Mtbl to zero in a hard way. More...
 
void annule (int l_min, int l_max)
 Sets the Mtbl to zero in some domains. More...
 
Tblset (int l)
 Read/write of the Tbl in a given domain. More...
 
const Tbloperator() (int l) const
 Read-only of the Tbl in a given domain. More...
 
double & set (int l, int k, int j, int i)
 Read/write of a particular element. More...
 
double operator() (int l, int k, int j, int i) const
 Read-only of a particular element. More...
 
const Mg3dget_mg () const
 Gives the Mg3d on which the Mtbl is defined. More...
 
int get_etat () const
 Gives the logical state. More...
 
int get_nzone () const
 Gives the number of zones (domains) More...
 
void sauve (FILE *) const
 Save in a file. More...
 
void affiche_seuil (ostream &ostr, int precision=4, double threshold=1.e-7) const
 Prints only the values greater than a given threshold. More...
 
void operator+= (const Mtbl &)
 += Mtbl More...
 
void operator+= (double)
 += double More...
 
void operator-= (const Mtbl &)
 -= Mtbl More...
 
void operator-= (double)
 -= double More...
 
void operator*= (const Mtbl &)
 *= Mtbl More...
 
void operator*= (double)
 *= double More...
 
void operator/= (const Mtbl &)
 /= Mtbl More...
 
void operator/= (double)
 /= double More...
 

Public Attributes

Tbl ** t
 Array (size nzone ) of pointers on the Tbl 's. More...
 

Private Member Functions

void del_t ()
 Logical destructor: dellocates the memory occupied by the Tbl array t . More...
 

Private Attributes

const Mg3dmg
 Pointer on the multi-grid Mgd3 on which this is defined. More...
 
int nzone
 Number of domains (zones) More...
 
int etat
 Logical state (ETATNONDEF , ETATQCQ or ETATZERO ). More...
 

Friends

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

Detailed Description

Multi-domain array.

()

This class is essentially an array of Tbl . It is intended to be used in conjunction with the class Mtbl_cf . A Mtbl is initialy created with a logical state NONDEF . Arithmetic operations are provided with the usual meaning (see below).

Version
#$Id: mtbl.h,v 1.7 2014/10/13 08:52:36 j_novak Exp $#

Definition at line 118 of file mtbl.h.

Constructor & Destructor Documentation

◆ Mtbl() [1/5]

Lorene::Mtbl::Mtbl ( const Mg3d mgrid)
explicit

Constructor.

Definition at line 127 of file mtbl.C.

◆ Mtbl() [2/5]

Lorene::Mtbl::Mtbl ( const Mg3d p_mgrid)
explicit

Constructor.

Definition at line 133 of file mtbl.C.

◆ Mtbl() [3/5]

Lorene::Mtbl::Mtbl ( const Mg3d g,
FILE *  fd 
)

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

Definition at line 185 of file mtbl.C.

References etat, Lorene::fread_be(), Lorene::Mg3d::get_nzone(), mg, nzone, and t.

◆ Mtbl() [4/5]

Lorene::Mtbl::Mtbl ( const Coord c)

Constructor from a Coord.

Definition at line 139 of file mtbl.C.

References Lorene::Coord::c, etat, Lorene::Coord::fait(), get_mg(), Lorene::Mg3d::get_nzone(), mg, nzone, and t.

◆ Mtbl() [5/5]

Lorene::Mtbl::Mtbl ( const Mtbl a)

Copy constructor.

Definition at line 165 of file mtbl.C.

References get_etat().

◆ ~Mtbl()

Lorene::Mtbl::~Mtbl ( )

Destructor.

Definition at line 159 of file mtbl.C.

References del_t().

Member Function Documentation

◆ affiche_seuil()

void Lorene::Mtbl::affiche_seuil ( ostream &  ostr,
int  precision = 4,
double  threshold = 1.e-7 
) const

Prints only the values greater than a given threshold.

Parameters
ostr[input] Output stream used for the printing
precision[input] Number of printed digits (default: 4)
threshold[input] Value above which an array element is printed (default: 1.e-7)

Definition at line 396 of file mtbl.C.

References etat, and nzone.

◆ annule()

void Lorene::Mtbl::annule ( int  l_min,
int  l_max 
)

Sets the Mtbl to zero in some domains.

Parameters
l_min[input] The Mtbl will be set (logically) to zero in the domains whose indices are in the range [l_min,l_max] .
l_max[input] see the comments for l_min .

Note that annule(0,nzone-1) is equivalent to set_etat_zero() .

Definition at line 332 of file mtbl.C.

References etat, nzone, and set_etat_zero().

◆ annule_hard()

void Lorene::Mtbl::annule_hard ( )

Sets the Mtbl to zero in a hard way.

1/ Sets the logical state to ETATQCQ , i.e. to an ordinary state. 2/ Allocates the memory of the Tbl array t , and fills it with zeros. NB: this function must be used for debugging purposes only. For other operations, the functions set_etat_zero() or annule(int, int) must be perferred.

Definition at line 315 of file mtbl.C.

References Lorene::Tbl::annule_hard(), etat, Lorene::Mg3d::get_grille3d(), mg, nzone, and t.

◆ del_t()

void Lorene::Mtbl::del_t ( )
private

Logical destructor: dellocates the memory occupied by the Tbl array t .

Definition at line 280 of file mtbl.C.

References nzone, and t.

◆ get_etat()

int Lorene::Mtbl::get_etat ( ) const
inline

Gives the logical state.

Definition at line 277 of file mtbl.h.

References etat.

◆ get_mg()

const Mg3d* Lorene::Mtbl::get_mg ( ) const
inline

Gives the Mg3d on which the Mtbl is defined.

Definition at line 274 of file mtbl.h.

References mg.

◆ get_nzone()

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

Gives the number of zones (domains)

Definition at line 280 of file mtbl.h.

References nzone.

◆ operator()() [1/2]

const Tbl& Lorene::Mtbl::operator() ( int  l) const
inline

Read-only of the Tbl in a given domain.

Parameters
l[input] domain index

Definition at line 232 of file mtbl.h.

References etat, and nzone.

◆ operator()() [2/2]

double Lorene::Mtbl::operator() ( int  l,
int  k,
int  j,
int  i 
) const
inline

Read-only of a particular element.

Parameters
l[input] domain index
k[input] $\phi$ index
j[input] $\theta$ index
i[input] r ( $\xi$) index

Definition at line 259 of file mtbl.h.

References etat.

◆ operator*=() [1/2]

void Lorene::Mtbl::operator*= ( const Mtbl mi)

*= Mtbl

Definition at line 560 of file mtbl_arithm.C.

References etat, get_mg(), and mg.

◆ operator*=() [2/2]

void Lorene::Mtbl::operator*= ( double  )

*= double

Definition at line 436 of file mtbl.C.

References Lorene::c_est_pas_fait().

◆ operator+=() [1/2]

void Lorene::Mtbl::operator+= ( const Mtbl mi)

+= Mtbl

Definition at line 516 of file mtbl_arithm.C.

References etat, get_mg(), and mg.

◆ operator+=() [2/2]

void Lorene::Mtbl::operator+= ( double  )

+= double

Definition at line 426 of file mtbl.C.

References Lorene::c_est_pas_fait().

◆ operator-=() [1/2]

void Lorene::Mtbl::operator-= ( const Mtbl mi)

-= Mtbl

Definition at line 538 of file mtbl_arithm.C.

References etat, get_mg(), and mg.

◆ operator-=() [2/2]

void Lorene::Mtbl::operator-= ( double  )

-= double

Definition at line 431 of file mtbl.C.

References Lorene::c_est_pas_fait().

◆ operator/=() [1/2]

void Lorene::Mtbl::operator/= ( const Mtbl )

/= Mtbl

◆ operator/=() [2/2]

void Lorene::Mtbl::operator/= ( double  )

/= double

Definition at line 441 of file mtbl.C.

References Lorene::c_est_pas_fait().

◆ operator=() [1/3]

void Lorene::Mtbl::operator= ( const Mtbl mtc)

Assignement to another Mtbl.

Definition at line 227 of file mtbl.C.

References get_etat(), and mg.

◆ operator=() [2/3]

void Lorene::Mtbl::operator= ( double  x)

Assignement to a double.

Definition at line 246 of file mtbl.C.

References nzone, set_etat_qcq(), set_etat_zero(), and t.

◆ operator=() [3/3]

void Lorene::Mtbl::operator= ( int  m)

Assignement to a int.

Definition at line 260 of file mtbl.C.

References nzone, set_etat_qcq(), set_etat_zero(), and t.

◆ sauve()

void Lorene::Mtbl::sauve ( FILE *  fd) const

Save in a file.

Definition at line 212 of file mtbl.C.

References etat, Lorene::fwrite_be(), mg, and Lorene::Mg3d::sauve().

◆ set() [1/2]

Tbl& Lorene::Mtbl::set ( int  l)
inline

Read/write of the Tbl in a given domain.

Parameters
l[input] domain index

Definition at line 221 of file mtbl.h.

References etat, and nzone.

◆ set() [2/2]

double& Lorene::Mtbl::set ( int  l,
int  k,
int  j,
int  i 
)
inline

Read/write of a particular element.

Parameters
l[input] domain index
k[input] $\phi$ index
j[input] $\theta$ index
i[input] r ( $\xi$) index

Definition at line 245 of file mtbl.h.

References etat, and nzone.

◆ set_etat_nondef()

void Lorene::Mtbl::set_etat_nondef ( )

Sets the logical state to ETATNONDEF (undefined).

Deallocates the memory occupied by the Tbl array t .

Definition at line 296 of file mtbl.C.

References etat.

◆ set_etat_qcq()

void Lorene::Mtbl::set_etat_qcq ( )

Sets the logical state to ETATQCQ (ordinary state).

If the state (member etat ) is already ETATQCQ , this function does nothing. Otherwise, it performs the memory allocation for the Tbl array t .

Definition at line 302 of file mtbl.C.

References etat.

◆ set_etat_zero()

void Lorene::Mtbl::set_etat_zero ( )

Sets the logical state to ETATZERO (zero).

Deallocates the memory occupied by the Tbl array t .

Definition at line 290 of file mtbl.C.

References etat.

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  o,
const Mtbl mt 
)
friend

Display.

Definition at line 368 of file mtbl.C.

Member Data Documentation

◆ etat

int Lorene::Mtbl::etat
private

Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).

Definition at line 128 of file mtbl.h.

◆ mg

const Mg3d* Lorene::Mtbl::mg
private

Pointer on the multi-grid Mgd3 on which this is defined.

Definition at line 124 of file mtbl.h.

◆ nzone

int Lorene::Mtbl::nzone
private

Number of domains (zones)

Definition at line 126 of file mtbl.h.

◆ t

Tbl** Lorene::Mtbl::t

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

Definition at line 132 of file mtbl.h.


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