forked from wsx-ucb/cs267-hw2.2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
34 lines (28 loc) · 920 Bytes
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef __CS267_COMMON_H__
#define __CS267_COMMON_H__
#include <cstdint>
#include <mpi.h>
// Program Constants
#define nsteps 1000
#define savefreq 10
#define density 0.0005
#define mass 0.01
#define cutoff 0.01
#define min_r (cutoff / 100)
#define dt 0.0005
// Particle Data Structure
typedef struct particle_t {
uint64_t id; // Particle ID
double x; // Position X
double y; // Position Y
double vx; // Velocity X
double vy; // Velocity Y
double ax; // Acceleration X
double ay; // Acceleration Y
} particle_t;
extern MPI_Datatype PARTICLE;
// Simulation routine
void init_simulation(particle_t* parts, int num_parts, double size, int rank, int num_procs);
void simulate_one_step(particle_t* parts, int num_parts, double size, int rank, int num_procs);
void gather_for_save(particle_t* parts, int num_parts, double size, int rank, int num_procs);
#endif