Debian Codegraph @

Codes/Test/Mtbl_cf/test_display.C

raw
1 /*
2 * Code for testing the new Mtbl_cf display
3 *
4 */
5
6 /*
7 * Copyright (c) 2003 Eric Gourgoulhon
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * LORENE is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with LORENE; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26 char test_display_C[] = "$Header: /cvsroot/Lorene/Codes/Test/Mtbl_cf/test_display.C,v 1.3 2014/10/13 08:54:02 j_novak Exp $" ;
27
28 /*
29 * $Id: test_display.C,v 1.3 2014/10/13 08:54:02 j_novak Exp $
30 * $Log: test_display.C,v $
31 * Revision 1.3 2014/10/13 08:54:02 j_novak
32 * Lorene classes and functions now belong to the namespace Lorene.
33 *
34 * Revision 1.2 2014/10/06 15:12:54 j_novak
35 * Modified #include directives to use c++ syntax.
36 *
37 * Revision 1.1 2003/10/19 20:03:49 e_gourgoulhon
38 * First version
39 *
40 *
41 * $Header: /cvsroot/Lorene/Codes/Test/Mtbl_cf/test_display.C,v 1.3 2014/10/13 08:54:02 j_novak Exp $
42 *
43 */
44
45 // C++ headers
46 #include "headcpp.h"
47
48 // C headers
49 #include <cstdlib>
50
51 // Lorene headers
52 #include "metric.h"
53 #include "nbr_spx.h"
54 #include "utilitaires.h"
55
56
57 using namespace Lorene ;
58
59 int main() {
60
61 // Construction of a multi-grid (Mg3d)
62 // -----------------------------------
63
64 int nz = 3 ; // Number of domains
65 int nr = 9 ; // Number of collocation points in r in each domain
66 int nt = 5 ; // Number of collocation points in theta in each domain
67 int np = 8 ; // Number of collocation points in phi in each domain
68 int symmetry_theta = SYM ; // symmetry with respect to the equatorial plane
69 int symmetry_phi = NONSYM ; // no symmetry in phi
70 bool compact = true ; // external domain is compactified
71
72 Mg3d mgrid(nz, nr, nt, np, symmetry_theta, symmetry_phi, compact) ;
73
74
75 // Construction of an affine mapping (Map_af)
76 // ------------------------------------------
77
78 // Boundaries of each domains
79 double r_limits[] = {0., 1., 2., __infinity} ;
80 assert( nz == 3 ) ; // since the above array describes only 3 domains
81
82 Map_af map(mgrid, r_limits) ;
83
84
85 // Construction of a scalar field (Scalar)
86 // ---------------------------------------
87
88 const Coord& x = map.x ;
89 const Coord& y = map.y ;
90 const Coord& z = map.z ;
91 const Coord& r = map.r ;
92 const Coord& sint = map.sint ;
93 const Coord& sinp = map.sinp ;
94
95 Scalar uu(map) ;
96 Scalar tmp(map) ;
97
98 uu = 1 + x + 2*y - z*z + x*y + x*x*y - z*z*y ;
99 tmp = sint * sinp / r ;
100 uu.set_domain(nz-1) = tmp.domain(nz-1) ; // y/r^2 in the external domain
101 uu.set_domain(1) = 0 ;
102
103 uu.std_spectral_base() ; // sets the standard spectral basis for
104 // expansion of a scalar field
105
106 Valeur va = uu.get_spectral_va() ;
107 va.coef() ;
108 va.ylm() ;
109 va.c_cf->affiche_seuil(cout) ;
110 va.c_cf->display() ;
111
112 arrete() ;
113 cout << "uu : " << endl ;
114 uu.spectral_display() ;
115 arrete() ;
116
117 // Construction of a flat metric
118 // -----------------------------
119
120 Metric_flat mets(map, map.get_bvect_spher()) ; // spherical representation
121
122 // Gradient of the scalar field
123 // ----------------------------
124
125 Vector vv = uu.derive_cov(mets) ;
126 vv.set(1) = 0 ;
127
128 cout << "vv : " << endl ;
129 vv.spectral_display() ;
130
131
132 return EXIT_SUCCESS ;
133 }