39 namespace functionObjects
58 { writeOption::NO_WRITE,
"noWrite" },
59 { writeOption::AUTO_WRITE,
"autoWrite" },
60 { writeOption::ANY_WRITE,
"anyWrite" },
61 { writeOption::LOG,
"log" },
83 Foam::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_);
126 writeOption::ANY_WRITE
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;
defineTypeNameAndDebug(ObukhovLength, 0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual bool write()
Write the registered objects.
void resize(const label len)
Adjust allocated size of list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool found(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as found_if.
List< bool > select(const label n, const labelUList &locations)
Construct a selection list of bools (all false) with the given pre-size, subsequently add specified l...
constexpr char nl
The newline '\n' character (0x0a)
T & first()
Access first element of the list, position [0].
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ignore writing from objectRegistry::writeObject()
Abstract base-class for Time/database function objects.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool warnOnly=false) const
Find the key in the dictionary and return the corresponding enumeration element based on its name...
Macros for easy insertion into run-time selection tables.
Various functions to operate on Lists.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
static word defaultRegion
Return the default region name.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
writeOption
Re-enumeration defining the write options, Naming based on the IOobjectOption::writeOption.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
Extract elements of the input list when select is true.
List< word > wordList
List of word.
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
static const Enum< writeOption > writeOptionNames_
Names for writeOption.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
Automatically write from objectRegistry::writeObject()
const Foam::objectRegistry & setRegistry(const Foam::Time &runTime, const Foam::dictionary &dict)
Registry of regIOobjects.
virtual bool execute()
Do nothing.
virtual bool read(const dictionary &)
Read the writeObjects data.
forAllConstIters(mixture.phases(), phase)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.