map_af_integ_surf_falloff.C

00001 /*
00002  *  Methods of the class Map_af for obtaining a surface integral
00003  *   with a falloff condition at the outer boundary
00004  *
00005  *    (see file map.h for documentation).
00006  *
00007  */
00008 
00009 /*
00010  *   Copyright (c) 2004 Joshua A. Faber
00011  *
00012  *   This file is part of LORENE.
00013  *
00014  *   LORENE is free software; you can redistribute it and/or modify
00015  *   it under the terms of the GNU General Public License version 2
00016  *   as published by the Free Software Foundation.
00017  *
00018  *   LORENE is distributed in the hope that it will be useful,
00019  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *   GNU General Public License for more details.
00022  *
00023  *   You should have received a copy of the GNU General Public License
00024  *   along with LORENE; if not, write to the Free Software
00025  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  *
00027  */
00028 
00029 char map_af_integ_surf_falloff_C[] = "$Header: /cvsroot/Lorene/C++/Source/Map/map_af_integ_surf_falloff.C,v 1.1 2004/11/30 20:53:08 k_taniguchi Exp $" ;
00030 
00031 /*
00032  * $Id: map_af_integ_surf_falloff.C,v 1.1 2004/11/30 20:53:08 k_taniguchi Exp $
00033  * $Log: map_af_integ_surf_falloff.C,v $
00034  * Revision 1.1  2004/11/30 20:53:08  k_taniguchi
00035  * *** empty log message ***
00036  *
00037  *
00038  * $Header: /cvsroot/Lorene/C++/Source/Map/map_af_integ_surf_falloff.C,v 1.1 2004/11/30 20:53:08 k_taniguchi Exp $
00039  *
00040  */
00041 
00042 #include <stdlib.h>
00043 #include <math.h>
00044 
00045 #include "map.h"
00046 #include "cmp.h"
00047 #include "proto.h"
00048 
00049 double Map_af::integrale_surface_falloff (const Cmp& ci) const {
00050     
00051   // Returns Surface integral/R^2 -> multiply by R^2 to get the right value!!!!!!
00052 
00053     assert (ci.get_etat() != ETATNONDEF) ;
00054     if (ci.get_etat() == ETATZERO)
00055     return 0 ;
00056     
00057     assert (ci.get_etat() == ETATQCQ) ;
00058     
00059     int nz = ci.get_mp()->get_mg()->get_nzone() ;
00060     
00061     ci.va.coef() ;
00062     int nr = get_mg()->get_nr(nz-1) ;
00063     int nt = get_mg()->get_nt(nz-1) ;
00064     
00065     int base_r = ci.va.base.get_base_r(nz-1) ;
00066     int base_t = ci.va.base.get_base_t(nz-1) ;
00067     int base_p = ci.va.base.get_base_p(nz-1) ;
00068     
00069     double result = 0 ;
00070     double* coef = new double [nr] ;
00071     double* auxi = new double[1] ;
00072      
00073     for (int j=0 ; j<nt ; j++) {
00074     for (int i=0 ; i<nr ; i++)
00075         coef[i] = (*ci.va.c_cf)(nz-1, 0, j, i) ;
00076   
00077     switch (base_r) {
00078     
00079         case R_CHEB :
00080         som_r_cheb (coef, nr, 1, 1, 1, auxi) ;
00081         break ;
00082         case R_CHEBP :
00083         som_r_chebp (coef, nr, 1, 1, 1, auxi) ;
00084         break ;
00085         case R_CHEBI :
00086         som_r_chebi (coef, nr, 1, 1, 1, auxi) ;
00087         break ;
00088         case R_CHEBU :
00089         som_r_chebu (coef, nr, 1, 1, 1, auxi) ;
00090         break ;
00091         case R_CHEBPIM_P :
00092         som_r_chebpim_p (coef, nr, 1, 1, 1, auxi) ;
00093         break ;
00094         case R_CHEBPIM_I :
00095         som_r_chebpim_i (coef, nr, 1, 1, 1, auxi) ;
00096         break ;
00097         default :
00098         som_r_pas_prevu (coef, nr, 1, 1, 1, auxi) ;
00099         break ;
00100     }
00101     result += 2 * (*auxi)/(1-4*j*j) ;
00102     }
00103     
00104     delete [] auxi ;
00105     delete [] coef ;
00106     
00107     switch (base_t) {
00108     case T_COS_P :
00109         break ;
00110     case T_COSSIN_CP :
00111         break ;
00112     case T_COSSIN_CI :
00113         result = 0 ;
00114         break ;
00115     default :
00116         cout << "base_t cas non prevu dans Map_af::integrale_surface" << endl ;
00117         abort() ;
00118         break ;
00119     }
00120     
00121      switch (base_p) {
00122     case P_COSSIN :
00123         result *= 2*M_PI ;
00124         break ;
00125     case P_COSSIN_P :
00126         result *= 2*M_PI ;
00127         break ;
00128     default :
00129         cout << "base_p cas non prevu dans Map_af::integrale_surface" << endl ;
00130         abort() ;
00131         break ;
00132     }
00133 
00134     return (result) ;
00135 }
00136 

Generated on Tue Feb 7 01:35:17 2012 for LORENE by  doxygen 1.4.6