39namespace functionObjects
48bool 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)."
74int 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;
117 dict.getOrDefault<
word>(
"result", scopedName(
type() +
"(@@)"));
122 (selectFields_.size() == 1 && selectFields_.first().isLiteral())
123 || checkFormatName(resultName_)
137 for (
const wordRe& select : selectFields_)
139 if (select.isLiteral())
141 const word& fieldName = select;
143 if (!candidates.
erase(fieldName))
145 missing.
append(fieldName);
147 else if (process(fieldName) < 1)
149 ignored.
append(fieldName);
154 for (
const word& fieldName : candidates)
162 <<
"Missing field " << missing <<
endl;
167 <<
"Unprocessed field " << ignored <<
endl;
182 for (
const word& fieldName : results_.sortedToc())
184 const regIOobject* ioptr = findObject<regIOobject>(fieldName);
188 Log <<
" " << fieldName <<
endl;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
bool erase(const iterator &iter)
Erase an entry specified by given iterator.
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Creates a volume field with zero-gradient boundary conditions from another volume field.
virtual bool read(const dictionary &dict)
Read the zeroGradient specification.
virtual bool execute()
Calculate the zeroGradient fields.
virtual bool write()
Write the zeroGradient fields.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
virtual bool write(const bool valid=true) const
Write using setting from DB.
A class for handling character strings derived from std::string.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define WarningInFunction
Report a warning using Foam::Warning.
StringListType subsetStrings(const regExp &matcher, const StringListType &input, const bool invert=false)
Extract elements of StringList when regular expression matches.
messageStream Info
Information stream (stdout output on master, null elsewhere)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
constexpr char nl
The newline '\n' character (0x0a)
Operations on lists of strings.