Field3D
SparseFile::Reference< Data_T > Class Template Reference

#include <SparseFile.h>

Public Types

typedef Sparse::SparseBlock< Data_T > * BlockPtrs
 
typedef ReferencePtr
 

Public Member Functions

float averageLoads () const
 Returns the average number of loads per accessed block in this file, for cache statistics.
 
int blockSize (int blockIdx) const
 Returns the number of bytes used by the data in the block.
 
void closeFile ()
 Closes the file. Will be re-opened as needed.
 
void decBlockRef (int blockIdx)
 Decrement reference count on a block.
 
bool fileIsOpen ()
 Checks if the file used by this reference is open already.
 
void incBlockRef (int blockIdx)
 Increment reference count on a block, indicates the block is currently in use, so prevents it from being unloaded.
 
void loadBlock (int blockIdx)
 Loads the block with the given index into memory. We don't pass in a reference to where the data should go since this is already know in the blocks data member.
 
long long int memSize () const
 Memory use for the Reference.
 
int numLoadedBlocks () const
 Returns the total number of blocks that are currently loaded, for statistics.
 
void openFile ()
 Opens the file. This is done just before the first request to loadBlock. This is delayed so that the original file open has closed the file and doesn't cause any Hdf5 hiccups.
 
void resetCacheStatistics ()
 Resets counts of total block loads.
 
void setNumBlocks (int numBlocks)
 Sets the number of blocks used by the SparseField we're supporting.
 
int totalLoadedBlocks () const
 Returns the total number of blocks that were ever loaded (max 1 per block, not the number of blocks), for statistics.
 
int totalLoads () const
 Returns the total number of loads of the blocks of this file, for cache statistics.
 
void unloadBlock (int blockIdx)
 Unloads the block with the given index from memory.
 
 ~Reference ()
 Destructor.
 

Static Public Member Functions

static Ptr create (const std::string a_filename, const std::string a_layerPath)
 Returns a shared pointer to a reference. Preferred way of creating References.
 

Public Attributes

std::vector< int > blockLoaded
 Whether each block is loaded. We don't use bools since vector<bool> is weird.
 
boost::mutex * blockMutex
 Allocated array of mutexes, one per block, to lock each block individually, for guaranteeing thread-safe updates of the ref counts.
 
int blockMutexSize
 Size of the mutex array. Used as modulus base.
 
BlockPtrs blocks
 Pointers to each block. This is so we can go in and manipulate them as we please.
 
std::vector< bool > blockUsed
 Flags of whether the blocks have been accessed since they were last considered for deallocation by the Second-chance/Clock caching system.
 
std::vector< int > fileBlockIndices
 Index in file for each block.
 
std::string filename
 
std::string layerPath
 
std::vector< int > loadCounts
 Per-block counts of the number of times each block has been loaded, for cache statistics.
 
int numBlocks
 
int numVoxels
 
int occupiedBlocks
 
std::vector< int > refCounts
 Per-block counts of the number of current references to the blocks. If a block's ref count is non-zero, then the block shouldn't be unloaded.
 
int valuesPerBlock
 

Private Types

typedef boost::mutex Mutex
 

Private Member Functions

Referenceoperator= (const Reference &o)
 Assignment operator. Clears ref counts and rebuilds mutex array.
 
 Reference (const Reference &o)
 Copy constructor. Clears ref counts and rebuilds mutex array.
 
 Reference (const std::string filename, const std::string layerPath)
 Constructor. Requires the filename and layer path of the field to be known.
 

Private Attributes

hid_t m_fileHandle
 Holds the Hdf5 handle to the file.
 
Hdf5Util::H5ScopedGopen m_layerGroup
 Hold the group containing the data open for the duration of the Reference's existence.
 
Mutex m_mutex
 Mutex to prevent two threads from modifying conflicting data.
 
size_t m_numActiveBlocks
 Number of currently active blocks.
 
IArchivePtr m_ogArchive
 Ogawa archive.
 
OgIGroupPtr m_ogLayerGroup
 Ogawa layer group.
 
OgSparseDataReader< Data_T > * m_ogReader
 Pointer to the ogawa reader. NULL at construction time. Created in openFile().
 
boost::shared_ptr< OgSparseDataReader< Data_T > > m_ogReaderPtr
 Shared pointer to the ogawa reader.
 
OgIGroupPtr m_ogRoot
 Ogawa archive root.
 
SparseDataReader< Data_T > * m_reader
 Pointer to the reader object. NULL at construction time. Created in openFile().
 

Detailed Description

template<class Data_T>
class SparseFile::Reference< Data_T >

Handles information about and block loading for a single SparseField as referenced on disk

Definition at line 105 of file SparseFile.h.

Member Typedef Documentation

◆ Ptr

template<class Data_T >
Reference* SparseFile::Reference< Data_T >::Ptr

Definition at line 116 of file SparseFile.h.

◆ BlockPtrs

template<class Data_T >
Sparse::SparseBlock<Data_T>* SparseFile::Reference< Data_T >::BlockPtrs

Definition at line 120 of file SparseFile.h.

◆ Mutex

template<class Data_T >
boost::mutex SparseFile::Reference< Data_T >::Mutex
private

Definition at line 215 of file SparseFile.h.

Constructor & Destructor Documentation

◆ ~Reference()

template<class Data_T >
SparseFile::Reference< Data_T >::~Reference ( )

Destructor.

Definition at line 572 of file SparseFile.h.

573{
574 closeFile();
575
576 if (m_reader) {
577 delete m_reader;
578 }
579
580 if (blockMutex)
581 delete [] blockMutex;
582}
void closeFile()
Closes the file. Will be re-opened as needed.
Definition SparseFile.h:710
SparseDataReader< Data_T > * m_reader
Pointer to the reader object. NULL at construction time. Created in openFile().
Definition SparseFile.h:239
boost::mutex * blockMutex
Allocated array of mutexes, one per block, to lock each block individually, for guaranteeing thread-s...
Definition SparseFile.h:156

◆ Reference() [1/2]

template<class Data_T >
SparseFile::Reference< Data_T >::Reference ( const std::string filename,
const std::string layerPath )
private

Constructor. Requires the filename and layer path of the field to be known.

Definition at line 559 of file SparseFile.h.

561 : filename(a_filename), layerPath(a_layerPath),
563 blockMutex(NULL), m_fileHandle(-1), m_reader(NULL), m_ogReader(NULL),
565{
566 /* Empty */
567}
std::string layerPath
Definition SparseFile.h:128
OgSparseDataReader< Data_T > * m_ogReader
Pointer to the ogawa reader. NULL at construction time. Created in openFile().
Definition SparseFile.h:245
hid_t m_fileHandle
Holds the Hdf5 handle to the file.
Definition SparseFile.h:231
size_t m_numActiveBlocks
Number of currently active blocks.
Definition SparseFile.h:257

◆ Reference() [2/2]

template<class Data_T >
SparseFile::Reference< Data_T >::Reference ( const Reference< Data_T > & o)
private

Copy constructor. Clears ref counts and rebuilds mutex array.

Definition at line 587 of file SparseFile.h.

588{
589 m_ogReaderPtr.reset();
590 m_ogReader = NULL;
591 m_reader = NULL;
592 blockMutex = NULL;
593 *this = o;
594}
boost::shared_ptr< OgSparseDataReader< Data_T > > m_ogReaderPtr
Shared pointer to the ogawa reader.
Definition SparseFile.h:242

Member Function Documentation

◆ create()

template<class Data_T >
Reference< Data_T >::Ptr SparseFile::Reference< Data_T >::create ( const std::string a_filename,
const std::string a_layerPath )
static

Returns a shared pointer to a reference. Preferred way of creating References.

Definition at line 660 of file SparseFile.h.

662{
663 return Ptr(new Reference(a_filename, a_layerPath));
664}
Reference(const std::string filename, const std::string layerPath)
Constructor. Requires the filename and layer path of the field to be known.
Definition SparseFile.h:559

◆ fileIsOpen()

template<class Data_T >
bool SparseFile::Reference< Data_T >::fileIsOpen ( )

Checks if the file used by this reference is open already.

Definition at line 669 of file SparseFile.h.

670{
671 return m_fileHandle >= 0;
672}

◆ setNumBlocks()

template<class Data_T >
void SparseFile::Reference< Data_T >::setNumBlocks ( int numBlocks)

Sets the number of blocks used by the SparseField we're supporting.

Definition at line 677 of file SparseFile.h.

678{
679 boost::mutex::scoped_lock lock(m_mutex);
680
681 // Store number of blocks in member variable
682 numBlocks = a_numBlocks;
683
685 blockLoaded.resize(numBlocks, 0);
686#if !F3D_NO_BLOCKS_ARRAY
688#endif
689 blockUsed.resize(numBlocks, false);
690 loadCounts.resize(numBlocks, 0);
691 refCounts.resize(numBlocks, 0);
692 if (blockMutex)
693 delete[] blockMutex;
694#if F3D_SHORT_MUTEX_ARRAY
695# if F3D_NO_BLOCKS_ARRAY
697# else
698 blockMutexSize = std::min(blocks.size(),
699 static_cast<size_t>(F3D_MUTEX_ARRAY_SIZE));
700# endif
701 blockMutex = new boost::mutex[blockMutexSize];
702#else
703 blockMutex = new boost::mutex[numBlocks];
704#endif
705}
#define F3D_MUTEX_ARRAY_SIZE
Definition SparseFile.h:65
std::vector< bool > blockUsed
Flags of whether the blocks have been accessed since they were last considered for deallocation by th...
Definition SparseFile.h:145
BlockPtrs blocks
Pointers to each block. This is so we can go in and manipulate them as we please.
Definition SparseFile.h:141
std::vector< int > fileBlockIndices
Index in file for each block.
Definition SparseFile.h:135
Mutex m_mutex
Mutex to prevent two threads from modifying conflicting data.
Definition SparseFile.h:254
int blockMutexSize
Size of the mutex array. Used as modulus base.
Definition SparseFile.h:159
std::vector< int > blockLoaded
Whether each block is loaded. We don't use bools since vector<bool> is weird.
Definition SparseFile.h:138
std::vector< int > refCounts
Per-block counts of the number of current references to the blocks. If a block's ref count is non-zer...
Definition SparseFile.h:152
std::vector< int > loadCounts
Per-block counts of the number of times each block has been loaded, for cache statistics.
Definition SparseFile.h:148
void resize(int n)
Alloc data.

References F3D_MUTEX_ARRAY_SIZE.

◆ openFile()

template<class Data_T >
void SparseFile::Reference< Data_T >::openFile ( )

Opens the file. This is done just before the first request to loadBlock. This is delayed so that the original file open has closed the file and doesn't cause any Hdf5 hiccups.

Definition at line 537 of file SparseFile.cpp.

538{
539 using namespace Exc;
540 using namespace Hdf5Util;
541
542 boost::mutex::scoped_lock lock_A(m_mutex);
543
544 // check that the file wasn't already opened before obtaining the lock
545 if (fileIsOpen()) {
546 return;
547 }
548
549 // First try Ogawa ---
550
551 m_ogArchive.reset(new Alembic::Ogawa::IArchive(filename));
552 if (m_ogArchive->isValid()) {
553 m_ogRoot.reset(new OgIGroup(*m_ogArchive));
554 m_ogLayerGroup.reset(new OgIGroup(m_ogRoot->findGroup(layerPath)));
555 if (m_ogLayerGroup->isValid()) {
556 // Allocate the reader
558 numVoxels,
560 true));
562 // Done
563 return;
564 }
565 }
566
567 // Then, try HDF5 ---
568
569 {
570 // Hold the global lock
572 // Open the file
573 m_fileHandle = H5Fopen(filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
574 if (m_fileHandle >= 0) {
575 // Open the layer group
577 if (m_layerGroup.id() < 0) {
578 Msg::print(Msg::SevWarning, "In SparseFile::Reference::openFile: "
579 "Couldn't find layer group " + layerPath +
580 " in .f3d file ");
581 throw FileIntegrityException(filename);
582 }
583 } else {
584 Msg::print(Msg::SevWarning, "In SparseFile::Reference::openFile: "
585 "Couldn't open HDF5 file ");
586 throw NoSuchFileException(filename);
587 }
588 }
589
590 // Re-allocate reader
591 if (m_reader) {
592 delete m_reader;
593 }
597}
FIELD3D_NAMESPACE_OPEN FIELD3D_API boost::recursive_mutex g_hdf5Mutex
Definition Hdf5Util.cpp:67
boost::recursive_mutex::scoped_lock GlobalLock
Definition Hdf5Util.h:78
hid_t id() const
Query the hid_t value.
Definition Hdf5Util.h:100
void open(hid_t parentLocation, const std::string &name)
Definition Hdf5Util.h:210
This class gets used by SparseFieldIO and SparseFileManager to read the block data....
OgIGroupPtr m_ogRoot
Ogawa archive root.
Definition SparseFile.h:249
Hdf5Util::H5ScopedGopen m_layerGroup
Hold the group containing the data open for the duration of the Reference's existence.
Definition SparseFile.h:235
IArchivePtr m_ogArchive
Ogawa archive.
Definition SparseFile.h:247
OgIGroupPtr m_ogLayerGroup
Ogawa layer group.
Definition SparseFile.h:251
bool fileIsOpen()
Checks if the file used by this reference is open already.
Definition SparseFile.h:669
Namespace for Exception objects.
Definition Exception.h:57
Contains utility functions and classes for Hdf5 files.
Definition Hdf5Util.h:86
@ SevWarning
Definition Log.h:68
FIELD3D_API void print(Severity severity, const std::string &message)
Sends the string to the assigned output, prefixing the message with the severity.
Definition Log.cpp:70

References g_hdf5Mutex, Msg::print(), and Msg::SevWarning.

◆ closeFile()

template<class Data_T >
void SparseFile::Reference< Data_T >::closeFile ( )

Closes the file. Will be re-opened as needed.

Definition at line 710 of file SparseFile.h.

711{
712 if (m_fileHandle >= 0) {
713 if (H5Fclose(m_fileHandle) < 0) {
714 Msg::print("In ~Reference(): Error closing file " + filename);
715 }
716 }
717}

References Msg::print().

◆ loadBlock()

template<class Data_T >
void SparseFile::Reference< Data_T >::loadBlock ( int blockIdx)

Loads the block with the given index into memory. We don't pass in a reference to where the data should go since this is already know in the blocks data member.

Definition at line 498 of file SparseFile.cpp.

499{
500 boost::mutex::scoped_lock lock(m_mutex);
501
502 // Allocate the block
503#if F3D_NO_BLOCKS_ARRAY
504 blocks[blockIdx].resize(numVoxels);
505 assert(blocks[blockIdx].data != NULL);
506 // Read the data
507 assert(m_reader || m_ogReader);
508 if (m_reader) {
509 m_reader->readBlock(fileBlockIndices[blockIdx], *blocks[blockIdx].data);
510 } else {
511 m_ogReader->readBlock(fileBlockIndices[blockIdx], blocks[blockIdx].data);
512 }
513 // Mark block as loaded
514 blockLoaded[blockIdx] = 1;
515 // Track count
517#else
518 blocks[blockIdx]->resize(numVoxels);
519 assert(blocks[blockIdx]->data != NULL);
520 // Read the data
521 assert(m_reader || m_ogReader);
522 if (m_reader) {
523 m_reader->readBlock(fileBlockIndices[blockIdx], *blocks[blockIdx]->data);
524 } else {
525 m_ogReader->readBlock(fileBlockIndices[blockIdx], blocks[blockIdx]->data);
526 }
527 // Mark block as loaded
528 blockLoaded[blockIdx] = 1;
529 // Track count
531#endif
532}

◆ unloadBlock()

template<class Data_T >
void SparseFile::Reference< Data_T >::unloadBlock ( int blockIdx)

Unloads the block with the given index from memory.

Definition at line 722 of file SparseFile.h.

723{
724 // Deallocate the block
725#if F3D_NO_BLOCKS_ARRAY
726 blocks[blockIdx].clear();
727#else
728 blocks[blockIdx]->clear();
729#endif
730 // Mark block as unloaded
731 blockLoaded[blockIdx] = 0;
732 // Track count
734#if 0
735 // If no active blocks, close the file. De-activate for now.
736 if (m_numActiveBlocks == 0) {
737 closeFile();
738 }
739#endif
740}
void clear()
Remove data.

◆ incBlockRef()

template<class Data_T >
void SparseFile::Reference< Data_T >::incBlockRef ( int blockIdx)

Increment reference count on a block, indicates the block is currently in use, so prevents it from being unloaded.

Definition at line 745 of file SparseFile.h.

746{
747#if F3D_SHORT_MUTEX_ARRAY
748 boost::mutex::scoped_lock lock(blockMutex[blockIdx % blockMutexSize]);
749#else
750 boost::mutex::scoped_lock lock(blockMutex[blockIdx]);
751#endif
752 ++refCounts[blockIdx];
753}

◆ decBlockRef()

template<class Data_T >
void SparseFile::Reference< Data_T >::decBlockRef ( int blockIdx)

Decrement reference count on a block.

Definition at line 758 of file SparseFile.h.

759{
760#if F3D_SHORT_MUTEX_ARRAY
761 boost::mutex::scoped_lock lock(blockMutex[blockIdx % blockMutexSize]);
762#else
763 boost::mutex::scoped_lock lock(blockMutex[blockIdx]);
764#endif
765 --refCounts[blockIdx];
766}

◆ blockSize()

template<class Data_T >
int SparseFile::Reference< Data_T >::blockSize ( int blockIdx) const

Returns the number of bytes used by the data in the block.

Definition at line 771 of file SparseFile.h.

772{
773 return numVoxels * sizeof(Data_T);
774}

◆ totalLoads()

template<class Data_T >
int SparseFile::Reference< Data_T >::totalLoads ( ) const

Returns the total number of loads of the blocks of this file, for cache statistics.

Definition at line 779 of file SparseFile.h.

780{
781 std::vector<int>::const_iterator i = loadCounts.begin();
782 std::vector<int>::const_iterator end = loadCounts.end();
783 int numLoads = 0;
784 for (; i != end; ++i)
785 numLoads += *i;
786
787 return numLoads;
788}

◆ numLoadedBlocks()

template<class Data_T >
int SparseFile::Reference< Data_T >::numLoadedBlocks ( ) const

Returns the total number of blocks that are currently loaded, for statistics.

Definition at line 793 of file SparseFile.h.

794{
795 std::vector<int>::const_iterator i = blockLoaded.begin();
796 std::vector<int>::const_iterator end = blockLoaded.end();
797 int numBlockCounter = 0;
798 for (; i != end; ++i)
799 if (*i)
800 numBlockCounter++;
801
802 return numBlockCounter;
803}

◆ totalLoadedBlocks()

template<class Data_T >
int SparseFile::Reference< Data_T >::totalLoadedBlocks ( ) const

Returns the total number of blocks that were ever loaded (max 1 per block, not the number of blocks), for statistics.

Definition at line 808 of file SparseFile.h.

809{
810 std::vector<int>::const_iterator i = loadCounts.begin();
811 std::vector<int>::const_iterator li = blockLoaded.begin();
812 std::vector<int>::const_iterator end = loadCounts.end();
813 int numBlockCounter = 0;
814
815 if (blockLoaded.size() == 0) {
816 for (; i != end; ++i)
817 if (*i)
818 numBlockCounter++;
819 } else {
820 assert(loadCounts.size() == blockLoaded.size());
821
822 for (; i != end; ++i, ++li)
823 if (*i || *li)
824 numBlockCounter++;
825 }
826
827 return numBlockCounter;
828}

◆ averageLoads()

template<class Data_T >
float SparseFile::Reference< Data_T >::averageLoads ( ) const

Returns the average number of loads per accessed block in this file, for cache statistics.

Definition at line 833 of file SparseFile.h.

834{
835 std::vector<int>::const_iterator i = loadCounts.begin();
836 std::vector<int>::const_iterator end = loadCounts.end();
837 int numLoads = 0, numBlockCounter = 0;
838 for (; i != end; ++i) {
839 if (*i) {
840 numLoads += *i;
841 numBlockCounter++;
842 }
843 }
844
845 return (float)numLoads / std::max(1, numBlockCounter);
846}

◆ resetCacheStatistics()

template<class Data_T >
void SparseFile::Reference< Data_T >::resetCacheStatistics ( )

Resets counts of total block loads.

Definition at line 851 of file SparseFile.h.

852{
853 std::vector<int>::iterator li = loadCounts.begin();
854 std::vector<int>::iterator lend = loadCounts.end();
855 for (; li != lend; ++li)
856 *li = 0;
857}

◆ memSize()

template<class Data_T >
long long int SparseFile::Reference< Data_T >::memSize ( ) const

Memory use for the Reference.

Definition at line 863 of file SparseFile.h.

864{
865 boost::mutex::scoped_lock lock(m_mutex);
866
867 return sizeof(*this) +
868 fileBlockIndices.capacity() * sizeof(int) +
869 blockLoaded.capacity() * sizeof(int) +
871 blocks.capacity() * sizeof(Sparse::SparseBlock<Data_T>*) +
872#endif
873 blockUsed.capacity() * sizeof(bool) +
874 loadCounts.capacity() * sizeof(int) +
875 refCounts.capacity() * sizeof(int) +
877 blockMutexSize * sizeof(boost::mutex) +
878#else
879 numBlocks * sizeof(boost::mutex) +
880#endif
882}
#define F3D_SHORT_MUTEX_ARRAY
Definition SparseFile.h:64
#define F3D_NO_BLOCKS_ARRAY
Definition SparseFile.h:66
Storage for one individual block of a SparseField.
Definition SparseFile.h:79

References F3D_NO_BLOCKS_ARRAY, and F3D_SHORT_MUTEX_ARRAY.

◆ operator=()

template<class Data_T >
Reference< Data_T > & SparseFile::Reference< Data_T >::operator= ( const Reference< Data_T > & o)
private

Assignment operator. Clears ref counts and rebuilds mutex array.

Definition at line 600 of file SparseFile.h.

601{
602 if (this == &o) {
603 return *this;
604 }
605
606 // Copy public member variables (where appropriate)
607 filename = o.filename;
608 layerPath = o.layerPath;
609 valuesPerBlock = o.valuesPerBlock;
610 numVoxels = o.numVoxels;
611 occupiedBlocks = o.occupiedBlocks;
612 fileBlockIndices = o.fileBlockIndices;
613 blockLoaded = o.blockLoaded;
614 blocks = o.blocks;
615 blockUsed = o.blockUsed;
616 loadCounts = o.loadCounts;
617 refCounts = o.refCounts;
618 if (blockMutex)
619 delete[] blockMutex;
620#if F3D_SHORT_MUTEX_ARRAY
621# if F3D_NO_BLOCKS_ARRAY
623# else
624 blockMutexSize = std::min(static_cast<int>(blocks.size()),
626# endif
627 blockMutex = new boost::mutex[blockMutexSize];
628#else
629 blockMutex = new boost::mutex[blocks.size()];
630#endif
631
632#if 0
633 // MW: Should this be copying the file handle? Never seems to happen,
634 // but it also seems bad. Ifdef'ing out for now.
635 // Copy private member variables (where appropriate)
636 m_fileHandle = o.m_fileHandle;
637 // Don't copy id, let hdf5 generate a new one.
638 if (m_fileHandle >= 0) {
640 }
641#else
642 m_fileHandle = -1;
643#endif
644
645 // Re-allocate reader
646 if (m_reader)
647 delete m_reader;
648 m_reader = NULL;
649
650 m_ogReaderPtr.reset();
651 m_ogReader = NULL;
652
653 return *this;
654}

References SparseFile::Reference< Data_T >::blockLoaded, SparseFile::Reference< Data_T >::blocks, SparseFile::Reference< Data_T >::blockUsed, F3D_MUTEX_ARRAY_SIZE, SparseFile::Reference< Data_T >::fileBlockIndices, SparseFile::Reference< Data_T >::filename, SparseFile::Reference< Data_T >::layerPath, SparseFile::Reference< Data_T >::loadCounts, SparseFile::Reference< Data_T >::m_fileHandle, SparseFile::Reference< Data_T >::numVoxels, SparseFile::Reference< Data_T >::occupiedBlocks, SparseFile::Reference< Data_T >::refCounts, and SparseFile::Reference< Data_T >::valuesPerBlock.

Member Data Documentation

◆ filename

template<class Data_T >
std::string SparseFile::Reference< Data_T >::filename

◆ layerPath

template<class Data_T >
std::string SparseFile::Reference< Data_T >::layerPath

◆ valuesPerBlock

template<class Data_T >
int SparseFile::Reference< Data_T >::valuesPerBlock

◆ numVoxels

template<class Data_T >
int SparseFile::Reference< Data_T >::numVoxels

◆ numBlocks

template<class Data_T >
int SparseFile::Reference< Data_T >::numBlocks

Definition at line 131 of file SparseFile.h.

◆ occupiedBlocks

template<class Data_T >
int SparseFile::Reference< Data_T >::occupiedBlocks

◆ fileBlockIndices

template<class Data_T >
std::vector<int> SparseFile::Reference< Data_T >::fileBlockIndices

Index in file for each block.

Definition at line 135 of file SparseFile.h.

Referenced by SparseFile::Reference< Data_T >::operator=(), and SparseField< Data_T >::setupReferenceBlocks().

◆ blockLoaded

template<class Data_T >
std::vector<int> SparseFile::Reference< Data_T >::blockLoaded

Whether each block is loaded. We don't use bools since vector<bool> is weird.

Definition at line 138 of file SparseFile.h.

Referenced by SparseFile::Reference< Data_T >::operator=().

◆ blocks

template<class Data_T >
BlockPtrs SparseFile::Reference< Data_T >::blocks

Pointers to each block. This is so we can go in and manipulate them as we please.

Definition at line 141 of file SparseFile.h.

Referenced by SparseFile::Reference< Data_T >::operator=(), and SparseField< Data_T >::setupReferenceBlocks().

◆ blockUsed

template<class Data_T >
std::vector<bool> SparseFile::Reference< Data_T >::blockUsed

Flags of whether the blocks have been accessed since they were last considered for deallocation by the Second-chance/Clock caching system.

Definition at line 145 of file SparseFile.h.

Referenced by SparseFile::Reference< Data_T >::operator=().

◆ loadCounts

template<class Data_T >
std::vector<int> SparseFile::Reference< Data_T >::loadCounts

Per-block counts of the number of times each block has been loaded, for cache statistics.

Definition at line 148 of file SparseFile.h.

Referenced by SparseFile::Reference< Data_T >::operator=().

◆ refCounts

template<class Data_T >
std::vector<int> SparseFile::Reference< Data_T >::refCounts

Per-block counts of the number of current references to the blocks. If a block's ref count is non-zero, then the block shouldn't be unloaded.

Definition at line 152 of file SparseFile.h.

Referenced by SparseFile::Reference< Data_T >::operator=().

◆ blockMutex

template<class Data_T >
boost::mutex* SparseFile::Reference< Data_T >::blockMutex

Allocated array of mutexes, one per block, to lock each block individually, for guaranteeing thread-safe updates of the ref counts.

Definition at line 156 of file SparseFile.h.

◆ blockMutexSize

template<class Data_T >
int SparseFile::Reference< Data_T >::blockMutexSize

Size of the mutex array. Used as modulus base.

Definition at line 159 of file SparseFile.h.

◆ m_fileHandle

template<class Data_T >
hid_t SparseFile::Reference< Data_T >::m_fileHandle
private

Holds the Hdf5 handle to the file.

Definition at line 231 of file SparseFile.h.

Referenced by SparseFile::Reference< Data_T >::operator=().

◆ m_layerGroup

template<class Data_T >
Hdf5Util::H5ScopedGopen SparseFile::Reference< Data_T >::m_layerGroup
private

Hold the group containing the data open for the duration of the Reference's existence.

Definition at line 235 of file SparseFile.h.

◆ m_reader

template<class Data_T >
SparseDataReader<Data_T>* SparseFile::Reference< Data_T >::m_reader
private

Pointer to the reader object. NULL at construction time. Created in openFile().

Definition at line 239 of file SparseFile.h.

◆ m_ogReaderPtr

template<class Data_T >
boost::shared_ptr<OgSparseDataReader<Data_T> > SparseFile::Reference< Data_T >::m_ogReaderPtr
private

Shared pointer to the ogawa reader.

Definition at line 242 of file SparseFile.h.

◆ m_ogReader

template<class Data_T >
OgSparseDataReader<Data_T>* SparseFile::Reference< Data_T >::m_ogReader
private

Pointer to the ogawa reader. NULL at construction time. Created in openFile().

Definition at line 245 of file SparseFile.h.

◆ m_ogArchive

template<class Data_T >
IArchivePtr SparseFile::Reference< Data_T >::m_ogArchive
private

Ogawa archive.

Definition at line 247 of file SparseFile.h.

◆ m_ogRoot

template<class Data_T >
OgIGroupPtr SparseFile::Reference< Data_T >::m_ogRoot
private

Ogawa archive root.

Definition at line 249 of file SparseFile.h.

◆ m_ogLayerGroup

template<class Data_T >
OgIGroupPtr SparseFile::Reference< Data_T >::m_ogLayerGroup
private

Ogawa layer group.

Definition at line 251 of file SparseFile.h.

◆ m_mutex

template<class Data_T >
Mutex SparseFile::Reference< Data_T >::m_mutex
mutableprivate

Mutex to prevent two threads from modifying conflicting data.

Definition at line 254 of file SparseFile.h.

◆ m_numActiveBlocks

template<class Data_T >
size_t SparseFile::Reference< Data_T >::m_numActiveBlocks
private

Number of currently active blocks.

Definition at line 257 of file SparseFile.h.


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