LORENE
map_af_integ_surf_falloff.C
1 /*
2  * Methods of the class Map_af for obtaining a surface integral
3  * with a falloff condition at the outer boundary
4  *
5  * (see file map.h for documentation).
6  *
7  */
8 
9 /*
10  * Copyright (c) 2004 Joshua A. Faber
11  *
12  * This file is part of LORENE.
13  *
14  * LORENE is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License version 2
16  * as published by the Free Software Foundation.
17  *
18  * LORENE is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with LORENE; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26  *
27  */
28 
29 
30 
31 /*
32  * $Id: map_af_integ_surf_falloff.C,v 1.4 2016/12/05 16:17:57 j_novak Exp $
33  * $Log: map_af_integ_surf_falloff.C,v $
34  * Revision 1.4 2016/12/05 16:17:57 j_novak
35  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
36  *
37  * Revision 1.3 2014/10/13 08:53:02 j_novak
38  * Lorene classes and functions now belong to the namespace Lorene.
39  *
40  * Revision 1.2 2014/10/06 15:13:12 j_novak
41  * Modified #include directives to use c++ syntax.
42  *
43  * Revision 1.1 2004/11/30 20:53:08 k_taniguchi
44  * *** empty log message ***
45  *
46  *
47  * $Header: /cvsroot/Lorene/C++/Source/Map/map_af_integ_surf_falloff.C,v 1.4 2016/12/05 16:17:57 j_novak Exp $
48  *
49  */
50 
51 #include <cstdlib>
52 #include <cmath>
53 
54 #include "map.h"
55 #include "cmp.h"
56 #include "proto.h"
57 
58 namespace Lorene {
59 double Map_af::integrale_surface_falloff (const Cmp& ci) const {
60 
61  // Returns Surface integral/R^2 -> multiply by R^2 to get the right value!!!!!!
62 
63  assert (ci.get_etat() != ETATNONDEF) ;
64  if (ci.get_etat() == ETATZERO)
65  return 0 ;
66 
67  assert (ci.get_etat() == ETATQCQ) ;
68 
69  int nz = ci.get_mp()->get_mg()->get_nzone() ;
70 
71  ci.va.coef() ;
72  int nr = get_mg()->get_nr(nz-1) ;
73  int nt = get_mg()->get_nt(nz-1) ;
74 
75  int base_r = ci.va.base.get_base_r(nz-1) ;
76  int base_t = ci.va.base.get_base_t(nz-1) ;
77  int base_p = ci.va.base.get_base_p(nz-1) ;
78 
79  double result = 0 ;
80  double* coef = new double [nr] ;
81  double* auxi = new double[1] ;
82 
83  for (int j=0 ; j<nt ; j++) {
84  for (int i=0 ; i<nr ; i++)
85  coef[i] = (*ci.va.c_cf)(nz-1, 0, j, i) ;
86 
87  switch (base_r) {
88 
89  case R_CHEB :
90  som_r_cheb (coef, nr, 1, 1, 1, auxi) ;
91  break ;
92  case R_CHEBP :
93  som_r_chebp (coef, nr, 1, 1, 1, auxi) ;
94  break ;
95  case R_CHEBI :
96  som_r_chebi (coef, nr, 1, 1, 1, auxi) ;
97  break ;
98  case R_CHEBU :
99  som_r_chebu (coef, nr, 1, 1, 1, auxi) ;
100  break ;
101  case R_CHEBPIM_P :
102  som_r_chebpim_p (coef, nr, 1, 1, 1, auxi) ;
103  break ;
104  case R_CHEBPIM_I :
105  som_r_chebpim_i (coef, nr, 1, 1, 1, auxi) ;
106  break ;
107  default :
108  som_r_pas_prevu (coef, nr, 1, 1, 1, auxi) ;
109  break ;
110  }
111  result += 2 * (*auxi)/(1-4*j*j) ;
112  }
113 
114  delete [] auxi ;
115  delete [] coef ;
116 
117  switch (base_t) {
118  case T_COS_P :
119  break ;
120  case T_COSSIN_CP :
121  break ;
122  case T_COSSIN_CI :
123  result = 0 ;
124  break ;
125  default :
126  cout << "base_t cas non prevu dans Map_af::integrale_surface" << endl ;
127  abort() ;
128  break ;
129  }
130 
131  switch (base_p) {
132  case P_COSSIN :
133  result *= 2*M_PI ;
134  break ;
135  case P_COSSIN_P :
136  result *= 2*M_PI ;
137  break ;
138  default :
139  cout << "base_p cas non prevu dans Map_af::integrale_surface" << endl ;
140  abort() ;
141  break ;
142  }
143 
144  return (result) ;
145 }
146 
147 }
#define P_COSSIN
dev. standart
Definition: type_parite.h:245
Lorene prototypes.
Definition: app_hor.h:67
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:783
#define R_CHEBI
base de Cheb. impaire (rare) seulement
Definition: type_parite.h:170
#define R_CHEBP
base de Cheb. paire (rare) seulement
Definition: type_parite.h:168
#define T_COS_P
dev. cos seulement, harmoniques paires
Definition: type_parite.h:200
#define R_CHEBPIM_I
Cheb. pair-impair suivant m, impair pour m=0.
Definition: type_parite.h:178
#define R_CHEBPIM_P
Cheb. pair-impair suivant m, pair pour m=0.
Definition: type_parite.h:176
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:469
#define T_COSSIN_CI
cos impair-sin pair alternes, cos pour m=0
Definition: type_parite.h:212
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:474
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
Definition: type_parite.h:180
#define P_COSSIN_P
dev. sur Phi = 2*phi, freq. paires
Definition: type_parite.h:247
#define T_COSSIN_CP
cos pair-sin impair alternes, cos pour m=0
Definition: type_parite.h:208
#define R_CHEB
base de Chebychev ordinaire (fin)
Definition: type_parite.h:166