LORENE
cmp_asymptot.C
1 /*
2  * Function Cmp::asymptot
3  *
4  */
5 
6 /*
7  * Copyright (c) 1999-2002 Eric Gourgoulhon
8  * Copyright (c) 1999-2001 Philippe Grandclement
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 
30 
31 /*
32  * $Id: cmp_asymptot.C,v 1.6 2016/12/05 16:17:48 j_novak Exp $
33  * $Log: cmp_asymptot.C,v $
34  * Revision 1.6 2016/12/05 16:17:48 j_novak
35  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
36  *
37  * Revision 1.5 2014/10/13 08:52:47 j_novak
38  * Lorene classes and functions now belong to the namespace Lorene.
39  *
40  * Revision 1.4 2014/10/06 15:13:03 j_novak
41  * Modified #include directives to use c++ syntax.
42  *
43  * Revision 1.3 2002/10/16 14:36:34 j_novak
44  * Reorganization of #include instructions of standard C++, in order to
45  * use experimental version 3 of gcc.
46  *
47  * Revision 1.2 2002/05/22 13:57:25 f_limousin
48  * Corrected error in determination of min and max values on the sphere.
49  *
50  * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
51  * LORENE
52  *
53  * Revision 2.2 2000/11/15 13:24:43 phil
54  * modification output
55  *
56  * Revision 2.1 2000/11/15 13:16:01 phil
57  * ajout gestion affichage
58  *
59  * Revision 2.0 2000/03/25 12:53:03 eric
60  * *** empty log message ***
61  *
62  *
63  * $Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_asymptot.C,v 1.6 2016/12/05 16:17:48 j_novak Exp $
64  *
65  */
66 
67 // Headers C
68 #include <cmath>
69 
70 // Headers Lorene
71 #include "cmp.h"
72 
73 namespace Lorene {
74 Valeur** Cmp::asymptot(int n0, const int flag) const {
75 
76  assert(n0 >= 0) ;
77  const Mg3d& mg = *(mp->get_mg()) ;
78  int nz = mg.get_nzone() ;
79  int nzm1 = nz-1 ;
80  assert(mg.get_type_r(nzm1) == UNSURR) ;
81  int np = mg.get_np(nzm1) ;
82  int nt = mg.get_nt(nzm1) ;
83  int nr = mg.get_nr(nzm1) ;
84  int nrm1 = nr-1 ;
85 
86  Valeur** vu = new Valeur*[n0+1] ;
87  for (int h=0; h<=n0; h++) {
88  vu[h] = new Valeur(mg.get_angu()) ;
89  }
90 
91  Cmp uu = *this ;
92 
93  int precis = 2 ;
94 
95  // The terms 1/r^h with h < dzpuis are null :
96  // -----------------------------------------
97  for (int h=0; h<dzpuis; h++) {
98 
99  vu[h]->set_etat_zero() ;
100 
101  }
102 
103  // Terms 1/r^h with h >= dzpuis :
104  // -----------------------------
105  for (int h=dzpuis; h<=n0; h++) {
106 
107  // Value on the sphere S^2 at infinity
108  // -----------------------------------
109  vu[h]->set_etat_c_qcq() ;
110  vu[h]->c->set_etat_qcq() ;
111  for (int l=0; l<nzm1; l++) {
112  vu[h]->c->t[l]->set_etat_zero() ;
113  }
114  vu[h]->c->t[nzm1]->set_etat_qcq() ;
115 
116  for (int k=0; k<np; k++) {
117  for (int j=0; j<nt; j++) {
118  vu[h]->set(nzm1, k, j, 0) = uu(nzm1, k, j, nrm1) ;
119  }
120  }
121 
122  vu[h]->set_base( uu.va.base ) ;
123 
124  // Printing
125  // --------
126  if (flag != 0) {
127  cout << "Term in 1/r^" << h << endl ;
128  cout << "-------------" << endl ;
129 
130  double ndec = 0 ;
131  double vmin = (*vu[h])(nzm1, 0, 0, 0) ;
132  double vmax = vmin ;
133 
134  cout << " Values at the point (phi_k, theta_j) : " << endl ;
135  cout.precision(precis) ;
136  cout.setf(ios::showpoint) ;
137  for (int k=0; k<np; k++) {
138  cout << " k=" << k << " : " ;
139  for (int j=0; j<nt; j++) {
140  double xx = (*vu[h])(nzm1, k, j, 0) ;
141  cout << " " << setw(precis) << xx ;
142  ndec += fabs(xx) ;
143  vmin = ( xx < vmin ) ? xx : vmin ;
144  vmax = ( xx > vmax ) ? xx : vmax ;
145  }
146  cout << endl;
147  }
148  ndec /= np*nt ;
149  cout << "Minimum value on S^2 : " << vmin << endl ;
150  cout << "Maximum value on S^2 : " << vmax << endl ;
151  cout << "L^1 norm on S^2 : " << ndec << endl ;
152  }
153  // The value at infinity is substracted
154  // ------------------------------------
155  for (int k=0; k<np; k++) {
156  for (int j=0; j<nt; j++) {
157  double v_inf = (*vu[h])(nzm1, k, j, 0) ;
158  for (int i=0; i<nr; i++) {
159  uu.set(nzm1, k, j, i) -= v_inf ;
160  }
161  }
162  }
163 
164  // Mutliplication by r
165  // -------------------
166 
167  uu.mult_r_zec() ;
168 
169  } // End of loop on h (development order)
170 
171  return vu ;
172 
173 }
174 }
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:446
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition: grilles.h:479
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: valeur.C:692
Lorene prototypes.
Definition: app_hor.h:67
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:777
void mult_r_zec()
Multiplication by r in the external compactified domain (ZEC)
Definition: cmp_r_manip.C:106
Values and coefficients of a (real-value) function.
Definition: valeur.h:297
void set_base(const Base_val &)
Sets the bases for spectral expansions (member base )
Definition: valeur.C:813
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tbl.C:364
const Mg3d * get_angu() const
Returns the pointer on the associated angular grid.
Definition: mg3d.C:604
int dzpuis
Power of r by which the quantity represented by this must be divided in the external compactified zo...
Definition: cmp.h:461
Base_val base
Bases on which the spectral expansion is performed.
Definition: valeur.h:315
Mtbl * c
Values of the function at the points of the multi-grid.
Definition: valeur.h:309
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:465
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: mtbl.C:302
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: tbl.C:350
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:469
Multi-domain grid.
Definition: grilles.h:279
Tbl & set(int l)
Read/write of the value in a given domain.
Definition: cmp.h:724
const Map * mp
Reference mapping.
Definition: cmp.h:451
Valeur ** asymptot(int n, const int flag=0) const
Asymptotic expansion at r = infinity.
Definition: cmp_asymptot.C:74
void set_etat_c_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl c )...
Definition: valeur.C:704
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:474
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Definition: grilles.h:491
Tbl ** t
Array (size nzone ) of pointers on the Tbl &#39;s.
Definition: mtbl.h:132
Valeur va
The numerical value of the Cmp.
Definition: cmp.h:464
Tbl & set(int l)
Read/write of the value in a given domain (configuration space).
Definition: valeur.h:373