Interface AtomicDoubleArray

All Known Implementing Classes:
AdderDoubleArray, MultiDoubleArray, PJDoubleArray

public interface AtomicDoubleArray
This interface abstracts away the implementation of maintaining a 1D double array that is operated on by multiple threads.
Since:
1.0
Author:
Michael J. Schnieders
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    AtomicDoubleArray implementations (ADDER, MULTI, PJ).
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(int threadID, int index, double value)
    Add a value to the double array at the specified index.
    void
    alloc(int size)
    Ensure the AtomicDoubleArray instance has at least the specified size.
    double
    get(int index)
    Get the value of the array at the specified index.
    void
    reduce(int lowerBound, int upperBound)
    Perform reduction between the given lower and upper bounds, if necessary.
    void
    reduce(ParallelTeam parallelTeam, int lowerBound, int upperBound)
    Perform reduction between the given bounds using a ParallelTeam.
    void
    reset(int threadID, int lowerBound, int upperBound)
    Reset the double array values to zero within the specified bounds.
    void
    reset(ParallelTeam parallelTeam, int lowerBound, int upperBound)
    Reset the double array values to zero within the specified bounds using a ParallelTeam.
    void
    scale(int threadID, int index, double value)
    Scale the value of the double array at the specified index.
    void
    set(int threadID, int index, double value)
    Set the value of the double array at the specified index.
    int
    Get the current size of the array.
    void
    sub(int threadID, int index, double value)
    Subtract a value from the double array at the specified index.
  • Method Details

    • add

      void add(int threadID, int index, double value)
      Add a value to the double array at the specified index.
      Parameters:
      threadID - The thread ID.
      index - The index of the array.
      value - The value to add.
    • alloc

      void alloc(int size)
      Ensure the AtomicDoubleArray instance has at least the specified size.
      Parameters:
      size - The required size of the array.
    • get

      double get(int index)
      Get the value of the array at the specified index. Note: The `reduce` method should be called first when using the MULTI implementation.
      Parameters:
      index - The index of the array.
      Returns:
      The value at the specified index.
    • reduce

      void reduce(int lowerBound, int upperBound)
      Perform reduction between the given lower and upper bounds, if necessary.
      Parameters:
      lowerBound - The lower bound of the range.
      upperBound - The upper bound of the range.
    • reduce

      void reduce(ParallelTeam parallelTeam, int lowerBound, int upperBound)
      Perform reduction between the given bounds using a ParallelTeam.
      Parameters:
      parallelTeam - The ParallelTeam to use.
      lowerBound - The lower bound of the range.
      upperBound - The upper bound of the range.
    • reset

      void reset(int threadID, int lowerBound, int upperBound)
      Reset the double array values to zero within the specified bounds.
      Parameters:
      threadID - The thread ID.
      lowerBound - The lower bound of the reset range.
      upperBound - The upper bound of the reset range.
    • reset

      void reset(ParallelTeam parallelTeam, int lowerBound, int upperBound)
      Reset the double array values to zero within the specified bounds using a ParallelTeam.
      Parameters:
      parallelTeam - The ParallelTeam to use.
      lowerBound - The lower bound of the reset range.
      upperBound - The upper bound of the reset range.
    • scale

      void scale(int threadID, int index, double value)
      Scale the value of the double array at the specified index.
      Parameters:
      threadID - The thread ID.
      index - The index of the array.
      value - The value to scale by.
    • set

      void set(int threadID, int index, double value)
      Set the value of the double array at the specified index.
      Parameters:
      threadID - The thread ID.
      index - The index of the array.
      value - The value to set.
    • size

      int size()
      Get the current size of the array.
      Returns:
      The size of the array.
    • sub

      void sub(int threadID, int index, double value)
      Subtract a value from the double array at the specified index.
      Parameters:
      threadID - The thread ID.
      index - The index of the array.
      value - The value to subtract.