Class ChunkComputation

java.lang.Object
noaa.coastwatch.util.chunk.ChunkComputation
All Implemented Interfaces:
ChunkOperation

public class ChunkComputation extends Object implements ChunkOperation
The ChunkComputation class can be used to perform a computation on a set of input data chunks using a function and a list of chunk producers/consumers. The computation is an operation broken down into a set of calls to the perform(noaa.coastwatch.util.chunk.ChunkPosition) method that performs the computation on each chunk position. To help with testing, the computation can optionally track the time used by chunk collecting, processing, and consuming.
Since:
3.4.0
Author:
Peter Hollemans
  • Constructor Details

    • ChunkComputation

      public ChunkComputation(ChunkCollector collector, ChunkConsumer consumer, ChunkFunction function)
      Creates a new chunk computation from the specified components.
      Parameters:
      collector - the collector to use for source data.
      consumer - the consumer to push processed data to.
      function - the function to use for processing the source chunk data.
  • Method Details

    • setTracked

      public void setTracked(boolean isTracked)
      Sets the tracking flag for this computation.
      Parameters:
      isTracked - the tracking flag, true to track the chunk computation and collector/consumer times or false to not. By default the computation timing is not tracked.
    • getTrackingData

      public Map<String,Double> getTrackingData()
      Gets the time tracking data for the computation.
      Returns:
      the map of tracked quantity to time in seconds.
    • getMemory

      public long getMemory(ChunkPosition pos)
      Estimates the memory requirements for processing a chunk of data at the specified position.
      Parameters:
      pos - the position to estimate the memory usage.
      Returns:
      the memory in bytes.
      Since:
      3.8.1
    • perform

      public void perform(ChunkPosition pos)
      Description copied from interface: ChunkOperation
      Performs an operation on the chunks at the specified position.
      Specified by:
      perform in interface ChunkOperation
      Parameters:
      pos - the chunk position to act on.