35 namespace functionObjects
51 void Foam::functionObjects::timeActivatedFileUpdate::updateFile()
56 i < fileVsTime_.size()-1
66 <<
type() <<
": copying file" <<
nl << fileVsTime_[i].second()
67 <<
nl <<
"to:" <<
nl << fileToUpdate_ <<
endl;
70 cp(fileVsTime_[i].
second(), destFile);
71 mv(destFile, fileToUpdate_);
79 Foam::functionObjects::timeActivatedFileUpdate::timeActivatedFileUpdate
108 dict.lookup(
"fileToUpdate") >> fileToUpdate_;
109 dict.lookupBackwardsCompatible({
"fileVsTime",
"timeVsFile"}) >> fileVsTime_;
112 fileToUpdate_.expand();
118 fileVsTime_[i].second() = fileVsTime_[i].second().expand();
122 <<
"File: " << fileVsTime_[i].second() <<
" not found"
127 << 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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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(fvMeshFunctionObject, 0)
addToRunTimeSelectionTable(functionObject, fvModel, dictionary)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
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)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
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.
labelList second(const UList< labelPair > &p)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
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.
Ostream & indent(Ostream &os)
Indent stream.