35 namespace functionObjects
42 timeActivatedFileUpdate,
51 void Foam::functionObjects::timeActivatedFileUpdate::updateFile()
56 i < timeVsFile_.size()-1
57 && timeVsFile_[i+1].first() < time_.value()
65 Info<<
nl <<
type() <<
": copying file" <<
nl << timeVsFile_[i].second()
66 <<
nl <<
"to:" <<
nl << fileToUpdate_ <<
nl <<
endl;
69 cp(timeVsFile_[i].second(), destFile);
70 mv(destFile, fileToUpdate_);
78 Foam::functionObjects::timeActivatedFileUpdate::timeActivatedFileUpdate
87 fileToUpdate_(dict.
lookup(
"fileToUpdate")),
108 dict.
lookup(
"fileToUpdate") >> fileToUpdate_;
109 dict.
lookup(
"timeVsFile") >> timeVsFile_;
112 fileToUpdate_.expand();
114 Info<<
type() <<
": time vs file list:" <<
nl;
117 timeVsFile_[i].second() = timeVsFile_[i].second().expand();
118 if (!
isFile(timeVsFile_[i].second()))
121 <<
"File: " << timeVsFile_[i].second() <<
" not found" 125 Info<<
" " << timeVsFile_[i].first() <<
tab 126 << timeVsFile_[i].second() <<
endl;
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
virtual bool execute()
Execute file updates.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy, recursively if necessary, the source to the destination.
Abstract base-class for Time/database function objects.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
bool read(const char *, int32_t &)
A class for handling words, derived from string.
virtual bool write()
Do nothing.
pid_t pid()
Return the PID of this process.
virtual ~timeActivatedFileUpdate()
Destructor.
virtual bool read(const dictionary &)
Read the timeActivatedFileUpdate data.
word name(const complex &)
Return a string representation of a complex.
defineTypeNameAndDebug(Qdot, 0)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.