41namespace functionObjects
50bool Foam::functionObjects::ddt2::checkFormatName
52 const std::string& str
55 if (std::string::npos == str.find(
"@@"))
58 <<
"Bad result naming (no '@@' token found)."
66 <<
"Bad result naming (only a '@@' token found)."
76bool Foam::functionObjects::ddt2::accept(
const word& fieldName)
const
80 return !denyField_.match(fieldName);
84int Foam::functionObjects::ddt2::process(
const word& fieldName)
86 if (!accept(fieldName))
93 apply<volScalarField>(fieldName, state);
94 apply<volVectorField>(fieldName, state);
114 mag_(
dict.getOrDefault(
"mag", false))
126 if (
word(mesh_.ddtScheme(
"default")) ==
"steadyState")
129 << typeName <<
" function object not appropriate for steady-state"
134 dict.readEntry(
"fields", selectFields_);
135 selectFields_.uniq();
137 Info<<
type() <<
" fields: " << selectFields_ <<
nl;
139 resultName_ =
dict.getOrDefault<
word>
142 ( mag_ ?
"mag(ddt(@@))" :
"magSqr(ddt(@@))" )
148 (selectFields_.size() == 1 && selectFields_.first().isLiteral())
149 || checkFormatName(resultName_)
155 .replace(
"@@",
"(.+)")
175 for (
const wordRe& select : selectFields_)
177 if (select.isLiteral())
179 const word& fieldName = select;
181 if (!candidates.
erase(fieldName))
183 missing.
append(fieldName);
185 else if (process(fieldName) < 1)
187 ignored.
append(fieldName);
192 for (
const word& fieldName : candidates)
200 <<
"Missing field " << missing <<
endl;
205 <<
"Unprocessed field " << ignored <<
endl;
220 const wordList outputList = results_.sortedToc();
221 for (
const word& fieldName : outputList)
223 if (foundObject<regIOobject>(fieldName))
225 const regIOobject&
io = lookupObject<regIOobject>(fieldName);
227 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.
Computes the magnitude or magnitude squared of the Eulerian time derivative of an input volume field ...
virtual bool execute()
Calculate the ddt2 fields.
virtual bool write()
Write the ddt2 fields.
virtual bool read(const dictionary &)
Read the ddt2 specification.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
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.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
#define WarningInFunction
Report a warning using Foam::Warning.
StringType quotemeta(const StringType &str, const UnaryPredicate &meta, const char quote='\\')
Quote any meta-characters in given string.
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.