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

Last change on this file since 152 was 152, checked in by (none), 14 years ago
File size: 1.3 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 G       6.6743E-11              // m^3 kg^-1 s^-2
26
27typedef struct vector {
28        real x, y, z;
29        real unused;
30} vector;
31
32typedef struct state {
33        int particles;
34        vector * positions;
35        vector * velocities;
36        vector * accelerations;
37        real * masses;
38} TState, *AState;
39
40/* declared in "io.c" */
41void read_initial( AState state, const char *filename );
42void rand_data( AState state, int nParticles );
43
44int connect_to_server( char * servername, int portno, int protocol );
45
46void send_state( int sock, AState state );
47
48void write_state( int fd, AState state );
49
50/* declared in "compute.c" */
51inline void compute_acc( vector *rv1, vector *rv2, vector *vv1, vector *vv2, vector *av1, vector *av2, real m1, real m2 );
52
53inline void update_pos_vel( vector *rv, vector *vv, vector *av, long DT );
54
55inline void v_init( vector *v, real x, real y, real z );
56
Note: See TracBrowser for help on using the repository browser.