X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=course%2Fsemester2%2Fpprog%2Fassignment1%2Fsingle-thread%2Fnbody.h;fp=course%2Fsemester2%2Fpprog%2Fassignment1%2Fsingle-thread%2Fnbody.h;h=a9bfec44fd218360e0518b8e6617d54f1bd42a3e;hb=20979b1c07eda73b7f86b2fe8cb66eb58d959e04;hp=4d53f9d07c62f7c8c44546a061814f1faba411f5;hpb=47b0dba32b8e0e0deedfbfc6db49b65b930e2889;p=matches%2Fhonours.git diff --git a/course/semester2/pprog/assignment1/single-thread/nbody.h b/course/semester2/pprog/assignment1/single-thread/nbody.h index 4d53f9d0..a9bfec44 100644 --- a/course/semester2/pprog/assignment1/single-thread/nbody.h +++ b/course/semester2/pprog/assignment1/single-thread/nbody.h @@ -33,9 +33,11 @@ else \ //Macro to be overwritten in multithreaded versions, called before the graphics is allowed to draw anything #define BeforeDraw() \ +System_Compute(&universe); \ +universe.steps += 1; \ if (options.verbosity != 0 && universe.steps % options.verbosity == 0) \ DisplayStatistics(); \ -System_Compute(&universe); + @@ -93,14 +95,14 @@ typedef struct const char * input; // initial body field const char * output; // file to write final positions / velocities of bodies to const char * program; // program name - unsigned num_threads; // number of worker threads to spawn (must be greater than 1 for any to be spawned) - unsigned nested_threads; // number of threads to nest computations with (must be greater than 1 for any to be spawned) - unsigned num_steps; // number of steps to run before stopping (run indefinately if equal to zero) - unsigned timeout; // number of seconds to run before stopping (run indefinately if equal to zero) + int num_threads; // number of worker threads to spawn (must be greater than 1 for any to be spawned) + int nested_threads; // number of threads to nest computations with (must be greater than 1 for any to be spawned) + int num_steps; // number of steps to run before stopping (run indefinately if less than zero) + int timeout; // number of seconds to run before stopping (run indefinately if less than zero) bool draw_graphics; // whether or not to actually draw graphics bool pedantic_graphics; // whether the graphics thread will synchronise with the computation thread (true) or just draw as fast as possible (false) bool print_positions; // print positions of bodies to stdout on every step - unsigned verbosity; // print statistics every number of steps indicated by this variable + int verbosity; // print statistics every number of steps indicated by this variable clock_t start_clock; // clock cycles done when simulation starts struct timeval start_time; // time at which simulation starts } Options;