The cellTable persistent data saved as a Map<dictionary>. More...
Public Member Functions | |
cellTable () | |
Construct null. More... | |
cellTable (const objectRegistry &, const word &name="cellTable", const fileName &instance="constant") | |
Construct read from registry, name. instance. More... | |
cellTable (const cellTable &)=delete | |
Disallow default bitwise copy construction. More... | |
~cellTable () | |
Destructor. More... | |
label | append (const dictionary &) |
Append to the end, return index. More... | |
label | findIndex (const word &name) const |
Return index corresponding to name. More... | |
word | name (const label id) const |
Return the name corresponding to id. More... | |
Map< word > | names () const |
Return a Map of (id => name) More... | |
Map< word > | names (const UList< wordRe > &patterns) const |
Return a Map of (id => names) selected by patterns. More... | |
Map< word > | selectType (const word &materialType) const |
Return a Map of (id => name) for materialType. More... | |
Map< word > | fluids () const |
Return a Map of (id => name) for fluids. More... | |
Map< word > | shells () const |
Return a Map of (id => name) for shells. More... | |
Map< word > | solids () const |
Return a Map of (id => name) for solids. More... | |
Map< word > | materialTypes () const |
Return a Map of (id => fluid|solid|shell) More... | |
void | setMaterial (const label, const word &) |
Assign material Type. More... | |
void | setName (const label, const word &) |
Assign name. More... | |
void | setName (const label) |
Assign default name if not already set. More... | |
void | readDict (const objectRegistry &, const word &name="cellTable", const fileName &instance="constant") |
Read constant/cellTable. More... | |
void | writeDict (const objectRegistry &, const word &name="cellTable", const fileName &instance="constant") const |
Write constant/cellTable for later reuse. More... | |
void | operator= (const cellTable &) |
Assignment. More... | |
void | operator= (const Map< dictionary > &) |
Assign from Map<dictionary> More... | |
void | operator= (const polyMesh &) |
Assign from cellZones. More... | |
void | addCellZones (polyMesh &, const labelList &tableIds) const |
Classify tableIds into cellZones according to the cellTable. More... | |
void | combine (const dictionary &, labelList &tableIds) |
Combine tableIds together. More... | |
Public Member Functions inherited from Map< dictionary > | |
Map (const label size=128) | |
Construct given initial size. More... | |
Map (Istream &is) | |
Construct from Istream. More... | |
Map (const Map< dictionary > &map) | |
Copy constructor. More... | |
Map (Map< dictionary > &&map) | |
Move constructor. More... | |
Map (HashTable< dictionary, label, Hash< label >> &&map) | |
Move constructor. More... | |
Map (std::initializer_list< Tuple2< label, dictionary >> map) | |
Construct from an initializer list. More... | |
void | operator= (const Map< dictionary > &map) |
void | operator= (Map< dictionary > &&map) |
Public Member Functions inherited from HashTable< T, Key, Hash > | |
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 initializer 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 initializer 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... | |
Additional Inherited Members | |
Public Types inherited from Map< dictionary > | |
typedef HashTable< dictionary, label, Hash< label > >::iterator | iterator |
typedef HashTable< dictionary, label, Hash< label > >::const_iterator | const_iterator |
Public Types inherited from HashTable< T, Key, Hash > | |
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... | |
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... | |
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.
cellTable | ( | ) |
Construct null.
Definition at line 103 of file cellTable.C.
cellTable | ( | const objectRegistry & | registry, |
const word & | name = "cellTable" , |
||
const fileName & | instance = "constant" |
||
) |
Construct read from registry, name. instance.
Definition at line 110 of file cellTable.C.
References cellTable::readDict().
~cellTable | ( | ) |
Destructor.
Definition at line 124 of file cellTable.C.
Foam::label append | ( | const dictionary & | dict | ) |
Append to the end, return index.
Definition at line 130 of file cellTable.C.
References forAllConstIter(), and HashTable< T, Key, Hash >::insert().
Foam::label findIndex | ( | const word & | name | ) | const |
Return index corresponding to name.
returns -1 if not found
Definition at line 206 of file cellTable.C.
References forAllConstIter(), and word::null.
Referenced by cellTable::combine().
Foam::word name | ( | const label | id | ) | const |
Return the name corresponding to id.
returns cellTable_ID if not otherwise defined
Definition at line 192 of file cellTable.C.
References HashTableCore::end(), HashTable< T, Key, Hash >::find(), and Foam::name().
Foam::Map< Foam::word > names | ( | ) | const |
Return a Map of (id => name)
Definition at line 146 of file cellTable.C.
References forAllConstIter(), HashTable< T, label, Hash< label > >::insert(), lookup(), and Foam::name().
Referenced by cellTable::combine().
Foam::Map< Foam::word > names | ( | const UList< wordRe > & | patterns | ) | const |
Return a Map of (id => names) selected by patterns.
Definition at line 168 of file cellTable.C.
References Foam::findStrings(), forAllConstIter(), HashTable< T, label, Hash< label > >::insert(), lookup(), and Foam::name().
Foam::Map< Foam::word > selectType | ( | const word & | materialType | ) | const |
Return a Map of (id => name) for materialType.
(fluid | solid | shell)
Definition at line 242 of file cellTable.C.
References forAllConstIter(), HashTable< T, label, Hash< label > >::insert(), lookup(), and Foam::name().
Referenced by cellTable::fluids(), cellTable::shells(), and cellTable::solids().
Foam::Map< Foam::word > fluids | ( | ) | const |
Return a Map of (id => name) for fluids.
Definition at line 270 of file cellTable.C.
References cellTable::selectType().
Foam::Map< Foam::word > shells | ( | ) | const |
Return a Map of (id => name) for shells.
Definition at line 282 of file cellTable.C.
References cellTable::selectType().
Foam::Map< Foam::word > solids | ( | ) | const |
Return a Map of (id => name) for solids.
Definition at line 276 of file cellTable.C.
References cellTable::selectType().
Foam::Map< Foam::word > materialTypes | ( | ) | const |
Return a Map of (id => fluid|solid|shell)
Definition at line 225 of file cellTable.C.
References forAllConstIter(), HashTable< T, label, Hash< label > >::insert(), and lookup().
Assign material Type.
Definition at line 289 of file cellTable.C.
Referenced by STARCD::readCells().
Assign name.
Definition at line 295 of file cellTable.C.
Referenced by STARCD::readCells(), and cellTable::setName().
void setName | ( | const label | id | ) |
Assign default name if not already set.
Definition at line 301 of file cellTable.C.
References HashTableCore::end(), HashTable< T, Key, Hash >::find(), HashTable< T, Key, Hash >::found(), Foam::name(), cellTable::readDict(), and cellTable::setName().
void readDict | ( | const objectRegistry & | registry, |
const word & | name = "cellTable" , |
||
const fileName & | instance = "constant" |
||
) |
Read constant/cellTable.
Definition at line 313 of file cellTable.C.
References HashTable< T, Key, Hash >::clear(), Foam::endl(), regIOobject::headerOk(), Foam::Info, IOobject::NO_WRITE, IOobject::READ_IF_PRESENT, and cellTable::writeDict().
Referenced by cellTable::cellTable(), STARCD::readAux(), cellTable::setName(), and STARCD::STARCD().
void writeDict | ( | const objectRegistry & | registry, |
const word & | name = "cellTable" , |
||
const fileName & | instance = "constant" |
||
) | const |
Write constant/cellTable for later reuse.
Definition at line 348 of file cellTable.C.
References Foam::endl(), Foam::Info, IOobject::name(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::note(), IOobject::objectPath(), and IOobject::writeHeader().
Referenced by cellTable::readDict(), and meshReader::writeAux().
Assignment.
Definition at line 381 of file cellTable.C.
References Map< T >::operator=().
void operator= | ( | const Map< dictionary > & | rhs | ) |
Assign from Map<dictionary>
Definition at line 388 of file cellTable.C.
References Map< T >::operator=().
Assign from cellZones.
Definition at line 395 of file cellTable.C.
References dictionary::add(), cellTable::addCellZones(), polyMesh::cellZones(), HashTable< T, Key, Hash >::clear(), dict, forAll, HashTable< T, Key, Hash >::insert(), ZoneMesh< ZoneType, MeshType >::names(), primitiveMesh::nCells(), Map< T >::operator=(), and List< T >::size().
Classify tableIds into cellZones according to the cellTable.
Definition at line 441 of file cellTable.C.
References List< T >::append(), IOobject::AUTO_WRITE, polyMesh::cellZones(), ZoneMesh< ZoneType, MeshType >::clear(), HashTableCore::end(), Foam::endl(), HashTable< T, Key, Hash >::find(), forAll, Foam::Info, PtrList< T >::set(), PtrList< T >::setSize(), List< T >::setSize(), List< T >::size(), HashTable< T, Key, Hash >::size(), and IOobject::writeOpt().
Referenced by cellTable::operator=().
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 Foam::endl(), HashTable< T, label, Hash< label > >::erase(), HashTable< T, Key, Hash >::erase(), cellTable::findIndex(), Foam::findStrings(), forAllConstIter(), Foam::identity(), Foam::Info, Foam::inplaceRenumber(), HashTable< T, label, Hash< label > >::insert(), Foam::max(), Foam::min(), cellTable::names(), HashTable< T, Key, Hash >::operator[](), HashTable< T, label, Hash< label > >::size(), and HashTable< T, label, Hash< label > >::toc().