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