diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2016-03-30 21:20:07 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2016-03-30 21:20:07 +0200 |
commit | 523f6b460dcf1f864656a9a6ccc2a54d52f385c6 (patch) | |
tree | dd457448a2518ce45ac36ba427c12491f01d7e76 /src/physics.h | |
parent | 745d5a072d8669d1bc35e7c1f28b75b3484542e8 (diff) |
Split common.h.
Diffstat (limited to 'src/physics.h')
-rw-r--r-- | src/physics.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/physics.h b/src/physics.h new file mode 100644 index 0000000..533d8a4 --- /dev/null +++ b/src/physics.h @@ -0,0 +1,46 @@ +#ifndef _PHYSICS_H +#define _PHYSICS_H + +#include "common.h" +#include "itc.h" + +typedef struct { + size_t width, height, depth; + size_t zstr, ystr, xstr, size; // strides in no. of points (not bytes) + size_t zstr1, ystr1, xstr1, size1; // same as above but for associated + // scalar fields + float spacing; // in meters +} phy_field_info; + +typedef struct { + float *E; + float *H; +} phy_field_em; + +enum { + PHY_CMD_QUIT, + PHY_CMD_PAUSE, + PHY_CMD_RESUME, + PHY_CMD_STEP +}; + +typedef struct { + phy_field_info field_info; + phy_field_em fields[3]; + float *field_eps, *field_mu; //permittivity and permeability + float time; + + // UI stuff + bool running; + itc_chan ctl; + SDL_mutex *rotate_lock; +} phy_sim; + +void phy_sim_destroy(phy_sim *sim); +int phy_sim_create(phy_sim *sim); +void phy_sim_compute_const_fields(phy_sim *sim); +void phy_sim_step(phy_sim *sim, float dt); + +int phy_thread(phy_sim *sim); + +#endif // _PHYSICS_H |