#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

#include "../src/param.h"
#include "../src/tdef.h"
#include "../src/common.c"

#include "../src/libutility/utility.h"

/* #undef VERBOSE */

int main(argc,argv)
int argc;
char **argv;
{
   FILE          *fpin;
   int            SWAPBYTES;
   
   if(argc<2)
    {
      fprintf(stderr,"Use: %s AMIGA_file\n",*argv);
      exit(1);
    }

   if((fpin=fopen(argv[1],"rb"))==NULL)
    {
      printf("Cannot open %s", argv[1]);
      exit(1);
    }
   
   /* read AMIGA header */
   read_amiga_header(fpin, &io, &SWAPBYTES);
   
   
   /* print some information */
   fprintf(stderr,"%s\n\n",io.header.header);
   fprintf(stderr,"multi_mass            = %d\n",io.header.multi_mass);
   fprintf(stderr,"double_precision      = %d\n",io.header.double_precision);
   fprintf(stderr,"hydro                 = %d\n",io.header.hydro);
   fprintf(stderr,"magneto               = %d\n",io.header.magneto);
   fprintf(stderr,"VERSION               = %g\n",io.header.version);
   fprintf(stderr,"BUILT                 = %d\n",io.header.built);
   fprintf(stderr,"no_part               = %ld\n",io.header.no_part);
   fprintf(stderr,"boxsize               = %g\n",io.header.boxsize);
   fprintf(stderr,"omega0                = %g\n",io.header.omega0);
   fprintf(stderr,"lambda0               = %g\n",io.header.lambda0);   
   fprintf(stderr,"z_initial             = %g\n",1./io.header.a_initial - 1.);
   fprintf(stderr,"z_current             = %g\n",1./io.header.a_current - 1.);
   fprintf(stderr,"no_species            = %ld\n",io.header.no_species);
   fprintf(stderr,"no_vpart              = %g\n",io.header.no_vpart);
   fprintf(stderr,"min_weight            = %g\n",io.header.min_weight);
   fprintf(stderr,"max_weight            = %g\n",io.header.max_weight);
   fprintf(stderr,"pmass                 = %g\n",io.header.pmass);
   fprintf(stderr,"t_unit                = %g\n",io.header.t_unit);
   fprintf(stderr,"omegab                = %g\n",io.header.omegab);
   fprintf(stderr,"gamma                 = %g\n",io.header.gamma);
   fprintf(stderr,"T_init                = %g\n",io.header.T_init);
   fprintf(stderr,"no_timestep           = %d\n",io.header.no_timestep);
   

   fclose(fpin);
}

