36 namespace substitutionModels
45 Foam::substitutionModels::fileRegEx::fileRegEx
62 matchSeparator_(
dict.getOrDefault<
string>(
"matchSeparator",
" ")),
63 lastMatch_(
dict.getOrDefault<bool>(
"lastMatch", true))
67 for (
const auto&
e : entriesDict)
69 entries_.insert(
cleanKey(
e.keyword()),
string(
e.stream()));
78 return entries_.found(keyName);
88 if (!valid(
key))
return false;
97 <<
"Unable to find file at " << path_
98 <<
". Deactivating." <<
endl;
103 Info<<
"Scanning for sections beginning with " 104 << sectionSeparator_ <<
endl;
110 bool started = sectionSeparator_.empty() ? true :
false;
114 if (
line.starts_with(sectionSeparator_))
125 Info<<
"Cached " << lines.size() <<
" lines" <<
endl;
130 for (
const string& data : lines)
137 for (
size_t i = 1; i <
match.size(); ++i)
139 if (i > 1) oss << matchSeparator_;
140 oss <<
match[i].str().c_str();
143 if (!lastMatch_)
break;
159 return entries_.sortedToc();
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
A class for handling file names.
SubStrings< std::string > results_type
Type for matches - similar to std::smatch.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
virtual bool apply(const word &key, string &buffer) const
Apply substitutions to this string buffer.
Base class for substitution models.
const dimensionedScalar re
Classical electron radius: default SI units: [m].
Ostream & endl(Ostream &os)
Add newline and flush stream.
regExpPosix regExp
Selection of preferred regular expression implementation.
virtual bool valid(const word &keyName) const
Return true of model applies to this keyName.
bool match(const UList< wordRe > &selectors, const std::string &text)
True if text matches one of the selector expressions.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
The fileRegEx substitution model.
const dimensionedScalar e
Elementary charge.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
A class for handling words, derived from Foam::string.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Input from file stream as an ISstream, normally using std::ifstream for the actual input...
addToRunTimeSelectionTable(substitutionModel, dictionaryValue, dictionary)
string & replaceAll(const std::string &s1, const std::string &s2, size_type pos=0)
Replace all occurrences of sub-string s1 with s2, beginning at pos in the string. ...
virtual wordList keys() const
Return a word list of the keys.
#define WarningInFunction
Report a warning using Foam::Warning.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
defineTypeNameAndDebug(dictionaryValue, 0)
messageStream Info
Information stream (stdout output on master, null elsewhere)
static word cleanKey(const string &str)
Clean the key text.
A class for handling character strings derived from std::string.