Changeset 2730 in Sophya for trunk/SophyaExt/XAstroPack/mollweide.cc
- Timestamp:
- May 19, 2005, 10:02:13 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/XAstroPack/mollweide.cc
r2615 r2730 1 //#define TEST_MOLLWEIDE2 1 #include <stdlib.h> 3 2 #include <stdio.h> … … 5 4 #include "sopnamsp.h" 6 5 #include "mollweide.h" 7 8 #if defined(TEST_MOLLWEIDE)9 #include "timing.h"10 double _t;11 #endif12 6 13 7 /*! \ingroup XAstroPack … … 99 93 *ymoll = M_SQRT2*sin(t0); 100 94 101 #if defined(TEST_MOLLWEIDE)102 _t = tini;103 #endif104 105 95 return t0; 106 96 } … … 149 139 } 150 140 151 ///////////////////////////////////////152 ////////// Programme de test //////////153 ///////////////////////////////////////154 #if defined(TEST_MOLLWEIDE)155 int main()156 {157 FILE *file = fopen("mollw.data","w");158 FILE *file2 = fopen("mollw2.data","w");159 int i,npoints=250000;160 double tvrai,lon,lat,x,y,tcalc,a;161 double longitude,latitude,tll,txy;162 InitTim();163 164 tll=txy=0.;165 for(i=0;i<=npoints;i++) {166 //tvrai = 1.57078;167 tvrai = (double)i*(M_PI_2) /(double)npoints;168 a = 2.*tvrai+sin(2.*tvrai);169 lat = asin(a/M_PI);170 tcalc = MollWeide_XY(0.,lat,&x,&y);171 if(fabs(tcalc-tvrai)>tll) {tll = fabs(tcalc-tvrai); txy=tvrai;}172 if(file) fprintf(file,"%e %e %e %e %e\n",tvrai,tcalc,_t,a,tcalc-tvrai);173 }174 printf("Maximum difference: %e for t=%.10e=Pi/2-%.10e\n",tll,txy,M_PI_2-txy);175 if(file) fclose(file);176 PrtTim("--- End of first testing ---");177 178 for(lon=0.;lon<360.;lon+=2.5) for(lat=-90.;lat<=90.1;lat+=2.5) {179 txy = MollWeide_XY(lon*M_PI/180.,lat*M_PI/180.,&x,&y);180 tll = MollWeide_LL(x,y,&longitude,&latitude);181 longitude *= 180./M_PI;182 latitude *= 180./M_PI;183 if(file2) fprintf(file2,"%e %e %e %e %e %e %e %e %e %e\n"184 ,lon,lat,x,y,longitude,latitude,txy,tll,longitude-lon,latitude-lat);185 }186 if(file2) fclose(file2);187 PrtTim("--- End of second testing ---");188 return 0;189 }190 #endif
Note:
See TracChangeset
for help on using the changeset viewer.