Ignore:
Timestamp:
May 19, 2005, 10:02:13 AM (20 years ago)
Author:
cmv
Message:

separation main prog de test et code cmv 19/05/05

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaExt/XAstroPack/mollweide.cc

    r2615 r2730  
    1 //#define TEST_MOLLWEIDE
    21#include <stdlib.h>
    32#include <stdio.h>
     
    54#include "sopnamsp.h"
    65#include "mollweide.h"
    7 
    8 #if defined(TEST_MOLLWEIDE)
    9 #include "timing.h"
    10 double _t;
    11 #endif
    126
    137/*! \ingroup XAstroPack
     
    9993 *ymoll = M_SQRT2*sin(t0);
    10094
    101  #if defined(TEST_MOLLWEIDE)
    102  _t = tini;
    103  #endif
    104 
    10595 return t0;
    10696}
     
    149139}
    150140
    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.