mtbl_cf.h
/*
* Definition of Lorene class Mtbl_cf
*
*/
/*
* Copyright (c) 1999-2000 Jean-Alain Marck
* Copyright (c) 1999-2005 Eric Gourgoulhon
* Copyright (c) 1999-2001 Philippe Grandclement
* Copyright (c) 1999-2001 Jerome Novak
*
* 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 __MTBL_CF_H_
#define __MTBL_CF_H_
/*
* $Id: mtbl_cf.h,v 1.10 2014/10/13 08:52:36 j_novak Exp $
* $Log: mtbl_cf.h,v $
* Revision 1.10 2014/10/13 08:52:36 j_novak
* Lorene classes and functions now belong to the namespace Lorene.
*
* Revision 1.9 2006/06/06 14:56:59 j_novak
* Summation functions for angular coefficients at xi=+/-1.
*
* Revision 1.8 2005/04/04 21:30:42 e_gourgoulhon
* Added argument lambda to method poisson_angu
* to treat the generalized angular Poisson equation:
* Lap_ang u + lambda u = source.
*
* Revision 1.7 2004/03/22 13:12:42 j_novak
* Modification of comments to use doxygen instead of doc++
*
* Revision 1.6 2003/11/06 14:43:37 e_gourgoulhon
* Gave a name to const arguments in certain method prototypes (e.g.
* constructors) to correct a bug of DOC++.
*
* Revision 1.5 2003/10/19 19:44:41 e_gourgoulhon
* Introduced new method display (to replace the old affiche_seuil).
*
* Revision 1.4 2003/10/15 21:09:22 e_gourgoulhon
* Added method poisson_regu.
*
* Revision 1.3 2002/09/13 09:17:33 j_novak
* Modif. commentaires
*
* Revision 1.2 2002/06/17 14:05:17 j_novak
* friend functions are now also declared outside the class definition
*
* Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
* LORENE
*
* Revision 2.28 2000/09/11 13:52:21 eric
* Ajout des methodes mult_cp() et mult_sp().
*
* Revision 2.27 2000/08/16 10:42:54 eric
* Suppression du membre dzpuis.
*
* Revision 2.26 2000/08/04 11:41:52 eric
* Ajout de l'operateur (int l) et de la fonction set(int l) pour l'acces
* individuel aux Tbl.
*
* Revision 2.25 2000/03/06 10:26:24 eric
* Ajout des fonctions val_point_symy, val_point_asymy.
*
* Revision 2.24 2000/02/25 13:53:44 eric
* Suppression de la fonction nettoie().
*
* Revision 2.23 1999/12/29 13:11:34 eric
* Ajout de la fonction val_point_jk.
*
* Revision 2.22 1999/12/07 14:51:52 eric
* Changement ordre des arguments (phi,theta,xi) --> (xi,theta,phi)
* dans la routine val_point.
*
* Revision 2.21 1999/12/06 16:45:48 eric
* Ajout de la fonction val_point.
*
* Revision 2.20 1999/11/23 14:30:12 novak
* Ajout des membres mult_ct et mult_st
*
* Revision 2.19 1999/11/16 13:06:22 novak
* Ajout de mult_x et scost
*
* Revision 2.18 1999/10/29 15:07:10 eric
* Suppression des fonctions membres min() et max():
* elles deviennent des fonctions externes.
* Ajout de fonctions mathematiques (abs, norme, etc...).
*
* Revision 2.17 1999/10/21 13:42:00 eric
* *** empty log message ***
*
* Revision 2.16 1999/10/21 12:49:13 eric
* Ajout de la fonction membre nettoie().
*
* Revision 2.15 1999/10/18 15:06:50 eric
* La fonction membre annule() est rebaptisee annule_hard().
* Introduction de la fonction membre annule(int, int).
*
* Revision 2.14 1999/10/18 13:39:13 eric
* Suppression de l'argument base dans les routines de derivation.
*
* Revision 2.13 1999/10/13 15:49:22 eric
* Ajout du membre base.
* Modification des constructeurs (la base doit etre passee en argument).
*
* Revision 2.12 1999/10/01 14:49:19 eric
* Depoussierage.
* Documentation.
*
* Revision 2.11 1999/09/07 14:33:43 phil
* ajout de la fonction ssint(int*)
*
* Revision 2.10 1999/04/26 17:02:40 phil
* ajout de sx2(int*)
*
* Revision 2.9 1999/04/26 16:24:02 phil
* ajout de mult2_xm1_zec(int*)
*
* Revision 2.8 1999/04/26 16:12:27 phil
* ajout de mult_xm1_zec(int *)
*
* Revision 2.7 1999/04/26 15:48:43 phil
* ajout de sxm1_zec(int*)
*
* Revision 2.6 1999/04/26 14:50:30 phil
* ajout de sx(int*)
*
* Revision 2.5 1999/04/26 12:19:38 phil
* ajout lapang
*
* Revision 2.4 1999/03/03 10:32:44 hyc
* *** empty log message ***
*
* Revision 2.3 1999/03/02 18:55:00 eric
* Ajout de la fonction affiche_seuil.
*
*
* $Header: /cvsroot/Lorene/C++/Include/mtbl_cf.h,v 1.10 2014/10/13 08:52:36 j_novak Exp $
*
*/
// Headers Lorene
#include "tbl.h"
#include "base_val.h"
#include "grilles.h"
namespace Lorene {
class Mg3d ;
class Mtbl_cf {
// Data :
// -----
private:
const Mg3d* mg ;
int nzone ;
int etat ;
public:
Base_val base ;
Tbl** t ;
// Constructors - Destructor
// -------------------------
public:
Mtbl_cf(const Mg3d& mgrid, const Base_val& basis) ;
Mtbl_cf(const Mg3d* p_mgrid, const Base_val& basis) ;
Mtbl_cf(const Mg3d&, FILE* ) ;
Mtbl_cf(const Mtbl_cf& ) ;
~Mtbl_cf() ;
// Assignement
// -----------
void operator=(const Mtbl_cf& ) ;
void operator=(double ) ;
void operator=(int ) ;
// Memory management
// -----------------
private:
void del_t() ;
public:
void set_etat_nondef() ;
void set_etat_zero() ;
void set_etat_qcq() ;
void annule_hard() ;
void annule(int l_min, int l_max) ;
// Access to individual elements
// -----------------------------
public:
Tbl& set(int l) {
assert(l < nzone) ;
assert(etat == ETATQCQ) ;
return *(t[l]) ;
};
const Tbl& operator()(int l) const {
assert(l < nzone) ;
assert(etat == ETATQCQ) ;
return *(t[l]) ;
};
double& set(int l, int k, int j, int i) {
assert(l < nzone) ;
assert(etat == ETATQCQ) ;
return (t[l])->set(k, j, i) ;
};
double operator()(int l, int k, int j, int i) const {
assert(etat != ETATNONDEF) ;
assert(l < nzone) ;
if (etat == ETATZERO) {
double zero = 0. ;
return zero ;
}
else return (*t[l])(k, j, i) ;
};
double val_point(int l, double x, double theta, double phi) const ;
double val_point_symy(int l, double x, double theta, double phi) const ;
double val_point_asymy(int l, double x, double theta, double phi) const ;
double val_point_jk(int l, double x, int j, int k) const ;
double val_point_jk_symy(int l, double x, int j, int k) const ;
double val_point_jk_asymy(int l, double x, int j, int k) const ;
double val_out_bound_jk(int l, int j, int k) const ;
double val_in_bound_jk(int l, int j, int k) const ;
// Extraction of information
// -------------------------
public:
const Mg3d* get_mg() const { return mg ; };
int get_etat() const { return etat ; };
int get_nzone() const { return nzone ; } ;
// Outputs
// -------
public:
void sauve(FILE *) const ;
void display(double threshold = 1.e-7, int precision = 4,
ostream& ostr = cout) const ;
void affiche_seuil(ostream& ostr, int precision = 4,
double threshold = 1.e-7) const ;
friend ostream& operator<<(ostream& , const Mtbl_cf& ) ;
// Member arithmetics
// ------------------
public:
void operator+=(const Mtbl_cf & ) ;
void operator-=(const Mtbl_cf & ) ;
void operator*=(double ) ;
void operator/=(double ) ;
// Linear operators
// ----------------
public:
void dsdx() ;
void d2sdx2() ;
void sx() ;
void sx2() ;
void mult_x() ;
void sxm1_zec() ;
void mult_xm1_zec() ;
void mult2_xm1_zec() ;
void dsdt() ;
void d2sdt2() ;
void ssint() ;
void scost() ;
void mult_ct() ;
void mult_st() ;
void dsdp() ;
void d2sdp2() ;
void mult_cp() ;
void mult_sp() ;
void lapang() ;
// PDE resolution
//---------------
public:
void poisson_angu(double lambda = 0) ;
} ;
ostream& operator<<(ostream& , const Mtbl_cf& ) ;
Mtbl_cf operator+(const Mtbl_cf& ) ;
Mtbl_cf operator-(const Mtbl_cf& ) ;
Mtbl_cf operator+(const Mtbl_cf&, const Mtbl_cf& ) ;
Mtbl_cf operator-(const Mtbl_cf&, const Mtbl_cf& ) ;
Mtbl_cf operator*(const Mtbl_cf&, double ) ;
Mtbl_cf operator*(double, const Mtbl_cf& ) ;
Mtbl_cf operator*(const Mtbl_cf&, int ) ;
Mtbl_cf operator*(int, const Mtbl_cf& ) ;
Mtbl_cf operator/(const Mtbl_cf&, double ) ;
Mtbl_cf operator/(const Mtbl_cf&, int ) ;
Mtbl_cf abs(const Mtbl_cf& ) ;
Tbl max(const Mtbl_cf& ) ;
Tbl min(const Mtbl_cf& ) ;
Tbl norme(const Mtbl_cf& ) ;
Tbl diffrel(const Mtbl_cf& a, const Mtbl_cf& b) ;
Tbl diffrelmax(const Mtbl_cf& a, const Mtbl_cf& b) ;
}
#endif
Lorene::Base_val
Bases of the spectral expansions.
Definition base_val.h:322
Lorene::Mg3d
Multi-domain grid.
Definition grilles.h:273
Lorene::Mtbl_cf
Coefficients storage for the multi-domain spectral method.
Definition mtbl_cf.h:186
Lorene::Mtbl_cf::val_point_jk
double val_point_jk(int l, double x, int j, int k) const
Computes the value of the field represented by *this at an arbitrary point in , but collocation point...
Definition mtbl_cf_val_point.C:258
Lorene::Mtbl_cf::base
Base_val base
Bases of the spectral expansions.
Definition mtbl_cf.h:200
Lorene::Mtbl_cf::del_t
void del_t()
Logical destructor: dellocates the memory occupied by the Tbl array t .
Definition mtbl_cf.C:276
Lorene::Mtbl_cf::set_etat_nondef
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
Definition mtbl_cf.C:294
Lorene::Mtbl_cf::mult2_xm1_zec
void mult2_xm1_zec()
Id (r sampling = RARE, FIN ) \ (r -sampling = UNSURR ).
Definition valeur_mult2_xm1.C:103
Lorene::Mtbl_cf::~Mtbl_cf
~Mtbl_cf()
Destructor.
Definition mtbl_cf.C:143
Lorene::Mtbl_cf::mult_xm1_zec
void mult_xm1_zec()
Id (r sampling = RARE, FIN ) \ (r -sampling = UNSURR ).
Definition valeur_mult_xm1.C:103
Lorene::Mtbl_cf::scost
void scost()
Definition valeur_scost.C:142
Lorene::Mtbl_cf::set_etat_zero
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition mtbl_cf.C:288
Lorene::Mtbl_cf::poisson_angu
void poisson_angu(double lambda=0)
Resolution of the generalized angular Poisson equation.
Definition mtbl_cf_pde.C:83
Lorene::Mtbl_cf::d2sdx2
void d2sdx2()
Definition valeur_d2sdx2.C:155
Lorene::Mtbl_cf::val_point_symy
double val_point_symy(int l, double x, double theta, double phi) const
Computes the value of the field represented by *this at an arbitrary point, by means of the spectral ...
Definition mtbl_cf_vp_symy.C:69
Lorene::Mtbl_cf::val_point_jk_asymy
double val_point_jk_asymy(int l, double x, int j, int k) const
Computes the value of the field represented by *this at an arbitrary point in , but collocation point...
Definition mtbl_cf_vp_asymy.C:203
Lorene::Mtbl_cf::sx
void sx()
(r -sampling = RARE ) \ Id (r sampling = FIN ) \ (r -sampling = UNSURR )
Definition valeur_sx.C:153
Lorene::Mtbl_cf::get_etat
int get_etat() const
Returns the logical state.
Definition mtbl_cf.h:456
Lorene::Mtbl_cf::operator()
const Tbl & operator()(int l) const
Read-only of the Tbl containing the coefficients in a given domain.
Definition mtbl_cf.h:306
Lorene::Mtbl_cf::dsdp
void dsdp()
Definition valeur_dsdp.C:139
Lorene::Mtbl_cf::val_point_jk_symy
double val_point_jk_symy(int l, double x, int j, int k) const
Computes the value of the field represented by *this at an arbitrary point in , but collocation point...
Definition mtbl_cf_vp_symy.C:201
Lorene::Mtbl_cf::ssint
void ssint()
Definition valeur_ssint.C:154
Lorene::Mtbl_cf::set
double & set(int l, int k, int j, int i)
Read/write of a particular element.
Definition mtbl_cf.h:319
Lorene::Mtbl_cf::sxm1_zec
void sxm1_zec()
Id (r sampling = RARE, FIN ) \ (r -sampling = UNSURR ).
Definition valeur_sxm1_zec.C:112
Lorene::Mtbl_cf::mg
const Mg3d * mg
Pointer on the multi-grid Mgd3 on which this is defined.
Definition mtbl_cf.h:192
Lorene::Mtbl_cf::dsdx
void dsdx()
Definition valeur_dsdx.C:153
Lorene::Mtbl_cf::operator*=
void operator*=(double)
*= double
Definition mtbl_cf.C:429
Lorene::Mtbl_cf::annule
void annule(int l_min, int l_max)
Sets the Mtbl_cf to zero in some domains.
Definition mtbl_cf.C:332
Lorene::Mtbl_cf::sauve
void sauve(FILE *) const
Save in a file.
Definition mtbl_cf.C:204
Lorene::Mtbl_cf::set
Tbl & set(int l)
Read/write of the Tbl containing the coefficients in a given domain.
Definition mtbl_cf.h:294
Lorene::Mtbl_cf::operator-=
void operator-=(const Mtbl_cf &)
-= Mtbl_cf
Definition mtbl_cf_arithm.C:325
Lorene::Mtbl_cf::sx2
void sx2()
(r -sampling = RARE ) \ Id (r sampling = FIN ) \ (r -sampling = UNSURR )
Definition valeur_sx2.C:157
Lorene::Mtbl_cf::get_nzone
int get_nzone() const
Returns the number of zones (domains).
Definition mtbl_cf.h:459
Lorene::Mtbl_cf::d2sdt2
void d2sdt2()
Definition valeur_d2sdt2.C:148
Lorene::Mtbl_cf::affiche_seuil
void affiche_seuil(ostream &ostr, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
Definition mtbl_cf.C:397
Lorene::Mtbl_cf::get_mg
const Mg3d * get_mg() const
Returns the Mg3d on which the Mtbl_cf is defined.
Definition mtbl_cf.h:453
Lorene::Mtbl_cf::operator=
void operator=(const Mtbl_cf &)
Assignement to another Mtbl_cf.
Definition mtbl_cf.C:220
Lorene::Mtbl_cf::etat
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition mtbl_cf.h:196
Lorene::Mtbl_cf::mult_cp
void mult_cp()
Definition valeur_mult_cp.C:120
Lorene::Mtbl_cf::t
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's which contain the spectral coefficients in each domain.
Definition mtbl_cf.h:205
Lorene::Mtbl_cf::val_point_asymy
double val_point_asymy(int l, double x, double theta, double phi) const
Computes the value of the field represented by *this at an arbitrary point, by means of the spectral ...
Definition mtbl_cf_vp_asymy.C:71
Lorene::Mtbl_cf::Mtbl_cf
Mtbl_cf(const Mg3d &mgrid, const Base_val &basis)
Constructor.
Definition mtbl_cf.C:124
Lorene::Mtbl_cf::display
void display(double threshold=1.e-7, int precision=4, ostream &ostr=cout) const
Prints the coefficients whose values are greater than a given threshold, as well as the corresponding...
Definition mtbl_cf_display.C:56
Lorene::Mtbl_cf::mult_x
void mult_x()
(r -sampling = RARE ) \ Id (r sampling = FIN ) \ (r -sampling = UNSURR )
Definition valeur_mult_x.C:144
Lorene::Mtbl_cf::val_point
double val_point(int l, double x, double theta, double phi) const
Computes the value of the field represented by *this at an arbitrary point, by means of the spectral ...
Definition mtbl_cf_val_point.C:115
Lorene::Mtbl_cf::mult_ct
void mult_ct()
Definition valeur_mult_ct.C:141
Lorene::Mtbl_cf::set_etat_qcq
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition mtbl_cf.C:300
Lorene::Mtbl_cf::operator+=
void operator+=(const Mtbl_cf &)
+= Mtbl_cf
Definition mtbl_cf_arithm.C:302
Lorene::Mtbl_cf::annule_hard
void annule_hard()
Sets the Mtbl_cf to zero in a hard way.
Definition mtbl_cf.C:312
Lorene::Mtbl_cf::operator/=
void operator/=(double)
/= double
Definition mtbl_cf.C:434
Lorene::Mtbl_cf::d2sdp2
void d2sdp2()
Definition valeur_d2sdp2.C:132
Lorene::Mtbl_cf::operator<<
friend ostream & operator<<(ostream &, const Mtbl_cf &)
Display.
Definition mtbl_cf.C:366
Lorene::Mtbl_cf::lapang
void lapang()
Angular Laplacian.
Definition mtbl_cf_lapang.C:93
Lorene::Mtbl_cf::val_out_bound_jk
double val_out_bound_jk(int l, int j, int k) const
Computes the angular coefficient of index j,k of the field represented by *this at by means of the s...
Definition mtbl_cf_val_point.C:428
Lorene::Mtbl_cf::val_in_bound_jk
double val_in_bound_jk(int l, int j, int k) const
Computes the angular coefficient of index j,k of the field represented by *this at by means of the s...
Definition mtbl_cf_val_point.C:452
Lorene::Mtbl_cf::dsdt
void dsdt()
Definition valeur_dsdt.C:152
Lorene::Mtbl_cf::nzone
int nzone
Number of domains (zones).
Definition mtbl_cf.h:194
Lorene::Mtbl_cf::mult_sp
void mult_sp()
Definition valeur_mult_sp.C:120
Lorene::Mtbl_cf::operator()
double operator()(int l, int k, int j, int i) const
Read-only of a particular element.
Definition mtbl_cf.h:332
Lorene::Mtbl_cf::mult_st
void mult_st()
Definition valeur_mult_st.C:140
Lorene::Tbl
Basic array class.
Definition tbl.h:161
Lorene::operator*
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Definition base_val_mult.C:102
Lorene::operator-
Cmp operator-(const Cmp &)
- Cmp
Definition cmp_arithm.C:108
Lorene::operator/
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Definition cmp_arithm.C:457
Lorene::diffrel
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
Definition cmp_math.C:504
Lorene::norme
Tbl norme(const Cmp &)
Sums of the absolute values of all the values of the Cmp in each domain.
Definition cmp_math.C:481
Lorene::min
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Definition cmp_math.C:458
Lorene::max
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Definition cmp_math.C:435
Lorene::abs
Cmp abs(const Cmp &)
Absolute value.
Definition cmp_math.C:410
Lorene::diffrelmax
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
Definition cmp_math.C:539
Lorene::operator+
Cmp operator+(const Cmp &)
Definition cmp_arithm.C:104
Lorene
Lorene prototypes.
Definition app_hor.h:64
Lorene::phi
Coord phi
coordinate centered on the grid
Definition map.h:720
Lorene::x
Coord x
x coordinate centered on the grid
Definition map.h:726