LORENE
scalar.h
1 /*
2  * Definition of Lorene class Scalar
3  *
4  */
5 
6 /*
7  * Copyright (c) 2003-2004 Eric Gourgoulhon & Jerome Novak
8  *
9  * Copyright (c) 1999-2000 Jean-Alain Marck (for previous class Cmp)
10  * Copyright (c) 1999-2002 Eric Gourgoulhon (for previous class Cmp)
11  * Copyright (c) 1999-2001 Philippe Grandclement (for previous class Cmp)
12  * Copyright (c) 2000-2002 Jerome Novak (for previous class Cmp)
13  * Copyright (c) 2000-2001 Keisuke Taniguchi (for previous class Cmp)
14  *
15  * This file is part of LORENE.
16  *
17  * LORENE is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation; either version 2 of the License, or
20  * (at your option) any later version.
21  *
22  * LORENE is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with LORENE; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  *
31  */
32 
33 
34 #ifndef __SCALAR_H_
35 #define __SCALAR_H_
36 
37 
38 /*
39  * $Id: scalar.h,v 1.99 2026/03/04 15:47:04 j_novak Exp $
40  * $Log: scalar.h,v $
41  * Revision 1.99 2026/03/04 15:47:04 j_novak
42  * Added 'verbose' flag (true by default) to limit the output of poisson solvers.
43  *
44  * Revision 1.98 2025/03/31 08:29:50 j_novak
45  * Methods to copyt Tensors and Scalars to smaller grids...
46  *
47  * Revision 1.97 2025/03/28 09:12:50 j_novak
48  * News methods to copy Tensors and Scalars to larger grids. To be used for de-aliasing.
49  *
50  * Revision 1.96 2023/08/31 08:27:26 g_servignat
51  * Added the possibility to filter in the r direction within the ylm filter. An order filtering of 0 means no filtering (for all 3 directions).
52  *
53  * Revision 1.95 2023/08/28 09:53:33 g_servignat
54  * Added ylm filter for Tensor and Scalar in theta + phi directions
55  *
56  * Revision 1.94 2015/12/18 15:52:51 j_novak
57  * New method is_nan() for class Scalar.
58  *
59  * Revision 1.93 2015/09/10 13:28:05 j_novak
60  * New methods for the class Hot_Eos
61  *
62  * Revision 1.92 2014/10/13 08:52:36 j_novak
63  * Lorene classes and functions now belong to the namespace Lorene.
64  *
65  * Revision 1.91 2013/06/05 15:06:10 j_novak
66  * Legendre bases are treated as standard bases, when the multi-grid
67  * (Mg3d) is built with BASE_LEG.
68  *
69  * Revision 1.90 2013/01/11 15:44:54 j_novak
70  * Addition of Legendre bases (part 2).
71  *
72  * Revision 1.89 2012/12/19 13:59:56 j_penner
73  * added a few lines to the documentation for scalar_match_tau function
74  *
75  * Revision 1.88 2012/01/17 15:05:46 j_penner
76  * *** empty log message ***
77  *
78  * Revision 1.87 2012/01/17 10:16:27 j_penner
79  * functions added: sarra_filter_r, sarra_filter_r_all_domains, Heaviside
80  *
81  * Revision 1.86 2011/04/08 13:13:09 e_gourgoulhon
82  * Changed the comment of function val_point to indicate specifically the
83  * division by r^dzpuis in the compactified external domain.
84  *
85  * Revision 1.85 2008/09/29 13:23:51 j_novak
86  * Implementation of the angular mapping associated with an affine
87  * mapping. Things must be improved to take into account the domain index.
88  *
89  * Revision 1.84 2008/09/22 19:08:01 j_novak
90  * New methods to deal with boundary conditions
91  *
92  * Revision 1.83 2008/05/24 15:05:22 j_novak
93  * New method Scalar::match_tau to match the output of an explicit time-marching scheme with the tau method.
94  *
95  * Revision 1.82 2007/12/21 16:06:16 j_novak
96  * Methods to filter Tensor, Vector and Sym_tensor objects.
97  *
98  * Revision 1.81 2007/10/31 10:33:11 j_novak
99  * Added exponential filters to smooth Gibbs-type phenomena.
100  *
101  * Revision 1.80 2007/06/21 19:56:36 k_taniguchi
102  * Introduction of another filtre_r.
103  *
104  * Revision 1.79 2007/05/06 10:48:08 p_grandclement
105  * Modification of a few operators for the vorton project
106  *
107  * Revision 1.78 2007/01/16 15:05:59 n_vasset
108  * New constructor (taking a Scalar in mono-domain angular grid for
109  * boundary) for function sol_elliptic_boundary
110  *
111  * Revision 1.77 2006/05/26 09:00:09 j_novak
112  * New members for multiplication or division by cos(theta).
113  *
114  * Revision 1.76 2005/11/30 13:48:06 e_gourgoulhon
115  * Replaced M_PI/2 by 1.57... in argument list of sol_elliptic_sin_zec
116  * (in order not to require the definition of M_PI).
117  *
118  * Revision 1.75 2005/11/30 11:09:03 p_grandclement
119  * Changes for the Bin_ns_bh project
120  *
121  * Revision 1.74 2005/11/17 15:29:46 e_gourgoulhon
122  * Added arithmetics with Mtbl.
123  *
124  * Revision 1.73 2005/10/25 08:56:34 p_grandclement
125  * addition of std_spectral_base in the case of odd functions near the origin
126  *
127  * Revision 1.72 2005/09/07 13:10:47 j_novak
128  * Added a filter setting to zero all mulitpoles in a given range.
129  *
130  * Revision 1.71 2005/08/26 14:02:38 p_grandclement
131  * Modification of the elliptic solver that matches with an oscillatory exterior solution
132  * small correction in Poisson tau also...
133  *
134  * Revision 1.70 2005/08/25 12:14:07 p_grandclement
135  * Addition of a new method to solve the scalar Poisson equation, based on a multi-domain Tau-method
136  *
137  * Revision 1.69 2005/06/09 07:56:25 f_limousin
138  * Implement a new function sol_elliptic_boundary() and
139  * Vector::poisson_boundary(...) which solve the vectorial poisson
140  * equation (method 6) with an inner boundary condition.
141  *
142  * Revision 1.68 2005/06/08 12:35:18 j_novak
143  * New method for solving divergence-like ODEs.
144  *
145  * Revision 1.67 2005/05/20 14:42:30 j_novak
146  * Added the method Scalar::get_spectral_base().
147  *
148  * Revision 1.66 2005/04/04 21:28:57 e_gourgoulhon
149  * Added argument lambda to method poisson_angu
150  * to deal with the generalized angular Poisson equation:
151  * Lap_ang u + lambda u = source.
152  *
153  * Revision 1.65 2004/12/14 09:09:39 f_limousin
154  * Modif. comments.
155  *
156  * Revision 1.64 2004/11/23 12:41:53 f_limousin
157  * Intoduce function poisson_dir_neu(...) to solve a scalar poisson
158  * equation with a mixed boundary condition (Dirichlet + Neumann).
159  *
160  * Revision 1.63 2004/10/11 15:09:00 j_novak
161  * The radial manipulation functions take Scalar as arguments, instead of Cmp.
162  * Added a conversion operator from Scalar to Cmp.
163  * The Cmp radial manipulation function make conversion to Scalar, call to the
164  * Map_radial version with a Scalar argument and back.
165  *
166  * Revision 1.62 2004/08/24 09:14:40 p_grandclement
167  * Addition of some new operators, like Poisson in 2d... It now requieres the
168  * GSL library to work.
169  *
170  * Also, the way a variable change is stored by a Param_elliptic is changed and
171  * no longer uses Change_var but rather 2 Scalars. The codes using that feature
172  * will requiere some modification. (It should concern only the ones about monopoles)
173  *
174  * Revision 1.61 2004/07/27 08:24:26 j_novak
175  * Modif. comments
176  *
177  * Revision 1.60 2004/07/26 16:02:21 j_novak
178  * Added a flag to specify whether the primitive should be zero either at r=0
179  * or at r going to infinity.
180  *
181  * Revision 1.59 2004/07/06 13:36:27 j_novak
182  * Added methods for desaliased product (operator |) only in r direction.
183  *
184  * Revision 1.58 2004/06/22 08:49:57 p_grandclement
185  * Addition of everything needed for using the logarithmic mapping
186  *
187  * Revision 1.57 2004/06/14 15:24:23 e_gourgoulhon
188  * Added method primr (radial primitive).
189  *
190  * Revision 1.56 2004/06/11 14:29:56 j_novak
191  * Scalar::multipole_spectrum() is now a const method.
192  *
193  * Revision 1.55 2004/05/24 14:07:31 e_gourgoulhon
194  * Method set_domain now includes a call to del_deriv() for safety.
195  *
196  * Revision 1.54 2004/05/07 11:26:10 f_limousin
197  * New method filtre_r(int*)
198  *
199  * Revision 1.53 2004/03/22 13:12:43 j_novak
200  * Modification of comments to use doxygen instead of doc++
201  *
202  * Revision 1.52 2004/03/17 15:58:47 p_grandclement
203  * Slight modification of sol_elliptic_no_zec
204  *
205  * Revision 1.51 2004/03/11 12:07:30 e_gourgoulhon
206  * Added method visu_section_anim.
207  *
208  * Revision 1.50 2004/03/08 15:45:38 j_novak
209  * Modif. comment
210  *
211  * Revision 1.49 2004/03/05 15:09:40 e_gourgoulhon
212  * Added method smooth_decay.
213  *
214  * Revision 1.48 2004/03/01 09:57:02 j_novak
215  * the wave equation is solved with Scalars. It now accepts a grid with a
216  * compactified external domain, which the solver ignores and where it copies
217  * the values of the field from one time-step to the next.
218  *
219  * Revision 1.47 2004/02/27 09:43:58 f_limousin
220  * New methods filtre_phi(int) and filtre_theta(int).
221  *
222  * Revision 1.46 2004/02/26 22:46:26 e_gourgoulhon
223  * Added methods derive_cov, derive_con and derive_lie.
224  *
225  * Revision 1.45 2004/02/21 17:03:49 e_gourgoulhon
226  * -- Method "point" renamed "val_grid_point".
227  * -- Method "set_point" renamed "set_grid_point".
228  *
229  * Revision 1.44 2004/02/19 22:07:35 e_gourgoulhon
230  * Added argument "comment" in method spectral_display.
231  *
232  * Revision 1.43 2004/02/11 09:47:44 p_grandclement
233  * Addition of a new elliptic solver, matching with the homogeneous solution
234  * at the outer shell and not solving in the external domain (more details
235  * coming soon ; check your local Lorene dealer...)
236  *
237  * Revision 1.42 2004/01/28 16:46:22 p_grandclement
238  * Addition of the sol_elliptic_fixe_der_zero stuff
239  *
240  * Revision 1.41 2004/01/28 13:25:40 j_novak
241  * The ced_mult_r arguments have been suppressed from the Scalar::*dsd* methods.
242  * In the div/mult _r_dzpuis, there is no more default value.
243  *
244  * Revision 1.40 2004/01/28 10:39:17 j_novak
245  * Comments modified.
246  *
247  * Revision 1.39 2004/01/27 15:10:01 j_novak
248  * New methods Scalar::div_r_dzpuis(int) and Scalar_mult_r_dzpuis(int)
249  * which replace div_r_inc*. Tried to clean the dzpuis handling.
250  * WARNING: no testing at this point!!
251  *
252  * Revision 1.38 2004/01/23 13:25:44 e_gourgoulhon
253  * Added methods set_inner_boundary and set_outer_boundary.
254  * Methods set_val_inf and set_val_hor, which are particular cases of
255  * the above, have been suppressed.
256  *
257  * Revision 1.37 2004/01/22 16:10:09 e_gourgoulhon
258  * Added (provisory) method div_r_inc().
259  *
260  * Revision 1.36 2003/12/16 06:32:20 e_gourgoulhon
261  * Added method visu_box.
262  *
263  * Revision 1.35 2003/12/14 21:46:35 e_gourgoulhon
264  * Added argument start_dx in visu_section.
265  *
266  * Revision 1.34 2003/12/11 16:19:38 e_gourgoulhon
267  * Added method visu_section for visualization with OpenDX.
268  *
269  * Revision 1.33 2003/12/11 14:48:47 p_grandclement
270  * Addition of ALL (and that is a lot !) the files needed for the general elliptic solver ... UNDER DEVELOPEMENT...
271  *
272  * Revision 1.32 2003/11/13 13:43:53 p_grandclement
273  * Addition of things needed for Bhole::update_metric (const Etoile_bin&, double, double)
274  *
275  * Revision 1.31 2003/11/06 14:43:37 e_gourgoulhon
276  * Gave a name to const arguments in certain method prototypes (e.g.
277  * constructors) to correct a bug of DOC++.
278  *
279  * Revision 1.30 2003/11/04 22:55:50 e_gourgoulhon
280  * Added new methods mult_cost(), mult_sint() and div_sint().
281  *
282  * Revision 1.29 2003/10/29 13:09:11 e_gourgoulhon
283  * -- Added integer argument to derivative functions dsdr, etc...
284  * so that one can choose the dzpuis of the result (default=2).
285  * -- Change of method name: laplacien --> laplacian.
286  *
287  * Revision 1.28 2003/10/29 11:00:42 e_gourgoulhon
288  * Virtual functions dec_dzpuis and inc_dzpuis have now an integer argument to
289  * specify by which amount dzpuis is to be increased.
290  * Accordingly virtual methods dec2_dzpuis and inc2_dzpuis have been suppressed.
291  *
292  * Revision 1.27 2003/10/20 14:26:02 j_novak
293  * New assignement operators.
294  *
295  * Revision 1.26 2003/10/19 19:46:33 e_gourgoulhon
296  * -- Method spectral_display now virtual (from Tensor), list of argument
297  * changed.
298  *
299  * Revision 1.25 2003/10/17 13:46:14 j_novak
300  * The argument is now between 1 and 3 (instead of 0->2)
301  *
302  * Revision 1.24 2003/10/16 15:23:41 e_gourgoulhon
303  * Name of method div_r_ced() changed to div_r_inc2().
304  * Name of method div_rsint_ced() changed to div_rsint_inc2().
305  *
306  * Revision 1.23 2003/10/15 21:10:11 e_gourgoulhon
307  * Added method poisson_angu().
308  *
309  * Revision 1.22 2003/10/15 16:03:35 j_novak
310  * Added the angular Laplace operator for Scalar.
311  *
312  * Revision 1.21 2003/10/15 10:29:05 e_gourgoulhon
313  * Added new members p_dsdt and p_stdsdp.
314  * Added new methods dsdt(), stdsdp() and div_tant().
315  *
316  * Revision 1.20 2003/10/13 13:52:39 j_novak
317  * Better managment of derived quantities.
318  *
319  * Revision 1.19 2003/10/10 15:57:27 j_novak
320  * Added the state one (ETATUN) to the class Scalar
321  *
322  * Revision 1.18 2003/10/08 14:24:08 j_novak
323  * replaced mult_r_zec with mult_r_ced
324  *
325  * Revision 1.17 2003/10/06 16:16:02 j_novak
326  * New constructor from a Tensor.
327  *
328  * Revision 1.16 2003/10/06 13:58:45 j_novak
329  * The memory management has been improved.
330  * Implementation of the covariant derivative with respect to the exact Tensor
331  * type.
332  *
333  * Revision 1.15 2003/10/05 21:06:31 e_gourgoulhon
334  * - Added new methods div_r_ced() and div_rsint_ced().
335  * - Added new virtual method std_spectral_base()
336  * - Removed method std_spectral_base_scal()
337  *
338  * Revision 1.14 2003/10/01 13:02:58 e_gourgoulhon
339  * Suppressed the constructor from Map* .
340  *
341  * Revision 1.13 2003/09/29 12:52:56 j_novak
342  * Methods for changing the triad are implemented.
343  *
344  * Revision 1.12 2003/09/25 09:33:36 j_novak
345  * Added methods for integral calculation and various manipulations
346  *
347  * Revision 1.11 2003/09/25 09:11:21 e_gourgoulhon
348  * Added functions for radial operations (divr, etc...)
349  *
350  * Revision 1.10 2003/09/25 08:55:23 e_gourgoulhon
351  * Added members raccord*.
352  *
353  * Revision 1.9 2003/09/25 08:50:11 j_novak
354  * Added the members import
355  *
356  * Revision 1.8 2003/09/25 08:13:51 j_novak
357  * Added method for calculating derivatives
358  *
359  * Revision 1.7 2003/09/25 07:59:26 e_gourgoulhon
360  * Added prototypes for PDE resolutions.
361  *
362  * Revision 1.6 2003/09/25 07:17:58 j_novak
363  * Method asymptot implemented.
364  *
365  * Revision 1.5 2003/09/24 20:53:38 e_gourgoulhon
366  * Added -- constructor by conversion from a Cmp
367  * -- assignment from Cmp
368  *
369  * Revision 1.4 2003/09/24 15:10:54 j_novak
370  * Suppression of the etat flag in class Tensor (still present in Scalar)
371  *
372  * Revision 1.3 2003/09/24 12:01:44 j_novak
373  * Added friend functions for math.
374  *
375  * Revision 1.2 2003/09/24 10:22:01 e_gourgoulhon
376  * still in progress...
377  *
378  * Revision 1.1 2003/09/22 12:50:47 e_gourgoulhon
379  * First version: not ready yet!
380  *
381  *
382  * $Header: /cvsroot/Lorene/C++/Include/scalar.h,v 1.99 2026/03/04 15:47:04 j_novak Exp $
383  *
384  */
385 
386 // Headers Lorene
387 #include "valeur.h"
388 #include "tensor.h"
389 
390 namespace Lorene {
391 class Param ;
392 class Cmp ;
393 class Param_elliptic ;
394 
402 class Scalar : public Tensor {
403 
404  // Data :
405  // -----
406  protected:
407 
411  int etat ;
412 
418  int dzpuis ;
419 
421 
422  // Derived data :
423  // ------------
424  protected:
426  mutable Scalar* p_dsdr ;
427 
431  mutable Scalar* p_srdsdt ;
432 
436  mutable Scalar* p_srstdsdp ;
437 
439  mutable Scalar* p_dsdt ;
440 
444  mutable Scalar* p_stdsdp ;
445 
449  mutable Scalar* p_dsdx ;
450 
454  mutable Scalar* p_dsdy ;
455 
459  mutable Scalar* p_dsdz ;
460 
463  mutable Scalar* p_lap ;
464 
467  mutable Scalar* p_lapang ;
468 
470  mutable Scalar* p_dsdradial ;
471 
473  mutable Scalar* p_dsdrho ;
474 
478  mutable int ind_lap ;
479 
483  mutable Tbl* p_integ ;
484 
485  // Constructors - Destructor
486  // -------------------------
487 
488  public:
489 
490  explicit Scalar(const Map& mpi) ;
491 
493  Scalar(const Tensor& a) ;
494 
495  Scalar(const Scalar& a) ;
496 
497  Scalar(const Cmp& a) ;
498 
500  Scalar(const Map&, const Mg3d&, FILE* ) ;
501 
502  virtual ~Scalar() ;
503 
504 
505  // Memory management
506  // -----------------
507  protected:
508  void del_t() ;
509  virtual void del_deriv() const;
510  void set_der_0x0() const;
511 
512  public:
513 
519  virtual void set_etat_nondef() ;
520 
526  virtual void set_etat_zero() ;
527 
534  virtual void set_etat_qcq() ;
535 
541  void set_etat_one() ;
542 
551  virtual void allocate_all() ;
552 
561  void annule_hard() ;
562 
563  // Extraction of information
564  // -------------------------
565  public:
569  int get_etat() const {return etat;} ;
570 
572  int get_dzpuis() const {return dzpuis;} ;
573 
577  bool dz_nonzero() const ;
578 
583  bool check_dzpuis(int dzi) const ;
584 
590  bool is_nan(bool verbose=false) const ;
591 
592  // Assignment
593  // -----------
594  public:
596  void operator=(const Scalar& a) ;
597 
599  virtual void operator=(const Tensor& a) ;
600 
601  void operator=(const Cmp& a) ;
602  void operator=(const Valeur& a) ;
603  void operator=(const Mtbl& a) ;
604  void operator=(double ) ;
605  void operator=(int ) ;
606 
607  // Conversion oprators
608  //---------------------
609  operator Cmp() const ;
610 
611  // Access to individual elements
612  // -----------------------------
613  public:
614 
616  const Valeur& get_spectral_va() const {return va;} ;
617 
619  Valeur& set_spectral_va() {return va;} ;
620 
630  Tbl& set_domain(int l) {
631  assert(etat == ETATQCQ) ;
632  del_deriv() ;
633  return va.set(l) ;
634  };
635 
640  const Tbl& domain(int l) const {
641  assert( (etat == ETATQCQ) || (etat == ETATUN) ) ;
642  return va(l) ;
643  };
644 
645 
652  double val_grid_point(int l, int k, int j, int i) const {
653  assert(etat != ETATNONDEF) ;
654  if (etat == ETATZERO) {
655  double zero = 0. ;
656  return zero ;
657  }
658  else {
659  if (etat == ETATUN) {
660  double one = 1. ;
661  return one ;
662  }
663  else{
664  return va(l, k, j, i) ;
665  }
666  }
667  };
668 
683  double val_point(double r, double theta, double phi) const ;
684 
685 
699  double& set_grid_point(int l, int k, int j, int i) {
700  assert(etat == ETATQCQ) ;
701  return va.set(l, k, j, i) ;
702  };
703 
704 
715  virtual void annule(int l_min, int l_max) ;
716 
722  void set_inner_boundary(int l, double x) ;
723 
729  void set_outer_boundary(int l, double x) ;
730 
739  Tbl multipole_spectrum () const ;
740 
747  Tbl tbl_out_bound(int l_dom, bool leave_ylm = false) ;
748 
755  Tbl tbl_in_bound(int n, bool leave_ylm = false) ;
756 
763  Scalar scalar_out_bound(int n, bool leave_ylm = false) ;
764 
765  // Differential operators and others
766  // ---------------------------------
767  public:
772  const Scalar& dsdr() const ;
773 
778  const Scalar& srdsdt() const ;
779 
784  const Scalar& srstdsdp() const ;
785 
788  const Scalar& dsdt() const ;
789 
797  const Scalar& dsdradial() const ;
798 
803  const Scalar& dsdrho() const ;
804 
807  const Scalar& stdsdp() const ;
808 
814  const Scalar& dsdx() const ;
815 
821  const Scalar& dsdy() const ;
822 
828  const Scalar& dsdz() const ;
829 
836  const Scalar& deriv(int i) const ;
837 
842  const Vector& derive_cov(const Metric& gam) const ;
843 
844 
850  const Vector& derive_con(const Metric& gam) const ;
851 
853  Scalar derive_lie(const Vector& v) const ;
854 
855 
864  const Scalar& laplacian(int ced_mult_r = 4) const ;
865 
873  const Scalar& lapang() const ;
874 
876  void div_r() ;
877 
882  void div_r_dzpuis(int ced_mult_r) ;
883 
887  void div_r_ced() ;
888 
890  void mult_r() ;
891 
896  void mult_r_dzpuis(int ced_mult_r) ;
897 
901  void mult_r_ced() ;
902 
904  void mult_rsint() ;
905 
910  void mult_rsint_dzpuis(int ced_mult_r) ;
911 
913  void div_rsint() ;
914 
919  void div_rsint_dzpuis(int ced_mult_r) ;
920 
921  void mult_cost() ;
922 
923  void div_cost() ;
924 
925  void mult_sint() ;
926 
927  void div_sint() ;
928 
929  void div_tant() ;
930 
941  Scalar primr(bool null_infty = true) const ;
942 
950  double integrale() const ;
951 
961  const Tbl& integrale_domains() const ;
962 
967  virtual void dec_dzpuis(int dec = 1) ;
968 
973  virtual void inc_dzpuis(int inc = 1) ;
974 
978  virtual void change_triad(const Base_vect& new_triad) ;
979 
980 
981  // Filters and de-aliasing tools
982  //---------------------------------
987  void filtre (int n) ;
988 
993  void filtre_r (int* nn) ;
994 
998  void filtre_r (int n, int nzone) ;
999 
1010 // virtual void exponential_filter_r(int lzmin, int lzmax, int p,
1011 // double alpha= -16.) ;
1012  virtual void exponential_filter_r(int lzmin, int lzmax, int p,
1013  double alpha= -16.) ;
1014 
1025  void sarra_filter_r(int lzmin, int lzmax, double p,
1026  double alpha= -1E-16) ;
1027 
1033  void exp_filter_r_all_domains(Scalar &ss, int p, double alpha=-16.) ;
1034 
1041  void sarra_filter_r_all_domains(double p, double alpha=1E-16) ;
1042 
1050  virtual void exponential_filter_ylm(int lzmin, int lzmax, int p,
1051  double alpha= -16.) ;
1052 
1060  virtual void exponential_filter_ylm_phi(int lzmin, int lzmax, int p_r, int p_tet, int p_phi,
1061  double alpha= -16.) ;
1062 
1070  void annule_l (int l_min, int l_max, bool ylm_output= false ) ;
1071 
1076  void filtre_phi (int n, int zone) ;
1077 
1082  void filtre_tp(int nn, int nz1, int nz2) ;
1083 
1092  void copy_coefs_from_small_grid(const Scalar& scal_small_grid) ;
1093 
1102  void copy_coefs_from_large_grid(const Scalar& scal_large_grid) ;
1103 
1109  void fixe_decroissance (int puis) ;
1110 
1116  void smooth_decay(int k, int n) ;
1117 
1122  void raccord(int n) ;
1123 
1130  void raccord_c1_zec(int puis, int nbre, int lmax) ;
1131 
1135  void raccord_externe(int puis, int nbre, int lmax) ;
1136 
1153  void match_tau(Param& par_bc, Param* par_mat=0x0) ;
1154 
1171  void match_tau_star(Param& par_bc, Param* par_mat=0x0) ;
1172 
1181  void match_tau_shell(Param& par_bc, Param* par_mat=0x0) ;
1182 
1191  void match_collocation(Param& par_bc, Param* par_mat=0x0) ;
1192 
1193  // Outputs
1194  // -------
1195  public:
1196  virtual void sauve(FILE *) const ;
1197 
1208  virtual void spectral_display(const char* comment = 0x0,
1209  double threshold = 1.e-7, int precision = 4,
1210  ostream& ostr = cout) const ;
1211 
1213  friend ostream& operator<<(ostream& , const Scalar & ) ;
1214 
1238  void visu_section(const char section_type, double aa, double umin, double umax, double vmin,
1239  double vmax, const char* title = 0x0, const char* filename = 0x0,
1240  bool start_dx = true, int nu = 200, int nv = 200) const ;
1241 
1270  void visu_section(const Tbl& plane, double umin, double umax, double vmin,
1271  double vmax, const char* title = 0x0, const char* filename = 0x0,
1272  bool start_dx = true, int nu = 200, int nv = 200) const ;
1273 
1302  void visu_section_anim(const char section_type, double aa, double umin,
1303  double umax, double vmin, double vmax, int jtime, double ttime,
1304  int jgraph = 1, const char* title = 0x0, const char* filename_root = 0x0,
1305  bool start_dx = false, int nu = 200, int nv = 200) const ;
1306 
1328  void visu_box(double xmin, double xmax, double ymin, double ymax,
1329  double zmin, double zmax, const char* title0 = 0x0,
1330  const char* filename0 = 0x0, bool start_dx = true, int nx = 40, int ny = 40,
1331  int nz = 40) const ;
1332 
1333 
1334 
1335  // Member arithmetics
1336  // ------------------
1337  public:
1338  void operator+=(const Scalar &) ;
1339  void operator-=(const Scalar &) ;
1340  void operator*=(const Scalar &) ;
1341 
1342  // Manipulation of spectral bases
1343  // ------------------------------
1347  virtual void std_spectral_base() ;
1348 
1352  virtual void std_spectral_base_odd() ;
1353 
1356  void set_spectral_base(const Base_val& ) ;
1357 
1359  const Base_val& get_spectral_base( ) const {return va.base ;} ;
1360 
1366  void set_dzpuis(int ) ;
1367 
1383  Valeur** asymptot(int n, const int flag = 0) const ;
1384 
1385 
1386  // PDE resolution
1387  // --------------
1388  public:
1398  Scalar poisson() const ;
1399 
1413  void poisson(Param& par, Scalar& uu, bool verbose=true) const ;
1414 
1424  Scalar poisson_tau() const ;
1425 
1436  void poisson_tau(Param& par, Scalar& uu) const ;
1437 
1452  Scalar poisson_dirichlet (const Valeur& limite, int num) const ;
1453 
1458  Scalar poisson_neumann (const Valeur&, int) const ;
1459 
1460 
1479  Scalar poisson_dir_neu (const Valeur& limite , int num,
1480  double fact_dir, double fact_neu) const ;
1481 
1488  Scalar poisson_frontiere_double (const Valeur&, const Valeur&, int) const ;
1489 
1514  void poisson_regular(int k_div, int nzet, double unsgam1, Param& par,
1515  Scalar& uu, Scalar& uu_regu, Scalar& uu_div,
1516  Tensor& duu_div,
1517  Scalar& source_regu, Scalar& source_div) const ;
1518 
1553  Tbl test_poisson(const Scalar& uu, ostream& ostr,
1554  bool detail = false) const ;
1555 
1569  Scalar poisson_angu(double lambda =0) const ;
1570 
1603  Scalar avance_dalembert(Param& par, const Scalar& fJm1, const Scalar& source)
1604  const ;
1605 
1610  Scalar sol_elliptic(Param_elliptic& params) const ;
1611 
1621  Scalar sol_elliptic_boundary(Param_elliptic& params, const Mtbl_cf& bound,
1622  double fact_dir, double fact_neu) const ;
1623 
1628  Scalar sol_elliptic_boundary(Param_elliptic& params, const Scalar& bound,
1629  double fact_dir, double fact_neu) const ;
1630 
1631 
1639 
1645 
1653  Scalar sol_elliptic_no_zec(Param_elliptic& params, double val = 0) const ;
1654 
1661  Scalar sol_elliptic_only_zec(Param_elliptic& params, double val) const ;
1662 
1672  Scalar sol_elliptic_sin_zec(Param_elliptic& params, double* coefs, double* phases) const ;
1673 
1674 
1682  Scalar sol_elliptic_fixe_der_zero(double val,
1683  Param_elliptic& params) const ;
1684 
1685 
1696  Scalar sol_divergence(int n) const ;
1697 
1698  // Import from other mapping
1699  // -------------------------
1700 
1706  void import(const Scalar& ci) ;
1707 
1714  void import_symy(const Scalar& ci) ;
1715 
1723  void import_asymy(const Scalar& ci) ;
1724 
1736  void import(int nzet, const Scalar& ci) ;
1737 
1750  void import_symy(int nzet, const Scalar& ci) ;
1751 
1765  void import_asymy(int nzet, const Scalar& ci) ;
1766 
1767  protected:
1781  void import_gal(int nzet, const Scalar& ci) ;
1782 
1796  void import_align(int nzet, const Scalar& ci) ;
1797 
1812  void import_anti(int nzet, const Scalar& ci) ;
1813 
1828  void import_align_symy(int nzet, const Scalar& ci) ;
1829 
1845  void import_anti_symy(int nzet, const Scalar& ci) ;
1846 
1862  void import_align_asymy(int nzet, const Scalar& ci) ;
1863 
1880  void import_anti_asymy(int nzet, const Scalar& ci) ;
1881 
1882 
1883  friend Scalar operator-(const Scalar& ) ;
1884  friend Scalar operator+(const Scalar&, const Scalar &) ;
1885  friend Scalar operator+(const Scalar&, const Mtbl&) ;
1886  friend Scalar operator+(const Scalar&, double ) ;
1887  friend Scalar operator-(const Scalar &, const Scalar &) ;
1888  friend Scalar operator-(const Scalar&, const Mtbl&) ;
1889  friend Scalar operator-(const Scalar&, double ) ;
1890  friend Scalar operator*(const Scalar &, const Scalar &) ;
1891  friend Scalar operator%(const Scalar &, const Scalar &) ;
1892  friend Scalar operator|(const Scalar &, const Scalar &) ;
1893  friend Scalar operator*(const Mtbl&, const Scalar &) ;
1894  friend Scalar operator*(double, const Scalar &) ;
1895  friend Scalar operator/(const Scalar &, const Scalar &) ;
1896  friend Scalar operator/(const Scalar &, const Mtbl &) ;
1897  friend Scalar operator/(const Mtbl &, const Scalar &) ;
1898  friend Scalar operator/(const Scalar&, double ) ;
1899  friend Scalar operator/(double, const Scalar &) ;
1900 
1901  friend Scalar sin(const Scalar& ) ;
1902  friend Scalar cos(const Scalar& ) ;
1903  friend Scalar tan(const Scalar& ) ;
1904  friend Scalar asin(const Scalar& ) ;
1905  friend Scalar acos(const Scalar& ) ;
1906  friend Scalar atan(const Scalar& ) ;
1907  friend Scalar exp(const Scalar& ) ;
1908  friend Scalar Heaviside(const Scalar& ) ;
1909  friend Scalar log(const Scalar& ) ;
1910  friend Scalar log10(const Scalar& ) ;
1911  friend Scalar sqrt(const Scalar& ) ;
1912  friend Scalar racine_cubique (const Scalar& ) ;
1913  friend Scalar pow(const Scalar& , int ) ;
1914  friend Scalar pow(const Scalar& , double ) ;
1915  friend Scalar abs(const Scalar& ) ;
1916 
1917  friend double totalmax(const Scalar& ) ;
1918  friend double totalmin(const Scalar& ) ;
1919  friend Tbl max(const Scalar& ) ;
1920  friend Tbl min(const Scalar& ) ;
1921  friend Tbl norme(const Scalar& ) ;
1922  friend Tbl diffrel(const Scalar& a, const Scalar& b) ;
1923  friend Tbl diffrelmax(const Scalar& a, const Scalar& b) ;
1924 
1925 };
1926 
1927 ostream& operator<<(ostream& , const Scalar & ) ;
1928 
1929 // Prototypage de l'arithmetique
1936 Scalar operator+(const Scalar& ) ;
1937 Scalar operator-(const Scalar& ) ;
1938 Scalar operator+(const Scalar&, const Scalar &) ;
1939 Scalar operator+(const Scalar&, const Mtbl&) ;
1940 Scalar operator+(const Mtbl&, const Scalar&) ;
1941 Scalar operator+(const Scalar&, double ) ;
1942 Scalar operator+(double, const Scalar& ) ;
1943 Scalar operator+(const Scalar&, int ) ;
1944 Scalar operator+(int, const Scalar& ) ;
1945 Scalar operator-(const Scalar &, const Scalar &) ;
1946 Scalar operator-(const Scalar&, const Mtbl&) ;
1947 Scalar operator-(const Mtbl&, const Scalar&) ;
1948 Scalar operator-(const Scalar&, double ) ;
1949 Scalar operator-(double, const Scalar& ) ;
1950 Scalar operator-(const Scalar&, int ) ;
1951 Scalar operator-(int, const Scalar& ) ;
1952 Scalar operator*(const Scalar &, const Scalar &) ;
1953 
1955 Scalar operator%(const Scalar &, const Scalar &) ;
1956 
1958 Scalar operator|(const Scalar &, const Scalar &) ;
1959 
1960 Scalar operator*(const Mtbl&, const Scalar&) ;
1961 Scalar operator*(const Scalar&, const Mtbl&) ;
1962 
1963 Scalar operator*(const Scalar&, double ) ;
1964 Scalar operator*(double, const Scalar &) ;
1965 Scalar operator*(const Scalar&, int ) ;
1966 Scalar operator*(int, const Scalar& ) ;
1967 Scalar operator/(const Scalar &, const Scalar &) ;
1968 Scalar operator/(const Scalar&, double ) ;
1969 Scalar operator/(double, const Scalar &) ;
1970 Scalar operator/(const Scalar&, int ) ;
1971 Scalar operator/(int, const Scalar &) ;
1972 Scalar operator/(const Scalar &, const Mtbl&) ;
1973 Scalar operator/(const Mtbl&, const Scalar &) ;
1974 
1975 
1976 Scalar sin(const Scalar& ) ;
1977 Scalar cos(const Scalar& ) ;
1978 Scalar tan(const Scalar& ) ;
1979 Scalar asin(const Scalar& ) ;
1980 Scalar acos(const Scalar& ) ;
1981 Scalar atan(const Scalar& ) ;
1982 Scalar exp(const Scalar& ) ;
1983 Scalar Heaviside(const Scalar& ) ;
1984 Scalar log(const Scalar& ) ;
1985 Scalar log10(const Scalar& ) ;
1986 Scalar sqrt(const Scalar& ) ;
1987 Scalar racine_cubique (const Scalar& ) ;
1988 Scalar pow(const Scalar& , int ) ;
1989 Scalar pow(const Scalar& , double ) ;
1990 Scalar abs(const Scalar& ) ;
1991 
1997 double totalmax(const Scalar& ) ;
1998 
2004 double totalmin(const Scalar& ) ;
2005 
2011 Tbl max(const Scalar& ) ;
2012 
2018 Tbl min(const Scalar& ) ;
2019 
2026 Tbl norme(const Scalar& ) ;
2027 
2036 Tbl diffrel(const Scalar& a, const Scalar& b) ;
2037 
2046 Tbl diffrelmax(const Scalar& a, const Scalar& b) ;
2047 
2052 void exp_filter_ylm_all_domains(Scalar& ss, int p, double alpha=-16.) ;
2053 
2058 void exp_filter_ylm_all_domains(Scalar& ss, int p_tet, int p_phi, double alpha=-16.) ;
2059 
2061 }
2062 #endif
const Base_val & get_spectral_base() const
Returns the spectral bases of the Valeur va.
Definition: scalar.h:1359
Scalar * p_srdsdt
Pointer on of *this (0x0 if not up to date)
Definition: scalar.h:431
void annule_l(int l_min, int l_max, bool ylm_output=false)
Sets all the multipolar components between l_min and l_max to zero.
Definition: scalar_manip.C:123
Metric for tensor calculation.
Definition: metric.h:90
Scalar * p_srstdsdp
Pointer on of *this (0x0 if not up to date)
Definition: scalar.h:436
Cmp log(const Cmp &)
Neperian logarithm.
Definition: cmp_math.C:299
Scalar poisson_dir_neu(const Valeur &limite, int num, double fact_dir, double fact_neu) const
Is identicall to Scalar::poisson() .
Cmp asin(const Cmp &)
Arcsine.
Definition: cmp_math.C:147
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:449
Cmp exp(const Cmp &)
Exponential.
Definition: cmp_math.C:273
void filtre_r(int *nn)
Sets the n lasts coefficients in r to 0 in all domains.
Definition: scalar_manip.C:192
Scalar poisson_frontiere_double(const Valeur &, const Valeur &, int) const
Idem as Scalar::poisson_dirichlet , the boundary condition being on both the function and its radial ...
const Scalar & dsdradial() const
Returns of *this if the mapping is affine (class Map_af) and of *this if the mapping is logarithmic...
Definition: scalar_deriv.C:490
void mult_r()
Multiplication by r everywhere; dzpuis is not changed.
void copy_coefs_from_small_grid(const Scalar &scal_small_grid)
Copies the content of the argument Scalar to this defined on a larger grid, with similar mappings...
Definition: scalar_manip.C:505
const Scalar & lapang() const
Returns the angular Laplacian of *this , where .
Definition: scalar_deriv.C:460
Cmp sqrt(const Cmp &)
Square root.
Definition: cmp_math.C:223
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: scalar.C:330
void set_der_0x0() const
Sets the pointers for derivatives to 0x0.
Definition: scalar.C:312
virtual void annule(int l_min, int l_max)
Sets the Scalar to zero in several domains.
Definition: scalar.C:397
Multi-domain array.
Definition: mtbl.h:118
const Tbl & domain(int l) const
Read-only of the value in a given domain.
Definition: scalar.h:640
friend Scalar exp(const Scalar &)
Exponential.
Definition: scalar_math.C:326
friend double totalmax(const Scalar &)
Maximum values of a Scalar in each domain.
Definition: scalar_math.C:556
Scalar(const Map &mpi)
Constructor from mapping.
Definition: scalar.C:210
Lorene prototypes.
Definition: app_hor.h:67
void div_cost()
Division by .
void visu_section_anim(const char section_type, double aa, double umin, double umax, double vmin, double vmax, int jtime, double ttime, int jgraph=1, const char *title=0x0, const char *filename_root=0x0, bool start_dx=false, int nu=200, int nv=200) const
3D visualization via time evolving plane section (animation).
Definition: scalar_visu.C:538
const Scalar & dsdt() const
Returns of *this .
Definition: scalar_deriv.C:207
const Scalar & laplacian(int ced_mult_r=4) const
Returns the Laplacian of *this.
Definition: scalar_deriv.C:435
Cmp racine_cubique(const Cmp &)
Cube root.
Definition: cmp_math.C:248
void visu_box(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, const char *title0=0x0, const char *filename0=0x0, bool start_dx=true, int nx=40, int ny=40, int nz=40) const
3D visualization (volume rendering) via OpenDX.
Definition: scalar_visu.C:345
Tbl multipole_spectrum() const
Gives the spectrum in terms of multipolar modes l .
Definition: scalar.C:962
const Scalar & dsdz() const
Returns of *this , where .
Definition: scalar_deriv.C:327
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:402
virtual void change_triad(const Base_vect &new_triad)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
Definition: scalar.C:1003
Scalar poisson() const
Solves the scalar Poisson equation with *this as a source.
Definition: scalar_pde.C:142
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Base class for coordinate mappings.
Definition: map.h:696
void import_gal(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings do not have a part...
void operator-=(const Scalar &)
-= Scalar
double integrale() const
Computes the integral over all space of *this .
Definition: scalar_integ.C:67
friend Tbl max(const Scalar &)
Maximum values of a Scalar in each domain.
Definition: scalar_math.C:614
friend ostream & operator<<(ostream &, const Scalar &)
Display.
Definition: scalar.C:708
Scalar * p_dsdt
Pointer on of *this (0x0 if not up to date)
Definition: scalar.h:439
Scalar primr(bool null_infty=true) const
Computes the radial primitive which vanishes for .
Definition: scalar_integ.C:106
friend Scalar atan(const Scalar &)
Arctangent.
Definition: scalar_math.C:234
void match_tau(Param &par_bc, Param *par_mat=0x0)
Method for matching accross domains and imposing boundary condition.
void mult_sint()
Multiplication by .
virtual void exponential_filter_ylm_phi(int lzmin, int lzmax, int p_r, int p_tet, int p_phi, double alpha=-16.)
Applies an exponential filter to the spectral coefficients in the angular directions.
void poisson_regular(int k_div, int nzet, double unsgam1, Param &par, Scalar &uu, Scalar &uu_regu, Scalar &uu_div, Tensor &duu_div, Scalar &source_regu, Scalar &source_div) const
Solves the scalar Poisson equation with *this as a source (version with parameters to control the res...
int ind_lap
Power of r by which the last computed Laplacian has been multiplied in the compactified external doma...
Definition: scalar.h:478
const Scalar & dsdx() const
Returns of *this , where .
Definition: scalar_deriv.C:265
virtual void exponential_filter_r(int lzmin, int lzmax, int p, double alpha=-16.)
Applies an exponential filter to the spectral coefficients in the radial direction.
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
Definition: scalar.C:790
void import_anti_symy(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings have anti-aligned ...
friend Tbl min(const Scalar &)
Minimum values of a Scalar in each domain.
Definition: scalar_math.C:642
Values and coefficients of a (real-value) function.
Definition: valeur.h:297
Cmp operator%(const Cmp &, const Cmp &)
Cmp * Cmp with desaliasing.
Definition: cmp_arithm.C:367
Scalar scalar_out_bound(int n, bool leave_ylm=false)
Returns the Scalar containing the values of angular coefficients at the outer boundary.
Definition: scalar_manip.C:479
virtual void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
Definition: scalar.C:371
virtual void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
Definition: scalar.C:350
int dzpuis
Power of r by which the quantity represented by this must be divided in the compactified external do...
Definition: scalar.h:418
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
Definition: scalar.h:569
void operator*=(const Scalar &)
*= Scalar
Scalar sol_elliptic_fixe_der_zero(double val, Param_elliptic &params) const
Resolution of a general elliptic equation fixing the dericative at the origin and relaxing one contin...
Definition: scalar_pde.C:378
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Definition: cmp_arithm.C:460
void operator+=(const Scalar &)
+= Scalar
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Definition: cmp_math.C:461
Scalar sol_divergence(int n) const
Resolution of a divergence-like equation.
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: scalar.C:359
friend Scalar sqrt(const Scalar &)
Square root.
Definition: scalar_math.C:266
Tbl tbl_in_bound(int n, bool leave_ylm=false)
Returns the Tbl containing the values of angular coefficients at the inner boundary.
Definition: scalar_manip.C:460
Scalar operator|(const Scalar &, const Scalar &)
Scalar * Scalar with desaliasing only in r.
Tbl test_poisson(const Scalar &uu, ostream &ostr, bool detail=false) const
Checks if a Poisson equation with *this as a source has been correctly solved.
const Vector & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of *this with respect to some metric , by raising the index of...
Definition: scalar_deriv.C:401
Tensor field of valence 1.
Definition: vector.h:188
friend Scalar operator*(const Scalar &, const Scalar &)
Scalar * Scalar.
Scalar poisson_angu(double lambda=0) const
Solves the (generalized) angular Poisson equation with *this as source.
Definition: scalar_pde.C:192
Vectorial bases (triads) with respect to which the tensorial components are defined.
Definition: base_vect.h:105
Cmp cos(const Cmp &)
Cosine.
Definition: cmp_math.C:97
Scalar sol_elliptic_only_zec(Param_elliptic &params, double val) const
Resolution of a general elliptic equation solving in the compactified domain and putting a given valu...
Definition: scalar_pde.C:333
Tbl & set_domain(int l)
Read/write of the value in a given domain.
Definition: scalar.h:630
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
Definition: cmp_math.C:507
friend Scalar acos(const Scalar &)
Arccosine.
Definition: scalar_math.C:202
void set_dzpuis(int)
Modifies the dzpuis flag.
Definition: scalar.C:814
double val_grid_point(int l, int k, int j, int i) const
Returns the value of the field at a specified grid point.
Definition: scalar.h:652
void annule_hard()
Sets the Scalar to zero in a hard way.
Definition: scalar.C:386
Scalar * p_lap
Pointer on the Laplacian of *this (0x0 if not up to date)
Definition: scalar.h:463
void exp_filter_ylm_all_domains(Scalar &ss, int p, double alpha=-16.)
Applies an exponential filter in angular directions in all domains.
void raccord(int n)
Performs the matching of the nucleus with respect to the first shell.
Cmp tan(const Cmp &)
Tangent.
Definition: cmp_math.C:123
Scalar avance_dalembert(Param &par, const Scalar &fJm1, const Scalar &source) const
Performs one time-step integration (from ) of the scalar d&#39;Alembert equation with *this being the val...
Definition: scalar_pde.C:209
friend Scalar pow(const Scalar &, int)
Power .
Definition: scalar_math.C:454
Tbl * p_integ
Pointer on the space integral of *this (values in each domain) (0x0 if not up to date) ...
Definition: scalar.h:483
void import_anti(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings have anti-aligned ...
void smooth_decay(int k, int n)
Performs a matching of the last non-compactified shell with a decaying function where is the spher...
friend Scalar cos(const Scalar &)
Cosine.
Definition: scalar_math.C:107
void div_r()
Division by r everywhere; dzpuis is not changed.
const Scalar & dsdrho() const
Returns of *this .
Definition: scalar_deriv.C:521
virtual void sauve(FILE *) const
Save in a file.
Definition: scalar.C:692
const Tbl & integrale_domains() const
Computes the integral in each domain of *this .
Definition: scalar_integ.C:85
virtual void del_deriv() const
Logical destructor of the derivatives.
Definition: scalar.C:293
Scalar * p_dsdradial
Pointer on of *this.
Definition: scalar.h:470
Tbl norme(const Cmp &)
Sums of the absolute values of all the values of the Cmp in each domain.
Definition: cmp_math.C:484
Cmp atan(const Cmp &)
Arctangent.
Definition: cmp_math.C:198
Scalar sol_elliptic_no_zec(Param_elliptic &params, double val=0) const
Resolution of a general elliptic equation, putting a given value at the outermost shell and not solvi...
Definition: scalar_pde.C:306
virtual void inc_dzpuis(int inc=1)
Increases by inc units the value of dzpuis and changes accordingly the values of the Scalar in the co...
Scalar * p_dsdrho
Pointer on of *this.
Definition: scalar.h:473
const Scalar & dsdy() const
Returns of *this , where .
Definition: scalar_deriv.C:296
Scalar * p_dsdy
Pointer on of *this , where (0x0 if not up to date)
Definition: scalar.h:454
void operator=(const Scalar &a)
Assignment to another Scalar defined on the same mapping.
Definition: scalar.C:452
Cmp operator+(const Cmp &)
Definition: cmp_arithm.C:107
Scalar * p_lapang
Pointer on the Laplacian of *this (0x0 if not up to date)
Definition: scalar.h:467
Scalar poisson_neumann(const Valeur &, int) const
Idem as Scalar::poisson_dirichlet , the boundary condition being on the radial derivative of the solu...
friend Scalar operator+(const Scalar &, const Scalar &)
Scalar + Scalar.
Base_val base
Bases on which the spectral expansion is performed.
Definition: valeur.h:315
int get_dzpuis() const
Returns dzpuis.
Definition: scalar.h:572
Scalar sol_elliptic(Param_elliptic &params) const
Resolution of a general elliptic equation, putting zero at infinity.
Definition: scalar_pde.C:226
virtual void spectral_display(const char *comment=0x0, double threshold=1.e-7, int precision=4, ostream &ostr=cout) const
Displays the spectral coefficients and the associated basis functions.
Definition: scalar.C:747
void set_outer_boundary(int l, double x)
Sets the value of the Scalar at the outer boundary of a given domain.
Definition: scalar_manip.C:327
friend Scalar sin(const Scalar &)
Sine.
Definition: scalar_math.C:75
void mult_r_ced()
Multiplication by r in the compactified external domain (CED), the dzpuis flag is not changed...
Scalar sol_elliptic_boundary(Param_elliptic &params, const Mtbl_cf &bound, double fact_dir, double fact_neu) const
Resolution of a general elliptic equation, putting zero at infinity and with inner boundary condition...
Definition: scalar_pde.C:248
Parameter storage.
Definition: param.h:125
void set_etat_one()
Sets the logical state to ETATUN (one).
Definition: scalar.C:340
friend Tbl diffrelmax(const Scalar &a, const Scalar &b)
Relative difference between two Scalar (max version).
Definition: scalar_math.C:733
Valeur va
The numerical value of the Scalar.
Definition: scalar.h:420
void del_t()
Logical destructor.
Definition: scalar.C:285
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Definition: cmp_math.C:438
virtual void std_spectral_base_odd()
Sets the spectral bases of the Valeur va to the standard odd ones for a scalar field.
Definition: scalar.C:797
const Scalar & deriv(int i) const
Returns of *this , where .
Definition: scalar_deriv.C:358
double totalmax(const Mtbl &)
Maximum value of the Mtbl elements in all domains.
Definition: mtbl_math.C:497
friend Tbl diffrel(const Scalar &a, const Scalar &b)
Relative difference between two Scalar (norme version).
Definition: scalar_math.C:698
friend Scalar operator|(const Scalar &, const Scalar &)
Scalar * Scalar with desaliasing only in r.
const Scalar & stdsdp() const
Returns of *this .
Definition: scalar_deriv.C:237
void mult_cost()
Multiplication by .
void div_rsint_dzpuis(int ced_mult_r)
Division by but with the output flag dzpuis set to ced_mult_r .
friend double totalmin(const Scalar &)
Minimum values of a Scalar in each domain.
Definition: scalar_math.C:585
void visu_section(const char section_type, double aa, double umin, double umax, double vmin, double vmax, const char *title=0x0, const char *filename=0x0, bool start_dx=true, int nu=200, int nv=200) const
3D visualization via a plane section.
Definition: scalar_visu.C:81
void mult_rsint()
Multiplication by everywhere; dzpuis is not changed.
Cmp pow(const Cmp &, int)
Power .
Definition: cmp_math.C:351
Tensor handling.
Definition: tensor.h:300
void sarra_filter_r_all_domains(double p, double alpha=1E-16)
Applies an exponential filter in radial direction in all domains for the case where p is a double (se...
void filtre(int n)
Sets the n lasts coefficients in r to 0 in the external domain.
Definition: scalar_manip.C:163
This class contains the parameters needed to call the general elliptic solver.
friend Scalar operator-(const Scalar &)
- Scalar
Definition: scalar_arithm.C:93
friend Scalar log(const Scalar &)
Neperian logarithm.
Definition: scalar_math.C:388
double totalmin(const Mtbl &)
Minimum value of the Mtbl elements in all domain.
Definition: mtbl_math.C:525
friend Scalar racine_cubique(const Scalar &)
Cube root.
Definition: scalar_math.C:296
Scalar derive_lie(const Vector &v) const
Computes the derivative of this along a vector field v.
Definition: scalar_deriv.C:418
void import_align_symy(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings have aligned Carte...
double val_point(double r, double theta, double phi) const
Computes the value of the field at an arbitrary point , by means of the spectral expansion.
Definition: scalar.C:896
void import_align(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings have aligned Carte...
void set_inner_boundary(int l, double x)
Sets the value of the Scalar at the inner boundary of a given domain.
Definition: scalar_manip.C:295
void filtre_tp(int nn, int nz1, int nz2)
Sets the n lasts coefficients in to 0 in the domain nz1 to nz2 when expressed in spherical harmonics...
Definition: scalar_manip.C:282
void fixe_decroissance(int puis)
Substracts all the components behaving like in the external domain, with n strictly lower than puis ...
Definition: scalar_manip.C:358
void set_spectral_base(const Base_val &)
Sets the spectral bases of the Valeur va
Definition: scalar.C:803
void copy_coefs_from_large_grid(const Scalar &scal_large_grid)
Copies the content of the argument Scalar to this defined on a smaller grid, with similar mappings...
Definition: scalar_manip.C:590
Multi-domain grid.
Definition: grilles.h:276
Bases of the spectral expansions.
Definition: base_val.h:325
void import_anti_asymy(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings have anti-aligned ...
Scalar * p_dsdz
Pointer on of *this , where (0x0 if not up to date)
Definition: scalar.h:459
double & set_grid_point(int l, int k, int j, int i)
Setting the value of the field at a given grid point.
Definition: scalar.h:699
friend Scalar operator/(const Scalar &, const Scalar &)
Scalar / Scalar.
void filtre_phi(int n, int zone)
Sets the n lasts coefficients in to 0 in the domain zone .
Definition: scalar_manip.C:261
bool dz_nonzero() const
Returns true if the last domain is compactified and *this is not zero in this domain.
Definition: scalar.C:820
void sarra_filter_r(int lzmin, int lzmax, double p, double alpha=-1E-16)
Applies an exponential filter to the spectral coefficients in the radial direction.
const Scalar & srdsdt() const
Returns of *this .
Definition: scalar_deriv.C:144
virtual ~Scalar()
Destructor.
Definition: scalar.C:273
void raccord_c1_zec(int puis, int nbre, int lmax)
Performs the matching of the external domain with respect to the last shell using function like wit...
Cmp log10(const Cmp &)
Basis 10 logarithm.
Definition: cmp_math.C:325
void exp_filter_r_all_domains(Scalar &ss, int p, double alpha=-16.)
Applies an exponential filter in radial direction in all domains.
Scalar sol_elliptic_pseudo_1d(Param_elliptic &) const
Solves a pseudo-1d elliptic equation with *this as a source.
Definition: scalar_pde.C:422
Cmp acos(const Cmp &)
Arccosine.
Definition: cmp_math.C:172
Cmp abs(const Cmp &)
Absolute value.
Definition: cmp_math.C:413
friend Scalar log10(const Scalar &)
Basis 10 logarithm.
Definition: scalar_math.C:421
int etat
The logical state ETATNONDEF (undefined), ETATZERO (null), ETATUN (one), or ETATQCQ (ordinary)...
Definition: scalar.h:411
Scalar * p_stdsdp
Pointer on of *this (0x0 if not up to date)
Definition: scalar.h:444
Coefficients storage for the multi-domain spectral method.
Definition: mtbl_cf.h:196
const Scalar & dsdr() const
Returns of *this .
Definition: scalar_deriv.C:112
void import_symy(const Scalar &ci)
Assignment to another Scalar defined on a different mapping.
friend Tbl norme(const Scalar &)
Sums of the absolute values of all the values of the Scalar in each domain.
Definition: scalar_math.C:670
Scalar * p_dsdr
Pointer on of *this (0x0 if not up to date)
Definition: scalar.h:426
void div_sint()
Division by .
void div_rsint()
Division by everywhere; dzpuis is not changed.
Valeur ** asymptot(int n, const int flag=0) const
Asymptotic expansion at r = infinity.
Tbl tbl_out_bound(int l_dom, bool leave_ylm=false)
Returns the Tbl containing the values of angular coefficients at the outer boundary.
Definition: scalar_manip.C:442
Cmp operator-(const Cmp &)
- Cmp
Definition: cmp_arithm.C:111
void mult_rsint_dzpuis(int ced_mult_r)
Multiplication by but with the output flag dzpuis set to ced_mult_r .
Cmp sin(const Cmp &)
Sine.
Definition: cmp_math.C:72
Mtbl Heaviside(const Mtbl &)
Heaviside function.
Definition: mtbl_math.C:320
Basic array class.
Definition: tbl.h:164
Valeur & set_spectral_va()
Returns va (read/write version)
Definition: scalar.h:619
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: scalar.C:879
bool is_nan(bool verbose=false) const
Looks for NaNs (not a number) in the scalar field.
Definition: scalar.C:1014
void match_tau_star(Param &par_bc, Param *par_mat=0x0)
Method for matching accross domains and imposing boundary condition.
void match_collocation(Param &par_bc, Param *par_mat=0x0)
Method for matching accross domains and imposing boundary condition.
friend Scalar tan(const Scalar &)
Tangent.
Definition: scalar_math.C:139
friend Scalar abs(const Scalar &)
Absolute value.
Definition: scalar_math.C:526
Scalar poisson_dirichlet(const Valeur &limite, int num) const
Is identicall to Scalar::poisson() .
virtual void exponential_filter_ylm(int lzmin, int lzmax, int p, double alpha=-16.)
Applies an exponential filter to the spectral coefficients in the angular directions.
void match_tau_shell(Param &par_bc, Param *par_mat=0x0)
Method for matching accross domains and imposing boundary condition.
Scalar sol_elliptic_sin_zec(Param_elliptic &params, double *coefs, double *phases) const
General elliptic solver.
Definition: scalar_pde.C:355
void import_align_asymy(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings have aligned Carte...
void div_r_dzpuis(int ced_mult_r)
Division by r everywhere but with the output flag dzpuis set to ced_mult_r .
const Vector & derive_cov(const Metric &gam) const
Returns the gradient (1-form = covariant vector) of *this
Definition: scalar_deriv.C:389
void div_tant()
Division by .
void raccord_externe(int puis, int nbre, int lmax)
Matching of the external domain with the outermost shell.
void div_r_ced()
Division by r in the compactified external domain (CED), the dzpuis flag is not changed.
friend Scalar operator%(const Scalar &, const Scalar &)
Scalar * Scalar with desaliasing.
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values of the Scalar in the co...
Scalar sol_elliptic_2d(Param_elliptic &) const
Solves the scalar 2-dimensional elliptic equation with *this as a source.
Definition: scalar_pde.C:401
void import_asymy(const Scalar &ci)
Assignment to another Scalar defined on a different mapping.
friend Scalar asin(const Scalar &)
Arcsine.
Definition: scalar_math.C:170
friend Scalar Heaviside(const Scalar &)
Heaviside function.
Definition: scalar_math.C:358
void mult_r_dzpuis(int ced_mult_r)
Multiplication by r everywhere but with the output flag dzpuis set to ced_mult_r ...
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
Definition: cmp_math.C:542
const Valeur & get_spectral_va() const
Returns va (read only version)
Definition: scalar.h:616
const Scalar & srstdsdp() const
Returns of *this .
Definition: scalar_deriv.C:176
Tbl & set(int l)
Read/write of the value in a given domain (configuration space).
Definition: valeur.h:373
Scalar poisson_tau() const
Solves the scalar Poisson equation with *this as a source using a real Tau method The source of the ...
Definition: scalar_pde.C:168
Scalar * p_dsdx
Pointer on of *this , where (0x0 if not up to date)
Definition: scalar.h:449