39template<
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));
73 const objectRegistry& obr,
75 const fileName& instance
89 if (maxId < iter.key())
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");
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;
propsDict readIfPresent("fields", acceptFields)
bool empty() const noexcept
True if the list is empty.
label size() const noexcept
The number of elements in list.
const_iterator cfind(const label &key) const
void reserve(label numEntries)
Reserve space for at least the specified number of elements (not the number of buckets) and regenerat...
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 emplace(const Key &key, Args &&... args)
Emplace insert a new entry, not overwriting existing entries.
dictionary & operator[](const label &key)
A Map of objects of type <T> with automated input and output. Is a global object; i....
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
fileName objectRelPath() const
The object path relative to the case.
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().
A HashTable to objects of type <T> with a label key.
constexpr Map() noexcept=default
void operator=(const this_type &rhs)
Copy assignment.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
word boundaryType(const word &name) const
Return BoundaryType corresponding to patch 'name', "patch" if not found.
label findIndex(const word &name) const
The index corresponding to entry with 'Label' of given name, or -1 if not found.
label maxIndex() const
The max table index, -1 if empty.
boundaryRegion() noexcept=default
Default construct.
void readDict(const objectRegistry &obr, const word &name="boundaryRegion", const fileName &instance="constant")
Read constant/boundaryRegion.
word name(const label id) const
The 'Label' name corresponding to id, or boundaryRegion_ID if not otherwise defined.
Map< word > boundaryTypes() const
Return the extracted Map of (id => type).
Map< word > names() const
Return the extracted Map of (id => name).
void writeDict(const objectRegistry &obr, const word &name="boundaryRegion", const fileName &instance="constant") const
Write constant/boundaryRegion for later reuse.
label push_back(const dictionary &dict)
Add to the end, return index.
boundaryRegion(const boundaryRegion &)=delete
No copy construct.
void rename(const dictionary &)
Rename regions.
void operator=(const boundaryRegion &)
Copy assignment.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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...
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
A keyword and a list of tokens is an 'entry'.
A class for handling file names.
Registry of regIOobjects.
bool headerOk()
Read and check header info. Does not check the headerClassName.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
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.
messageStream Info
Information stream (stdout output on master, null elsewhere).
static Map< word > names_impl(const Map< dictionary > &input, const MatchPredicate &nameMatcher)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
constexpr char nl
The newline '\n' character (0x0a).
nonInt insert("surfaceSum(((S|magSf)*S)")
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
Unary and binary predicates that always return true, useful for templating.