Module simpa.core

Class ParallelTracker

java.lang.Object
simpa.core.api.track.ParallelTracker

public class ParallelTracker extends Object
Class that sets up the BlockingExecutor for queue based multi threaded tracking and adds the tracking tasks to the queue.
  • Constructor Details

    • ParallelTracker

      public ParallelTracker()
      Constructs a ParallelTracker with all available processor cores and sets up the BlockingExecutor.
    • ParallelTracker

      public ParallelTracker(int nThreads)
      Constructs a ParallelTracker with the given number of processor threads and sets up the BlockingExecutor.
      Parameters:
      nThreads - The amount of threads to use.
  • Method Details

    • addCopyToQueue

      public void addCopyToQueue(ParticleTrackerTask task)
      Adds the task to the queue. The potential provider object in the task will be deep copied, so all the task can share the same instance and still the executing threads will not interfere.
      Parameters:
      task - A tracking task to be added to the queue.
    • addToQueue

      public void addToQueue(ParticleTrackerTask task)
      Adds the task to the queue. It is the responsibility of the caller to make sure the PotentialProvider objects inside each task are unique, so the threads of the queue will not interfere with each other.
      Parameters:
      task - A tracking task to be added to the queue.
    • waitTermination

      public void waitTermination()
      Awaits the termination of all tasks on all threads.
    • shutdown

      public void shutdown()
      Shuts down the underlying thread pool.