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 value to the double array at the specified index.
    void
    alloc(int size)
    Ensure the AtomicDoubleArray instance is greater than or equal to size.
    atomicDoubleArrayFactory(AtomicDoubleArray.AtomicDoubleArrayImpl atomicDoubleArrayImpl, int threads, int size)
    Factory method to create an AtomicDoubleArray instance.
    double
    get(int index)
    Get the value of the array at the specified index.
    void
    reduce(int lb, int ub)
    Perform reduction between the given lower bound (lb) and upper bound (up) if necessary.
    void
    reduce(ParallelTeam parallelTeam, int lb, int ub)
    Perform reduction between the given lower bound (lb) and upper bound (up) using a ParallelTeam.
    void
    reset(int threadID, int lb, int ub)
    Reset the double array to Zero.
    void
    reset(ParallelTeam parallelTeam, int lb, int ub)
    Reset the double array to Zero using a ParallelTeam.
    void
    scale(int threadID, int index, double value)
    Scale the double array at the specified index by the given value.
    void
    set(int threadID, int index, double value)
    Set the double array at the specified index to the given value.
    int
    Get the size of the array.
    void
    sub(int threadID, int index, double value)
    Subtract value to the double array at the specified index.
  • Method Details

    • atomicDoubleArrayFactory

      static AtomicDoubleArray atomicDoubleArrayFactory(AtomicDoubleArray.AtomicDoubleArrayImpl atomicDoubleArrayImpl, int threads, int size)
      Factory method to create an AtomicDoubleArray instance.
      Parameters:
      atomicDoubleArrayImpl - The implementation to use.
      threads - The number of threads.
      size - The size of the array.
      Returns:
      An AtomicDoubleArray instance.
    • add

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

      void alloc(int size)
      Ensure the AtomicDoubleArray instance is greater than or equal to size.
      Parameters:
      size - The size of the array.
    • get

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

      void reduce(int lb, int ub)
      Perform reduction between the given lower bound (lb) and upper bound (up) if necessary.
      Parameters:
      lb - the lower bound.
      ub - the upper bound.
    • reduce

      void reduce(ParallelTeam parallelTeam, int lb, int ub)
      Perform reduction between the given lower bound (lb) and upper bound (up) using a ParallelTeam.
      Parameters:
      parallelTeam - ParallelTeam to use.
      lb - the lower bound.
      ub - the upper bound.
    • reset

      void reset(int threadID, int lb, int ub)
      Reset the double array to Zero.
      Parameters:
      threadID - the thread ID.
      lb - the lower bound.
      ub - the upper bound.
    • reset

      void reset(ParallelTeam parallelTeam, int lb, int ub)
      Reset the double array to Zero using a ParallelTeam.
      Parameters:
      parallelTeam - ParallelTeam to use.
      lb - the lower bound.
      ub - the upper bound.
    • scale

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

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

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

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