-
Notifications
You must be signed in to change notification settings - Fork 4
/
ParticleSet3D.h
44 lines (34 loc) · 1.09 KB
/
ParticleSet3D.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
#pragma once
class LevelSet3D;
class Particle3D;
class StableFluid3D;
class ParticleSet3D
{
const double RESEED_THRESHOLD = 3.0;
const int PARTICLES_PER_NODE = 64;
public:
ParticleSet3D(int xResolution, int yResolution, int zResolution);
~ParticleSet3D();
void Update(const StableFluid3D& g0, const StableFluid3D& g1, const StableFluid3D& g2, double timestep);
void UpdateThreaded(const StableFluid3D& g0, const StableFluid3D& g1, const StableFluid3D& g2, double timestep);
void Reseed(const LevelSet3D& levelSet);
typedef std::list<Particle3D*>::iterator Iterator;
Iterator begin(int i, int j, int k) const;
Iterator end(int i, int j, int k) const;
private:
struct WorkerData
{
int iBegin, iEnd;
const StableFluid3D *g0, *g1, *g2;
double timestep;
};
void UpdateWorker(WorkerData data);
int sizeX, sizeY, sizeZ;
int gridLength;
std::list<Particle3D*>* grid1;
std::list<Particle3D*>* grid2;
//turns a grid index into an array index
int getindex(int i, int j, int k) const;
//turns an array index into a grid index
void getposition(int index, int& x, int& y, int& z) const;
};