CP_core_IPS.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # pragma once
  2. // only for glib stuff so fix me... (gint, g boolean)
  3. // make it only need glib could be better
  4. #include <gtk/gtk.h>
  5. #include "mt64.h" // Pseudo Random Number Generation 64bit MT Lib
  6. #include <math.h> // math to transform random n from continuos to discrete
  7. #include <time.h> // time library to initialize random generator with time seed
  8. // Lattice size // 2D Latice of 256 x 256 sites
  9. #define X_SIZE 256
  10. #define Y_SIZE 256
  11. // Default mortality value
  12. #define MORTALITY 0.58
  13. // Simulation data (state - parameters)
  14. struct simulation
  15. {
  16. // Latice configuration
  17. int lattice_configuration[X_SIZE][Y_SIZE];
  18. gint run; // time handler tag
  19. gboolean running; // Are we running?
  20. gboolean initialized; // Have we been initialized?
  21. int generation_time; // generations simulated
  22. double occupancy; // lattice occupancy
  23. float dead_rate; // particle mortality
  24. };
  25. // Define a new data type
  26. typedef struct simulation IPSmodel;
  27. // Prepare default parameters and Random number generator
  28. void prepare_IPS(IPSmodel *s);
  29. // Initialize the lattice
  30. void initialize_IPS(IPSmodel *s);
  31. // Update the lattice (Monte Carlo)
  32. void update_IPS(IPSmodel *s);
  33. // Some simulation Ctrl callbacks
  34. void show_about(GtkWidget *widget, gpointer data);