LORENE
integrale2d.C
1 /*
2  * Performs a 2D integration from 0 to infty of the l=0 part of a Scalar
3  *
4  */
5 
6 /*
7  * Copyright (c) 2010 Jerome Novak
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 
27 
28 /*
29  * $Id $
30  * $Log $
31  *
32  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/integrale2d.C,v 1.3 2016/12/05 16:18:07 j_novak Exp $
33  *
34  */
35 
36 // Lorene headers
37 #include "tensor.h"
38 
39 namespace Lorene {
40 double integrale2d(const Scalar& fi) {
41 
42  const Map* mp = &fi.get_mp() ;
43  const Map_af* mp_aff = dynamic_cast<const Map_af*>(mp) ;
44  assert( mp_aff != 0x0 ) ;
45  assert( fi.check_dzpuis(4) || fi.check_dzpuis(3) ) ;
46 
47  double lambda ;
48  if (fi.get_etat() == ETATZERO) lambda = 0. ;
49  else {
50  const Base_val& base = fi.get_spectral_base() ;
51  Scalar tmp(*mp_aff) ;
52  tmp.annule_hard() ;
53  tmp.set_dzpuis(fi.get_dzpuis()) ;
54  tmp += fi ;
55  tmp.set_spectral_base(base) ;
56  const Mg3d& mg = *mp_aff->get_mg() ;
57  int nz0 = mg.get_nzone() ;
58  tmp.mult_r_dzpuis(2) ;
59  tmp.set_spectral_va().coef() ;
60  tmp.set_spectral_va().ylm_i() ;
61  Mtbl_cf& mtc = *tmp.set_spectral_va().c_cf ;
62  for (int lz=0; lz<nz0; lz++) {
63  int np0 = mg.get_np(lz)+2 ;
64  int nt0 = mg.get_nt(lz) ;
65  int nr0 = mg.get_nr(lz) ;
66  for (int k=0; k<np0; k++)
67  for (int j=0; j<nt0; j++)
68  for (int i=0; i<nr0; i++) {
69  double resu = 0. ;
70  if ((j==0)&&(k==0))
71  resu = mtc(lz, k, j, i) ;
72  mtc.set(lz, k, j, i) = resu ;
73  }
74  }
75  if (tmp.get_spectral_va().c != 0x0) {
76  delete tmp.set_spectral_va().c ;
77  tmp.set_spectral_va().c = 0x0 ;
78  }
79 
80  Scalar integ(*mp_aff) ;
81  mp_aff->primr(tmp, integ, true) ;
82  lambda = -integ.val_grid_point(0,0,0,0) ;
83  }
84 
85  return lambda ;
86 
87 }
88 }
Lorene prototypes.
Definition: app_hor.h:67