58 { writeOption::NO_WRITE,
"noWrite" },
59 { writeOption::AUTO_WRITE,
"autoWrite" },
60 { writeOption::ANY_WRITE,
"anyWrite" },
61 { writeOption::LOG,
"log" },
83Foam::functionObjects::writeObjects::writeObjects
92 writeOption_(ANY_WRITE),
108 if (
dict.found(
"field"))
111 dict.readEntry(
"field", objectNames_.
first());
113 else if (
dict.found(
"fields"))
115 dict.readEntry(
"fields", objectNames_);
119 dict.readEntry(
"objects", objectNames_);
141 if (writeOption_ == writeOption::LOG)
143 const auto& classes = obr_.classes();
145 Log <<
"Registered objects:\n";
149 const word& className = classInfo.key();
152 Log <<
" " << className <<
":\n";
154 for (
const auto& objectName : objectSet)
156 Log <<
" " << objectName <<
"\n";
168 if (!obr_.time().writeTime())
170 obr_.time().writeTimeDict();
174 const wordList selectedNames(obr_.sortedNames<regIOobject>(objectNames_));
177 bitSet missed(objectNames_.size());
180 for (
const wordRe& select : objectNames_)
192 <<
"No corresponding selection for "
194 <<
"Available objects in database:"
195 <<
nl << obr_.sortedToc()
199 for (
const word& objName : selectedNames)
201 regIOobject& obj = obr_.lookupObjectRef<regIOobject>(objName);
203 switch (writeOption_)
205 case writeOption::NO_WRITE:
214 case writeOption::AUTO_WRITE:
223 case writeOption::ANY_WRITE:
230 <<
"Unknown writeOption "
231 << writeOptionNames_[writeOption_]
232 <<
". Valid writeOption types are "
244 && obr_.time().writeTime()
247 Log <<
" automatically written object " << obj.name() <<
endl;
265 Log <<
" writing object " << obj.name() <<
endl;
Various functions to operate on Lists.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
writeOption writeOpt() const noexcept
Get the write option.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
const word & name() const noexcept
Return the object name.
void resize(const label len)
Adjust allocated size of list.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
T & first()
Access first element of the list, position [0].
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
bool any() const
True if any bits in this bitset are set.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
functionObject(const word &name, const bool withNamePrefix=defaultUseNamePrefix)
Construct from components.
Allows specification of different writing frequency of objects registered to the database.
static const Enum< writeOption > writeOptionNames_
Names for writeOption.
writeOption
Re-enumeration defining the write options, Naming based on the IOobjectOption::writeOption.
virtual bool execute()
Execute the function-object operations (no-op).
virtual bool write()
Write the function-object results.
virtual bool read(const dictionary &)
Read the function-object dictionary.
Registry of regIOobjects.
static word defaultRegion
Return the default region name.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
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.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
bool found(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as found_if.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
List< word > wordList
List of word.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
Extract elements of the input list when select is true.
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.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
const Foam::objectRegistry & setRegistry(const Foam::Time &runTime, const Foam::dictionary &dict)