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
89 iterator iter = find(
id);
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);
234 iter().lookupOrDefault<word>(
"MaterialType", defaultMaterial_)
251 == iter().lookupOrDefault<word>(
"MaterialType", defaultMaterial_)
257 iter().lookupOrDefault<word>
272 return selectType(
"fluid");
278 return selectType(
"solid");
284 return selectType(
"shell");
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]);
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],
527 matches.
insert(namesIter.key(), namesIter());
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();
#define forAll(list, i)
Loop across all elements in list.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
wordList toc() const
Return the table of contents.
An STL-conforming const_iterator.
An STL-conforming iterator.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
List< Key > toc() const
Return the table of contents.
label size() const
Return number of elements in table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
void operator=(const HashTable< T, label, Hash< label > > &)
Assignment operator.
void clear()
Clear all entries from table.
A Map of objects of type <Type> with automated input and output. Is a global object; i....
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
writeOption writeOpt() const
string & note()
Return non-constant access to the optional note.
const word & name() const
Return name.
bool writeHeader(Ostream &) const
Write header.
Input from memory buffer stream.
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
A HashTable to objects of type <T> with a label key.
autoPtr< T > set(const label, const word &key, T *)
Set element to pointer provided and return old element.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void clear()
Clear the zones.
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.
void combine(const dictionary &, labelList &tableIds)
Combine tableIds together.
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)
void writeDict(const objectRegistry &, const word &name="cellTable", const fileName &instance="constant") const
Write constant/cellTable for later reuse.
label append(const dictionary &)
Append to the end, return index.
A list of keyword definitions, which are a keyword followed by any number of values (e....
bool add(entry *, bool mergeEntry=false)
Add a new entry.
A class for handling file names.
Registry of regIOobjects.
Mesh consisting of general polyhedral cells.
const cellZoneList & cellZones() const
Return cell zones.
fileName objectPath() const
Return complete path + object name.
bool headerOk()
Read and check header info.
A class for handling words, derived from string.
static const word null
An empty word.
void insert(const scalar, DynamicList< floatScalar > &)
Append scalar to given DynamicList.
List< word > wordList
A List of words.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
Operations on lists of strings.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable