The cellTable persistent data saved as a Map<dictionary>. More...
#include <conversion/cellTable.H>
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; MaterialTypeWORD; MaterialId INT; PorosityId INT; ColorIdxINT; ... } ... )
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 78 of file cellTable.H.
Public Member Functions | |
cellTable () | |
Construct null. | |
cellTable (const objectRegistry &, const word &name="cellTable", const fileName &instance="constant") | |
Construct read from registry, name. instance. | |
~cellTable () | |
Destructor. | |
label | append (const dictionary &) |
Append to the end, return index. | |
label | findIndex (const word &name) const |
Return index corresponding to name. | |
word | name (const label &id) const |
Return the name corresponding to id. | |
Map< word > | names () const |
Return a Map of (id => name) | |
Map< word > | names (const List< wordRe > &patterns) const |
Return a Map of (id => names) selected by patterns. | |
Map< word > | selectType (const word &materialType) const |
Return a 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 &, labelList &tableIds) |
Combine tableIds together. | |
![]() | |
Map (const label size=128) | |
Construct given initial size. | |
Map (Istream &is) | |
Construct from Istream. | |
Map (const Map< dictionary > &map) | |
Construct as copy. | |
Map (const Xfer< Map< dictionary > > &map) | |
Construct by transferring the parameter contents. | |
Map (const Xfer< HashTable< dictionary, label, Hash< label > > > &map) | |
Construct by transferring the parameter contents. | |
![]() | |
bool | set (const label &, const dictionary &newElmt) |
Assign a new hashedEntry, overwriting existing entries. | |
HashTable (const label size=128) | |
Construct given initial table size. | |
HashTable (Istream &, const label size=128) | |
Construct from Istream. | |
HashTable (const HashTable< dictionary, label, Hash< label > > &) | |
Construct as copy. | |
HashTable (const Xfer< HashTable< dictionary, label, Hash< label > > > &) | |
Construct by transferring the parameter contents. | |
~HashTable () | |
label | size () const |
Return number of elements in table. | |
bool | empty () const |
Return true if the hash table is empty. | |
bool | found (const label &) const |
Return true if hashedEntry is found in table. | |
iterator | find (const label &) |
Find and return an iterator set at the hashedEntry. | |
const_iterator | find (const label &) const |
Find and return an const_iterator set at the hashedEntry. | |
List< label > | toc () const |
Return the table of contents. | |
List< label > | sortedToc () const |
Return the table of contents as a sorted list. | |
Ostream & | printInfo (Ostream &) const |
Print information. | |
bool | insert (const label &, const dictionary &newElmt) |
Insert a new hashedEntry. | |
bool | erase (const iterator &) |
Erase an hashedEntry specified by given iterator. | |
bool | erase (const label &) |
Erase an hashedEntry specified by given key if in table. | |
label | erase (const UList< label > &) |
Remove entries given by the listed keys from this HashTable. | |
label | erase (const HashTable< AnyType, label, AnyHash > &) |
Remove entries given by the given keys from this HashTable. | |
void | resize (const label newSize) |
Resize the hash table for efficiency. | |
void | clear () |
Clear all entries from table. | |
void | clearStorage () |
Clear the table entries and the table itself. | |
void | transfer (HashTable< dictionary, label, Hash< label > > &) |
Transfer the contents of the argument table into this table. | |
Xfer< HashTable< dictionary, label, Hash< label > > > | xfer () |
Transfer contents to the Xfer container. | |
dictionary & | operator[] (const label &) |
Find and return an hashedEntry. | |
const dictionary & | operator[] (const label &) const |
Find and return an hashedEntry. | |
dictionary & | operator() (const label &) |
Find and return an hashedEntry, create it null if not present. | |
void | operator= (const HashTable< dictionary, label, Hash< label > > &) |
Assignment. | |
bool | operator== (const HashTable< dictionary, label, Hash< label > > &) const |
Equality. Two hash tables are equal if all contents of first are. | |
bool | operator!= (const HashTable< dictionary, label, Hash< label > > &) const |
The opposite of the equality operation. Takes linear time. | |
iterator | begin () |
iterator set to the begining of the HashTable | |
const_iterator | begin () const |
const_iterator set to the beginning of the HashTable | |
const iterator & | end () |
iterator set to beyond the end of the HashTable | |
const const_iterator & | end () const |
const_iterator set to beyond the end of the HashTable | |
const_iterator | cbegin () const |
const_iterator set to the beginning of the HashTable | |
const const_iterator & | cend () const |
const_iterator set to beyond the end of the HashTable |
Additional Inherited Members | |
![]() | |
typedef HashTable< dictionary, label, Hash< label > >::iterator | iterator |
typedef HashTable< dictionary, label, Hash< label > >::const_iterator | const_iterator |
![]() | |
typedef dictionary | value_type |
Type of values the HashTable contains. | |
typedef dictionary & | reference |
Type that can be used for storing into HashTable::value_type. | |
typedef const dictionary & | const_reference |
Type that can be used for storing into constant. | |
typedef label | size_type |
The type that can represent the size of a HashTable. |
cellTable | ( | ) |
Construct null.
Definition at line 105 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 112 of file cellTable.C.
~cellTable | ( | ) |
Destructor.
Definition at line 126 of file cellTable.C.
Foam::label append | ( | const dictionary & | dict | ) |
Append to the end, return index.
Definition at line 132 of file cellTable.C.
References forAllConstIter, and insert().
Foam::label findIndex | ( | const word & | name | ) | const |
Return index corresponding to name.
returns -1 if not found
Definition at line 208 of file cellTable.C.
References forAllConstIter, and word::null.
Foam::word name | ( | const label & | id | ) | const |
Return the name corresponding to id.
returns cellTable_ID if not otherwise defined
Definition at line 194 of file cellTable.C.
References Foam::name().
Foam::Map< Foam::word > names | ( | ) | const |
Return a Map of (id => name)
Definition at line 148 of file cellTable.C.
References forAllConstIter, HashTable< T, label, Hash< label > >::insert(), and Foam::name().
Foam::Map< Foam::word > names | ( | const List< wordRe > & | patterns | ) | const |
Return a Map of (id => names) selected by patterns.
Definition at line 170 of file cellTable.C.
References Foam::findStrings(), forAllConstIter, HashTable< T, label, Hash< label > >::insert(), 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 244 of file cellTable.C.
References forAllConstIter, HashTable< T, label, Hash< label > >::insert(), and Foam::name().
Foam::Map< Foam::word > fluids | ( | ) | const |
Return a Map of (id => name) for fluids.
Definition at line 272 of file cellTable.C.
Foam::Map< Foam::word > shells | ( | ) | const |
Return a Map of (id => name) for shells.
Definition at line 284 of file cellTable.C.
Foam::Map< Foam::word > solids | ( | ) | const |
Return a Map of (id => name) for solids.
Definition at line 278 of file cellTable.C.
Foam::Map< Foam::word > materialTypes | ( | ) | const |
Return a Map of (id => fluid|solid|shell)
Definition at line 227 of file cellTable.C.
References forAllConstIter, and HashTable< T, label, Hash< label > >::insert().
void setMaterial | ( | const label & | id, |
const word & | matlType | ||
) |
Assign material Type.
Definition at line 291 of file cellTable.C.
void setName | ( | const label & | id, |
const word & | name | ||
) |
Assign name.
Definition at line 297 of file cellTable.C.
void setName | ( | const label & | id | ) |
Assign default name if not already set.
Definition at line 303 of file cellTable.C.
References Foam::name().
void readDict | ( | const objectRegistry & | registry, |
const word & | name = "cellTable" , |
||
const fileName & | instance = "constant" |
||
) |
Read constant/cellTable.
Definition at line 315 of file cellTable.C.
References clear(), Foam::endl(), IOobject::headerOk(), Foam::Info, IOobject::NO_WRITE, and IOobject::READ_IF_PRESENT.
void writeDict | ( | const objectRegistry & | registry, |
const word & | name = "cellTable" , |
||
const fileName & | instance = "constant" |
||
) | const |
write constant/cellTable for later reuse
Definition at line 350 of file cellTable.C.
References Foam::endl(), Foam::Info, IOobject::name(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::note(), IOobject::objectPath(), and IOobject::writeHeader().
Assignment.
Definition at line 383 of file cellTable.C.
References HashTable< T, label, Hash< label > >::operator=().
void operator= | ( | const Map< dictionary > & | rhs | ) |
Assign from Map<dictionary>
Definition at line 390 of file cellTable.C.
References HashTable< T, label, Hash< label > >::operator=().
Assign from cellZones.
Definition at line 397 of file cellTable.C.
References dictionary::add(), polyMesh::cellZones(), HashTable< T, Key, Hash >::clear(), forAll, HashTable< T, Key, Hash >::insert(), ZoneMesh< ZoneType, MeshType >::names(), primitiveMesh::nCells(), HashTable< T, label, Hash< label > >::operator=(), and List< T >::size().
Classify tableIds into cellZones according to the cellTable.
Definition at line 443 of file cellTable.C.
References List< T >::append(), IOobject::AUTO_WRITE, polyMesh::cellZones(), ZoneMesh< ZoneType, MeshType >::clear(), HashTable< T, Key, Hash >::end(), Foam::endl(), HashTable< T, Key, Hash >::find(), forAll, Foam::Info, PtrList< T >::set(), PtrList< T >::setSize(), List< T >::setSize(), List< T >::size(), and IOobject::writeOpt().
void combine | ( | const dictionary & | mapDict, |
labelList & | tableIds | ||
) |
Combine tableIds together.
each dictionary entry is a wordList
Definition at line 509 of file cellTable.C.
References DLListBase::empty(), Foam::endl(), HashTable< T, label, Hash< label > >::erase(), Foam::findIndex(), Foam::findStrings(), forAllConstIter, Foam::identity(), Foam::Info, Foam::inplaceRenumber(), HashTable< T, label, Hash< label > >::insert(), Foam::max(), Foam::min(), HashTable< T, label, Hash< label > >::size(), and HashTable< T, label, Hash< label > >::toc().