[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

details ChunkedArrayTmpFile< N, T > Class Template Reference VIGRA

#include <vigra/multi_array_chunked.hxx>

Inheritance diagram for ChunkedArrayTmpFile< N, T >:
ChunkedArray< N, T >

Public Member Functions

 ChunkedArrayTmpFile (shape_type const &shape, shape_type const &chunk_shape=shape_type(), ChunkedArrayOptions const &options=ChunkedArrayOptions(), std::string const &path="")
 Construct with given 'shape', 'chunk_shape' and 'options'. More...
 
virtual std::size_t overheadBytesPerChunk () const
 Bytes of main memory needed to manage a single chunk.
 
- Public Member Functions inherited from ChunkedArray< N, T >
std::string backend () const
 Return the class that implements this ChunkedArray.
 
iterator begin ()
 Create a scan-order iterator for the entire chunked array.
 
const_iterator begin () const
 Create a read-only scan-order iterator for the entire chunked array.
 
template<unsigned int M>
MultiArrayView< N-1, T,
ChunkedArrayTag
bind (difference_type_1 index) const
 Create a lower dimensional view to the chunked array. More...
 
MultiArrayView< N-1, T,
ChunkedArrayTag
bindAt (MultiArrayIndex dim, MultiArrayIndex index) const
 Create a lower dimensional view to the chunked array. More...
 
MultiArrayView< N-1, T,
ChunkedArrayTag
bindInner (difference_type_1 index) const
 Create a lower dimensional view to the chunked array. More...
 
template<int M, class Index >
MultiArrayView< N-M, T,
ChunkedArrayTag
bindInner (const TinyVector< Index, M > &d) const
 Create a lower dimensional view to the chunked array. More...
 
MultiArrayView< N-1, T,
ChunkedArrayTag
bindOuter (difference_type_1 index) const
 Create a lower dimensional view to the chunked array. More...
 
template<int M, class Index >
MultiArrayView< N-M, T,
ChunkedArrayTag
bindOuter (const TinyVector< Index, M > &d) const
 Create a lower dimensional view to the chunked array. More...
 
std::size_t cacheMaxSize () const
 Get the number of chunks the cache will hold. More...
 
int cacheSize () const
 Number of chunks currently fitting into the cache.
 
const_iterator cbegin () const
 Create a read-only scan-order iterator for the entire chunked array.
 
const_iterator cend () const
 Create the end iterator for read-only scan-order iteration over the entire chunked array.
 
template<class U , class Stride >
void checkoutSubarray (shape_type const &start, MultiArrayView< N, U, Stride > &subarray) const
 Copy an ROI of the chunked array into an ordinary MultiArrayView. More...
 
chunk_iterator chunk_begin (shape_type const &start, shape_type const &stop)
 Create an iterator over all chunks intersected by the given ROI.
 
chunk_const_iterator chunk_begin (shape_type const &start, shape_type const &stop) const
 Create a read-only iterator over all chunks intersected by the given ROI.
 
chunk_const_iterator chunk_cbegin (shape_type const &start, shape_type const &stop) const
 Create a read-only iterator over all chunks intersected by the given ROI.
 
chunk_const_iterator chunk_cend (shape_type const &start, shape_type const &stop) const
 Create the end iterator for read-only iteration over all chunks intersected by the given ROI.
 
chunk_iterator chunk_end (shape_type const &start, shape_type const &stop)
 Create the end iterator for iteration over all chunks intersected by the given ROI.
 
chunk_const_iterator chunk_end (shape_type const &start, shape_type const &stop) const
 Create the end iterator for read-only iteration over all chunks intersected by the given ROI.
 
virtual shape_type chunkArrayShape () const
 Number of chunks along each coordinate direction.
 
shape_type chunkShape (shape_type const &chunk_index) const
 Find the shape of the chunk indexed by 'chunk_index'. More...
 
shape_type const & chunkShape () const
 Return the global chunk shape. More...
 
shape_type chunkStart (shape_type const &global_start) const
 Find the chunk that contains array element 'global_start'.
 
shape_type chunkStop (shape_type global_stop) const
 Find the chunk that is beyond array element 'global_stop'. More...
 
template<class U , class Stride >
void commitSubarray (shape_type const &start, MultiArrayView< N, U, Stride > const &subarray)
 Copy an ordinary MultiArrayView into an ROI of the chunked array. More...
 
const_view_type const_subarray (shape_type const &start, shape_type const &stop) const
 Create a read-only view to the specified ROI. More...
 
std::size_t dataBytes () const
 Bytes of main memory occupied by the array's data. More...
 
std::size_t dataBytesPerChunk () const
 Number of data bytes in an uncompressed chunk.
 
iterator end ()
 Create the end iterator for scan-order iteration over the entire chunked array.
 
const_iterator end () const
 Create the end iterator for read-only scan-order iteration over the entire chunked array.
 
value_type getItem (shape_type const &point) const
 Read the array element at index 'point'. More...
 
bool isInside (shape_type const &p) const
 Check if the given point is in the array domain.
 
template<class U , class C1 >
bool operator!= (MultiArrayView< N, U, C1 > const &rhs) const
 Check if two arrays differ in at least one element.
 
template<class U , class C1 >
bool operator== (MultiArrayView< N, U, C1 > const &rhs) const
 Check if two arrays are elementwise equal.
 
std::size_t overheadBytes () const
 Bytes of main memory needed to manage the chunked storage.
 
void releaseChunks (shape_type const &start, shape_type const &stop, bool destroy=false)
 
void setCacheMaxSize (std::size_t c)
 Set the number of chunks the cache will hold. More...
 
void setItem (shape_type const &point, value_type const &v)
 Write the array element at index 'point'. More...
 
shape_type const & shape () const
 Return the shape in this array.
 
MultiArrayIndex size () const
 Return the number of elements in this array.
 
view_type subarray (shape_type const &start, shape_type const &stop)
 Create a view to the specified ROI. More...
 
const_view_type subarray (shape_type const &start, shape_type const &stop) const
 Create a read-only view to the specified ROI. More...
 

Detailed Description

template<unsigned int N, class T>
class vigra::ChunkedArrayTmpFile< N, T >

Implement ChunkedArray as a collection of chunks that can be swapped out into a temporary file when asleep.

#include <vigra/multi_array_chunked.hxx>
Namespace: vigra

The present implementation uses a memory-mapped sparse file to store the chunks. A sparse file is created on Linux using the O_TRUNC flag (this seems to be the default file behavior on Linux anyway), and on Windows by calling DeviceIoControl(file_handle, FSCTL_SET_SPARSE,...) after file creation.

The file is automatically deleted upon closing. On Windows, this happens because the file was opened with FILE_FLAG_DELETE_ON_CLOSE in combination with the flag FILE_ATTRIBUTE_TEMPORARY, which tells the OS to avoid writing the file to disk if possible. (However, judging from the timings, something is still written, or cleanup takes considerable time.) On Linux, automated deletion is achieved via fileno(tmpfile()).

Constructor & Destructor Documentation

ChunkedArrayTmpFile ( shape_type const &  shape,
shape_type const &  chunk_shape = shape_type(),
ChunkedArrayOptions const &  options = ChunkedArrayOptions(),
std::string const &  path = "" 
)
explicit

Construct with given 'shape', 'chunk_shape' and 'options'.

If the optional 'path' is given, the file is created in this directory. Otherwise (default), the path specified by the $TMP or $TEMP environment variables (in that order) is used.


The documentation for this class was generated from the following file:

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.11.1 (Fri May 19 2017)