LORENE
cmp_integ.C
1/*
2 * Member functions of the Cmp class for the computation of integrals.
3 */
4
5/*
6 * Copyright (c) 1999-2001 Eric Gourgoulhon
7 *
8 * This file is part of LORENE.
9 *
10 * LORENE is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
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
27
28
29/*
30 * $Id: cmp_integ.C,v 1.3 2016/12/05 16:17:48 j_novak Exp $
31 * $Log: cmp_integ.C,v $
32 * Revision 1.3 2016/12/05 16:17:48 j_novak
33 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
34 *
35 * Revision 1.2 2014/10/13 08:52:47 j_novak
36 * Lorene classes and functions now belong to the namespace Lorene.
37 *
38 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
39 * LORENE
40 *
41 * Revision 1.1 1999/12/09 10:50:21 eric
42 * Initial revision
43 *
44 *
45 * $Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_integ.C,v 1.3 2016/12/05 16:17:48 j_novak Exp $
46 *
47 */
48
49// Headers Lorene
50#include "map.h"
51#include "cmp.h"
52
53 //-----------------------------------//
54 // Integral over all space //
55 //-----------------------------------//
56
57namespace Lorene {
58double Cmp::integrale() const {
59
60 const Tbl& integ = integrale_domains() ;
61
62 int nz = mp->get_mg()->get_nzone() ;
63
64 double resu = integ(0) ;
65 for (int l=1; l<nz; l++) {
66 resu += integ(l) ;
67 }
68
69 return resu ;
70}
71
72 //-----------------------------------//
73 // Integrals in each domain //
74 //-----------------------------------//
75
77
78 // Protection
79 assert(etat != ETATNONDEF) ;
80
81 // If the integrals have not been previously computed, the
82 // computation must be done by the appropriate routine of the mapping :
83
84 if (p_integ == 0x0) {
85 p_integ = mp->integrale(*this) ;
86 }
87
88 return *p_integ ;
89
90}
91
92}
const Map * mp
Reference mapping.
Definition cmp.h:451
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition cmp.h:454
const Tbl & integrale_domains() const
Computes the integral in each domain of *this .
Definition cmp_integ.C:76
double integrale() const
Computes the integral over all space of *this .
Definition cmp_integ.C:58
Tbl * p_integ
Pointer on the space integral of *this (values in each domain).
Definition cmp.h:503
Basic array class.
Definition tbl.h:161
Lorene prototypes.
Definition app_hor.h:67