00001 /* 00002 * Method of the class Map_af for the resolution of the scalar Poisson 00003 * equation 00004 */ 00005 00006 /* 00007 * Copyright (c) 1999-2001 Eric Gourgoulhon 00008 * Copyright (c) 1999-2001 Philippe Grandclement 00009 * 00010 * This file is part of LORENE. 00011 * 00012 * LORENE is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * LORENE is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with LORENE; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 * 00026 */ 00027 00028 00029 char map_af_poisson_C[] = "$Header: /cvsroot/Lorene/C++/Source/Map/map_af_poisson.C,v 1.5 2005/08/25 12:14:09 p_grandclement Exp $" ; 00030 00031 /* 00032 * $Id: map_af_poisson.C,v 1.5 2005/08/25 12:14:09 p_grandclement Exp $ 00033 * $Log: map_af_poisson.C,v $ 00034 * Revision 1.5 2005/08/25 12:14:09 p_grandclement 00035 * Addition of a new method to solve the scalar Poisson equation, based on a multi-domain Tau-method 00036 * 00037 * Revision 1.4 2004/05/06 15:25:39 e_gourgoulhon 00038 * The case dzpuis=5 with null value in CED is well treated now. 00039 * 00040 * Revision 1.3 2004/02/20 10:55:23 j_novak 00041 * The versions dzpuis 5 -> 3 has been improved and polished. Should be 00042 * operational now... 00043 * 00044 * Revision 1.2 2004/02/06 10:53:52 j_novak 00045 * New dzpuis = 5 -> dzpuis = 3 case (not ready yet). 00046 * 00047 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon 00048 * LORENE 00049 * 00050 * Revision 1.9 2000/05/22 13:46:48 phil 00051 * ajout du cas dzpuis = 3 00052 * 00053 * Revision 1.8 2000/02/09 14:44:24 eric 00054 * Traitement de dzpuis ameliore. 00055 * 00056 * Revision 1.7 1999/12/22 16:37:10 eric 00057 * Ajout de pot.set_dzpuis(0) a la fin. 00058 * 00059 * Revision 1.6 1999/12/22 15:11:03 eric 00060 * Remplacement du test source.get_mp() == this par 00061 * source.get_mp()->get_mg() == mg 00062 * (idem pour pot), 00063 * afin de permettre l'appel par Map_et::poisson. 00064 * 00065 * Revision 1.5 1999/12/21 13:02:37 eric 00066 * Changement de prototype de la routine poisson : la solution est 00067 * desormais passee en argument (et non plus en valeur de retour) 00068 * pour s'adapter au prototype general de la fonction virtuelle 00069 * Map::poisson. 00070 * 00071 * Revision 1.4 1999/12/21 10:06:29 eric 00072 * Ajout de l'argument (muet) Param&. 00073 * 00074 * Revision 1.3 1999/12/07 16:48:50 phil 00075 * On fait ylm_i avant de quitter 00076 * 00077 * Revision 1.2 1999/12/02 16:12:22 eric 00078 * *** empty log message *** 00079 * 00080 * Revision 1.1 1999/12/02 14:30:07 eric 00081 * Initial revision 00082 * 00083 * 00084 * $Header: /cvsroot/Lorene/C++/Source/Map/map_af_poisson.C,v 1.5 2005/08/25 12:14:09 p_grandclement Exp $ 00085 * 00086 */ 00087 00088 // Header Lorene: 00089 #include "map.h" 00090 #include "cmp.h" 00091 00092 Mtbl_cf sol_poisson(const Map_af&, const Mtbl_cf&, int, bool match = true) ; 00093 Mtbl_cf sol_poisson_tau(const Map_af&, const Mtbl_cf&, int) ; 00094 //***************************************************************************** 00095 00096 void Map_af::poisson(const Cmp& source, Param& , Cmp& pot) const { 00097 00098 assert(source.get_etat() != ETATNONDEF) ; 00099 assert(source.get_mp()->get_mg() == mg) ; 00100 assert(pot.get_mp()->get_mg() == mg) ; 00101 00102 assert( source.check_dzpuis(2) || source.check_dzpuis(4) 00103 || source.check_dzpuis(3) || source.check_dzpuis(5) ) ; 00104 00105 bool match = true ; 00106 00107 int dzpuis ; 00108 00109 if ( (source.dz_nonzero()) || (source.get_dzpuis() > 3)) { //##awkward?? 00110 dzpuis = source.get_dzpuis() ; 00111 } 00112 else{ 00113 dzpuis = 4 ; 00114 } 00115 00116 match = !(dzpuis == 5) ; 00117 00118 // Spherical harmonic expansion of the source 00119 // ------------------------------------------ 00120 00121 const Valeur& sourva = source.va ; 00122 00123 if (sourva.get_etat() == ETATZERO) { 00124 pot.set_etat_zero() ; 00125 return ; 00126 } 00127 00128 // Spectral coefficients of the source 00129 assert(sourva.get_etat() == ETATQCQ) ; 00130 00131 Valeur rho(sourva.get_mg()) ; 00132 sourva.coef() ; 00133 rho = *(sourva.c_cf) ; // copy of the coefficients of the source 00134 00135 rho.ylm() ; // spherical harmonic transforms 00136 00137 // Call to the Mtbl_cf version 00138 // --------------------------- 00139 Mtbl_cf resu = sol_poisson(*this, *(rho.c_cf), dzpuis, match) ; 00140 00141 // Final result returned as a Cmp 00142 // ------------------------------ 00143 00144 pot.set_etat_zero() ; // to call Cmp::del_t(). 00145 00146 pot.set_etat_qcq() ; 00147 00148 pot.va = resu ; 00149 (pot.va).ylm_i() ; // On repasse en base standard. 00150 00151 (dzpuis == 5) ? pot.set_dzpuis(3) : pot.set_dzpuis(0) ; 00152 00153 } 00154 00155 00156 //---------------------- 00157 // Tau version method 00158 //--------------------- 00159 00160 00161 void Map_af::poisson_tau(const Cmp& source, Param& , Cmp& pot) const { 00162 00163 assert(source.get_etat() != ETATNONDEF) ; 00164 assert(source.get_mp()->get_mg() == mg) ; 00165 assert(pot.get_mp()->get_mg() == mg) ; 00166 00167 assert( source.check_dzpuis(2) || source.check_dzpuis(4) 00168 || source.check_dzpuis(3)) ; 00169 00170 int dzpuis ; 00171 00172 if ( (source.dz_nonzero()) || (source.get_dzpuis() > 3)) { //##awkward?? 00173 dzpuis = source.get_dzpuis() ; 00174 } 00175 else{ 00176 dzpuis = 4 ; 00177 } 00178 00179 // Spherical harmonic expansion of the source 00180 // ------------------------------------------ 00181 00182 const Valeur& sourva = source.va ; 00183 00184 if (sourva.get_etat() == ETATZERO) { 00185 pot.set_etat_zero() ; 00186 return ; 00187 } 00188 00189 // Spectral coefficients of the source 00190 assert(sourva.get_etat() == ETATQCQ) ; 00191 00192 Valeur rho(sourva.get_mg()) ; 00193 sourva.coef() ; 00194 rho = *(sourva.c_cf) ; // copy of the coefficients of the source 00195 00196 rho.ylm() ; // spherical harmonic transforms 00197 00198 // Call to the Mtbl_cf version 00199 // --------------------------- 00200 00201 Mtbl_cf resu = sol_poisson_tau(*this, *(rho.c_cf), dzpuis) ; 00202 00203 // Final result returned as a Cmp 00204 // ------------------------------ 00205 00206 pot.set_etat_zero() ; // to call Cmp::del_t(). 00207 00208 pot.set_etat_qcq() ; 00209 00210 pot.va = resu ; 00211 (pot.va).ylm_i() ; // On repasse en base standard. 00212 pot.set_dzpuis(0) ; 00213 } 00214
1.4.6