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
27char cmp_integ_C[] = "$Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_integ.C,v 1.2 2014/10/13 08:52:47 j_novak Exp $" ;
28
29/*
30 * $Id: cmp_integ.C,v 1.2 2014/10/13 08:52:47 j_novak Exp $
31 * $Log: cmp_integ.C,v $
32 * Revision 1.2 2014/10/13 08:52:47 j_novak
33 * Lorene classes and functions now belong to the namespace Lorene.
34 *
35 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
36 * LORENE
37 *
38 * Revision 1.1 1999/12/09 10:50:21 eric
39 * Initial revision
40 *
41 *
42 * $Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_integ.C,v 1.2 2014/10/13 08:52:47 j_novak Exp $
43 *
44 */
45
46// Headers Lorene
47#include "map.h"
48#include "cmp.h"
49
50 //-----------------------------------//
51 // Integral over all space //
52 //-----------------------------------//
53
54namespace Lorene {
55double Cmp::integrale() const {
56
57 const Tbl& integ = integrale_domains() ;
58
59 int nz = mp->get_mg()->get_nzone() ;
60
61 double resu = integ(0) ;
62 for (int l=1; l<nz; l++) {
63 resu += integ(l) ;
64 }
65
66 return resu ;
67}
68
69 //-----------------------------------//
70 // Integrals in each domain //
71 //-----------------------------------//
72
74
75 // Protection
76 assert(etat != ETATNONDEF) ;
77
78 // If the integrals have not been previously computed, the
79 // computation must be done by the appropriate routine of the mapping :
80
81 if (p_integ == 0x0) {
82 p_integ = mp->integrale(*this) ;
83 }
84
85 return *p_integ ;
86
87}
88
89}
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:73
double integrale() const
Computes the integral over all space of *this .
Definition cmp_integ.C:55
Tbl * p_integ
Pointer on the space integral of *this (values in each domain)
Definition cmp.h:503
virtual Tbl * integrale(const Cmp &) const =0
Computes the integral over all space of a Cmp .
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition map.h:765
int get_nzone() const
Returns the number of domains.
Definition grilles.h:448
Basic array class.
Definition tbl.h:161
Lorene prototypes.
Definition app_hor.h:64