-
Notifications
You must be signed in to change notification settings - Fork 0
/
sim_dat.h
60 lines (48 loc) · 1.15 KB
/
sim_dat.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef SIMDAT_H
#define SIMDAT_H
#include <string>
//Global Simulation Data
struct SimDat {
SimDat(int new_dim){
dim = new_dim;
dim3 = dim*dim*dim;
x = new float[dim];
y = new float[dim];
z = new float[dim];
Bx = new float[dim3];
By = new float[dim3];
Bz = new float[dim3];
Ex = new float[dim3];
Ey = new float[dim3];
Ez = new float[dim3];
}
~SimDat(){
delete[] x;
delete[] y;
delete[] z;
delete[] Bx;
delete[] By;
delete[] Bz;
delete[] Ex;
delete[] Ey;
delete[] Ez;
}
void GetSimState (const int i, const int j, const int k, float *out) const{
int idx = i*dim*dim+j*dim+k;
out[0] = Bx[idx];
out[1] = By[idx];
out[2] = Bz[idx];
out[3] = Ex[idx];
out[4] = Ey[idx];
out[5] = Ez[idx];
}
int dim, dim3;
float * Bx,* By, * Bz;
float * Ex,* Ey, * Ez;
float * x, * y, * z;
float bbox[6];
float dx;
void set_bounds();
};
int read_simulation_data(SimDat& sd, const char* file_name);
#endif /* SIMDAT_H */