Commits

takaiwa committed 28109c4

parallelrun.cxx

Comments (0)

Files changed (1)

unit_test/parallelrun.cxx

 int main() {
   const int numBodies = 10000;                                  // Number of bodies
   const int numTarget = 100;                                    // Number of target points to be used for error eval
-  IMAGES = 0;                                                   // Level of periodic image tree (0 for non-periodic)
+  IMAGES = 1;                                                   // Level of periodic image tree (0 for non-periodic)
   THETA = 1 / sqrtf(4);                                         // Multipole acceptance criteria
   Bodies bodies(numBodies);                                     // Define vector of bodies
   Bodies jbodies;                                               // Define vector of source bodies
   FMM.eraseTimer("Downward");                                   // Erase entry from timer to avoid timer overlap
 
 #ifndef VTK
- if( IMAGES != 0 ) {                                            // For periodic boundary condition
-    FMM.startTimer("Set periodic");                             //  Start timer
-    jbodies = FMM.periodicBodies(bodies);                       //  Copy source bodies for all periodic images
-    FMM.stopTimer("Set periodic",FMM.printNow);                 //  Stop timer
-    FMM.eraseTimer("Set periodic");                             //  Erase entry from timer to avoid timer overlap
-  } else {                                                      // For free field boundary condition
-    jbodies = bodies;                                           //  Copy source bodies
-  }                                                             // End if for periodic boundary condition
   FMM.startTimer("Direct sum");                                 // Start timer
-  bodies.resize(numTarget);                                     // Shrink target bodies vector to save time
+  jbodies = bodies;                                             // Copy source bodies
+  FMM.sampleBodies(bodies,numTarget);                           // Shrink target bodies vector to save time
   Bodies bodies2 = bodies;                                      // Define new bodies vector for direct sum
   FMM.initTarget(bodies2);                                      // Reinitialize target values
   for( int i=0; i!=MPISIZE; ++i ) {                             // Loop over all MPI processes
     FMM.shiftBodies(jbodies);                                   //  Communicate bodies round-robin
-    FMM.evalP2P(bodies2,jbodies);                               //  Direct summation between bodies2 and jbodies2
+    FMM.evalP2P(bodies2,jbodies);                           //  Direct summation between bodies2 and jbodies2
     if(FMM.printNow) std::cout << "Direct loop   : " << i+1 << "/" << MPISIZE << std::endl;// Print loop counter
   }                                                             // End loop over all MPI processes
   FMM.stopTimer("Direct sum",FMM.printNow);                     // Stop timer