#include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef SOLARIS #include #endif #ifdef LINUX #include #endif #include "ctk.h" /*---------*/ /* globals */ /*---------*/ volatile extern TRACKINGPAR Pars; int setupTrack (struct tms *timesThen, STAT * ctkStat, SHELLHIT * shellhit) { /* declarations */ int i, in, siz; char str[132]; /* initialize */ printf ("pi=%f\n", PI); printf ("rad2deg=%f\n", RAD2DEG); /* zap the statistics structure */ bzero ((void *) ctkStat, sizeof (STAT)); ctkinit (); Pars.mode2 = 0; //LR /* faculty function lookup */ printf ("\n"); printf ("faculty function\n"); printf ("\n"); Pars.fac[0] = 1; Pars.fac[1] = 1; for (i = 2; i < MAXFACULTY; i++) Pars.fac[i] = (long long) i *Pars.fac[i - 1]; for (i = 1; i < MAXFACULTY; i++) { printf ("fac[%2i]=%20lld ", i, Pars.fac[i]); printf ("check %i\n", (int) (Pars.fac[i] / Pars.fac[i - 1])); }; printf ("sizeof (long long) = %li bytes\n", sizeof (long long)); printf ("sizeof (long) = %li bytes\n", sizeof (long)); printf ("sizeof (int) = %li bytes\n", sizeof (int)); printf ("\n"); /* sanity checks */ if (Pars.useCCEnergy == 1 && Pars.useSegEnergy == 1) { printf ("error: only one of Pars.useCCEnergy and Pars.useSegEnergy can be true\n"); exit (1); }; /* print tracking parameters that will be used */ ctk_pr_trackPar (); /* start timer */ times ((struct tms *) timesThen); /* initialize the rotation matrices */ /* should be done better in future */ /* #include "crmat_assign.h" */ #ifdef LINUX sprintf (str, "crmat.LINUX"); #endif #ifdef SOLARIS sprintf (str, "crmat.SOLARIS"); #endif in = open (str, O_RDONLY, 0); if (in > 0) printf ("%s is open (input) binary format\n", str); else { printf ("could not open %s\n", str); exit (1); }; siz = read (in, (char *) Pars.crmat, sizeof (Pars.crmat)); printf ("read %i bytes into Pars.crmat\n", siz); close (in); /* done */ return (0); }