| 1 | /* |
| 2 | * Definition of Lorene class Base_val |
| 3 | * |
| 4 | */ |
| 5 | |
| 6 | /* |
| 7 | * Copyright (c) 1999-2000 Jean-Alain Marck |
| 8 | * Copyright (c) 1999-2001 Eric Gourgoulhon |
| 9 | * Copyright (c) 1999-2001 Philippe Grandclement |
| 10 | * Copyright (c) 2001 Jerome Novak |
| 11 | * |
| 12 | * This file is part of LORENE. |
| 13 | * |
| 14 | * LORENE is free software; you can redistribute it and/or modify |
| 15 | * it under the terms of the GNU General Public License as published by |
| 16 | * the Free Software Foundation; either version 2 of the License, or |
| 17 | * (at your option) any later version. |
| 18 | * |
| 19 | * LORENE is distributed in the hope that it will be useful, |
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | * GNU General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU General Public License |
| 25 | * along with LORENE; if not, write to the Free Software |
| 26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 27 | * |
| 28 | */ |
| 29 | |
| 30 | |
| 31 | #ifndef __BASE_VAL_H_ |
| 32 | #define __BASE_VAL_H_ |
| 33 | |
| 34 | /* |
| 35 | * $Id: base_val.h,v 1.23 2014/10/13 08:52:31 j_novak Exp $ |
| 36 | * $Log: base_val.h,v $ |
| 37 | * Revision 1.23 2014/10/13 08:52:31 j_novak |
| 38 | * Lorene classes and functions now belong to the namespace Lorene. |
| 39 | * |
| 40 | * Revision 1.22 2014/10/06 15:09:39 j_novak |
| 41 | * Modified #include directives to use c++ syntax. |
| 42 | * |
| 43 | * Revision 1.21 2013/06/05 15:10:41 j_novak |
| 44 | * Suppression of FINJAC sampling in r. This Jacobi(0,2) base is now |
| 45 | * available by setting colloc_r to BASE_JAC02 in the Mg3d constructor. |
| 46 | * |
| 47 | * Revision 1.20 2013/01/11 08:20:10 j_novak |
| 48 | * New radial spectral bases with Legendre polynomials (R_LEG, R_LEGP, R_LEGI). |
| 49 | * |
| 50 | * Revision 1.19 2012/01/17 10:18:17 j_penner |
| 51 | * changed nzone from a private member to a protected member |
| 52 | * |
| 53 | * Revision 1.18 2009/10/23 12:55:46 j_novak |
| 54 | * New base T_LEG_MI |
| 55 | * |
| 56 | * Revision 1.17 2009/10/08 16:19:32 j_novak |
| 57 | * Addition of new bases T_COS and T_SIN. |
| 58 | * |
| 59 | * Revision 1.16 2008/12/03 15:21:20 j_novak |
| 60 | * New method mult_cost. |
| 61 | * |
| 62 | * Revision 1.15 2007/12/11 15:28:05 jl_cornou |
| 63 | * Jacobi(0,2) polynomials partially implemented |
| 64 | * |
| 65 | * Revision 1.14 2005/09/07 13:09:48 j_novak |
| 66 | * New method for determining the highest multipole that can be described on a 3D |
| 67 | * grid. |
| 68 | * |
| 69 | * Revision 1.13 2004/11/23 15:03:14 m_forot |
| 70 | * Corrected error in comments. |
| 71 | * |
| 72 | * Revision 1.12 2004/11/04 15:39:45 e_gourgoulhon |
| 73 | * Modif documentation: added description of bases without any symmetry |
| 74 | * in theta. |
| 75 | * |
| 76 | * Revision 1.11 2004/08/24 09:14:40 p_grandclement |
| 77 | * Addition of some new operators, like Poisson in 2d... It now requieres the |
| 78 | * GSL library to work. |
| 79 | * |
| 80 | * Also, the way a variable change is stored by a Param_elliptic is changed and |
| 81 | * no longer uses Change_var but rather 2 Scalars. The codes using that feature |
| 82 | * will requiere some modification. (It should concern only the ones about monopoles) |
| 83 | * |
| 84 | * Revision 1.10 2004/03/22 13:12:40 j_novak |
| 85 | * Modification of comments to use doxygen instead of doc++ |
| 86 | * |
| 87 | * Revision 1.9 2004/01/27 14:31:25 j_novak |
| 88 | * New method Base_val::mult_sint() |
| 89 | * |
| 90 | * Revision 1.8 2004/01/27 14:13:58 j_novak |
| 91 | * Added method Base_val::mult_x() |
| 92 | * |
| 93 | * Revision 1.7 2003/10/20 06:41:43 e_gourgoulhon |
| 94 | * Corrected documentation. |
| 95 | * |
| 96 | * Revision 1.6 2003/10/19 19:42:50 e_gourgoulhon |
| 97 | * -- member nzone now private |
| 98 | * -- introduced new methods get_nzone() and get_b() |
| 99 | * -- introduced new methods name_r, name_theta and name_phi. |
| 100 | * |
| 101 | * Revision 1.5 2003/09/16 08:53:05 j_novak |
| 102 | * Addition of the T_LEG_II base (odd in theta, only for odd m) and the |
| 103 | * transformation functions from and to T_SIN_P. |
| 104 | * |
| 105 | * Revision 1.4 2002/10/16 14:36:28 j_novak |
| 106 | * Reorganization of #include instructions of standard C++, in order to |
| 107 | * use experimental version 3 of gcc. |
| 108 | * |
| 109 | * Revision 1.3 2002/09/13 09:17:31 j_novak |
| 110 | * Modif. commentaires |
| 111 | * |
| 112 | * Revision 1.2 2002/06/17 14:05:15 j_novak |
| 113 | * friend functions are now also declared outside the class definition |
| 114 | * |
| 115 | * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon |
| 116 | * LORENE |
| 117 | * |
| 118 | * Revision 2.20 2001/10/12 14:56:09 novak |
| 119 | * Ajout des methodes dsdx(), dsdt(), etc... |
| 120 | * |
| 121 | * Revision 2.19 2001/05/29 16:08:45 eric |
| 122 | * Modif commentaires (mise en conformite Doc++ 3.4.7). |
| 123 | * |
| 124 | * Revision 2.18 2000/09/28 10:19:50 eric |
| 125 | * Modif commentaires (nouvelles bases T_LEG_IP et T_LEG_PI). |
| 126 | * |
| 127 | * Revision 2.17 2000/09/08 11:42:55 eric |
| 128 | * *** empty log message *** |
| 129 | * |
| 130 | * Revision 2.16 2000/09/08 10:14:11 eric |
| 131 | * *** empty log message *** |
| 132 | * |
| 133 | * Revision 2.15 2000/09/08 10:11:49 eric |
| 134 | * *** empty log message *** |
| 135 | * |
| 136 | * Revision 2.14 2000/09/08 10:10:24 eric |
| 137 | * *** empty log message *** |
| 138 | * |
| 139 | * Revision 2.13 2000/09/08 10:06:19 eric |
| 140 | * Ajout des methodes set_base_r, etc... et get_base_r, etc... |
| 141 | * |
| 142 | * Revision 2.12 1999/12/29 10:49:12 eric |
| 143 | * theta_functions et phi_functions declarees const. |
| 144 | * |
| 145 | * Revision 2.11 1999/12/29 10:36:58 eric |
| 146 | * Modif commentaires. |
| 147 | * |
| 148 | * Revision 2.10 1999/12/28 12:57:44 eric |
| 149 | * Introduction des methodes theta_functions et phi_functions. |
| 150 | * |
| 151 | * Revision 2.9 1999/11/19 14:53:11 phil |
| 152 | * *** empty log message *** |
| 153 | * |
| 154 | * Revision 2.8 1999/11/18 13:48:35 phil |
| 155 | * *** empty log message *** |
| 156 | * |
| 157 | * Revision 2.7 1999/11/18 12:51:12 phil |
| 158 | * commentaire de operator* |
| 159 | * |
| 160 | * Revision 2.6 1999/10/26 13:23:12 phil |
| 161 | * *** empty log message *** |
| 162 | * |
| 163 | * Revision 2.5 1999/10/26 13:18:06 phil |
| 164 | * ajout de l'operator* |
| 165 | * |
| 166 | * Revision 2.4 1999/10/13 15:49:12 eric |
| 167 | * *** empty log message *** |
| 168 | * |
| 169 | * Revision 2.3 1999/10/12 10:02:17 eric |
| 170 | * Amelioration des commentaires: description de toutes les bases. |
| 171 | * |
| 172 | * Revision 2.2 1999/10/01 15:55:58 eric |
| 173 | * Depoussierage. |
| 174 | * Documentation |
| 175 | * |
| 176 | * Revision 2.1 1999/09/13 14:38:08 phil |
| 177 | * ajout de l'operateur == |
| 178 | * |
| 179 | * Revision 2.0 1999/02/22 15:17:47 hyc |
| 180 | * *** empty log message *** |
| 181 | * |
| 182 | * |
| 183 | * $Header: /cvsroot/Lorene/C++/Include/base_val.h,v 1.23 2014/10/13 08:52:31 j_novak Exp $ |
| 184 | * |
| 185 | */ |
| 186 | |
| 187 | #include <cstdio> |
| 188 | #include <cassert> |
| 189 | #include "headcpp.h" |
| 190 | |
| 191 | |
| 192 | #include "type_parite.h" |
| 193 | namespace Lorene { |
| 194 | class Tbl ; |
| 195 | class Mg3d ; |
| 196 | |
| 197 | /** |
| 198 | * Bases of the spectral expansions. \ingroup (spec) |
| 199 | * |
| 200 | * The class \c Base_val describes, in each domain, on which basis the |
| 201 | * spectral expansion of a given function is performed. The corresponding |
| 202 | * coefficients will be stored in a \c Mtbl_cf. |
| 203 | * |
| 204 | * The various bases in each of the three dimensions \e r , \f$\theta\f$ and |
| 205 | * \f$\phi\f$ are identified by an integer defined by a macro in the |
| 206 | * file \c type_parite.h. These three integers are then merged (by means of |
| 207 | * the bitwise OR operator) to give a single integer, stored in |
| 208 | * \c Base_val::b[l], |
| 209 | * \c l being the domain index. The bases in \e r , \f$\theta\f$ and \f$\phi\f$ can |
| 210 | * be restored by applying the bitwise AND operator with the masks |
| 211 | * \c MSQ_R, \c MSQ_T and \c MSQ_P defined in \c type_parite.h. |
| 212 | * |
| 213 | * The basis functions for expansion with respect to the radial coordinate \f$\xi\f$ |
| 214 | * are coded as follows, \e m being the order of the Fourier expansion in \f$\phi\f$: |
| 215 | * \li \c R_CHEB (0x00000001) : Chebyshev polynomials |
| 216 | * (\e r -sampling: \c FIN); |
| 217 | * \li \c R_CHEBP (0x00000002) : Even Chebyshev polynomials |
| 218 | * (\e r -sampling: \c RARE); |
| 219 | * \li \c R_CHEBI (0x00000003) : Odd Chebyshev polynomials |
| 220 | * (\e r -sampling: \c RARE ); |
| 221 | * \li \c R_CHEBPI_P (0x00000004) : Even (resp. odd) Chebyshev |
| 222 | * polynomials for \e l (spherical harmonic index) even (resp. odd) (\e r -sampling: \c RARE ); |
| 223 | * \li \c R_CHEBPI_I (0x00000005) : Odd (resp. even) Chebyshev |
| 224 | * polynomials for \e l (spherical harmonic index) even (resp. odd) (\e r -sampling: \c RARE ) ; |
| 225 | * \li \c R_CHEBPIM_P (0x00000006) : Even (resp. odd) Chebyshev |
| 226 | * polynomials for \e m even (resp. odd) (\e r -sampling: \c RARE ); |
| 227 | * \li \c R_CHEBPIM_I (0x00000007) : Odd (resp. even) Chebyshev |
| 228 | * polynomials for \e m even (resp. odd) (\e r -sampling: \c RARE ) ; |
| 229 | * \li \c R_CHEBU (0x00000008) : Chebyshev polynomials |
| 230 | * (\e r -sampling: \c UNSURR ) ; |
| 231 | * \li \c R_LEG (0x00000009) : Legendre polynomials |
| 232 | * (\e r -sampling: \c FIN); |
| 233 | * \li \c R_LEGP (0x0000000a) : Even Legendre polynomials |
| 234 | * (\e r -sampling: \c RARE); |
| 235 | * \li \c R_LEGI (0x0000000b) : Odd Legendre polynomials |
| 236 | * (\e r -sampling: \c RARE); |
| 237 | * \li \c R_JACO02 (0x0000000c) : Jacobi(0,2) polynomials |
| 238 | * (\e r -sampling: \c FIN). |
| 239 | * |
| 240 | * The basis functions for expansion with respect to the co-latitude coordinate |
| 241 | * \f$\theta\f$ are coded as follows, \e m being the order of the Fourier expansion |
| 242 | * in \f$\phi\f$: |
| 243 | * \li \c T_COSSIN_C (0x00000100) : \f$\cos(j \theta)\f$ for \e m even, |
| 244 | * \f$\sin(j \theta)\f$ for \e m odd |
| 245 | * (\f$\theta\f$-sampling: \c NONSYM); |
| 246 | * \li \c T_COSSIN_S (0x00000200) : \f$\sin(j \theta)\f$ for \e m even, |
| 247 | * \f$\cos(j \theta)\f$ for \e m odd |
| 248 | * (\f$\theta\f$-sampling: \c NONSYM); |
| 249 | * \li \c T_COS (0x00000300) : \f$\cos(j \theta)\f$ \e m being always even and |
| 250 | * (\f$\theta\f$-sampling: \c NONSYM); |
| 251 | * \li \c T_SIN (0x00000400) : \f$\sin(j \theta)\f$ \e m being always even, |
| 252 | * (\f$\theta\f$-sampling: \c NONSYM); |
| 253 | * \li \c T_COS_P (0x00000500) : \f$\cos(2j \theta)\f$ |
| 254 | * (\f$\theta\f$-sampling: \c SYM); |
| 255 | * \li \c T_SIN_P (0x00000600) : \f$\sin(2j \theta)\f$ |
| 256 | * (\f$\theta\f$-sampling: \c SYM); |
| 257 | * \li \c T_COS_I (0x00000700) : \f$\cos((2j+1) \theta)\f$ |
| 258 | * (\f$\theta\f$-sampling: \c SYM); |
| 259 | * \li \c T_SIN_I (0x00000800) : \f$\sin((2j+1) \theta)\f$ |
| 260 | * (\f$\theta\f$-sampling: \c SYM); |
| 261 | * \li \c T_COSSIN_CP (0x00000900) : \f$\cos(2j \theta)\f$ for \e m even, |
| 262 | * \f$\sin((2j+1) \theta)\f$ for \e m odd |
| 263 | * (\f$\theta\f$-sampling: \c SYM); |
| 264 | * \li \c T_COSSIN_SP (0x00000a00) : \f$\sin(2j \theta)\f$ for \e m even, |
| 265 | * \f$\cos((2j+1) \theta)\f$ for \e m odd |
| 266 | * (\f$\theta\f$-sampling: \c SYM); |
| 267 | * \li \c T_COSSIN_CI (0x00000b00) : \f$\cos((2j+1) \theta)\f$ for \e m even, |
| 268 | * \f$\sin(2j \theta)\f$ for \e m odd |
| 269 | * (\f$\theta\f$-sampling: \c SYM); |
| 270 | * \li \c T_COSSIN_SI (0x00000c00) : \f$\sin((2j+1) \theta)\f$ for \e m even, |
| 271 | * \f$\cos(2j \theta)\f$ for \e m odd |
| 272 | * (\f$\theta\f$-sampling: \c SYM); |
| 273 | * \li \c T_LEG_P (0x00000d00) : Associated Legendre functions |
| 274 | * \f$P_{2j}^m(\cos\theta)\f$ for \e m even, |
| 275 | * \f$P_{2j+1}^m(\cos\theta)\f$ for \e m odd |
| 276 | * (\f$\theta\f$-sampling: \c SYM); |
| 277 | * \li \c T_LEG_PP (0x00000e00) : Associated Legendre functions |
| 278 | * \f$P_{2j}^m(\cos\theta)\f$, \e m being |
| 279 | * always even |
| 280 | * (\f$\theta\f$-sampling: \c SYM); |
| 281 | * \li \c T_LEG_I (0x00000f00) : Associated Legendre functions |
| 282 | * \f$P_{2j+1}^m(\cos\theta)\f$ for \e m even, |
| 283 | * \f$P_{2j}^m(\cos\theta)\f$ for \e m odd |
| 284 | * (\f$\theta\f$-sampling: \c SYM); |
| 285 | * \li \c T_LEG_IP (0x00001000) : Associated Legendre functions |
| 286 | * \f$P_{2j+1}^m(\cos\theta)\f$, \e m being |
| 287 | * always even |
| 288 | * (\f$\theta\f$-sampling: \c SYM); |
| 289 | * \li \c T_LEG_PI (0x00001100) : Associated Legendre functions |
| 290 | * \f$P_{2j+1}^m(\cos\theta)\f$, \e m being |
| 291 | * always odd |
| 292 | * (\f$\theta\f$-sampling: \c SYM); |
| 293 | * \li \c T_LEG_II (0x00001200) : Associated Legendre functions |
| 294 | * \f$P_{2j}^m(\cos\theta)\f$, \e m being |
| 295 | * always odd |
| 296 | * (\f$\theta\f$-sampling: \c SYM); |
| 297 | * \li \c T_LEG (0x00001700) : Associated Legendre functions |
| 298 | * \f$P_l^m(\cos\theta)\f$ of all types ; |
| 299 | * \li \c T_LEG_MP (0x00001800) : Associated Legendre functions |
| 300 | * \f$P_l^m(\cos\theta)\f$ \e m being always even |
| 301 | * (\f$\theta\f$-sampling: \c NONSYM ); |
| 302 | * \li \c T_LEG_MI (0x00001900) : Associated Legendre functions |
| 303 | * \f$P_l^m(\cos\theta)\f$ \e m being always odd |
| 304 | * (\f$\theta\f$-sampling: \c NONSYM ); |
| 305 | * |
| 306 | * The basis functions for expansion with respect to the azimuthal coordinate |
| 307 | * \f$\phi\f$ are coded as follows |
| 308 | * \li \c P_COSSIN (0x00010000) : Fourrier series |
| 309 | * \f$(\cos(m\phi),\ \sin(m\phi))\f$ |
| 310 | * (\f$\phi\f$-sampling: \c NONSYM); |
| 311 | * \li \c P_COSSIN_P (0x00020000) : Fourrier series |
| 312 | * \f$(\cos(m\phi),\ \sin(m\phi))\f$ with |
| 313 | * even harmonics only (i.e. \e m even) |
| 314 | * (\f$\phi\f$-sampling: \c SYM); |
| 315 | * \li \c P_COSSIN_I (0x00030000) : Fourrier series |
| 316 | * \f$(\cos(m\phi),\ \sin(m\phi))\f$ with |
| 317 | * odd harmonics only (i.e. \e m odd) |
| 318 | * (\f$\phi\f$-sampling: \c SYM); |
| 319 | * |
| 320 | */ |
| 321 | |
| 322 | class Base_val { |
| 323 | |
| 324 | // Data |
| 325 | // ---- |
| 326 | protected: |
| 327 | int nzone ; ///< Number of domains (zones) |
| 328 | |
| 329 | public: |
| 330 | /// Array (size: \c nzone ) of the spectral basis in each domain |
| 331 | int* b ; |
| 332 | |
| 333 | // Constructors - Destructor |
| 334 | // ------------------------- |
| 335 | public: |
| 336 | explicit Base_val(int nb_of_domains) ; ///< Standard constructor |
| 337 | Base_val(const Base_val& ) ; ///< Copy constructor |
| 338 | |
| 339 | /// Constructor from a file (see \c sauve(FILE*) ) |
| 340 | explicit Base_val(FILE* ) ; |
| 341 | |
| 342 | ~Base_val() ; ///< Destructor |
| 343 | |
| 344 | |
| 345 | // Mutators / assignment |
| 346 | // --------------------- |
| 347 | public: |
| 348 | void set_base_nondef() ; ///< Sets the spectral bases to \c NONDEF |
| 349 | |
| 350 | /** Sets the expansion basis for \e r (\f$\xi\f$) functions in a |
| 351 | * given domain. |
| 352 | * |
| 353 | * @param l Domain index |
| 354 | * @param base_r type of basis functions in \e r (\f$\xi\f$) |
| 355 | * (e.g. \c R_CHEB_P , etc..., |
| 356 | * see general documentation of class \c Base_val |
| 357 | * for denomination of the various bases). |
| 358 | */ |
| 359 | void set_base_r(int l, int base_r) ; |
| 360 | |
| 361 | /** Sets the expansion basis for \f$\theta\f$ functions in all |
| 362 | * domains. |
| 363 | * |
| 364 | * @param base_t type of basis functions in \f$\theta\f$ |
| 365 | * (e.g. \c T_COS_P , etc..., |
| 366 | * see general documentation of class \c Base_val |
| 367 | * for denomination of the various bases). |
| 368 | */ |
| 369 | void set_base_t(int base_t) ; |
| 370 | |
| 371 | /** Sets the expansion basis for \f$\phi\f$ functions in all |
| 372 | * domains. |
| 373 | * |
| 374 | * @param base_p type of basis functions in \f$\phi\f$ |
| 375 | * (e.g. \c P_COSSIN , etc..., |
| 376 | * see general documentation of class \c Base_val |
| 377 | * for denomination of the various bases). |
| 378 | */ |
| 379 | void set_base_p(int base_p) ; |
| 380 | |
| 381 | void operator=(const Base_val& ) ; ///< Assignment |
| 382 | |
| 383 | // Accessors |
| 384 | // --------- |
| 385 | public: |
| 386 | bool operator==(const Base_val& ) const ; ///< Comparison operator |
| 387 | |
| 388 | /// Returns the code for the expansion basis in domain no. \c l |
| 389 | int get_b(int l) const { |
| 390 | assert( (l>=0) && (l<nzone) ) ; |
| 391 | return b[l] ; |
| 392 | } |
| 393 | |
| 394 | /** Returns the expansion basis for \e r (\f$\xi\f$) functions in the |
| 395 | * domain of index \c l |
| 396 | * (e.g. \c R_CHEB_P , etc..., |
| 397 | * see general documentation of class \c Base_val |
| 398 | * for denomination of the various bases). |
| 399 | */ |
| 400 | int get_base_r(int l) const { |
| 401 | assert( (l>=0) && (l<nzone) ) ; |
| 402 | return b[l] & MSQ_R ; |
| 403 | } ; |
| 404 | |
| 405 | /** Returns the expansion basis for \f$\theta\f$ functions in the |
| 406 | * domain of index \c l |
| 407 | * (e.g. \c T_COS_P , etc..., |
| 408 | * see general documentation of class \c Base_val |
| 409 | * for denomination of the various bases). |
| 410 | */ |
| 411 | int get_base_t(int l) const { |
| 412 | assert( (l>=0) && (l<nzone) ) ; |
| 413 | return b[l] & MSQ_T ; |
| 414 | } ; |
| 415 | |
| 416 | /** Returns the expansion basis for \f$\phi\f$ functions in the |
| 417 | * domain of index \c l |
| 418 | * (e.g. \c P_COSSIN , etc..., |
| 419 | * see general documentation of class \c Base_val |
| 420 | * for denomination of the various bases). |
| 421 | */ |
| 422 | int get_base_p(int l) const { |
| 423 | assert( (l>=0) && (l<nzone) ) ; |
| 424 | return b[l] & MSQ_P ; |
| 425 | } ; |
| 426 | |
| 427 | /** Name of the basis function in \e r (\f$\xi\f$) |
| 428 | * |
| 429 | * @param l [input] domain index |
| 430 | * @param k [input] phi index (for the basis in \e r may depend upon |
| 431 | * the phi index) |
| 432 | * @param j [input] theta index (for the basis in \e r may depend upon |
| 433 | * the theta index) |
| 434 | * @param i [input] r index |
| 435 | * @param basename [output] string containing the name of the basis function; |
| 436 | * this \c char array must have a size of (at least) 8 elements |
| 437 | * and must have been allocated before the call |
| 438 | * to \c name_r . |
| 439 | */ |
| 440 | void name_r(int l, int k, int j, int i, char* basename) const ; |
| 441 | |
| 442 | /** Name of the basis function in \f$\theta\f$ |
| 443 | * |
| 444 | * @param l [input] domain index |
| 445 | * @param k [input] phi index (for the basis in \f$\theta\f$ may depend upon |
| 446 | * the phi index) |
| 447 | * @param j [input] theta index |
| 448 | * @param basename [output] string containing the name of the basis function; |
| 449 | * this \c char array must have a size of (at least) 8 elements |
| 450 | * and must have been allocated before the call |
| 451 | * to \c name_theta . |
| 452 | */ |
| 453 | void name_theta(int l, int k, int j, char* basename) const ; |
| 454 | |
| 455 | /** Name of the basis function in \f$\varphi\f$ |
| 456 | * |
| 457 | * @param l [input] domain index |
| 458 | * @param k [input] phi index |
| 459 | * @param basename [output] string containing the name of the basis function; |
| 460 | * this \c char array must have a size of (at least) 8 elements |
| 461 | * and must have been allocated before the call |
| 462 | * to \c name_phi . |
| 463 | */ |
| 464 | void name_phi(int l, int k, char* basename) const ; |
| 465 | |
| 466 | |
| 467 | /** Values of the theta basis functions at the theta collocation points. |
| 468 | * @param l [input] domain index |
| 469 | * @param nt [input] number of theta collocation points |
| 470 | * (or equivalently number of theta basis functions) in the |
| 471 | * domain of index \c l |
| 472 | * @return resu : \c Tbl 3-D containing the values |
| 473 | * \f$B_i(\theta_j)\f$ of |
| 474 | * the \c nt theta basis functions \f$B_i\f$ at the |
| 475 | * \c nt collocation points |
| 476 | * \f$\theta_j\f$ in the domain of index \c l . The storage convention |
| 477 | * is the following one : \\ |
| 478 | * \c resu(ind_phi,i,j) = \f$B_i(\theta_j)\f$ with \c ind_phi |
| 479 | * being a supplementary dimension in case of a dependence in |
| 480 | * phi of the theta basis : |
| 481 | * for example, if the theta basis is \c T_COS_P (no dependence |
| 482 | * in phi), \c resu.get_dim(2) = 1 and \c ind_phi can take |
| 483 | * only the value 0; if the theta basis is |
| 484 | * \c T_COSSIN_CP , \c resu.get_dim(2) = 2, with |
| 485 | * \c ind_phi = 0 for \e m even and |
| 486 | * \c ind_phi = 1 for \e m odd. |
| 487 | * |
| 488 | */ |
| 489 | const Tbl& theta_functions(int l, int nt) const ; |
| 490 | |
| 491 | /** Values of the phi basis functions at the phi collocation points. |
| 492 | * @param l [input] domain index |
| 493 | * @param np [input] number of phi collocation points |
| 494 | * (or equivalently number of phi basis functions) in the |
| 495 | * domain of index \c l |
| 496 | * @return resu : \c Tbl 2-D containing the values |
| 497 | * \f$B_i(\phi_k)\f$ of |
| 498 | * the \c np phi basis functions \f$B_i\f$ at the \c np |
| 499 | * collocation points |
| 500 | * \f$\phi_k\f$ in the domain of index \c l . The storage convention |
| 501 | * is the following one : \\ |
| 502 | * \c resu(i,k) = \f$B_i(\phi_k)\f$. |
| 503 | * |
| 504 | */ |
| 505 | const Tbl& phi_functions(int l, int np) const ; |
| 506 | |
| 507 | /// Returns the number of domains |
| 508 | int get_nzone() const {return nzone; } ; |
| 509 | |
| 510 | // Manipulation of basis |
| 511 | // ---------------------- |
| 512 | public: |
| 513 | /** |
| 514 | * The basis is transformed as with a \f$\frac{\partial}{\partial \xi}\f$ |
| 515 | * operation. |
| 516 | */ |
| 517 | void dsdx() ; |
| 518 | |
| 519 | /** |
| 520 | * The basis is transformed as with a \f$\frac{1}{\xi}\f$ |
| 521 | * multiplication. |
| 522 | */ |
| 523 | void sx() ; |
| 524 | |
| 525 | /** |
| 526 | * The basis is transformed as with a |
| 527 | * multiplication by \f$\xi\f$. |
| 528 | */ |
| 529 | void mult_x() ; |
| 530 | |
| 531 | /** |
| 532 | * The basis is transformed as with a |
| 533 | * \f$\frac{\partial}{\partial \theta}\f$ operation. |
| 534 | */ |
| 535 | void dsdt() ; |
| 536 | |
| 537 | /** |
| 538 | * The basis is transformed as with a |
| 539 | * \f$\frac{1}{\sin \theta}\f$ multiplication. |
| 540 | */ |
| 541 | void ssint() ; |
| 542 | |
| 543 | /** |
| 544 | * The basis is transformed as with a |
| 545 | * \f$\sin \theta\f$ multiplication. |
| 546 | */ |
| 547 | void mult_sint() ; |
| 548 | |
| 549 | /** |
| 550 | * The basis is transformed as with a |
| 551 | * \f$\cos \theta\f$ multiplication. |
| 552 | */ |
| 553 | void mult_cost() ; |
| 554 | |
| 555 | /** |
| 556 | * The basis is transformed as with a transformation to |
| 557 | * \f$Y^l_m\f$ basis. |
| 558 | */ |
| 559 | void ylm() ; |
| 560 | |
| 561 | /** |
| 562 | * Computes the various quantum numbers and 1d radial base |
| 563 | **/ |
| 564 | void give_quant_numbers (int, int, int, |
| 565 | int&, int&, int&) const ; |
| 566 | |
| 567 | /** |
| 568 | * Returns the highest multipole for a given grid. |
| 569 | * @param mgrid : the \c Mg3d |
| 570 | * @param lz : the domain to consider |
| 571 | * @return the highest multipolar momentum \e l that can be |
| 572 | * described by \c this base on the grid. |
| 573 | */ |
| 574 | int give_lmax(const Mg3d& mgrid, int lz) const ; |
| 575 | |
| 576 | // Outputs |
| 577 | // ------- |
| 578 | public: |
| 579 | void sauve(FILE *) const ; ///< Save in a file |
| 580 | |
| 581 | friend ostream& operator<<(ostream& , const Base_val& ) ; ///< Display |
| 582 | friend Base_val operator*(const Base_val&, const Base_val&) ; |
| 583 | }; |
| 584 | ostream& operator<<(ostream& , const Base_val& ) ; |
| 585 | /** |
| 586 | * \defgroup baseval_m Base_val Mathematics |
| 587 | * \ingroup (spec) |
| 588 | * @{ |
| 589 | */ |
| 590 | |
| 591 | /** |
| 592 | * This operator is used when calling multiplication or division of \c Valeur . |
| 593 | * It returns the appropriate base, taking into account the symmetry of the result. |
| 594 | * The calculation propreties are those of the multiplication of -1 for |
| 595 | * antisymmetry and 1 for symmetry. |
| 596 | * |
| 597 | * Should the product of the \c Base_val not be possible, the result is set to |
| 598 | * \c ETATNONDEF , (state not defined). It would be the case, for example, if |
| 599 | * one and only one of the \c Valeur is given in spherical harmonics. |
| 600 | * |
| 601 | */ |
| 602 | Base_val operator*(const Base_val&, const Base_val&) ; |
| 603 | |
| 604 | /** @}*/ |
| 605 | |
| 606 | } |
| 607 | #endif |