Go to the documentation of this file.
35 const char*
const Foam::cellTable::defaultMaterial_ =
"fluid";
47 lookup.insert(iter.key(), zonei++);
56 Map<word> lookup =
names();
62 list[zonei++] = *iter;
69 void Foam::cellTable::addDefaults()
73 if (!iter().
found(
"MaterialType"))
75 iter().add(
"MaterialType", defaultMaterial_);
81 void Foam::cellTable::setEntry
91 iterator iter =
find(
id);
120 readDict(registry,
name, instance);
131 if (maxId < iter.key())
151 iter().getOrDefault<word>
165 const wordRes& patterns
172 const word lookupName = iter().getOrDefault<word>
178 if (patterns.match(lookupName))
180 lookup.insert(iter.key(), lookupName);
192 const_iterator iter = cfind(
id);
195 iter().readIfPresent(
"Label", theName);
230 iter().getOrDefault<word>(
"MaterialType", defaultMaterial_)
244 const label index = iter.key();
245 const dictionary&
dict = iter.val();
271 return selectType(
"fluid");
277 return selectType(
"solid");
283 return selectType(
"shell");
290 setEntry(
id,
"MaterialType", matlType);
296 setEntry(
id,
"Label",
name);
302 iterator iter =
find(
id);
304 if (!iter.found() || !iter().
found(
"Label"))
313 const objectRegistry& registry,
315 const fileName& instance
321 IOMap<dictionary> ioObj
334 if (ioObj.headerOk())
341 Info<<
"no constant/cellTable information available" <<
endl;
348 const objectRegistry& registry,
350 const fileName& instance
354 IOMap<dictionary> ioObj
368 "persistent data for thirdParty mesh <-> OpenFOAM translation";
370 Info<<
"Writing " << ioObj.name() <<
" to " << ioObj.objectPath() <<
endl;
372 OFstream
os(ioObj.objectPath());
373 ioObj.writeHeader(
os);
399 label nZoneCells = 0;
402 label unZonedType = zoneNames.size() + 1;
408 nZoneCells += cZone.size();
411 dict.
add(
"Label", zoneNames[zoneI]);
412 zoneDict.insert(zoneI + 1,
dict);
428 dictionary(IStringStream(
"Label cells;")())
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;
470 zoneUsed.setSize(nZone);
477 Info<<
"cellZones not used" <<
endl;
480 czMesh.setSize(nZone);
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],
513 Map<word> origNames(
names());
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();
List< label > labelList
A List of labels.
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
void setName(const label, const word &)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
typename parent_type::const_iterator const_iterator
A class for handling words, derived from Foam::string.
Map< word > selectType(const word &materialType) const
A class for handling file names.
void writeDict(const objectRegistry &, const word &name="cellTable", const fileName &instance="constant") const
void readDict(const objectRegistry &, const word &name="cellTable", const fileName &instance="constant")
void operator=(const this_type &rhs)
A HashTable to objects of type <T> with a label key.
Map< word > names() const
void append(const T &val)
Map< word > materialTypes() const
Ostream & endl(Ostream &os)
label append(const dictionary &)
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with the type cellZone.
typename parent_type::iterator iterator
label min(const labelHashSet &set, label minValue=labelMax)
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Mesh consisting of general polyhedral cells.
bool match(const std::string &text, bool literal=false) const
List< word > wordList
A List of words.
Registry of regIOobjects.
Map< word > fluids() const
label nCells() const noexcept
const cellZoneMesh & cellZones() const noexcept
void setSize(const label n)
word name(const label id) const
The cellTable persistent data saved as a Map<dictionary>.
label findIndex(const ListType &input, typename ListType::const_reference val, const label start=0)
Map< word > solids() const
label max(const labelHashSet &set, label maxValue=labelMin)
Lookup type of boundary radiation properties.
void combine(const dictionary &mapDict, labelList &tableIds)
#define forAllIters(container, iter)
void setMaterial(const label, const word &)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
label findIndex(const word &name) const
Output to file stream, using an OSstream.
const word & name() const noexcept
const string & note() const noexcept
forAllConstIters(mixture.phases(), phase)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
labelList identity(const label len, label start=0)
A List of wordRe with additional matching capabilities.
word name(const expressions::valueTypeCode typeCode)
Map< word > shells() const
entry * add(entry *entryPtr, bool mergeEntry=false)
bool writeHeader(Ostream &os) const
fileName objectPath() const
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
void addCellZones(polyMesh &, const labelList &tableIds) const
A Map of objects of type <T> with automated input and output. Is a global object; i....