35 namespace functionObjects
51 void Foam::functionObjects::timeActivatedFileUpdate::updateFile()
56 i < fileVsTime_.size()-1
65 Info<<
nl <<
type() <<
": copying file" <<
nl << fileVsTime_[i].second()
66 <<
nl <<
"to:" <<
nl << fileToUpdate_ <<
nl <<
endl;
69 cp(fileVsTime_[i].
second(), destFile);
70 mv(destFile, fileToUpdate_);
78 Foam::functionObjects::timeActivatedFileUpdate::timeActivatedFileUpdate
86 fileToUpdate_(
dict.lookup(
"fileToUpdate")),
107 dict.lookup(
"fileToUpdate") >> fileToUpdate_;
108 dict.lookupBackwardsCompatible({
"fileVsTime",
"timeVsFile"}) >> fileVsTime_;
111 fileToUpdate_.expand();
113 Info<<
type() <<
": file vs time list:" <<
nl;
116 fileVsTime_[i].second() = fileVsTime_[i].second().expand();
120 <<
"File: " << fileVsTime_[i].second() <<
" not found"
124 Info<<
" " << fileVsTime_[i].first() <<
tab
125 << fileVsTime_[i].second() <<
endl;
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
scalar userTimeValue() const
Return current user time value.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Abstract base-class for Time/database functionObjects.
virtual const word & type() const =0
Runtime type information.
const Time & time_
Reference to time.
Performs a file copy/replacement once a specified time has been reached.
virtual ~timeActivatedFileUpdate()
Destructor.
virtual bool execute()
Execute file updates.
virtual bool write()
Do nothing.
virtual bool read(const dictionary &)
Read the timeActivatedFileUpdate data.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
labelList second(const UList< labelPair > &p)
pid_t pid()
Return the PID of this process.
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy, recursively if necessary, the source to the destination.
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.