X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=course%2Fsemester2%2Fpprog%2Fassignment1%2Fopenmp%2Fnbody.h~;fp=course%2Fsemester2%2Fpprog%2Fassignment1%2Fopenmp%2Fnbody.h~;h=ebab8927b69b50e13deca244639eb0795a7b180a;hb=bb7fa31ea517a1fba064e723b37d5b8d8bd7dd72;hp=0000000000000000000000000000000000000000;hpb=20979b1c07eda73b7f86b2fe8cb66eb58d959e04;p=matches%2Fhonours.git diff --git a/course/semester2/pprog/assignment1/openmp/nbody.h~ b/course/semester2/pprog/assignment1/openmp/nbody.h~ new file mode 100644 index 00000000..ebab8927 --- /dev/null +++ b/course/semester2/pprog/assignment1/openmp/nbody.h~ @@ -0,0 +1,48 @@ +#ifndef _NBODY_OPENMP_H +#define _NBODY_OPENMP_H + +/** + * @file nbody.h + * @purpose OpenMP version of N-Body simulator, declarations + * @author Sam Moore (20503628) - 2012 + */ + +#include "../single-thread/nbody.h" //Include original code +#include + + +#undef SINGLE_THREADED +#define OMP_THREADED + + +#define CRAPPY_VERSION + +// Replace default macros with thread-safe functions +#undef Simulation_Run +void Simulation_Run(int argc, char ** argv); +//#undef QuitProgram +//#define QuitProgram(x) break + +#undef BeforeDraw +#define BeforeDraw() (void)0 // Do nothing (apparently this is how to do nothing with a macro) +//void BeforeDraw(); + +#undef AfterDraw +#define AfterDraw() (void)0 +//void AfterDraw(); + +omp_lock_t graphics_lock; + + +void Compute(void); +void Compute2(void); + +//#define OVER_ENGINEERED +// define to (my original approach) manually split the System array (same as pthread version) between threads +// Manually splitting the System array is not required in openmp, since "#pragma omp for" automatically does it +// I still like doing it this way, since you can explicitly see what each thread is doing, but it would probably lose me marks. +// However I can't bring myself to delete it. Hence, compromise. + +#endif //_NBODY_OPENMP_H + +//EOF