Commits

Alexander Konovalov  committed 1c35650

Removed r5 and rf from Particle struct.

  • Participants
  • Parent commits b2289fe

Comments (0)

Files changed (2)

File core/core.cpp

 
 void FindNearest3Neighbours(size_t p) {
     std::vector<Particle>& particles = data.particles;
+    std::vector<double>& r5 = data.tmp1;
 
     double minDistance = 0;
     
     for (size_t j1 = 0; j1 < 99; j1++) {
         size_t i = particles[p].numf[j1];
 
-        if (i != p) {
-            particles[i].r5 = (particles[i].p - particles[p].p).Magnitude();
-        }
+        r5[i] = (particles[i].p - particles[p].p).Magnitude();
     }
 
     for (size_t i = 0; i < 3; i++) {
             size_t j = particles[p].numf[j1];
 
             if (j != p) {
-                if ((particles[j].r5 < rt) && (particles[j].r5 > minDistance)) {
+                if ((r5[j] < rt) && (r5[j] > minDistance)) {
                     particles[p].num5[i] = j;
-                    rt = particles[j].r5;
+                    rt = r5[j];
                 }
             }
         }
         
         size_t k = particles[p].num5[i];
-        minDistance = particles[k].r5;
+        minDistance = r5[k];
     }
 }
 
     Vector w51;
     Vector w52;
     double gdto5;
-    double r5;
 
     size_t numf[99];
     Vector wf;
     Vector wf1;
     Vector wf2;
     double gdtof;
-    double rf;
 
     uint8_t red;
     uint8_t green;
         , w51(0, 0, 0)
         , w52(0, 0, 0)
         , gdto5(0)
-        , r5(0)
         , wf(0, 0, 0)
         , wf1(0, 0, 0)
         , wf2(0, 0, 0)
         , gdtof(0)
-        , rf(0)
         , red(0xFF)
         , green(0xFF)
         , blue(0xFF)