X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=simulation.cpp;h=97cee6ee610fc1f6f37202b1e5c9715e95cec2e1;hb=1b2999c4407ef8419fb89b66b843b7141caff4da;hp=19f2b928b247f4557b24414f80d9eeda029743da;hpb=0745215b9a29658a36c8c040e8afada43b9137bb;p=rsem.git diff --git a/simulation.cpp b/simulation.cpp index 19f2b92..97cee6e 100644 --- a/simulation.cpp +++ b/simulation.cpp @@ -31,7 +31,7 @@ using namespace std; -int N; +READ_INT_TYPE N; int model_type, M, m; Refs refs; @@ -138,19 +138,19 @@ void simulate(char* modelF, char* resultsF) { fin.close(); for (int i = 1; i <= M; i++) theta[i] = theta[i] / denom * (1.0 - theta[0]); - int tmp2140 = 0; + READ_INT_TYPE resimulation_count = 0; //simulating... model.startSimulation(&sampler, theta); - for (int i = 0; i < N; i++) { - while (!model.simulate(i, read, sid)) { ++tmp2140; }//; + for (READ_INT_TYPE i = 0; i < N; i++) { + while (!model.simulate(i, read, sid)) { ++resimulation_count; } read.write(n_os, os); ++counts[sid]; - if ((i + 1) % 1000000 == 0 && verbose) printf("GEN %d\n", i + 1); + if ((i + 1) % 1000000 == 0 && verbose) cout<<"GEN "<< i + 1<< endl; } model.finishSimulation(); - printf("Total number of resimulation is %d\n", tmp2140); + cout<< "Total number of resimulation is "<< resimulation_count<< endl; } void writeResFiles(char* outFN) { @@ -237,7 +237,7 @@ int main(int argc, char* argv[]) { //read model type from modelF fi = fopen(argv[2], "r"); if (fi == NULL) { fprintf(stderr, "Cannot open %s! It may not exist.\n", argv[2]); exit(-1); } - fscanf(fi, "%d", &model_type); + assert(fscanf(fi, "%d", &model_type) == 1); fclose(fi); theta = new double[M + 1];