source: proiecte/SolarSim/C/Serial/src/SolarSim.h @ 152

Last change on this file since 152 was 152, checked in by (none), 14 years ago
File size: 1.4 KB
Line 
1/* SolarSim.h */
2#include <stdio.h>
3#include <stdlib.h>
4#include <string.h>
5#include <math.h>
6#include <fcntl.h>
7#include <omp.h>
8
9#if __INTEL_COMPILER
10#include <pmmintrin.h>
11#endif
12
13#define _SINGLE_PRECISION_
14//#define _DOUBLE_PRECISION_
15
16#if defined _DOUBLE_PRECISION_
17typedef double real;
18#elif defined _SINGLE_PRECISION_
19typedef float real;
20#else
21        #error "Must have either _DOUBLE_PRECISION_ or _SINGLE_PRECISION_ defined."
22#endif
23
24/* simulation constants */
25//#define SIM_STEPS (24*365*25) // 250 years
26#define G       6.6743E-11      // m^3 kg^-1 s^-2
27//#define DT    3600            // one hour
28//#define SAVE  (24)            // 1 day
29
30typedef struct vector {
31        real x, y, z;
32        real unused;
33} vector;
34
35typedef struct state {
36        int particles;
37        vector * positions;
38        vector * velocities;
39        vector * accelerations;
40        real * masses;
41} TState, *AState;
42
43/* declared in "io.c" */
44void read_initial( AState state, const char *filename );
45
46int connect_to_server( char * servername, int portno, int protocol );
47
48void send_state( int sock, AState state );
49
50void write_state( int fd, AState state );
51
52/* declared in "compute.c" */
53inline void compute_acc( vector *rv1, vector *rv2, vector *vv1, vector *vv2, vector *av1, vector *av2, real m1, real m2 );
54
55inline void update_pos_vel( vector *rv, vector *vv, vector *av, long DT );
56
57inline void v_init( vector *v, real x, real y, real z );
58
Note: See TracBrowser for help on using the repository browser.