1 // there is a current limitation of 16 particles per cell
2 // (this structure use to be a simple linked-list of particles but, due to
3 // improved cache locality, we get a huge performance increase by copying
4 // particles instead of referencing them)
12 public float[] m_density;
14 public Cell(int _id) {
17 this.m_p = new Vec3[16];
18 this.m_hv = new Vec3[16];
19 this.m_v = new Vec3[16];
20 this.m_a = new Vec3[16];
21 this.m_density = new float[16];
26 Cell copy = new Cell(this.m_id);
27 copy.m_numPars = this.m_numPars;
28 copy.m_p = new Vec3[16];
29 for(int i = 0; i < this.m_numPars; i++) {
30 copy.m_p[i] = this.m_p[i].clone();
32 copy.m_hv = new Vec3[16];
33 for(int i = 0; i < this.m_numPars; i++) {
34 copy.m_hv[i] = this.m_hv[i].clone();
36 copy.m_v = new Vec3[16];
37 for(int i = 0; i < this.m_numPars; i++) {
38 copy.m_v[i] = this.m_v[i].clone();
40 copy.m_a = new Vec3[16];
41 for(int i = 0; i < this.m_numPars; i++) {
42 copy.m_a[i] = this.m_a[i].clone();
44 copy.m_density = new float[16];
45 for(int i = 0; i < this.m_numPars; i++) {
46 copy.m_density[i] = this.m_density[i];
52 for(int i = 0; i < this.m_p.length; i++) {
53 this.m_p[i] = new Vec3();
55 for(int i = 0; i < this.m_hv.length; i++) {
56 this.m_hv[i] = new Vec3();
58 for(int i = 0; i < this.m_v.length; i++) {
59 this.m_v[i] = new Vec3();
61 for(int i = 0; i < this.m_a.length; i++) {
62 this.m_a[i] = new Vec3();
64 for(int i = 0; i < this.m_density.length; i++) {
65 this.m_density[i] = 0;