00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 char et_bin_bhns_extr_phi_C[] = "$Header: /cvsroot/Lorene/C++/Source/Etoile/et_bin_bhns_extr_phi.C,v 1.1 2004/11/30 20:50:48 k_taniguchi Exp $" ;
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #include <math.h>
00046
00047
00048 #include "et_bin_bhns_extr.h"
00049 #include "utilitaires.h"
00050
00051 double Et_bin_bhns_extr::phi_longest_rad(double x_max, double y_max) const {
00052
00053
00054
00055
00056
00057
00058 Map_et& mp_et = dynamic_cast<Map_et&>(mp) ;
00059
00060 const Valeur& ff0 = mp_et.get_ff() ;
00061 const Valeur& gg0 = mp_et.get_gg() ;
00062
00063 Valeur fff = ff0 ;
00064 Valeur ggg = gg0 ;
00065 Valeur dff = fff.dsdp() ;
00066 Valeur dgg = ggg.dsdp() ;
00067
00068 double ppp = M_PI/2. ;
00069 double ptmp ;
00070 int mm ;
00071 double dp = 1. ;
00072 double diff ;
00073 double diff_prev ;
00074 double ss ;
00075
00076 while ( dp > 1.e-15 ) {
00077
00078 diff = 1. ;
00079 mm = 0 ;
00080 dp = 0.1 * dp ;
00081
00082 diff_prev = ( dff.val_point(0,1.,M_PI/2.,ppp)
00083 + dgg.val_point(0,1.,M_PI/2.,ppp) )
00084 * ( 1. + ff0.val_point(0,1.,M_PI/2.,ppp)
00085 + gg0.val_point(0,1.,M_PI/2.,ppp)
00086 - x_max * cos(ppp) - y_max * sin(ppp) )
00087 - ( 1. + ff0.val_point(0,1.,M_PI/2.,ppp)
00088 + gg0.val_point(0,1.,M_PI/2.,ppp) )
00089 * ( - x_max * sin(ppp) + y_max * cos(ppp) ) ;
00090
00091 if ( diff_prev > 0. ) {
00092 ss = 1. ;
00093 }
00094 else {
00095 ss = -1. ;
00096 }
00097
00098 while ( diff > 1.e-15 ) {
00099
00100 mm++ ;
00101 ptmp = ppp + mm * dp ;
00102
00103 diff = ss * ( ( dff.val_point(0,1.,M_PI/2.,ptmp)
00104 + dgg.val_point(0,1.,M_PI/2.,ptmp) )
00105 * ( 1. + ff0.val_point(0,1.,M_PI/2.,ptmp)
00106 + gg0.val_point(0,1.,M_PI/2.,ptmp)
00107 - x_max * cos(ptmp) - y_max * sin(ptmp) )
00108 - ( 1. + ff0.val_point(0,1.,M_PI/2.,ptmp)
00109 + gg0.val_point(0,1.,M_PI/2.,ptmp) )
00110 * ( - x_max * sin(ptmp) + y_max * cos(ptmp) ) ) ;
00111
00112 }
00113 ppp += ss * (mm - 1) * dp ;
00114
00115 }
00116
00117 return ppp ;
00118
00119 }