Go to the documentation of this file.
39 namespace functionObjects
48 bool Foam::functionObjects::zeroGradient::checkFormatName
50 const std::string& str
53 if (std::string::npos == str.find(
"@@"))
56 <<
"Bad result naming (no '@@' token found)."
64 <<
"Bad result naming (only a '@@' token found)."
74 int Foam::functionObjects::zeroGradient::process(
const word& fieldName)
77 apply<scalar>(fieldName, state);
78 apply<vector>(fieldName, state);
79 apply<sphericalTensor>(fieldName, state);
80 apply<symmTensor>(fieldName, state);
81 apply<tensor>(fieldName, state);
111 dict.readEntry(
"fields", selectFields_);
112 selectFields_.uniq();
114 Info<<
type() <<
" fields: " << selectFields_ <<
nl;
116 resultName_ =
dict.getOrDefault<
word>(
"result",
type() +
"(@@)");
121 (selectFields_.size() == 1 && selectFields_.first().isLiteral())
122 || checkFormatName(resultName_)
136 for (
const wordRe& select : selectFields_)
138 if (select.isLiteral())
140 const word& fieldName = select;
142 if (!candidates.
erase(fieldName))
144 missing.append(fieldName);
146 else if (process(fieldName) < 1)
148 ignored.append(fieldName);
153 for (
const word& fieldName : candidates)
161 <<
"Missing field " << missing <<
endl;
166 <<
"Unprocessed field " << ignored <<
endl;
181 for (
const word& fieldName : results_.sortedToc())
183 const regIOobject* ioptr = findObject<regIOobject>(fieldName);
187 Log <<
" " << fieldName <<
endl;
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
virtual bool read(const dictionary &dict)
Read the zeroGradient specification.
bool read(const char *buf, int32_t &val)
Same as readInt32.
virtual bool execute()
Calculate the zeroGradient fields.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
virtual bool write(const bool valid=true) const
Write using setting from DB.
bool erase(const iterator &iter)
Erase an entry specified by given iterator.
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
StringListType subsetStrings(const regExp &matcher, const StringListType &input, const bool invert=false)
Extract elements of StringList when regular expression matches.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
static const string null
An empty string.
virtual bool read(const dictionary &dict)
Read optional controls.
Macros for easy insertion into run-time selection tables.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
zeroGradient(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
defineTypeNameAndDebug(ObukhovLength, 0)
Operations on lists of strings.
#define WarningInFunction
Report a warning using Foam::Warning.
virtual bool write()
Write the zeroGradient fields.