Go to the documentation of this file.
40 namespace functionObjects
55 bool Foam::functionObjects::ddt2::checkFormatName
57 const std::string& str
60 if (std::string::npos == str.find(
"@@"))
63 <<
"Bad result naming (no '@@' token found)."
71 <<
"Bad result naming (only a '@@' token found)."
81 bool Foam::functionObjects::ddt2::accept(
const word& fieldName)
const
85 return !blacklist_.match(fieldName);
89 int Foam::functionObjects::ddt2::process(
const word& fieldName)
91 if (!accept(fieldName))
98 apply<volScalarField>(fieldName, state);
99 apply<volVectorField>(fieldName, state);
107 Foam::functionObjects::ddt2::ddt2
119 mag_(
dict.lookupOrDefault(
"mag",
false))
131 if (
word(mesh_.ddtScheme(
"default")) ==
"steadyState")
134 << typeName <<
" function object not appropriate for steady-state"
139 dict.readEntry(
"fields", selectFields_);
140 selectFields_.uniq();
142 Info<<
type() <<
" fields: " << selectFields_ <<
nl;
144 resultName_ =
dict.lookupOrDefault<
word>
147 ( mag_ ?
"mag(ddt(@@))" :
"magSqr(ddt(@@))" )
153 (selectFields_.size() == 1 && selectFields_.first().isLiteral())
154 || checkFormatName(resultName_)
159 string::quotemeta<regExp>
162 ).replace(
"@@",
"(.+)")
182 for (
const wordRe& select : selectFields_)
184 if (select.isLiteral())
186 const word& fieldName = select;
188 if (!candidates.
erase(fieldName))
190 missing.append(fieldName);
192 else if (process(fieldName) < 1)
194 ignored.append(fieldName);
199 for (
const word& fieldName : candidates)
207 <<
"Missing field " << missing <<
endl;
212 <<
"Unprocessed field " << ignored <<
endl;
227 const wordList outputList = results_.sortedToc();
228 for (
const word& fieldName : outputList)
230 if (foundObject<regIOobject>(fieldName))
232 const regIOobject& io = lookupObject<regIOobject>(fieldName);
234 Log <<
" " << fieldName <<
endl;
virtual bool write()
Write the ddt fields.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual bool read(const dictionary &)
Read the ddt2 specification.
A class for handling words, derived from Foam::string.
virtual bool execute()
Calculate the ddt2 fields.
bool read(const char *buf, int32_t &val)
Same as readInt32.
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,...
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.
static const word null
An empty word.
Operations on lists of strings.
#define WarningInFunction
Report a warning using Foam::Warning.
#define Log
Report write to Foam::Info if the local log switch is true.