Package noaa.coastwatch.util.chunk
Class ChunkComputation
java.lang.Object
noaa.coastwatch.util.chunk.ChunkComputation
- All Implemented Interfaces:
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 Summary
ConstructorDescriptionChunkComputation
(ChunkCollector collector, ChunkConsumer consumer, ChunkFunction function) Creates a new chunk computation from the specified components. -
Method Summary
Modifier and TypeMethodDescriptionlong
getMemory
(ChunkPosition pos) Estimates the memory requirements for processing a chunk of data at the specified position.Gets the time tracking data for the computation.void
perform
(ChunkPosition pos) Performs an operation on the chunks at the specified position.void
setTracked
(boolean isTracked) Sets the tracking flag for this computation.
-
Constructor Details
-
ChunkComputation
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
Gets the time tracking data for the computation.- Returns:
- the map of tracked quantity to time in seconds.
-
getMemory
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
Description copied from interface:ChunkOperation
Performs an operation on the chunks at the specified position.- Specified by:
perform
in interfaceChunkOperation
- Parameters:
pos
- the chunk position to act on.
-