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
29char map_af_integ_surf_falloff_C[] = "$Header: /cvsroot/Lorene/C++/Source/Map/map_af_integ_surf_falloff.C,v 1.3 2014/10/13 08:53:02 j_novak Exp $" ;
30
31/*
32 * $Id: map_af_integ_surf_falloff.C,v 1.3 2014/10/13 08:53:02 j_novak Exp $
33 * $Log: map_af_integ_surf_falloff.C,v $
34 * Revision 1.3 2014/10/13 08:53:02 j_novak
35 * Lorene classes and functions now belong to the namespace Lorene.
36 *
37 * Revision 1.2 2014/10/06 15:13:12 j_novak
38 * Modified #include directives to use c++ syntax.
39 *
40 * Revision 1.1 2004/11/30 20:53:08 k_taniguchi
41 * *** empty log message ***
42 *
43 *
44 * $Header: /cvsroot/Lorene/C++/Source/Map/map_af_integ_surf_falloff.C,v 1.3 2014/10/13 08:53:02 j_novak Exp $
45 *
46 */
47
48#include <cstdlib>
49#include <cmath>
50
51#include "map.h"
52#include "cmp.h"
53#include "proto.h"
54
55namespace Lorene {
56double Map_af::integrale_surface_falloff (const Cmp& ci) const {
57
58 // Returns Surface integral/R^2 -> multiply by R^2 to get the right value!!!!!!
59
60 assert (ci.get_etat() != ETATNONDEF) ;
61 if (ci.get_etat() == ETATZERO)
62 return 0 ;
63
64 assert (ci.get_etat() == ETATQCQ) ;
65
66 int nz = ci.get_mp()->get_mg()->get_nzone() ;
67
68 ci.va.coef() ;
69 int nr = get_mg()->get_nr(nz-1) ;
70 int nt = get_mg()->get_nt(nz-1) ;
71
72 int base_r = ci.va.base.get_base_r(nz-1) ;
73 int base_t = ci.va.base.get_base_t(nz-1) ;
74 int base_p = ci.va.base.get_base_p(nz-1) ;
75
76 double result = 0 ;
77 double* coef = new double [nr] ;
78 double* auxi = new double[1] ;
79
80 for (int j=0 ; j<nt ; j++) {
81 for (int i=0 ; i<nr ; i++)
82 coef[i] = (*ci.va.c_cf)(nz-1, 0, j, i) ;
83
84 switch (base_r) {
85
86 case R_CHEB :
87 som_r_cheb (coef, nr, 1, 1, 1, auxi) ;
88 break ;
89 case R_CHEBP :
90 som_r_chebp (coef, nr, 1, 1, 1, auxi) ;
91 break ;
92 case R_CHEBI :
93 som_r_chebi (coef, nr, 1, 1, 1, auxi) ;
94 break ;
95 case R_CHEBU :
96 som_r_chebu (coef, nr, 1, 1, 1, auxi) ;
97 break ;
98 case R_CHEBPIM_P :
99 som_r_chebpim_p (coef, nr, 1, 1, 1, auxi) ;
100 break ;
101 case R_CHEBPIM_I :
102 som_r_chebpim_i (coef, nr, 1, 1, 1, auxi) ;
103 break ;
104 default :
105 som_r_pas_prevu (coef, nr, 1, 1, 1, auxi) ;
106 break ;
107 }
108 result += 2 * (*auxi)/(1-4*j*j) ;
109 }
110
111 delete [] auxi ;
112 delete [] coef ;
113
114 switch (base_t) {
115 case T_COS_P :
116 break ;
117 case T_COSSIN_CP :
118 break ;
119 case T_COSSIN_CI :
120 result = 0 ;
121 break ;
122 default :
123 cout << "base_t cas non prevu dans Map_af::integrale_surface" << endl ;
124 abort() ;
125 break ;
126 }
127
128 switch (base_p) {
129 case P_COSSIN :
130 result *= 2*M_PI ;
131 break ;
132 case P_COSSIN_P :
133 result *= 2*M_PI ;
134 break ;
135 default :
136 cout << "base_p cas non prevu dans Map_af::integrale_surface" << endl ;
137 abort() ;
138 break ;
139 }
140
141 return (result) ;
142}
143
144}
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition map.h:765
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition grilles.h:457
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition grilles.h:452
#define P_COSSIN_P
dev. sur Phi = 2*phi, freq. paires
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define R_CHEBPIM_I
Cheb. pair-impair suivant m, impair pour m=0.
#define T_COS_P
dev. cos seulement, harmoniques paires
#define T_COSSIN_CI
cos impair-sin pair alternes, cos pour m=0
#define P_COSSIN
dev. standart
#define R_CHEBPIM_P
Cheb. pair-impair suivant m, pair pour m=0.
#define T_COSSIN_CP
cos pair-sin impair alternes, cos pour m=0
#define R_CHEB
base de Chebychev ordinaire (fin)
#define R_CHEBP
base de Cheb. paire (rare) seulement
Lorene prototypes.
Definition app_hor.h:64