#include <time.h>

struct nwdata {
    long simlen;          /* number of iterations for denominator         */
    long n_batches;        /* number of external batches */
    long ext_batch;        /* size of external batch */
    int int_batch;             /* internal batch size */
    int n_classes;         /* number of traffic classes                    */
    int n_links;           /* number of links                              */
    int maxlen;            /* max(initdata.n_max[])+1                     */
    int targetclass;   
    int currentclass;
    int **b;             /* bandwith requirements b[class_ind][link_ind] */
    int *cap;            /* capacities for the links cap[link_ind]       */
    double *rho;                /* load vector rho[class_ind]            */
};


struct initdata {
    int rlen;             /* length of route */
    int *route;           /* array of links used by the simulated class */
    int **classes;        /* classes[rlen][n_classes], 
			     classes used by the links in route         */
    int *nc;              /* nc[rlen], nc[j] is  number of 
			     classes using link j                       */
    int *n_max;           /* n_max[n_classes], max nr of class k calls 
			     fitting in the network                     */
    double **f;           /* f[n_classes][n_max[k]+1] , cdf of 
			     truncated Poisson                          */
    double ***m;          /* m[ rlen ][ nc[i] ][ cap[route[i]]+1 ]      */
    double ***q;          /* q[ rlen ][ nc[i] ][ cap[route[i]]+1 ]      */
    double ****qq;        /* qq[ rlen ][ nc[i] ][ cap[route[i]]+1 ][ nms[][][]  ] */

    int ***nms;           /* nms[ rlen ][ nc[i] ][ cap[route[i]]+1 ]   */
    int *maxprob_elem_f;  /* [n_classes] */ 
    int ***maxprob_elem_qq;     /* [ rlen ][ nc[i] ][ cap[route[i]]+1 ]  */
    double **p;         /* [rlen]  */
    double *vj;         /* vj[rlen]   */

};

struct results {
    clock_t c0;
    clock_t c1;
    clock_t c2;
    long tot_loops;
    long gam_hits;    /* hits in allowed state space in current batch */
    long hits;        /* number of hits in the allowed state space */
    long *hits_in_B; /* number of hits in the blocking states of each class */
    double *bl;         /* bl[rlen]   */
    double *blsq;       /* blsq[rlen]   */

    double *bl_tmp;
    double gamma_tmp;
    double gamma_sum;
    double *beta_tmp;

};

struct tmpdata {
    int *n;
    int *occup;
    long *na;
    long *nt;
    long *nt_tot;
    double *r_num;
    double *bkstd;
    long *lag;
    long *optall;
};

