34 const char*
const Foam::cellTable::defaultMaterial_ =
"fluid";
45 lookup.insert(iter.key(), zoneI++);
54 Map<word> lookup =
names();
60 lst[zoneI++] = iter();
67 void Foam::cellTable::addDefaults()
71 if (!iter().
found(
"MaterialType"))
73 iter().add(
"MaterialType", defaultMaterial_);
79 void Foam::cellTable::setEntry
87 dict.add(keyWord, value);
135 if (maxId < iter.key())
155 iter().lookupOrDefault<
word>
176 word lookupName = iter().lookupOrDefault<
word>
184 lookup.
insert(iter.key(), lookupName);
199 iter().readIfPresent(
"Label", theName);
215 if (iter().lookupOrDefault<word>(
"Label",
word::null) == name)
234 iter().lookupOrDefault<
word>(
"MaterialType", defaultMaterial_)
251 == iter().lookupOrDefault<word>(
"MaterialType", defaultMaterial_)
257 iter().lookupOrDefault<
word>
291 setEntry(
id,
"MaterialType", matlType);
297 setEntry(
id,
"Label", name);
305 if (iter ==
end() || !iter().
found(
"Label"))
342 Info<<
"no constant/cellTable information available" <<
endl;
369 "persistent data for thirdParty mesh <-> OpenFOAM translation";
400 label nZoneCells = 0;
403 label unZonedType = zoneNames.
size() + 1;
409 nZoneCells += cZone.
size();
412 dict.
add(
"Label", zoneNames[zoneI]);
413 zoneDict.
insert(zoneI + 1, dict);
424 if (mesh.
nCells() > nZoneCells)
452 if (iter != typeToZone.
end())
454 zoneCells[iter()].
append(celli);
465 zoneCells[zoneI].shrink();
466 if (zoneCells[zoneI].
size())
468 zoneUsed[nZone++] = zoneI;
478 Info<<
"cellZones not used" <<
endl;
485 const label origZoneI = zoneUsed[zoneI];
487 Info<<
"cellZone " << zoneI
488 <<
" (size: " << zoneCells[origZoneI].
size()
489 <<
") name: " << zoneNames[origZoneI] <<
endl;
496 zoneNames[origZoneI],
497 zoneCells[origZoneI],
528 matches.
insert(namesIter.key(), namesIter());
536 Info<<
"combine cellTable: " << iter().keyword();
540 targetId =
min(matches.
toc());
541 operator[](targetId).set(
"Label", iter().keyword());
552 matches.
erase(targetId);
553 origNames.
erase(targetId);
556 this->
erase(matches);
557 origNames.
erase(matches);
561 mapping[matchIter.key()] = targetId;
562 Info<<
" " << matchIter();
label append(const dictionary &)
Append to the end, return index.
fileName objectPath() const
Return complete path + object name.
#define forAll(list, i)
Loop across all elements in list.
Map< word > solids() const
Return a Map of (id => name) for solids.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
An STL-conforming const_iterator.
void clear()
Clear the zones.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
bool empty() const
Return true if the list is empty.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Map< word > selectType(const word &materialType) const
Return a Map of (id => name) for materialType.
HashTable< dictionary, label, Hash< label > >::iterator iterator
word name(const label id) const
Return the name corresponding to id.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
void setName(const label, const word &)
Assign name.
void size(const label)
Override size to be inconsistent with allocated storage.
void writeDict(const objectRegistry &, const word &name="cellTable", const fileName &instance="constant") const
Write constant/cellTable for later reuse.
void operator=(const HashTable< T, label, Hash< label > > &)
Assignment.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool writeHeader(Ostream &) const
Write header.
Map< word > shells() const
Return a Map of (id => name) for shells.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
A Map of objects of type <T> with automated input and output.
label size() const
Return number of elements in table.
Operations on lists of strings.
void addCellZones(polyMesh &, const labelList &tableIds) const
Classify tableIds into cellZones according to the cellTable.
void setMaterial(const label, const word &)
Assign material Type.
writeOption writeOpt() const
void operator=(const cellTable &)
Assignment.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
An STL-conforming iterator.
string & note()
Return non-constant access to the optional note.
void readDict(const objectRegistry &, const word &name="cellTable", const fileName &instance="constant")
Read constant/cellTable.
stressControl lookup("compactNormalStress") >> compactNormalStress
Map< word > materialTypes() const
Return a Map of (id => fluid|solid|shell)
A class for handling words, derived from string.
wordList names() const
Return a list of zone names.
void clear()
Clear all entries from table.
void append(const T &)
Append an element at the end of the list.
void combine(const dictionary &, labelList &tableIds)
Combine tableIds together.
Map< word > names() const
Return a Map of (id => name)
bool set(const label) const
Is element set.
static const word null
An empty word.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
List< label > toc() const
Return the table of contents.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
The cellTable persistent data saved as a Map<dictionary>.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
bool found(const Key &) const
Return true if hashedEntry is found in table.
label findIndex(const word &name) const
Return index corresponding to name.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
List< word > wordList
A List of words.
void setSize(const label)
Reset size of List.
const cellZoneMesh & cellZones() const
Return cell zone mesh.
Input from memory buffer stream.
Map< word > fluids() const
Return a Map of (id => name) for fluids.
bool headerOk()
Read and check header info.
Mesh consisting of general polyhedral cells.
T & operator[](const Key &)
Find and return a hashedEntry.
Registry of regIOobjects.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
cellTable()
Construct null.
const word & name() const
Return name.
A HashTable to objects of type <T> with a label key.