39 template<
class MatchPredicate>
43 const MatchPredicate& nameMatcher
54 lookupName =
"boundaryRegion_" +
Foam::name(iter.key());
57 if (nameMatcher(lookupName))
59 output.
emplace(iter.key(), std::move(lookupName));
89 if (maxId < iter.key())
101 label maxId = this->maxIndex();
130 lookupType =
"patch";
133 output.
emplace(iter.key(), std::move(lookupType));
144 const auto iter = cfind(
id);
147 iter.val().readIfPresent(
"Label", lookupName);
150 if (lookupName.empty() &&
id >= 0)
168 const auto&
dict = iter.val();
183 word lookupType(
"patch");
188 operator[](
id).readIfPresent(
"BoundaryType", lookupType);
197 const objectRegistry& obr,
199 const fileName& instance
205 IOMap<dictionary> ioObj
218 if (ioObj.headerOk())
224 Info<<
"no constant/boundaryRegion information available" <<
endl;
231 const objectRegistry& obr,
233 const fileName& instance
237 IOMap<dictionary> ioObj
251 "persistent data for third-party mesh <-> OpenFOAM translation";
253 Info<<
"Writing " << ioObj.name() <<
" to " 254 << ioObj.objectRelPath() <<
endl;
256 OFstream os(ioObj.objectPath());
257 ioObj.writeHeader(os);
292 mapping.reserve(mapDict.size());
294 for (
const entry& dEntry : mapDict)
296 const word oldName(dEntry.stream());
298 const label
id = this->
findIndex(oldName);
301 mapping.insert(
id, dEntry.keyword());
307 const word& newName = iter.val();
314 oldName =
"boundaryRegion_" +
Foam::name(iter.key());
317 Info<<
"rename patch: " << newName <<
" <- " << oldName <<
nl;
A class for handling file names.
bool emplace(const label &key, Args &&... args)
Emplace insert a new entry, not overwriting existing entries.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ignore writing from objectRegistry::writeObject()
label findIndex(const word &name) const
The index corresponding to entry with 'Label' of given name, or -1 if not found.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
label size() const noexcept
The number of elements in table.
Unary and binary predicates that always return true, useful for templating.
void rename(const dictionary &)
Rename regions.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Map< word > boundaryTypes() const
Return the extracted Map of (id => type)
A class for handling words, derived from Foam::string.
void clear()
Remove all entries from table.
boundaryRegion() noexcept=default
Default construct.
Reading is optional [identical to LAZY_READ].
Map< word > names() const
Return the extracted Map of (id => name)
A List of wordRe with additional matching capabilities.
propsDict readIfPresent("fields", acceptFields)
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
static Map< word > names_impl(const Map< dictionary > &input, const MatchPredicate &nameMatcher)
label push_back(const dictionary &dict)
Add to the end, return index.
word boundaryType(const word &name) const
Return BoundaryType corresponding to patch 'name', "patch" if not found.
void operator=(const boundaryRegion &)
Copy assignment.
void readDict(const objectRegistry &obr, const word &name="boundaryRegion", const fileName &instance="constant")
Read constant/boundaryRegion.
label maxIndex() const
The max table index, -1 if empty.
void reserve(label numEntries)
Reserve space for at least the specified number of elements (not the number of buckets) and regenerat...
messageStream Info
Information stream (stdout output on master, null elsewhere)
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
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.
Registry of regIOobjects.
The boundaryRegion persistent data saved as a Map<dictionary>.
word name(const label id) const
The 'Label' name corresponding to id, or boundaryRegion_ID if not otherwise defined.
void writeDict(const objectRegistry &obr, const word &name="boundaryRegion", const fileName &instance="constant") const
Write constant/boundaryRegion for later reuse.
void operator=(const this_type &rhs)
Copy assignment.
Do not request registration (bool: false)
forAllConstIters(mixture.phases(), phase)
A HashTable to objects of type <T> with a label key.