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>
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);
304 if (!iter.found() || !iter().found(
"Label"))
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]);
412 zoneDict.insert(zoneI + 1,
dict);
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;
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],
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();
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
void setName(const label, const word &)
Assign name.
void clear()
Clear the zones.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
typename parent_type::const_iterator const_iterator
const word & name() const
Return name.
A class for handling words, derived from Foam::string.
Map< word > selectType(const word &materialType) const
Return a Map of (id => name) for materialType.
A class for handling file names.
void writeDict(const objectRegistry &, const word &name="cellTable", const fileName &instance="constant") const
Write constant/cellTable for later reuse.
void readDict(const objectRegistry &, const word &name="cellTable", const fileName &instance="constant")
Read constant/cellTable.
void operator=(const cellTable &)
Assignment.
void operator=(const this_type &rhs)
Copy assignment.
const cellZoneMesh & cellZones() const
Return cell zone mesh.
A HashTable to objects of type <T> with a label key.
Map< word > names() const
Return a Map of (id => name)
void append(const T &val)
Append an element at the end of the list.
Map< word > materialTypes() const
Return a Map of (id => fluid|solid|shell)
Ostream & endl(Ostream &os)
Add newline and flush stream.
label append(const dictionary &)
Append to the end, return index.
typename parent_type::iterator iterator
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
bool match(const std::string &text, bool literal=false) const
Smart match as literal or regex, stopping on the first match.
List< word > wordList
A List of words.
Registry of regIOobjects.
Map< word > fluids() const
Return a Map of (id => name) for fluids.
label nCells() const
Number of mesh cells.
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
const cellModel * lookup(const word &modelName)
Deprecated(2017-11) equivalent to cellModel::ptr static method.
word name(const label id) const
Return the name corresponding to id.
The cellTable persistent data saved as a Map<dictionary>.
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.
Map< word > solids() const
Return a Map of (id => name) for solids.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Lookup type of boundary radiation properties.
void combine(const dictionary &mapDict, labelList &tableIds)
Combine tableIds together.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
void setMaterial(const label, const word &)
Assign material Type.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Find index of the first occurrence that satisfies the predicate.
Input from string buffer, using a ISstream.
label findIndex(const word &name) const
Return index corresponding to name.
wordList names() const
A list of the zone names.
Output to file stream, using an OSstream.
const string & note() const
Return the optional note.
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)
Create identity map of the given length with (map[i] == i)
A List of wordRe with additional matching capabilities.
cellTable()
Construct null.
static const word null
An empty word.
Map< word > shells() const
Return a Map of (id => name) for shells.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
bool writeHeader(Ostream &os) const
Write header.
fileName objectPath() const
The complete path + object name.
void setSize(const label newSize)
Alias for resize(const label)
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
bool headerOk()
Read and check header info.
void addCellZones(polyMesh &, const labelList &tableIds) const
Classify tableIds into cellZones according to the cellTable.
A Map of objects of type <T> with automated input and output. Is a global object; i....