Debian Codegraph @

C++/Source/Tensor/Scalar/scalar_integ.C

raw
1 /*
2 * Member functions of the Scalar class for the computation of integrals.
3 */
4
5 /*
6 * Copyright (c) 2003 Eric Gourgoulhon & Jerome Novak
7 *
8 * Copyright (c) 1999-2001 Eric Gourgoulhon (Cmp version)
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 char scalar_integ_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_integ.C,v 1.4 2014/10/13 08:53:46 j_novak Exp $" ;
30
31 /*
32 * $Id: scalar_integ.C,v 1.4 2014/10/13 08:53:46 j_novak Exp $
33 * $Log: scalar_integ.C,v $
34 * Revision 1.4 2014/10/13 08:53:46 j_novak
35 * Lorene classes and functions now belong to the namespace Lorene.
36 *
37 * Revision 1.3 2004/07/26 16:02:23 j_novak
38 * Added a flag to specify whether the primitive should be zero either at r=0
39 * or at r going to infinity.
40 *
41 * Revision 1.2 2004/06/14 15:28:17 e_gourgoulhon
42 * Added method primr().
43 *
44 * Revision 1.1 2003/09/25 09:33:36 j_novak
45 * Added methods for integral calculation and various manipulations
46 *
47 *
48 * $Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_integ.C,v 1.4 2014/10/13 08:53:46 j_novak Exp $
49 *
50 */
51
52 // Headers Lorene
53 #include "tensor.h"
54 #include "cmp.h"
55
56 //-----------------------------------//
57 // Integral over all space //
58 //-----------------------------------//
59
60 namespace Lorene {
61 double Scalar::integrale() const {
62
63 const Tbl& integ = integrale_domains() ;
64
65 int nz = mp->get_mg()->get_nzone() ;
66
67 double resu = integ(0) ;
68 for (int l=1; l<nz; l++) {
69 resu += integ(l) ;
70 }
71
72 return resu ;
73 }
74
75 //-----------------------------------//
76 // Integrals in each domain //
77 //-----------------------------------//
78
79 const Tbl& Scalar::integrale_domains() const {
80
81 // Protection
82 assert(etat != ETATNONDEF) ;
83
84 // If the integrals have not been previously computed, the
85 // computation must be done by the appropriate routine of the mapping :
86
87 if (p_integ == 0x0) {
88 Cmp orig(*this) ;
89 p_integ = mp->integrale(orig) ;
90 }
91
92 return *p_integ ;
93
94 }
95
96
97 //----------------------//
98 // Radial primitive //
99 //----------------------//
100
101 Scalar Scalar::primr(bool null_infty) const {
102
103 Scalar resu(*mp) ;
104
105 mp->primr(*this, resu, null_infty) ;
106
107 return resu ;
108 }
109
110
111
112
113 }