An STL-conforming hash table. More...
Inherits HashTableCore.
Inherited by EdgeMap< Foam::FvWallInfoData >, EdgeMap< scalar >, HashPtrTable< curve >, HashPtrTable< Foam::Field >, HashPtrTable< Foam::Function1< scalar > >, HashPtrTable< Foam::GeometricField >, HashPtrTable< Foam::List >, HashPtrTable< Foam::OFstream >, HashPtrTable< Foam::sutherlandTransport >, HashPtrTable< Foam::unknownTypeFunction1 >, HashPtrTable< HashPtrTable< volScalarField >, phaseInterfaceKey, phaseInterfaceKey::hash >, HashPtrTable< IOobject >, HashPtrTable< surfaceScalarField, phaseInterfaceKey, phaseInterfaceKey::hash >, HashPtrTable< T, label, Hash< label > >, HashPtrTable< volScalarField, phaseInterfaceKey, phaseInterfaceKey::hash >, Map< dictionary >, Map< Foam::edge >, Map< Foam::FvWallInfoData >, Map< Foam::List >, Map< Foam::Pair< Foam::edge > >, Map< Foam::splitCell *>, Map< Foam::Vector >, and Map< label >.
Classes | |
class | const_iterator |
An STL-conforming const_iterator. More... | |
class | iterator |
An STL-conforming iterator. More... | |
class | iteratorBase |
The iterator base for HashTable. More... | |
Public Types | |
typedef T | value_type |
Type of values the HashTable contains. More... | |
typedef T & | reference |
Type that can be used for storing into HashTable::value_type. More... | |
typedef const T & | const_reference |
Type that can be used for storing into constant. More... | |
typedef label | size_type |
The type that can represent the size of a HashTable. More... | |
Public Member Functions | |
HashTable (const label size=128) | |
Construct given initial table size. More... | |
HashTable (Istream &, const label size=128) | |
Construct from Istream. More... | |
HashTable (const HashTable< T, Key, Hash > &) | |
Copy constructor. More... | |
HashTable (HashTable< T, Key, Hash > &&) | |
Move constructor. More... | |
HashTable (std::initializer_list< Tuple2< Key, T >>) | |
Construct from an initialiser list. More... | |
~HashTable () | |
Destructor. More... | |
label | capacity () const |
The size of the underlying table. More... | |
label | size () const |
Return number of elements in table. More... | |
bool | empty () const |
Return true if the hash table is empty. More... | |
bool | found (const Key &) const |
Return true if hashedEntry is found in table. More... | |
iterator | find (const Key &) |
Find and return an iterator set at the hashedEntry. More... | |
const_iterator | find (const Key &) const |
Find and return an const_iterator set at the hashedEntry. More... | |
List< Key > | toc () const |
Return the table of contents. More... | |
List< Key > | sortedToc () const |
Return the table of contents as a sorted list. More... | |
Ostream & | printInfo (Ostream &) const |
Print information. More... | |
bool | insert (const Key &, const T &newElmt) |
Insert a new hashedEntry. More... | |
bool | set (const Key &, const T &newElmt) |
Assign a new hashedEntry, overwriting existing entries. More... | |
bool | erase (const iterator &) |
Erase a hashedEntry specified by given iterator. More... | |
bool | erase (const Key &) |
Erase a hashedEntry specified by the given key. More... | |
label | erase (const UList< Key > &) |
Remove entries given by the listed keys from this HashTable. More... | |
template<class AnyType , class AnyHash > | |
label | erase (const HashTable< AnyType, Key, AnyHash > &) |
Remove entries given by the given keys from this HashTable. More... | |
void | resize (const label newSize) |
Resize the hash table for efficiency. More... | |
void | clear () |
Clear all entries from table. More... | |
void | clearStorage () |
Clear the table entries and the table itself. More... | |
void | shrink () |
Shrink the allocated table to approx. twice number of elements. More... | |
void | transfer (HashTable< T, Key, Hash > &) |
Transfer the contents of the argument table into this table. More... | |
T & | operator[] (const Key &) |
Find and return a hashedEntry. More... | |
const T & | operator[] (const Key &) const |
Find and return a hashedEntry. More... | |
T & | operator() (const Key &) |
Find and return a hashedEntry, create it null if not present. More... | |
void | operator= (const HashTable< T, Key, Hash > &) |
Assignment operator. More... | |
void | operator= (HashTable< T, Key, Hash > &&) |
Move assignment operator. More... | |
void | operator= (std::initializer_list< Tuple2< Key, T >>) |
Assignment to an initialiser list. More... | |
bool | operator== (const HashTable< T, Key, Hash > &) const |
Equality. Hash tables are equal if the keys and values are equal. More... | |
bool | operator!= (const HashTable< T, Key, Hash > &) const |
The opposite of the equality operation. Takes linear time. More... | |
iterator | begin () |
Iterator set to the beginning of the HashTable. More... | |
const_iterator | cbegin () const |
const_iterator set to the beginning of the HashTable More... | |
const_iterator | begin () const |
const_iterator set to the beginning of the HashTable More... | |
template<class AnyType , class AnyHash > | |
Foam::label | erase (const HashTable< AnyType, Key, AnyHash > &rhs) |
Public Member Functions inherited from HashTableCore | |
HashTableCore () | |
Construct null. More... | |
ClassName ("HashTable") | |
Define template name and debug. More... | |
Friends | |
template<class T2 , class Key2 , class Hash2 > | |
class | HashPtrTable |
Declare friendship with the HashPtrTable class. More... | |
class | iteratorBase |
Declare friendship with the iteratorBase. More... | |
class | iterator |
Declare friendship with the iterator. More... | |
class | const_iterator |
Declare friendship with the const_iterator. More... | |
Istream & | operator>> (Istream &, HashTable< T, Key, Hash > &) |
Ostream & | operator (Ostream &, const HashTable< T, Key, Hash > &) |
Additional Inherited Members | |
Static Public Member Functions inherited from HashTableCore | |
static label | canonicalSize (const label) |
Return a canonical (power-of-two) size. More... | |
static iteratorEnd | cend () |
iteratorEnd set to beyond the end of any HashTable More... | |
static iteratorEnd | end () |
iteratorEnd set to beyond the end of any HashTable More... | |
Static Public Attributes inherited from HashTableCore | |
static const label | maxTableSize |
Maximum allowable table size. More... | |
An STL-conforming hash table.
Note: Hashing index collisions are handled via chaining using a singly-linked list with the colliding entry being added to the head of the linked list. Thus copying the hash table (or indeed even resizing it) will often result in a different hash order. Use a sorted table-of-contents when the hash order is important.
Definition at line 61 of file HashTable.H.
typedef T value_type |
Type of values the HashTable contains.
Definition at line 332 of file HashTable.H.
Type that can be used for storing into HashTable::value_type.
objects. This type is usually List::value_type&.
Definition at line 336 of file HashTable.H.
typedef const T& const_reference |
Type that can be used for storing into constant.
HashTable::value_type objects. This type is usually const HashTable::value_type&.
Definition at line 341 of file HashTable.H.
The type that can represent the size of a HashTable.
Definition at line 344 of file HashTable.H.
Construct given initial table size.
Definition at line 36 of file HashTable.C.
Referenced by HashTable< Foam::phase *>::HashTable().
Construct from Istream.
Definition at line 33 of file HashTableIO.C.
Copy constructor.
Definition at line 56 of file HashTable.C.
Move constructor.
Definition at line 69 of file HashTable.C.
Construct from an initialiser list.
Definition at line 84 of file HashTable.C.
~HashTable | ( | ) |
Destructor.
Definition at line 100 of file HashTable.C.
|
inline |
The size of the underlying table.
Definition at line 58 of file HashTableI.H.
|
inline |
Return number of elements in table.
Definition at line 65 of file HashTableI.H.
Referenced by singleProcessorFaceSetsConstraint::add(), cellTable::addCellZones(), snappyLayerDriver::addLayers(), polyTopoChange::addMesh(), cellToFaceStencil::calcFaceStencil(), pointMVCWeight::calcWeights(), primitiveMesh::cellEdges(), primitiveMesh::cellPoints(), primitiveMesh::checkEdgeLength(), motionSmootherAlgo::checkMesh(), edgeCollapser::checkMeshQuality(), hexRef8::consistentSlowRefinement2(), meshRefinement::dupNonManifoldPoints(), surfaceSets::getHangingCells(), combineFaces::getMergeSets(), removePoints::getUnrefimentSet(), IOobjectList::lookup(), IOobjectList::lookupClass(), meshToMesh::mapAndOpTgtToSrc(), polyBoundaryMesh::matchGroups(), meshRefinement::mergePatchFacesUndo(), NamedEnum< compressibleField, 8 >::names(), IOobjectList::names(), polyBoundaryMesh::nbrEdges(), distribution::normalised(), minEqOpFace::operator()(), HashTable< Foam::phase *>::operator==(), Foam::polyMeshZipUpCells(), fvMeshDistribute::printCoupleInfo(), fvMeshDistribute::printFieldInfo(), distribution::raw(), repatchMesh::readTriSurface(), structuredRenumber::renumber(), faceAreaWeightAMI::restartUncoveredSourceFace(), motionSmootherAlgo::scaleMesh(), polyTopoChange::setCapacity(), fvMeshSubset::setCellSubset(), duplicatePoints::setRefinement(), removePoints::setRefinement(), meshCutAndRemove::setRefinement(), meshCutter::setRefinement(), hexRef8::setUnrefinement(), UnsortedMeshedSurface< Face >::sortedZones(), faceZoneSet::sync(), boundaryCutter::topoChange(), localPointRegion::topoChange(), meshCutAndRemove::topoChange(), meshCutter::topoChange(), triSurfaceRegionSearch::treeByRegion(), loadBalancer::update(), edgeVertex::updateLabels(), domainDecomposition::writeComplete(), domainDecomposition::writeProcs(), and graph::y().
|
inline |
Return true if the hash table is empty.
Definition at line 72 of file HashTableI.H.
Referenced by forces::calcForcesMoment(), and globalIndexAndTransform::transformIndicesForPatches().
bool found | ( | const Key & | key | ) | const |
Return true if hashedEntry is found in table.
Definition at line 113 of file HashTable.C.
Referenced by fieldAverage::addMeanFieldType(), fieldAverage::addPrime2MeanFieldType(), faceZoneToFaceZone::applyToSet(), setToPointZone::applyToSet(), setToCellZone::applyToSet(), setToFaceZone::applyToSet(), setAndNormalToFaceZone::applyToSet(), setsToFaceZone::applyToSet(), addPatchCellLayer::calcSidePatch(), layerAdditionRemoval::changeTopology(), edgeCollapser::checkMeshQuality(), edgeMeshFormatsCore::checkSupport(), surfaceFormatsCore::checkSupport(), motionSmootherAlgo::correctBoundaryConditions(), geomCellLooper::cut(), HashTable< Foam::phase *>::erase(), scalarTransport::execute(), cellFeatures::faceMap(), polyMeshFilter::filter(), surfaceSets::getHangingCells(), removePoints::getUnrefimentSet(), fvMeshAdder::MapDimFields(), fvMeshAdder::MapPointFields(), fvMeshAdder::MapSurfaceFields(), fvMeshAdder::MapVolFields(), NamedEnum< compressibleField, 8 >::names(), UnsortedMeshedSurface< Face >::New(), MeshedSurface< Foam::face >::New(), cellCuts::nonAnchorPoints(), nonConformalBoundary::nonConformalNonCoupledPatchIDs(), ListPlusEqOp< T, Size >::operator()(), InflationInjection< CloudType >::parcelsToInject(), fvMeshDistribute::printFieldInfo(), STARCD::readBoundary(), STARCD::readCells(), faceAreaWeightAMI::restartUncoveredSourceFace(), fvMeshSubset::setCellSubset(), motionSmootherAlgo::setDisplacementPatchFields(), cellTable::setName(), boundaryCutter::setRefinement(), surfaceIntersection::surfaceIntersection(), UnsortedMeshedSurface< Face >::write(), MeshedSurface< Foam::face >::write(), regionSizeDistribution::write(), and domainDecomposition::writeProcs().
Foam::HashTable< T, Key, Hash >::iterator find | ( | const Key & | key | ) |
Find and return an iterator set at the hashedEntry.
If not found iterator = end()
Definition at line 142 of file HashTable.C.
Referenced by distribution::add(), cellTable::addCellZones(), faceZoneSet::addSet(), enrichedPatch::calcEnrichedFaces(), cellMatcher::calcLocalFaces(), createShellMesh::calcPointRegions(), GAMGAgglomeration::calculateRegionMaster(), primitiveMesh::checkFaceFaces(), objectRegistry::checkIn(), objectRegistry::checkOut(), probes::classifyFields(), cyclicPolyPatch::coupledEdges(), cyclicAMIGAMGInterface::cyclicAMIGAMGInterface(), cyclicGAMGInterface::cyclicGAMGInterface(), faceZoneSet::deleteSet(), HashTable< Foam::phase *>::find(), HashTable< Foam::phase *>::found(), snappySnapDriver::getZoneSurfacePoints(), polyBoundaryMesh::groupPatchIDs(), Foam::stringOps::inplaceExpand(), distribution::insertMissingKeys(), fvMeshSubset::interpolate(), lduPrimitiveMesh::lduPrimitiveMesh(), zone::localID(), IOobjectList::lookup(), fvMeshAdder::MapSurfaceFields(), PatchTools::matchEdges(), PatchTools::matchPoints(), globalMeshData::mergePoints(), polyTopoChange::modifyFace(), attachDetach::modifyMotionPoints(), slidingInterface::modifyMotionPoints(), polyTopoChange::modifyPoint(), cellTable::name(), NamedEnum< compressibleField, 8 >::names(), polyBoundaryMesh::nbrEdges(), minEqOpFace::operator()(), Foam::parseNASCoord(), PatchTools::pointNormals(), fvMeshDistribute::printCoupleInfo(), processorGAMGInterface::processorGAMGInterface(), OBJsurfaceFormat< Face >::read(), NASsurfaceFormat< Face >::read(), STARCDsurfaceFormat< Face >::read(), STARCD::readBoundary(), cellTable::setName(), duplicatePoints::setRefinement(), edgeCollapser::setRefinement(), combineFaces::setUnrefinement(), UnsortedMeshedSurface< Face >::sortedZones(), faceZoneSet::subset(), surfaceFeatures::surfaceFeatures(), syncTools::syncEdgeList(), syncTools::syncEdgeMap(), syncTools::syncPointList(), hexRef8::topoChange(), vtkUnstructuredReader::vtkUnstructuredReader(), PrimitivePatch< IndirectList< face >, const pointField & >::whichPoint(), MeshZones< cellZone, polyMesh >::whichZone(), meshRefinement::zonify(), and TRIsurfaceFormatCore::~TRIsurfaceFormatCore().
Foam::HashTable< T, Key, Hash >::const_iterator find | ( | const Key & | key | ) | const |
Find and return an const_iterator set at the hashedEntry.
If not found iterator = end()
Definition at line 173 of file HashTable.C.
Foam::List< Key > toc | ( | ) | const |
Return the table of contents.
Definition at line 202 of file HashTable.C.
Referenced by cellToCellStencil::calcFaceCells(), cellToFaceStencil::calcFaceCells(), surfaceFormatsCore::checkSupport(), triSurfaceTools::collapseEdges(), meshRefinement::createBaffles(), dynamicMeshPointInterpolator::curPointField(), domainDecomposition::decompose(), dynamicIndexedOctree< Foam::dynamicTreeDataPoint >::findBox(), indexedOctree< Foam::treeDataFace >::findBox(), dynamicIndexedOctree< Foam::dynamicTreeDataPoint >::findSphere(), indexedOctree< Foam::treeDataFace >::findSphere(), triSurfaceTools::getVertexVertices(), InflationInjection< CloudType >::InflationInjection(), distribution::insertMissingKeys(), distribution::mean(), attachDetach::modifyMotionPoints(), NamedEnum< compressibleField, 8 >::names(), objectRegistry::names(), distribution::normalised(), writeObjectsBase::objectNames(), ParticleErosion< CloudType >::ParticleErosion(), PatchPostProcessing< CloudType >::PatchPostProcessing(), Foam::polyMeshZipUpCells(), distribution::raw(), and fvMeshSubset::setCellSubset().
Foam::List< Key > sortedToc | ( | ) | const |
Return the table of contents as a sorted list.
Definition at line 217 of file HashTable.C.
Referenced by preservePatchesConstraint::add(), singleProcessorFaceSetsConstraint::add(), Foam::AddPatchFields(), preservePatchesConstraint::apply(), regIOobject::checkIn(), edgeMeshFormatsCore::checkSupport(), DispersionRASModel< CloudType >::epsilonModel(), coupleGroupIdentifier::findOtherPatchID(), DispersionRASModel< CloudType >::kModel(), Foam::listSwitches(), writeObjectsBase::objectNames(), Foam::ReorderPatchFields(), objectRegistry::sortedNames(), and domainDecomposition::writeComplete().
Foam::Ostream & printInfo | ( | Ostream & | os | ) | const |
Print information.
Definition at line 58 of file HashTableIO.C.
Insert a new hashedEntry.
Definition at line 80 of file HashTableI.H.
Referenced by IOobjectList::add(), distribution::add(), polyTopoChange::addCell(), polyTopoChange::addFace(), polyTopoChange::addPoint(), boundaryRegion::append(), cellTable::append(), addPatchCellLayer::calcSidePatch(), primitiveMesh::checkFaceFaces(), objectRegistry::checkIn(), globalMeshData::coupledPatchMeshEdgeMap(), HashTable< Foam::phase *>::empty(), polyBoundaryMesh::groupPatchIDs(), HashSet< Foam::triFace, Foam::Hash< Foam::triFace > >::insert(), distribution::insertMissingKeys(), IOobjectList::IOobjectList(), IOobjectList::lookup(), objectRegistry::lookupClass(), IOobjectList::lookupClass(), polyTopoChange::modifyFace(), polyTopoChange::modifyPoint(), NamedEnum< compressibleField, 8 >::names(), polyBoundaryMesh::nbrEdges(), cellCuts::nonAnchorPoints(), minEqOpFace::operator()(), ListPlusEqOp< T, Size >::operator()(), ifEqEqOp< value >::operator()(), cellTable::operator=(), Foam::parseNASCoord(), pointMVCWeight::pointMVCWeight(), fvMeshDistribute::printCoupleInfo(), patchToPatch::rDistributeTgt(), OBJsurfaceFormat< Face >::read(), NASsurfaceFormat< Face >::read(), STARCDsurfaceFormat< Face >::read(), functionObjectList::read(), STARCD::readBoundary(), repatchMesh::readTriSurface(), HashTable< Foam::phase *>::resize(), fvMeshSubset::setCellSubset(), removePoints::setRefinement(), boundaryCutter::setRefinement(), combineFaces::setRefinement(), meshCutAndRemove::setRefinement(), meshCutter::setRefinement(), combineFaces::setUnrefinement(), UnsortedMeshedSurface< Face >::sortedZones(), hexRef8::storeData(), meshToMesh::update(), meshReader::warnDuplicates(), domainDecomposition::writeComplete(), meshRefinement::zonify(), and TRIsurfaceFormatCore::~TRIsurfaceFormatCore().
Assign a new hashedEntry, overwriting existing entries.
Definition at line 91 of file HashTableI.H.
Referenced by domainDecomposition::procFaceAddressingBf(), and refinementRegions::refinementRegions().
Erase a hashedEntry specified by given iterator.
This invalidates the iterator until the next operator++
Definition at line 371 of file HashTable.C.
Referenced by fileOperation::addWatches(), masterUncollatedFileOperation::addWatches(), objectRegistry::checkOut(), cellTable::combine(), HashTable< Foam::phase *>::erase(), polyBoundaryMesh::groupPatchIDs(), polyBoundaryMesh::matchGroups(), polyTopoChange::modifyFace(), polyTopoChange::modifyPoint(), polyBoundaryMesh::nbrEdges(), probes::prepare(), polyTopoChange::removeCell(), polyTopoChange::removeFace(), polyTopoChange::removePoint(), HashSet< Foam::triFace, Foam::Hash< Foam::triFace > >::unset(), vtkUnstructuredReader::vtkUnstructuredReader(), and regionSizeDistribution::write().
bool erase | ( | const Key & | key | ) |
Erase a hashedEntry specified by the given key.
Definition at line 383 of file HashTable.C.
Foam::label erase | ( | const UList< Key > & | keys | ) |
Remove entries given by the listed keys from this HashTable.
Return the number of elements removed
Definition at line 390 of file HashTable.C.
void resize | ( | const label | newSize | ) |
Resize the hash table for efficiency.
Definition at line 432 of file HashTable.C.
Referenced by polyTopoChange::addMesh(), fvMeshDistribute::distribute(), polyTopoChange::setCapacity(), boundaryCutter::setRefinement(), removePoints::setRefinement(), meshCutAndRemove::setRefinement(), meshCutter::setRefinement(), and hexRef8::storeData().
void clear | ( | ) |
Clear all entries from table.
Definition at line 468 of file HashTable.C.
Referenced by decompositionMethod::calcCellCells(), cellToCellStencil::calcFaceCells(), cellToFaceStencil::calcFaceCells(), cellToFaceStencil::calcFaceStencil(), primitiveMesh::cellEdges(), primitiveMesh::cellPoints(), primitiveMesh::checkFaceFaces(), edgeCollapser::checkMeshQuality(), primitiveMesh::faceEdges(), tetIndices::faceTriIs(), minEqOpFace::operator()(), cellTable::operator=(), boundaryRegion::readDict(), cellTable::readDict(), boundaryCutter::setRefinement(), meshCutAndRemove::setRefinement(), meshCutter::setRefinement(), and hexRef8::setRefinement().
void clearStorage | ( | ) |
Clear the table entries and the table itself.
Equivalent to clear() followed by resize(0)
Definition at line 492 of file HashTable.C.
Referenced by polyTopoChange::changeMesh(), polyTopoChange::clear(), and polyTopoChange::makeMesh().
void shrink | ( | ) |
Shrink the allocated table to approx. twice number of elements.
Definition at line 500 of file HashTable.C.
Transfer the contents of the argument table into this table.
and annul the argument table.
Definition at line 513 of file HashTable.C.
Referenced by primitiveMesh::checkEdgeLength(), polyBoundaryMesh::matchGroups(), boundaryCutter::topoChange(), localPointRegion::topoChange(), meshCutAndRemove::topoChange(), and meshCutter::topoChange().
Find and return a hashedEntry.
Definition at line 103 of file HashTableI.H.
Referenced by boundaryRegion::boundaryType(), cellTable::combine(), and boundaryRegion::rename().
Find and return a hashedEntry.
Definition at line 120 of file HashTableI.H.
Find and return a hashedEntry, create it null if not present.
Definition at line 137 of file HashTableI.H.
Assignment operator.
Definition at line 537 of file HashTable.C.
Move assignment operator.
Definition at line 568 of file HashTable.C.
Assignment to an initialiser list.
Definition at line 586 of file HashTable.C.
Equality. Hash tables are equal if the keys and values are equal.
Independent of table storage size and table order.
Definition at line 609 of file HashTable.C.
The opposite of the equality operation. Takes linear time.
Definition at line 635 of file HashTable.C.
|
inline |
Iterator set to the beginning of the HashTable.
Definition at line 411 of file HashTableI.H.
Referenced by distribution::add(), distribution::insertMissingKeys(), Foam::kShellIntegration(), basicThermo::lookupThermo(), fvMeshAdder::MapDimFields(), Foam::MapGeometricFields(), fvMeshAdder::MapPointFields(), fvMeshAdder::MapSurfaceFields(), fvMeshAdder::MapVolFields(), polyBoundaryMesh::matchGroups(), Foam::MeshToMeshMapVolFields(), Foam::NaNGeometricFields(), regionSizeDistribution::write(), and graph::y().
|
inline |
const_iterator set to the beginning of the HashTable
Definition at line 506 of file HashTableI.H.
Referenced by HashTable< Foam::phase *>::begin(), HashSet< Foam::triFace, Foam::Hash< Foam::triFace > >::HashSet(), HashTable< Foam::phase *>::HashTable(), HashTable< Foam::phase *>::operator=(), and HashTable< Foam::phase *>::operator==().
|
inline |
const_iterator set to the beginning of the HashTable
Definition at line 514 of file HashTableI.H.
Foam::label erase | ( | const HashTable< AnyType, Key, AnyHash > & | rhs | ) |
Definition at line 411 of file HashTable.C.
|
friend |
Declare friendship with the HashPtrTable class.
Definition at line 184 of file HashTable.H.
|
friend |
Declare friendship with the iteratorBase.
Definition at line 191 of file HashTable.H.
|
friend |
Declare friendship with the iterator.
Definition at line 194 of file HashTable.H.
|
friend |
Declare friendship with the const_iterator.
Definition at line 197 of file HashTable.H.