map_af_poisson.C
/*
* Method of the class Map_af for the resolution of the scalar Poisson
* equation
*/
/*
* Copyright (c) 1999-2001 Eric Gourgoulhon
* Copyright (c) 1999-2001 Philippe Grandclement
*
* 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
*
*/
char map_af_poisson_C[] = "$Header: /cvsroot/Lorene/C++/Source/Map/map_af_poisson.C,v 1.6 2014/10/13 08:53:02 j_novak Exp $" ;
/*
* $Id: map_af_poisson.C,v 1.6 2014/10/13 08:53:02 j_novak Exp $
* $Log: map_af_poisson.C,v $
* Revision 1.6 2014/10/13 08:53:02 j_novak
* Lorene classes and functions now belong to the namespace Lorene.
*
* Revision 1.5 2005/08/25 12:14:09 p_grandclement
* Addition of a new method to solve the scalar Poisson equation, based on a multi-domain Tau-method
*
* Revision 1.4 2004/05/06 15:25:39 e_gourgoulhon
* The case dzpuis=5 with null value in CED is well treated now.
*
* Revision 1.3 2004/02/20 10:55:23 j_novak
* The versions dzpuis 5 -> 3 has been improved and polished. Should be
* operational now...
*
* Revision 1.2 2004/02/06 10:53:52 j_novak
* New dzpuis = 5 -> dzpuis = 3 case (not ready yet).
*
* Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
* LORENE
*
* Revision 1.9 2000/05/22 13:46:48 phil
* ajout du cas dzpuis = 3
*
* Revision 1.8 2000/02/09 14:44:24 eric
* Traitement de dzpuis ameliore.
*
* Revision 1.7 1999/12/22 16:37:10 eric
* Ajout de pot.set_dzpuis(0) a la fin.
*
* Revision 1.6 1999/12/22 15:11:03 eric
* Remplacement du test source.get_mp() == this par
* source.get_mp()->get_mg() == mg
* (idem pour pot),
* afin de permettre l'appel par Map_et::poisson.
*
* Revision 1.5 1999/12/21 13:02:37 eric
* Changement de prototype de la routine poisson : la solution est
* desormais passee en argument (et non plus en valeur de retour)
* pour s'adapter au prototype general de la fonction virtuelle
* Map::poisson.
*
* Revision 1.4 1999/12/21 10:06:29 eric
* Ajout de l'argument (muet) Param&.
*
* Revision 1.3 1999/12/07 16:48:50 phil
* On fait ylm_i avant de quitter
*
* Revision 1.2 1999/12/02 16:12:22 eric
* *** empty log message ***
*
* Revision 1.1 1999/12/02 14:30:07 eric
* Initial revision
*
*
* $Header: /cvsroot/Lorene/C++/Source/Map/map_af_poisson.C,v 1.6 2014/10/13 08:53:02 j_novak Exp $
*
*/
// Header Lorene:
#include "map.h"
#include "cmp.h"
namespace Lorene {
Mtbl_cf sol_poisson(const Map_af&, const Mtbl_cf&, int, bool match = true) ;
Mtbl_cf sol_poisson_tau(const Map_af&, const Mtbl_cf&, int) ;
//*****************************************************************************
void Map_af::poisson(const Cmp& source, Param& , Cmp& pot) const {
assert(source.get_etat() != ETATNONDEF) ;
assert(source.get_mp()->get_mg() == mg) ;
assert(pot.get_mp()->get_mg() == mg) ;
assert( source.check_dzpuis(2) || source.check_dzpuis(4)
|| source.check_dzpuis(3) || source.check_dzpuis(5) ) ;
bool match = true ;
int dzpuis ;
if ( (source.dz_nonzero()) || (source.get_dzpuis() > 3)) { //##awkward??
dzpuis = source.get_dzpuis() ;
}
else{
dzpuis = 4 ;
}
match = !(dzpuis == 5) ;
// Spherical harmonic expansion of the source
// ------------------------------------------
const Valeur& sourva = source.va ;
if (sourva.get_etat() == ETATZERO) {
pot.set_etat_zero() ;
return ;
}
// Spectral coefficients of the source
assert(sourva.get_etat() == ETATQCQ) ;
Valeur rho(sourva.get_mg()) ;
sourva.coef() ;
rho = *(sourva.c_cf) ; // copy of the coefficients of the source
rho.ylm() ; // spherical harmonic transforms
// Call to the Mtbl_cf version
// ---------------------------
Mtbl_cf resu = sol_poisson(*this, *(rho.c_cf), dzpuis, match) ;
// Final result returned as a Cmp
// ------------------------------
pot.set_etat_zero() ; // to call Cmp::del_t().
pot.set_etat_qcq() ;
pot.va = resu ;
(pot.va).ylm_i() ; // On repasse en base standard.
(dzpuis == 5) ? pot.set_dzpuis(3) : pot.set_dzpuis(0) ;
}
//----------------------
// Tau version method
//---------------------
void Map_af::poisson_tau(const Cmp& source, Param& , Cmp& pot) const {
assert(source.get_etat() != ETATNONDEF) ;
assert(source.get_mp()->get_mg() == mg) ;
assert(pot.get_mp()->get_mg() == mg) ;
assert( source.check_dzpuis(2) || source.check_dzpuis(4)
|| source.check_dzpuis(3)) ;
int dzpuis ;
if ( (source.dz_nonzero()) || (source.get_dzpuis() > 3)) { //##awkward??
dzpuis = source.get_dzpuis() ;
}
else{
dzpuis = 4 ;
}
// Spherical harmonic expansion of the source
// ------------------------------------------
const Valeur& sourva = source.va ;
if (sourva.get_etat() == ETATZERO) {
pot.set_etat_zero() ;
return ;
}
// Spectral coefficients of the source
assert(sourva.get_etat() == ETATQCQ) ;
Valeur rho(sourva.get_mg()) ;
sourva.coef() ;
rho = *(sourva.c_cf) ; // copy of the coefficients of the source
rho.ylm() ; // spherical harmonic transforms
// Call to the Mtbl_cf version
// ---------------------------
Mtbl_cf resu = sol_poisson_tau(*this, *(rho.c_cf), dzpuis) ;
// Final result returned as a Cmp
// ------------------------------
pot.set_etat_zero() ; // to call Cmp::del_t().
pot.set_etat_qcq() ;
pot.va = resu ;
(pot.va).ylm_i() ; // On repasse en base standard.
pot.set_dzpuis(0) ;
}
}
Lorene::Cmp
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition cmp.h:446
Lorene::Cmp::get_etat
int get_etat() const
Returns the logical state.
Definition cmp.h:899
Lorene::Cmp::va
Valeur va
The numerical value of the Cmp.
Definition cmp.h:464
Lorene::Cmp::set_etat_qcq
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition cmp.C:304
Lorene::Cmp::get_dzpuis
int get_dzpuis() const
Returns dzpuis.
Definition cmp.h:903
Lorene::Cmp::dz_nonzero
bool dz_nonzero() const
Returns true if the last domain is compactified and *this is not zero in this domain.
Definition cmp.C:660
Lorene::Cmp::set_etat_zero
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition cmp.C:289
Lorene::Cmp::set_dzpuis
void set_dzpuis(int)
Set a value to dzpuis.
Definition cmp.C:654
Lorene::Cmp::check_dzpuis
bool check_dzpuis(int dzi) const
Returns false if the last domain is compactified and *this is not zero in this domain and dzpuis is n...
Definition cmp.C:715
Lorene::Cmp::get_mp
const Map * get_mp() const
Returns the mapping.
Definition cmp.h:901
Lorene::Map_af
Affine radial mapping.
Definition map.h:2027
Lorene::Map_af::poisson
virtual void poisson(const Cmp &source, Param &par, Cmp &uu) const
Computes the solution of a scalar Poisson equation.
Definition map_af_poisson.C:100
Lorene::Map_af::poisson_tau
virtual void poisson_tau(const Cmp &source, Param &par, Cmp &uu) const
Computes the solution of a scalar Poisson equation using a Tau method.
Definition map_af_poisson.C:165
Lorene::Mtbl_cf
Coefficients storage for the multi-domain spectral method.
Definition mtbl_cf.h:186
Lorene::Param
Parameter storage.
Definition param.h:125
Lorene::Valeur
Values and coefficients of a (real-value) function.
Definition valeur.h:287
Lorene::Valeur::get_etat
int get_etat() const
Returns the logical state.
Definition valeur.h:726
Lorene::Valeur::ylm
void ylm()
Computes the coefficients of *this.
Definition valeur_ylm.C:138
Lorene::Valeur::c_cf
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Definition valeur.h:302
Lorene::Valeur::coef
void coef() const
Computes the coeffcients of *this.
Definition valeur_coef.C:148
Lorene::Valeur::get_mg
const Mg3d * get_mg() const
Returns the Mg3d on which the this is defined.
Definition valeur.h:729
Lorene
Lorene prototypes.
Definition app_hor.h:64