| 1 | /* |
| 2 | * Definition of Lorene classes Grille3d and Mg3d |
| 3 | * |
| 4 | */ |
| 5 | |
| 6 | /* |
| 7 | * Copyright (c) 1999-2000 Jean-Alain Marck |
| 8 | * Copyright (c) 1999-2001 Eric Gourgoulhon |
| 9 | * |
| 10 | * This file is part of LORENE. |
| 11 | * |
| 12 | * LORENE is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * LORENE is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with LORENE; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 | * |
| 26 | */ |
| 27 | |
| 28 | |
| 29 | #ifndef __GRILLES_H_ |
| 30 | #define __GRILLES_H_ |
| 31 | |
| 32 | /* |
| 33 | * $Id: grilles.h,v 1.23 2014/10/13 08:52:35 j_novak Exp $ |
| 34 | * $Log: grilles.h,v $ |
| 35 | * Revision 1.23 2014/10/13 08:52:35 j_novak |
| 36 | * Lorene classes and functions now belong to the namespace Lorene. |
| 37 | * |
| 38 | * Revision 1.22 2014/10/06 15:09:39 j_novak |
| 39 | * Modified #include directives to use c++ syntax. |
| 40 | * |
| 41 | * Revision 1.21 2013/06/05 15:00:26 j_novak |
| 42 | * Suppression of all classes derived from Grille3d. Now Grille3d is no |
| 43 | * longer an abstract class. r-samplings are only one of RARE, FIN or |
| 44 | * UNSURR (FINJAC has been removed). Instead, Mg3d possesses a new member |
| 45 | * colloc_r[nzone] defining the type of collocation points (spectral |
| 46 | * bases) in each domain. |
| 47 | * |
| 48 | * Revision 1.20 2013/01/11 15:44:53 j_novak |
| 49 | * Addition of Legendre bases (part 2). |
| 50 | * |
| 51 | * Revision 1.19 2012/01/17 10:10:15 j_penner |
| 52 | * added a constructor in which the nucleus and outer domain are both of type FIN |
| 53 | * |
| 54 | * Revision 1.18 2008/10/29 08:17:51 jl_cornou |
| 55 | * Standard spectral bases for pseudo vectors added |
| 56 | * |
| 57 | * Revision 1.17 2008/02/18 13:53:37 j_novak |
| 58 | * Removal of special indentation instructions. |
| 59 | * |
| 60 | * Revision 1.16 2007/12/11 15:28:05 jl_cornou |
| 61 | * Jacobi(0,2) polynomials partially implemented |
| 62 | * |
| 63 | * Revision 1.15 2006/05/17 13:17:02 j_novak |
| 64 | * New member g_angu_1dom, the one-domain angular grid associated with the |
| 65 | * current grid. |
| 66 | * |
| 67 | * Revision 1.14 2005/10/25 08:56:34 p_grandclement |
| 68 | * addition of std_spectral_base in the case of odd functions near the origin |
| 69 | * |
| 70 | * Revision 1.13 2005/10/07 08:47:20 j_novak |
| 71 | * Addition of the pointer g_non_axi on a grid, with at least 5 points in the |
| 72 | * theta direction and 4 in the phi one (for tensor rotations). |
| 73 | * |
| 74 | * Revision 1.12 2005/03/25 14:54:04 e_gourgoulhon |
| 75 | * Corrected documentation. |
| 76 | * |
| 77 | * Revision 1.11 2004/07/06 13:36:27 j_novak |
| 78 | * Added methods for desaliased product (operator |) only in r direction. |
| 79 | * |
| 80 | * Revision 1.10 2004/06/22 08:49:56 p_grandclement |
| 81 | * Addition of everything needed for using the logarithmic mapping |
| 82 | * |
| 83 | * Revision 1.9 2004/03/22 13:12:41 j_novak |
| 84 | * Modification of comments to use doxygen instead of doc++ |
| 85 | * |
| 86 | * Revision 1.8 2003/06/20 14:16:57 f_limousin |
| 87 | * Add the operator== to compare two Mg3d |
| 88 | * |
| 89 | * Revision 1.7 2003/06/18 08:45:26 j_novak |
| 90 | * In class Mg3d: added the member get_radial, returning only a radial grid |
| 91 | * For dAlembert solver: the way the coefficients of the operator are defined has been changed. |
| 92 | * |
| 93 | * Revision 1.6 2002/10/16 14:36:29 j_novak |
| 94 | * Reorganization of #include instructions of standard C++, in order to |
| 95 | * use experimental version 3 of gcc. |
| 96 | * |
| 97 | * Revision 1.5 2002/08/13 08:02:45 j_novak |
| 98 | * Handling of spherical vector/tensor components added in the classes |
| 99 | * Mg3d and Tenseur. Minor corrections for the class Metconf. |
| 100 | * |
| 101 | * Revision 1.4 2002/06/17 14:05:16 j_novak |
| 102 | * friend functions are now also declared outside the class definition |
| 103 | * |
| 104 | * Revision 1.3 2001/12/12 09:23:46 e_gourgoulhon |
| 105 | * Parameter compact added to the simplified constructor of class Mg3d |
| 106 | * |
| 107 | * Revision 1.2 2001/12/11 06:47:42 e_gourgoulhon |
| 108 | * Simplified constructor for class Mg3d |
| 109 | * |
| 110 | * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon |
| 111 | * LORENE |
| 112 | * |
| 113 | * Revision 2.10 2001/06/13 14:23:40 eric |
| 114 | * Les fonctions Mg3d::del_deriv() et Mg3d::set_deriv_0x0() ne sont plus |
| 115 | * virtuelles puisque Mg3d n'a aucune classe derivee. |
| 116 | * |
| 117 | * Revision 2.9 2001/05/26 13:24:49 eric |
| 118 | * Ajout du membre g_twice (grille double pour le desaliasing) |
| 119 | * Modif de la declaration de g_angu (pointeur mutable) |
| 120 | * g_twice et g_angu ne sont calcules que si necessaire (cad si |
| 121 | * on appelle la fonction get_twice() ou get_angu()). |
| 122 | * |
| 123 | * Revision 2.8 1999/11/16 14:15:57 eric |
| 124 | * Ajout de la fonction Mg3d::get_angu(). |
| 125 | * |
| 126 | * Revision 2.7 1999/10/12 14:54:11 eric |
| 127 | * Ajout du membre Base_val std_base_scal() const. |
| 128 | * |
| 129 | * Revision 2.6 1999/10/01 10:35:42 eric |
| 130 | * Amelioration des commentaires. |
| 131 | * |
| 132 | * Revision 2.5 1999/09/30 14:58:00 eric |
| 133 | * Operator!= declare const/ |
| 134 | * |
| 135 | * Revision 2.4 1999/09/30 14:11:43 eric |
| 136 | * sauve et std_base_vect_cart declarees const. |
| 137 | * |
| 138 | * Revision 2.3 1999/09/30 12:52:38 eric |
| 139 | * Depoussierage. |
| 140 | * Documentation. |
| 141 | * |
| 142 | * Revision 2.2 1999/09/24 14:23:24 eric |
| 143 | * Declaration de methodes const. |
| 144 | * |
| 145 | * Revision 2.1 1999/09/14 15:24:04 phil |
| 146 | * ajout de std_base_vect_cart |
| 147 | * |
| 148 | * Revision 2.0 1999/02/15 10:41:51 hyc |
| 149 | * *** empty log message *** |
| 150 | * |
| 151 | * Revision 2.1 1999/02/15 09:59:50 hyc |
| 152 | * *** empty log message *** |
| 153 | * |
| 154 | * Revision 2.0 1998/12/01 14:28:00 hyc |
| 155 | * Version 2 |
| 156 | * |
| 157 | * |
| 158 | * $Header: /cvsroot/Lorene/C++/Include/grilles.h,v 1.23 2014/10/13 08:52:35 j_novak Exp $ |
| 159 | * |
| 160 | */ |
| 161 | |
| 162 | // Classes utilisees |
| 163 | |
| 164 | // Fichiers includes |
| 165 | #include <cassert> |
| 166 | #include <cstdio> |
| 167 | #include <cstdlib> |
| 168 | #include "headcpp.h" |
| 169 | |
| 170 | #include "type_parite.h" |
| 171 | |
| 172 | namespace Lorene { |
| 173 | class Base_val ; |
| 174 | |
| 175 | //-------------// |
| 176 | // Mono-grille // |
| 177 | //-------------// |
| 178 | |
| 179 | // Classe de base |
| 180 | /** |
| 181 | * 3D grid class in one domain.\ingroup (spec) |
| 182 | * |
| 183 | * Basic 3D spherical grid class in spherical coordinates \f$(r,\theta,\phi)\f$. |
| 184 | * The radial coordinate \f$\xi\f$ lies in the range [0, 1] or [-1, 1] |
| 185 | * depending upon the sampling (\c RARE or \c FIN ). Its relation with the |
| 186 | * physical radial coordinate \e r is defined by the mapping (cf. class \c Map) |
| 187 | * and is described in Bonazzola, Gourgoulhon \& Marck, \a Phys. \a Rev. \a D |
| 188 | * \b 58, 104020 (1998). |
| 189 | * Note: this monogrid should not be used. Use instead \c Mg3d. |
| 190 | * |
| 191 | * @version #$Id: grilles.h,v 1.23 2014/10/13 08:52:35 j_novak Exp $# |
| 192 | */ |
| 193 | |
| 194 | class Grille3d { |
| 195 | protected: |
| 196 | const int nr ; ///< Number of points in \e r (\f$\xi\f$) |
| 197 | const int nt ; ///< Number of points in \f$\theta\f$ |
| 198 | const int np ; ///< Number of points in \f$\phi\f$ |
| 199 | |
| 200 | ///Type of sampling in \e r (\f$\xi\f$) (\c RARE,\c FIN,\c UNSURR ) |
| 201 | int type_r ; |
| 202 | int type_t ; ///< Type of sampling in \f$\theta\f$ (\c SYM,\c NONSYM) |
| 203 | int type_p ; ///< Type of sampling in \f$\phi\f$ (\c SYM,\c NONSYM) |
| 204 | /// Type of radial spectral basis (\c BASE_CHEB, \c BASE_LEG, BASE_JAC02 ) |
| 205 | int base_r ; |
| 206 | |
| 207 | public: |
| 208 | /// Array of values of \f$\xi\f$ at the \c nr collocation points |
| 209 | double* x ; |
| 210 | /// Array of values of \f$\theta\f$ at the \c nt collocation points |
| 211 | double* tet ; |
| 212 | /// Array of values of \f$\phi\f$ at the \c np collocation points |
| 213 | double* phi ; |
| 214 | |
| 215 | /// Constructor |
| 216 | Grille3d(int n_r, int n_t, int n_p, int typer, int typet, |
| 217 | int typep, int baser) ; |
| 218 | |
| 219 | /// Copy constructor |
| 220 | Grille3d(const Grille3d& ) ; |
| 221 | |
| 222 | /// Assignement operator |
| 223 | void operator=(const Grille3d& ) ; |
| 224 | |
| 225 | public: |
| 226 | virtual ~Grille3d() ; ///< Destructor |
| 227 | |
| 228 | public: |
| 229 | /// Returns \c nr |
| 230 | int get_nr() const {return nr ;} ; |
| 231 | /// Returns \c nt |
| 232 | int get_nt() const {return nt ;} ; |
| 233 | /// Returns \c np |
| 234 | int get_np() const {return np ;} ; |
| 235 | |
| 236 | /// Returns \c type_r |
| 237 | int get_type_r() const {return type_r ;} ; |
| 238 | /// Returns \c type_t |
| 239 | int get_type_t() const {return type_t ;} ; |
| 240 | /// Returns \c type_p |
| 241 | int get_type_p() const {return type_p ;} ; |
| 242 | /// Returns \c base_r |
| 243 | int get_base_r() const {return base_r ;} ; |
| 244 | |
| 245 | protected: |
| 246 | /// Computes the collocation point coordinates in the radial direction |
| 247 | void compute_radial_grid() ; |
| 248 | }; |
| 249 | |
| 250 | |
| 251 | |
| 252 | //---------------// |
| 253 | // Multi-grilles // |
| 254 | //---------------// |
| 255 | |
| 256 | /** |
| 257 | * Multi-domain grid. \ingroup (spec) |
| 258 | * |
| 259 | * A multi-domain grid is a set of 3D grids for the implementation of |
| 260 | * the multi-domain spectral method described in Bonazzola, Gourgoulhon |
| 261 | * \& Marck, \a Phys. \a Rev. \a D \b 58, 104020 (1998). |
| 262 | * Each domain is represented by a 3D mono grid (\c Grille3d) and |
| 263 | * is called a \e zone. |
| 264 | * For each direction, the Number of Degrees of Freedom (NDF) is |
| 265 | * \e a \e priori independent of the zone. However, some methods or |
| 266 | * routines may refuse to work if the NDF of some \f$(\theta, \phi)\f$ |
| 267 | * direction is not identical in all the zones. |
| 268 | * This holds for the type of sampling (symmetry) too. |
| 269 | * |
| 270 | * @version #$Id: grilles.h,v 1.23 2014/10/13 08:52:35 j_novak Exp $# |
| 271 | */ |
| 272 | |
| 273 | class Mg3d { |
| 274 | |
| 275 | // Data |
| 276 | // ---- |
| 277 | protected: |
| 278 | int nzone ; ///< Number of domains (zones) |
| 279 | |
| 280 | int* nr ; ///< Array (size: \c nzone) of nb. of points in \e r (\f$\xi\f$) |
| 281 | int* nt ; ///< Array (size: \c nzone) of nb. of points in \f$\theta\f$ |
| 282 | int* np ; ///< Array (size: \c nzone) of nb. of points in \f$\phi\f$ |
| 283 | |
| 284 | /** Array (size: \c nzone) of type of sampling in \e r (\f$\xi\f$) |
| 285 | *(\c RARE,\c FIN, c UNSURR) |
| 286 | */ |
| 287 | int* type_r ; |
| 288 | |
| 289 | /// Type of sampling in \f$\theta\f$ (\c SYM, \c NONSYM) |
| 290 | int type_t ; |
| 291 | |
| 292 | /// Type of sampling in \f$\phi\f$ (\c SYM, \c NONSYM) |
| 293 | int type_p ; |
| 294 | |
| 295 | /** Array (size: \c nzone) of type of collocation points |
| 296 | * in \e r (\f$\xi\f$) and related decompoisition bases |
| 297 | * (\c BASE_CHEB, \c BASE_LEG, \c BASE_JAC02 ). |
| 298 | */ |
| 299 | int* colloc_r ; |
| 300 | |
| 301 | /// Array (size: \c nzone) of pointers on the \c Grille3d's |
| 302 | Grille3d** g ; |
| 303 | |
| 304 | mutable Mg3d* g_angu ; ///< Pointer on the associated angular grid |
| 305 | ///Pointer on the associated angular grid with only one domain |
| 306 | mutable Mg3d* g_angu_1dom ; |
| 307 | mutable Mg3d* g_radial ; ///< Pointer on the associated radial grid |
| 308 | |
| 309 | /** Pointer on the grid which has twice the number of points in |
| 310 | * each dimension (for desaliasing). |
| 311 | */ |
| 312 | mutable Mg3d* g_twice ; |
| 313 | |
| 314 | /** Pointer on the grid which has 50% more points in |
| 315 | * \e r dimension (for desaliasing). |
| 316 | */ |
| 317 | mutable Mg3d* g_plus_half ; |
| 318 | |
| 319 | /** Pointer on the grid which has at least 4 points in |
| 320 | * the \f$\phi\f$ direction and at least 5 in the \f$\theta\f$ |
| 321 | * direction (for tensor rotations). |
| 322 | */ |
| 323 | mutable Mg3d* g_non_axi ; |
| 324 | |
| 325 | // Constructors - Destructor |
| 326 | // ------------------------- |
| 327 | |
| 328 | public: |
| 329 | |
| 330 | /** |
| 331 | * General constructor. |
| 332 | * |
| 333 | * @param nz [input] Number of domains (zones). |
| 334 | * @param nbr[] [input] Array (size: \c nz ) of number of degree of |
| 335 | * freedom (NDF) in \e r-direction |
| 336 | * @param typr[] [input] Array (size: \c nz ) of type of sampling in \e r -direction |
| 337 | * @param nbt[] [input] Array (size: \c nz ) of NDF in \f$\theta\f$-direction |
| 338 | * @param typt [input] Type of sampling in \f$\theta\f$-direction |
| 339 | * @param nbp[] [input] Array (size: \c nz) of NDF in \f$\phi\f$-direction |
| 340 | * @param typp [input] Type of sampling in \f$\phi\f$-direction |
| 341 | * @param base_r [input] Types of \e r bases in each domain, to define the |
| 342 | * collocation points: \c BASE_CHEB , \c BASE_LEG or |
| 343 | * \c BASE_JAC02. If the pointer is null, BASE_CHEB is set. |
| 344 | * |
| 345 | */ |
| 346 | Mg3d(int nz, int nbr[], int typr[], int nbt[], int typt, int nbp[], |
| 347 | int typp, int* base_r = 0x0) ; |
| 348 | |
| 349 | /** |
| 350 | * Simplified constructor for a standard multi-grid. |
| 351 | * This provides a multi-grid with the same number of degrees of freedom |
| 352 | * in all the domains. \n |
| 353 | * The domain of index \c l = 0 will be a nucleus: |
| 354 | * \f$\xi\in [0,1]\f$, rarefied sampling (type \c RARE) near the origin; \n |
| 355 | * domains of indices \f$ 1 \le {\tt l} \le {\tt nz}-2\f$ will be shells: |
| 356 | * \f$\xi\in [-1,1]\f$, dense sampling (type \c FIN) near -1 and 1; \n |
| 357 | * if \c compact == true, |
| 358 | * the domains of index \c l = \c nz-1 will be the outermost compactified |
| 359 | * shell: |
| 360 | * \f$\xi\in [-1,1]\f$, dense sampling (type \c UNSURR) near -1 and 1 |
| 361 | * for a \e 1/r discretization. |
| 362 | * |
| 363 | * |
| 364 | * @param nz [input] Number of domains (zones). |
| 365 | * @param nbr [input] Number of degree of freedom (NDF) in |
| 366 | * \e r -direction in each domain |
| 367 | * @param nbt [input] Number of degree of freedom (NDF) in |
| 368 | * \f$\theta\f$-direction in each domain |
| 369 | * @param nbp [input] Number of degree of freedom (NDF) in |
| 370 | * \f$\phi\f$-direction in each domain |
| 371 | * @param typt [input] Type of sampling in \f$\theta\f$-direction: \n |
| 372 | * \c SYM for a sampling in \f$[0,\pi/2]\f$ |
| 373 | * (symmetry with respect to the equatorial plane), \n |
| 374 | * \c NONSYM for a sampling in \f$[0,\pi]\f$ |
| 375 | * @param typp [input] Type of sampling in \f$\phi\f$-direction: \n |
| 376 | * \c SYM for a sampling in \f$[0,\pi[\f$ |
| 377 | * (symmetry with respect to a \f$\pi\f$ translation |
| 378 | * in \f$\phi\f$) \n |
| 379 | * \c NONSYM for a sampling in \f$[0,2\pi[\f$ |
| 380 | * @param compact [input] \c true for the last domain to have |
| 381 | * a \e 1/r sampling (\c UNSURR ) instead of a |
| 382 | * \e r sampling (\c FIN ). |
| 383 | * @param legendre [input] \c true if the nucleus and shells have Legendre-type |
| 384 | * collocation points. If \c false, Chebyshev ones shall |
| 385 | * be used. |
| 386 | */ |
| 387 | Mg3d(int nz, int nbr, int nbt, int nbp, int typt, int typp, |
| 388 | bool compact, bool legendre=false) ; |
| 389 | |
| 390 | /** |
| 391 | * Simplified constructor for a standard multi-grid only with shells and Chebyshev. |
| 392 | * This provides a multi-grid with the same number of degrees of freedom |
| 393 | * in all the domains. \n |
| 394 | * ALL DOMAINS ARE TREATED AS SHELLS |
| 395 | * \f$\xi\in [-1,1]\f$, dense sampling (type \c FIN) near -1 and 1; \n and only |
| 396 | * Chebyshev bases are considered. |
| 397 | * |
| 398 | * @param nz [input] Number of domains (zones). |
| 399 | * @param nbr [input] Number of degree of freedom (NDF) in |
| 400 | * \e r -direction in each domain |
| 401 | * @param nbt [input] Number of degree of freedom (NDF) in |
| 402 | * \f$\theta\f$-direction in each domain |
| 403 | * @param nbp [input] Number of degree of freedom (NDF) in |
| 404 | * \f$\phi\f$-direction in each domain |
| 405 | * @param typt [input] Type of sampling in \f$\theta\f$-direction: \n |
| 406 | * \c SYM for a sampling in \f$[0,\pi/2]\f$ |
| 407 | * (symmetry with respect to the equatorial plane), \n |
| 408 | * \c NONSYM for a sampling in \f$[0,\pi]\f$ |
| 409 | * @param typp [input] Type of sampling in \f$\phi\f$-direction: \n |
| 410 | * \c SYM for a sampling in \f$[0,\pi[\f$ |
| 411 | * (symmetry with respect to a \f$\pi\f$ translation |
| 412 | * in \f$\phi\f$) \n |
| 413 | * \c NONSYM for a sampling in \f$[0,2\pi[\f$ |
| 414 | */ |
| 415 | Mg3d(int nz, int nbr, int nbt, int nbp, int typt, int typp) ; |
| 416 | |
| 417 | /**Constructor from a file (see \c sauve(FILE*)). |
| 418 | * If the boolean flag \c read_base is \c false (default) the |
| 419 | * spectral basis is not saved, for compatibility with older |
| 420 | * versions. If it is set to \c true , the basis is saved. |
| 421 | */ |
| 422 | Mg3d(FILE* fd, bool read_base=false) ; |
| 423 | |
| 424 | public: |
| 425 | /** |
| 426 | * Copy constructor (private and not implemented to make \c Mg3d a |
| 427 | * non-copyable class) |
| 428 | */ |
| 429 | Mg3d(const Mg3d& ) ; |
| 430 | |
| 431 | public: |
| 432 | |
| 433 | ~Mg3d() ; ///< Destructor |
| 434 | |
| 435 | // Assignement |
| 436 | // ----------- |
| 437 | private: |
| 438 | /** |
| 439 | * Assignement operator (private and not implemented to make \c Mg3d |
| 440 | * a non-copyable class) |
| 441 | */ |
| 442 | void operator=(const Mg3d& ) ; |
| 443 | |
| 444 | // Extraction of information |
| 445 | // ------------------------- |
| 446 | public: |
| 447 | /// Returns the number of domains |
| 448 | int get_nzone() const { |
| 449 | return nzone ; |
| 450 | } ; |
| 451 | /// Returns the number of points in the radial direction (\f$\xi\f$) in domain no. \e l |
| 452 | int get_nr(int l) const { |
| 453 | assert(l>=0 && l<nzone) ; |
| 454 | return nr[l] ; |
| 455 | } ; |
| 456 | /// Returns the number of points in the co-latitude direction (\f$\theta\f$) in domain no. \e l |
| 457 | int get_nt(int l) const { |
| 458 | assert(l>=0 && l<nzone) ; |
| 459 | return nt[l] ; |
| 460 | } ; |
| 461 | /// Returns the number of points in the azimuthal direction (\f$\phi\f$) in domain no. \e l |
| 462 | int get_np(int l) const { |
| 463 | assert(l>=0 && l<nzone) ; |
| 464 | return np[l] ; |
| 465 | } ; |
| 466 | |
| 467 | /** Returns the type of sampling in the radial direction |
| 468 | * in domain no.\e l : \n |
| 469 | * \c RARE : \f$\xi\in[0,1]\f$ : rarefied at the origin \n |
| 470 | * \c FIN : \f$\xi\in[-1,1]\f$ : dense at the two extremities \n |
| 471 | * \c UNSURR : \f$\xi\in[-1,1]\f$ : dense at the two extremities, |
| 472 | * in view of using \f$u=1/r\f$ as radial variable |
| 473 | */ |
| 474 | int get_type_r(int l) const { |
| 475 | assert(l>=0 && l<nzone) ; |
| 476 | return type_r[l] ; |
| 477 | } ; |
| 478 | |
| 479 | /** Returns the type of sampling in the \f$\theta\f$ direction: \n |
| 480 | * \c SYM : \f$\theta\in[0,\pi/2]\f$ : symmetry with respect to |
| 481 | * the equatorial plane \n |
| 482 | * \c NONSYM : \f$\theta\in[0,\pi]\f$ : no symmetry with respect |
| 483 | * to the equatorial plane |
| 484 | */ |
| 485 | int get_type_t() const { |
| 486 | return type_t ; |
| 487 | } ; |
| 488 | |
| 489 | /** Returns the type of sampling in the \f$\phi\f$ direction: \n |
| 490 | * \c SYM : \f$\phi\in[0,\pi[\f$ : symmetry with respect to the |
| 491 | * transformation \f$ \phi \mapsto \phi + \pi\f$ \n |
| 492 | * \c NONSYM : \f$\phi\in[0,2\pi[\f$ : no symmetry with respect to |
| 493 | * the transformation \f$ \phi \mapsto \phi + \pi\f$ |
| 494 | */ |
| 495 | int get_type_p() const { |
| 496 | return type_p ; |
| 497 | } ; |
| 498 | |
| 499 | /// Returns a pointer on the 3D mono-grid for domain no. l |
| 500 | const Grille3d* get_grille3d(int l) const { |
| 501 | assert(l>=0 && l<nzone) ; |
| 502 | return g[l] ; |
| 503 | } ; |
| 504 | |
| 505 | /** Returns the type of collocation points used in domain no. \e l. |
| 506 | * This type depends on the spectral decomposition basis: |
| 507 | * \li \c BASE_CHEB : Chebyshev basis and collocation points |
| 508 | * \li \c BASE_LEG : Legendre basis and collocation points |
| 509 | * \li \c BASE_JAC02 : Jacobi (0,2) polynomials |
| 510 | */ |
| 511 | int get_colloc_r(int l) const { |
| 512 | assert(l>=0 && l<nzone) ; |
| 513 | return colloc_r[l] ; |
| 514 | } |
| 515 | |
| 516 | /// Returns the pointer on the associated angular grid |
| 517 | const Mg3d* get_angu() const ; |
| 518 | |
| 519 | /** Returns the pointer on the associated mono-domain angular grid. |
| 520 | * This angular grid corresponds to the first domain (index 0). |
| 521 | */ |
| 522 | const Mg3d* get_angu_1dom() const ; |
| 523 | |
| 524 | /// Returns the pointer on the associated radial grid |
| 525 | const Mg3d* get_radial() const ; |
| 526 | |
| 527 | /** Returns the pointer on the grid which has twice the number |
| 528 | * of points in each dimension (for desaliasing). |
| 529 | */ |
| 530 | const Mg3d* get_twice() const ; |
| 531 | |
| 532 | /** Returns the pointer on the grid which has 50% more points in |
| 533 | * \e r dimension (for desaliasing). |
| 534 | */ |
| 535 | const Mg3d* plus_half() const ; |
| 536 | |
| 537 | /** Returns the pointer on the grid which has at least 4 points in |
| 538 | * the \f$\phi\f$ direction and at least 5 in the \f$\theta\f$ |
| 539 | * direction (for tensor rotations). |
| 540 | */ |
| 541 | const Mg3d* get_non_axi() const ; |
| 542 | |
| 543 | /// Comparison operator (egality) |
| 544 | bool operator==(const Mg3d& ) const ; |
| 545 | |
| 546 | |
| 547 | |
| 548 | // Outputs |
| 549 | // ------- |
| 550 | public: |
| 551 | /** Saves into a file. |
| 552 | * By default, if \c save_base is false, the spectral decomposition |
| 553 | * basis \c colloc_r is not saved (for compatibility reasons). |
| 554 | * If \c save_base is \c true, then \c colloc_r is save, too. |
| 555 | * The same value for the flag \c read_base must be given in the |
| 556 | * contructor reading the file. |
| 557 | */ |
| 558 | void sauve(FILE* fd, bool save_base=false) const ; |
| 559 | |
| 560 | friend ostream& operator<<(ostream& , const Mg3d & ) ; ///< Display |
| 561 | |
| 562 | // Management of derived quantities |
| 563 | // -------------------------------- |
| 564 | protected: |
| 565 | /** Deletes all the derived quantities |
| 566 | * (\c g_radial , \c g_angu, \c g_twice, ...) |
| 567 | */ |
| 568 | void del_deriv() const ; |
| 569 | |
| 570 | /** Sets to \c 0x0 all the pointers on derived quantities |
| 571 | * (\c g_radial , \c g_angu, \c g_twice, ... ) |
| 572 | */ |
| 573 | void set_deriv_0x0() const ; |
| 574 | |
| 575 | |
| 576 | // Miscellaneous |
| 577 | // ------------- |
| 578 | public: |
| 579 | bool operator!=(const Mg3d & ) const ; ///< Operator != |
| 580 | |
| 581 | /// Returns the standard spectral bases for a scalar |
| 582 | Base_val std_base_scal() const ; |
| 583 | |
| 584 | /// Returns the standard odd spectral bases for a scalar |
| 585 | Base_val std_base_scal_odd() const ; |
| 586 | |
| 587 | /** Returns the standard spectral bases for the Cartesian components |
| 588 | * of a vector |
| 589 | */ |
| 590 | Base_val** std_base_vect_cart() const ; |
| 591 | |
| 592 | /** Returns the standard spectral bases for the spherical components |
| 593 | * of a vector |
| 594 | */ |
| 595 | Base_val** std_base_vect_spher() const ; |
| 596 | |
| 597 | /** Returns the standard spectral bases for the Cartesian components |
| 598 | * of a pseudo-vector |
| 599 | */ |
| 600 | Base_val** pseudo_base_vect_cart() const ; |
| 601 | |
| 602 | /** Returns the standard spectral bases for the spherical components |
| 603 | * of a pseudo-vector |
| 604 | */ |
| 605 | Base_val** pseudo_base_vect_spher() const ; |
| 606 | |
| 607 | }; |
| 608 | ostream& operator<<(ostream& , const Mg3d & ) ; |
| 609 | |
| 610 | |
| 611 | //====================================== |
| 612 | // One domain standard bases definitions |
| 613 | //====================================== |
| 614 | int std_base_scal_1z(int type_r, int type_t, int type_p) ; |
| 615 | int std_base_scal_odd_1z(int type_r, int type_t, int type_p) ; |
| 616 | int leg_base_scal_1z(int type_r, int type_t, int type_p) ; |
| 617 | int leg_base_scal_odd_1z(int type_r, int type_t, int type_p) ; |
| 618 | int jac02_base_scal_1z(int type_r, int type_t, int type_p) ; |
| 619 | int jac02_base_scal_odd_1z(int type_r, int type_t, int type_p) ; |
| 620 | |
| 621 | } |
| 622 | #endif |