tsimulation.h - granular - granular dynamics simulation (HTM) git clone git://src.adamsgaard.dk/granular (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- tsimulation.h (1340B) --- 1 #ifndef GRANULAR_SIMULATION_ 2 #define GRANULAR_SIMULATION_ 3 4 #define DEFAULT_SIMULATION_NAME "unnamed" 5 6 #include <stdio.h> 7 #include "grain.h" 8 9 /* Simulation settings */ 10 struct simulation { 11 12 /* simulation name to use for output files */ 13 char name[255]; 14 15 /* grain sorting grid */ 16 size_t nd[3]; 17 double origo[3]; 18 double L[3]; 19 20 /* temporal state [s] */ 21 double t; 22 double t_end; 23 double dt; 24 double dt_file; 25 size_t n_file; 26 size_t iter; 27 double t_file; 28 29 /* grains */ 30 size_t ng; 31 struct grain *grains; 32 }; 33 34 struct simulation sim_new(void); 35 void sim_defaults(struct simulation *sim); 36 void sim_free(struct simulation *sim); 37 38 void sim_add_grain(struct simulation *sim, struct grain *g); 39 void sim_read_grains(struct simulation *sim, FILE *stream); 40 41 void sim_print_grains(const struct simulation *sim, FILE *stream); 42 void sim_print_grains_vtk(const struct simulation *sim, FILE *stream); 43 void sim_print_grains_energy(const struct simulation *sim, FILE *stream); 44 void sim_write_output_files(struct simulation *sim); 45 46 void sim_force_reset(struct simulation *sim); 47 void sim_add_acceleration_scalar(struct simulation *sim, double acc, int dimension); 48 void sim_set_timestep(struct simulation *sim); 49 void sim_detect_contacts(struct simulation *sim); 50 void sim_step_time(struct simulation *sim); 51 void sim_run_time_loop(struct simulation *sim); 52 53 #endif