Go to the documentation of this file.
39 namespace functionObjects
54 bool Foam::functionObjects::zeroGradient::checkFormatName
56 const std::string& str
59 if (std::string::npos == str.find(
"@@"))
62 <<
"Bad result naming (no '@@' token found)."
70 <<
"Bad result naming (only a '@@' token found)."
80 int Foam::functionObjects::zeroGradient::process(
const word& fieldName)
83 apply<scalar>(fieldName, state);
84 apply<vector>(fieldName, state);
85 apply<sphericalTensor>(fieldName, state);
86 apply<symmTensor>(fieldName, state);
87 apply<tensor>(fieldName, state);
95 Foam::functionObjects::zeroGradient::zeroGradient
117 dict.readEntry(
"fields", selectFields_);
118 selectFields_.uniq();
120 Info<<
type() <<
" fields: " << selectFields_ <<
nl;
122 resultName_ =
dict.lookupOrDefault<
word>(
"result",
type() +
"(@@)");
127 (selectFields_.size() == 1 && selectFields_.first().isLiteral())
128 || checkFormatName(resultName_)
142 for (
const wordRe& select : selectFields_)
144 if (select.isLiteral())
146 const word& fieldName = select;
148 if (!candidates.
erase(fieldName))
150 missing.append(fieldName);
152 else if (process(fieldName) < 1)
154 ignored.append(fieldName);
159 for (
const word& fieldName : candidates)
167 <<
"Missing field " << missing <<
endl;
172 <<
"Unprocessed field " << ignored <<
endl;
187 for (
const word& fieldName : results_.sortedToc())
189 const regIOobject* ioptr = findObject<regIOobject>(fieldName);
193 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.
addToRunTimeSelectionTable(functionObject, add, dictionary)
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.
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Operations on lists of strings.
#define WarningInFunction
Report a warning using Foam::Warning.
virtual bool write()
Write the zeroGradient fields.
#define Log
Report write to Foam::Info if the local log switch is true.