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.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
A class for handling file names.
bool set(const label) const
Is element set.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
An STL-conforming const_iterator.
Map< word > shells() const
Return a Map of (id => name) for shells.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
const meshCellZones & cellZones() const
Return cell zones.
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...
HashTable< dictionary, label, Hash< label > >::iterator iterator
#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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Map< word > solids() const
Return a Map of (id => name) for solids.
bool headerOk()
Read and check header info.
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. Is a global object; i...
Operations on lists of strings.
void clear()
Clear the zones.
void setMaterial(const label, const word &)
Assign material Type.
void operator=(const cellTable &)
Assignment.
label size() const
Return number of elements in table.
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.
void writeDict(const objectRegistry &, const word &name="cellTable", const fileName &instance="constant") const
Write constant/cellTable for later reuse.
wordList names() const
Return a list of zone names.
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
bool found(const Key &) const
Return true if hashedEntry is found in table.
A class for handling words, derived from string.
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)
Map< word > materialTypes() const
Return a Map of (id => fluid|solid|shell)
static const word null
An empty word.
Map< word > fluids() const
Return a Map of (id => name) for fluids.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
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.
word name(const label id) const
Return the name corresponding to id.
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.
writeOption writeOpt() const
Input from memory buffer stream.
bool writeHeader(Ostream &) const
Write header.
void addCellZones(polyMesh &, const labelList &tableIds) const
Classify tableIds into cellZones according to the cellTable.
Mesh consisting of general polyhedral cells.
T & operator[](const Key &)
Find and return a hashedEntry.
List< label > toc() const
Return the table of contents.
Registry of regIOobjects.
label findIndex(const word &name) const
Return index corresponding to name.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
fileName objectPath() const
Return complete path + object name.
Map< word > selectType(const word &materialType) const
Return a Map of (id => name) for materialType.
void operator=(const Map< T > &map)
cellTable()
Construct null.
A HashTable to objects of type <T> with a label key.