The cellTable persistent data saved as a Map<dictionary>. More...
#include <cellTable.H>


Public Member Functions | |
| cellTable (const cellTable &)=delete | |
| No copy construct. | |
| cellTable () noexcept=default | |
| Default construct. | |
| cellTable (const objectRegistry &obr, const word &name="cellTable", const fileName &instance="constant") | |
| Read construct from registry, name, instance. | |
| ~cellTable ()=default | |
| Destructor. | |
| label | push_back (const dictionary &dict) |
| Add to the end, return index. | |
| label | maxIndex () const |
| The max table index, -1 if empty. | |
| label | findIndex (const word &name) const |
| The index corresponding to entry with 'Label' of given name, or -1 if not found. | |
| word | name (const label id) const |
| The 'Label' name corresponding to id, or cellTable_ID if not otherwise defined. | |
| Map< word > | names () const |
| Return the extracted Map of (id => name). | |
| Map< word > | names (const wordRes &patterns) const |
| Return the extracted Map of (id => names) selected by patterns. | |
| Map< word > | selectType (const word &materialType) const |
| Return the extracted Map of (id => name) for materialType (fluid | solid | shell). | |
| Map< word > | fluids () const |
| Return a Map of (id => name) for fluids. | |
| Map< word > | shells () const |
| Return a Map of (id => name) for shells. | |
| Map< word > | solids () const |
| Return a Map of (id => name) for solids. | |
| Map< word > | materialTypes () const |
| Return a Map of (id => fluid|solid|shell). | |
| void | setMaterial (const label, const word &) |
| Assign material Type. | |
| void | setName (const label, const word &) |
| Assign name. | |
| void | setName (const label) |
| Assign default name if not already set. | |
| void | readDict (const objectRegistry &, const word &name="cellTable", const fileName &instance="constant") |
| Read constant/cellTable. | |
| void | writeDict (const objectRegistry &, const word &name="cellTable", const fileName &instance="constant") const |
| Write constant/cellTable for later reuse. | |
| void | operator= (const cellTable &) |
| Assignment. | |
| void | operator= (const Map< dictionary > &) |
| Assign from Map<dictionary>. | |
| void | operator= (const polyMesh &) |
| Assign from cellZones. | |
| void | addCellZones (polyMesh &, const labelList &tableIds) const |
| Classify tableIds into cellZones according to the cellTable. | |
| void | combine (const dictionary &mapDict, labelList &tableIds) |
| Combine tableIds together. | |
| label | append (const dictionary &dict) |
| Add to the end, return index. | |
| Public Member Functions inherited from Map< dictionary > | |
| void | operator= (const this_type &rhs) |
| Copy assign. | |
| void | operator= (std::initializer_list< std::pair< label, dictionary > > rhs) |
| Copy assign from an initializer list. | |
| void | operator= (this_type &&rhs) |
| Move assign. | |
| constexpr | Map () noexcept=default |
| Default construct: empty without allocation (capacity=0). | |
| Public Member Functions inherited from HashTable< dictionary, label, Hash< label > > | |
| Foam::List< label > | sortedToc (const Compare &comp) const |
| Foam::List< label > | tocKeys (const UnaryPredicate &pred, const bool invert) const |
| Foam::List< label > | tocValues (const UnaryPredicate &pred, const bool invert) const |
| Foam::List< label > | tocEntries (const BinaryPredicate &pred, const bool invert) const |
| Foam::label | countKeys (const UnaryPredicate &pred, const bool invert) const |
| Foam::label | countValues (const UnaryPredicate &pred, const bool invert) const |
| Foam::label | countEntries (const BinaryPredicate &pred, const bool invert) const |
| Foam::label | erase (InputIter first, InputIter last) |
| Foam::label | erase (const FixedList< label, N > &keys) |
| Foam::label | erase (const HashTable< AnyType, label, AnyHash > &other) |
| Foam::label | retain (const HashTable< AnyType, label, AnyHash > &other) |
| Foam::label | filterKeys (const UnaryPredicate &pred, const bool pruning) |
| Foam::label | filterValues (const UnaryPredicate &pred, const bool pruning) |
| Foam::label | filterEntries (const BinaryPredicate &pred, const bool pruning) |
| constexpr | HashTable () noexcept |
| Default construct: empty without allocation (capacity=0). | |
| ~HashTable () | |
| Destructor. | |
| bool | empty () const noexcept |
| True if the hash table is empty. | |
| label | size () const noexcept |
| The number of elements in table. | |
| label | capacity () const noexcept |
| The size of the underlying table (the number of buckets). | |
| dictionary & | at (const label &key) |
| Find and return a hashed entry. FatalError if it does not exist. | |
| bool | contains (const label &key) const |
| True if hashed key is contained (found) in table. | |
| iterator | find (const label &key) |
| Find and return an iterator set at the hashed entry. | |
| const_iterator | cfind (const label &key) const |
| Find and return an const_iterator set at the hashed entry. | |
| const dictionary & | lookup (const label &key, const dictionary &deflt) const |
| Return hashed entry if it exists, or return the given default. | |
| List< label > | toc () const |
| The table of contents (the keys) in unsorted order. | |
| UPtrList< const node_type > | csorted () const |
| Const access to the hash-table contents in sorted order (sorted by keys). | |
| UPtrList< node_type > | sorted () |
| Non-const access to the hash-table contents in sorted order (sorted by keys). | |
| bool | emplace (const label &key, Args &&... args) |
| Emplace insert a new entry, not overwriting existing entries. | |
| bool | emplace_set (const label &key, Args &&... args) |
| Emplace set an entry, overwriting any existing entries. | |
| bool | insert (const label &key, const dictionary &obj) |
| Copy insert a new entry, not overwriting existing entries. | |
| bool | set (const label &key, const dictionary &obj) |
| Copy assign a new entry, overwriting existing entries. | |
| void | clear () |
| Remove all entries from table. | |
| void | clearStorage () |
| Remove all entries from table and the table itself. | |
| void | setCapacity (label newCapacity) |
| Change the hash table capacity (number of buckets). | |
| void | resize (label newCapacity) |
| Rehash the hash table with new number of buckets. Currently identical to setCapacity(). | |
| void | reserve (label numEntries) |
| Reserve space for at least the specified number of elements (not the number of buckets) and regenerates the hash table. | |
| void | swap (HashTable< dictionary, label, Hash > &rhs) noexcept |
| Swap contents into this table. | |
| void | transfer (HashTable< dictionary, label, Hash > &rhs) |
| Transfer contents into this table. | |
| void | merge (HashTable< dictionary, label, Hash > &source) |
Attempts to extract entries from source parameter and insert them into this, does not overwrite existing entries. The source will contains any items that could not be merged. | |
| dictionary & | operator[] (const label &key) |
| Find and return a hashed entry. FatalError if it does not exist. | |
| dictionary & | operator() (const label &key) |
| Return existing entry or create a new entry. | |
| void | operator= (const this_type &rhs) |
| Copy assign. | |
| bool | operator== (const this_type &rhs) const |
| Equality. Tables are equal if all keys and values are equal, independent of order or underlying storage size. | |
| bool | operator!= (const this_type &rhs) const |
| The opposite of the equality operation. | |
| this_type & | operator+= (const this_type &rhs) |
| Add entries into this HashTable. | |
| const_iterator_pair< const_key_iterator, this_type > | keys () const |
| A const iterator begin/end pair for iterating over keys. | |
| iterator | begin () |
| iterator set to the beginning of the HashTable | |
| const_iterator | cbegin () const |
| const_iterator set to the beginning of the HashTable | |
| iterator | end () noexcept |
| iterator to signal the end (for any HashTable) | |
| constexpr const_iterator | cend () const noexcept |
| const_iterator to signal the end (for any HashTable) | |
| Ostream & | printInfo (Ostream &os) const |
| Print information. | |
| Ostream & | writeKeys (Ostream &os, const label shortLen=0) const |
| Write unordered keys (list), with line-breaks when length exceeds shortLen. | |
| bool | found (const label &key) const |
| Same as contains(). | |
| Public Member Functions inherited from HashTableCore | |
| ClassName ("HashTable") | |
| Declare type-name (with debug switch). | |
| constexpr | HashTableCore () noexcept=default |
| Default construct. | |
Additional Inherited Members | |
| Public Types inherited from Map< dictionary > | |
| typedef Map< dictionary > | this_type |
| The template instance used for this Map. | |
| typedef HashTable< dictionary, label, Hash< label > > | parent_type |
| The template instance used for the parent HashTable. | |
| using | iterator |
| using | const_iterator |
| Public Types inherited from HashTable< dictionary, label, Hash< label > > | |
| typedef HashTable< dictionary, label, Hash > | this_type |
| The template instance used for this HashTable. | |
| using | node_type |
| A table entry (node) that encapsulates the key/val tuple with an additional linked-list entry for hash collisions. | |
| typedef label | key_type |
| The second template parameter, type of keys used. | |
| typedef dictionary | mapped_type |
| The first template parameter, type of objects contained. | |
| typedef dictionary | value_type |
| Same as mapped_type for OpenFOAM HashTables. | |
| typedef Hash | hasher |
| The third template parameter, the hash index method. | |
| typedef dictionary * | pointer |
| Pointer type for storing into value_type objects. | |
| typedef dictionary & | reference |
| Reference to the stored value_type. | |
| typedef const dictionary * | const_pointer |
| Const pointer type for the stored value_type. | |
| typedef const dictionary & | const_reference |
| Const reference to the stored value_type. | |
| typedef label | difference_type |
| The type to represent the difference between two iterators. | |
| typedef label | size_type |
| The type that can represent the size of a HashTable. | |
| using | key_iterator |
| Forward iterator returning the key. | |
| using | const_key_iterator |
| Forward const iterator returning the key. | |
| Static Public Member Functions inherited from HashTableCore | |
| static label | canonicalSize (const label size) noexcept |
| Return a canonical (power-of-two) of the requested size. | |
| Static Public Attributes inherited from HashTableCore | |
| static constexpr int32_t | maxTableSize = (1 << (32-3)) |
| Maximum allowable internal table size (must be a power of two!). | |
The cellTable persistent data saved as a Map<dictionary>.
The meshReader supports cellTable information.
The constant/cellTable file is an IOMap<dictionary> that is used to save the information persistently. It contains the cellTable information of the following form:
(
ID
{
Label WORD;
MaterialType WORD;
MaterialId INT;
PorosityId INT;
ColorIdx INT;
...
}
...
)
If the Label is missing, a value cellTable_{ID} will be inferred. If the MaterialType is missing, the value fluid will be inferred.
Definition at line 77 of file cellTable.H.
|
delete |
No copy construct.
References cellTable().
Referenced by cellTable(), cellTable(), operator=(), and ~cellTable().


|
defaultnoexcept |
Default construct.
References cellTable(), name(), and Foam::noexcept.

|
explicit |
Read construct from registry, name, instance.
Definition at line 107 of file cellTable.C.
References name(), and readDict().

|
default |
Destructor.
References addCellZones(), cellTable(), combine(), dict, findIndex(), fluids(), Map< dictionary >::Map(), materialTypes(), maxIndex(), name(), names(), HashTable< dictionary, label, Hash< label > >::operator, push_back(), readDict(), selectType(), setMaterial(), setName(), shells(), solids(), and writeDict().

| Foam::label push_back | ( | const dictionary & | dict | ) |
Add to the end, return index.
Definition at line 135 of file cellTable.C.
References dict, insert(), and maxIndex().
Referenced by append(), and ~cellTable().


| Foam::label maxIndex | ( | ) | const |
The max table index, -1 if empty.
Definition at line 120 of file cellTable.C.
References forAllConstIters.
Referenced by combine(), push_back(), and ~cellTable().

| Foam::label findIndex | ( | const word & | name | ) | const |
The index corresponding to entry with 'Label' of given name, or -1 if not found.
Definition at line 175 of file cellTable.C.
References dict, forAllConstIters, and name().
Referenced by ~cellTable().


| Foam::word name | ( | const label | id | ) | const |
The 'Label' name corresponding to id, or cellTable_ID if not otherwise defined.
Definition at line 156 of file cellTable.C.
References HashTable< dictionary, label, Hash< label > >::cfind(), and Foam::name().
Referenced by cellTable(), cellTable(), findIndex(), readDict(), setName(), writeDict(), and ~cellTable().


| Foam::Map< Foam::word > names | ( | ) | const |
Return the extracted Map of (id => name).
Definition at line 144 of file cellTable.C.
References Foam::names_impl().
Referenced by ~cellTable().


| Foam::Map< Foam::word > names | ( | const wordRes & | patterns | ) | const |
Return the extracted Map of (id => names) selected by patterns.
Definition at line 150 of file cellTable.C.
References Foam::names_impl().

| Foam::Map< Foam::word > selectType | ( | const word & | materialType | ) | const |
Return the extracted Map of (id => name) for materialType (fluid | solid | shell).
Definition at line 217 of file cellTable.C.
References defaultMaterial_, dict, HashTable< T, Key, Hash >::emplace(), forAllConstIters, Map< dictionary >::Map(), Foam::name(), HashTable< T, Key, Hash >::reserve(), and HashTable< dictionary, label, Hash< label > >::size().
Referenced by fluids(), shells(), solids(), and ~cellTable().


| Foam::Map< Foam::word > fluids | ( | ) | const |
Return a Map of (id => name) for fluids.
Definition at line 246 of file cellTable.C.
References selectType().
Referenced by ~cellTable().


| Foam::Map< Foam::word > shells | ( | ) | const |
Return a Map of (id => name) for shells.
Definition at line 258 of file cellTable.C.
References selectType().
Referenced by ~cellTable().


| Foam::Map< Foam::word > solids | ( | ) | const |
Return a Map of (id => name) for solids.
Definition at line 252 of file cellTable.C.
References selectType().
Referenced by ~cellTable().


| Foam::Map< Foam::word > materialTypes | ( | ) | const |
Return a Map of (id => fluid|solid|shell).
Definition at line 197 of file cellTable.C.
References defaultMaterial_, HashTable< T, Key, Hash >::emplace(), forAllConstIters, Map< dictionary >::Map(), readIfPresent(), HashTable< T, Key, Hash >::reserve(), and HashTable< dictionary, label, Hash< label > >::size().
Referenced by ~cellTable().


| void setMaterial | ( | const label | id, |
| const word & | matlType ) |
Assign material Type.
Definition at line 264 of file cellTable.C.
Referenced by ~cellTable().

| void setName | ( | const label | id, |
| const word & | name ) |
Assign name.
Definition at line 270 of file cellTable.C.
References name().
Referenced by setName(), and ~cellTable().


| void setName | ( | const label | id | ) |
Assign default name if not already set.
Definition at line 276 of file cellTable.C.
References HashTable< dictionary, label, Hash< label > >::find(), found, Foam::name(), and setName().

| void readDict | ( | const objectRegistry & | obr, |
| const word & | name = "cellTable", | ||
| const fileName & | instance = "constant" ) |
Read constant/cellTable.
Definition at line 287 of file cellTable.C.
References clear(), Foam::endl(), regIOobject::headerOk(), Foam::Info, name(), IOobjectOption::NO_REGISTER, IOobjectOption::NO_WRITE, and IOobjectOption::READ_IF_PRESENT.
Referenced by cellTable(), and ~cellTable().


| void writeDict | ( | const objectRegistry & | obr, |
| const word & | name = "cellTable", | ||
| const fileName & | instance = "constant" ) const |
Write constant/cellTable for later reuse.
Definition at line 322 of file cellTable.C.
References Foam::endl(), Foam::Info, name(), IOobject::name(), IOobjectOption::NO_READ, IOobjectOption::NO_REGISTER, IOobjectOption::NO_WRITE, IOobject::note(), IOobject::objectPath(), IOobject::objectRelPath(), os(), IOobject::writeEndDivider(), and IOobject::writeHeader().
Referenced by ~cellTable().


Assignment.
Definition at line 359 of file cellTable.C.
References cellTable(), Map< T >::operator=(), and Foam::rhs().

| void operator= | ( | const Map< dictionary > & | rhs | ) |
Assign from Map<dictionary>.
Definition at line 366 of file cellTable.C.
References Map< dictionary >::Map(), Map< T >::operator=(), and Foam::rhs().

Assign from cellZones.
Definition at line 373 of file cellTable.C.
References HashTable< T, Key, Hash >::clear(), dict, dictionary, forAll, HashTable< T, Key, Hash >::insert(), Map< dictionary >::Map(), mesh, Map< T >::operator=(), and UList< T >::size().

Classify tableIds into cellZones according to the cellTable.
Definition at line 418 of file cellTable.C.
References IOobjectOption::AUTO_WRITE, ZoneMesh< ZoneType, MeshType >::clear(), HashTable< dictionary, label, Hash< label > >::empty(), Foam::endl(), forAll, Foam::Info, HashTable< T, Key, Hash >::lookup(), Map< dictionary >::Map(), mesh, names, DynamicList< T, SizeMin >::push_back(), List< T >::push_back(), HashTable< T, Key, Hash >::reserve(), List< T >::resize(), PtrList< T >::resize(), PtrList< T >::set(), HashTable< T, Key, Hash >::size(), UList< T >::size(), HashTable< T, Key, Hash >::sortedToc(), and IOobjectOption::writeOpt().
Referenced by ~cellTable().


| void combine | ( | const dictionary & | mapDict, |
| labelList & | tableIds ) |
Combine tableIds together.
each dictionary entry is a wordList
Definition at line 507 of file cellTable.C.
References DLListBase::empty(), Foam::endl(), erase(), HashTable< T, Key, Hash >::erase(), Foam::findIndex(), forAllConstIters, Foam::identity(), Foam::Info, Foam::inplaceRenumber(), HashTable< T, Key, Hash >::insert(), Map< dictionary >::Map(), wordRes::match(), maxIndex(), Foam::min(), names, HashTable< dictionary, label, Hash< label > >::operator[](), HashTable< T, Key, Hash >::size(), and HashTable< T, Key, Hash >::toc().
Referenced by ~cellTable().


|
inline |
Add to the end, return index.
Definition at line 257 of file cellTable.H.
References append(), dict, and push_back().
Referenced by append().

