35const char*
const Foam::cellTable::defaultMaterial_ =
"fluid";
47 lookup.insert(iter.key(), zonei++);
56 Map<word> lookup =
names();
62 list[zonei++] = *iter;
69void Foam::cellTable::addDefaults()
73 if (!iter().
found(
"MaterialType"))
75 iter().add(
"MaterialType", defaultMaterial_);
81void Foam::cellTable::setEntry
91 iterator iter =
find(
id);
131 if (maxId < iter.key())
151 iter().getOrDefault<word>
172 const word lookupName = iter().getOrDefault<
word>
178 if (patterns.
match(lookupName))
180 lookup.insert(iter.key(), lookupName);
195 iter().readIfPresent(
"Label", theName);
230 iter().getOrDefault<word>(
"MaterialType", defaultMaterial_)
244 const label index = iter.key();
271 return selectType(
"fluid");
277 return selectType(
"solid");
283 return selectType(
"shell");
290 setEntry(
id,
"MaterialType", matlType);
296 setEntry(
id,
"Label",
name);
341 Info<<
"no constant/cellTable information available" <<
endl;
368 "persistent data for thirdParty mesh <-> OpenFOAM translation";
399 label nZoneCells = 0;
402 label unZonedType = zoneNames.
size() + 1;
408 nZoneCells += cZone.
size();
411 dict.
add(
"Label", zoneNames[zoneI]);
450 const auto iter = typeToZone.
cfind(tableIds[celli]);
453 zoneCells[*iter].
append(celli);
464 zoneCells[zoneI].shrink();
465 if (zoneCells[zoneI].size())
467 zoneUsed[nZone++] = zoneI;
477 Info<<
"cellZones not used" <<
endl;
484 const label origZoneI = zoneUsed[zoneI];
486 Info<<
"cellZone " << zoneI
487 <<
" (size: " << zoneCells[origZoneI].
size()
488 <<
") name: " << zoneNames[origZoneI] <<
endl;
495 zoneNames[origZoneI],
496 zoneCells[origZoneI],
519 wordRes patterns(iter().stream());
525 if (patterns.
match(namesIter()))
527 matches.
insert(namesIter.key(), namesIter());
533 label targetId = this->
findIndex(iter().keyword());
535 Info<<
"combine cellTable: " << iter().keyword();
539 targetId =
min(matches.
toc());
540 operator[](targetId).set(
"Label", iter().keyword());
551 matches.
erase(targetId);
552 origNames.
erase(targetId);
555 this->
erase(matches);
556 origNames.
erase(matches);
560 mapping[matchIter.key()] = targetId;
561 Info<<
" " << matchIter();
bool found() const noexcept
True if iterator points to an entry - same as good()
Forward iterator with const access.
Forward iterator with non-const access.
List< Key > toc() const
The table of contents (the keys) in unsorted order.
const T & lookup(const Key &key, const T &deflt) const
Return hashed entry if it exists, or return the given default.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
bool erase(const iterator &iter)
Erase an entry specified by given iterator.
void clear()
Clear all entries from table.
A Map of objects of type <T> with automated input and output. Is a global object; i....
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
const string & note() const noexcept
Return the optional note.
fileName objectPath() const
The complete path + object name.
bool writeHeader(Ostream &os) const
Write header with current type()
writeOption writeOpt() const noexcept
The write option.
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
void setSize(const label n)
Alias for resize()
void append(const T &val)
Append an element at the end of the list.
A HashTable to objects of type <T> with a label key.
void operator=(const this_type &rhs)
Copy assignment.
Output to file stream, using an OSstream.
const T * set(const label i) const
void setSize(const label newLen)
Same as resize()
void size(const label n)
Older name for setAddressableSize.
void clear()
Clear the zones.
wordList names() const
A list of the zone names.
A linked-list that is searchable by the 'name()' of the items.
The cellTable persistent data saved as a Map<dictionary>.
Map< word > solids() const
Return a Map of (id => name) for solids.
void setMaterial(const label, const word &)
Assign material Type.
label findIndex(const word &name) const
Return index corresponding to name.
void readDict(const objectRegistry &, const word &name="cellTable", const fileName &instance="constant")
Read constant/cellTable.
Map< word > shells() const
Return a Map of (id => name) for shells.
cellTable()
Construct null.
word name(const label id) const
Return the name corresponding to id.
Map< word > fluids() const
Return a Map of (id => name) for fluids.
void setName(const label, const word &)
Assign name.
Map< word > selectType(const word &materialType) const
Return a Map of (id => name) for materialType.
void operator=(const cellTable &)
Assignment.
void addCellZones(polyMesh &, const labelList &tableIds) const
Classify tableIds into cellZones according to the cellTable.
Map< word > names() const
Return a Map of (id => name)
Map< word > materialTypes() const
Return a Map of (id => fluid|solid|shell)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
A class for handling file names.
Foam::dictionary writeDict() const
Write to dictionary.
Registry of regIOobjects.
Mesh consisting of general polyhedral cells.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
label nCells() const noexcept
Number of mesh cells.
Lookup type of boundary radiation properties.
bool headerOk()
Read and check header info. Does not check the headerClassName.
bool append() const noexcept
True if output format uses an append mode.
A List of wordRe with additional matching capabilities.
bool match(const std::string &text, bool literal=false) const
Smart match as literal or regex, stopping on the first match.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as ListOps::find_if.
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
List< word > wordList
A List of words.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
label findIndex(const ListType &input, typename ListType::const_reference val, const label start=0)
Deprecated(2017-10) search for first occurrence of the given element.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
#define forAll(list, i)
Loop across all elements in list.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.