ENH: use readOption to fine-tune dictionary reading

- previously had 'mandatory' (bool) for advanced control of reading
  dictionary entries but its meaning was unclear in the calling code
  without extra code comments.

  Now use IOobjectOption::readOption instead, which allows further
  options (ie, NO_READ) and is more transparent as to its purpose in
  the code than a true/false bool flag was.

  This is a minor breaking change (infrequent, advanced usage only)

- minor code cleanup in dictionary lookup methods
This commit is contained in:
Mark Olesen
2022-09-30 15:43:01 +02:00
parent d938e01d7a
commit 7eda6de6f4
21 changed files with 279 additions and 222 deletions

View File

@ -1038,13 +1038,17 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
}
}
// Mandatory if we didn't pick up a value from selectionNames_
// The "name" entry
// - mandatory if we didn't pick up a value from selectionNames_
dict.readEntry
(
"name",
regionName_,
keyType::LITERAL,
regionName_.empty()
(
regionName_.empty()
? IOobjectOption::MUST_READ : IOobjectOption::READ_IF_PRESENT
)
);
// Ensure there is always content for selectionNames_