ENH: have MUST_READ_IF_MODIFIED on IOdictionary construction

This commit is contained in:
mattijs
2010-06-02 09:48:07 +01:00
parent dd475e3c6b
commit c51a2b0f63
192 changed files with 779 additions and 411 deletions

View File

@ -30,6 +30,7 @@ Class
#include "IOstreams.H"
#include "Pstream.H"
#include "PackedList.H"
#include "PstreamReduceOps.H"
#ifdef FOAM_USE_STAT
# include "OSspecific.H"
@ -57,12 +58,14 @@ const Foam::NamedEnum<Foam::fileMonitor::fileState, 3>
namespace Foam
{
class fileStateEqOp
// Reduction operator for PackedList of fileState
class reduceFileStates
{
public:
void operator()(unsigned int& x, const unsigned int& y) const
unsigned int operator()(const unsigned int x, const unsigned int y)
const
{
// x,y are list of 2bits representing fileState
// x,y are sets of 2bits representing fileState
unsigned int mask = 3u;
unsigned int shift = 0;
@ -82,7 +85,17 @@ namespace Foam
shift += 2;
mask <<= 2;
}
x = result;
return result;
}
};
// Combine operator for PackedList of fileState
class combineReduceFileStates
{
public:
void operator()(unsigned int& x, const unsigned int y) const
{
x = reduceFileStates()(x, y);
}
};
}
@ -323,7 +336,19 @@ void Foam::fileMonitor::updateStates(const bool syncPar) const
// Save local state for warning message below
PackedList<2> thisProcStats(stats);
Pstream::listCombineGather(stats.storage(), fileStateEqOp());
if (stats.storage().size() == 1)
{
// Optimisation valid for most cases.
reduce(stats.storage()[0], reduceFileStates());
}
else
{
Pstream::listCombineGather
(
stats.storage(),
combineReduceFileStates()
);
}
i = 0;
forAllIter(Map<fileState>, state_, iter)

View File

@ -316,8 +316,12 @@ Foam::fileName Foam::IOobject::filePath() const
Foam::Istream* Foam::IOobject::objectStream()
{
fileName fName = filePath();
return objectStream(filePath());
}
Foam::Istream* Foam::IOobject::objectStream(const fileName& fName)
{
if (fName.size())
{
IFstream* isPtr = new IFstream(fName);

View File

@ -39,9 +39,16 @@ Description
@param MUST_READ
Object must be read from Istream on construction. \n
Error if Istream does not exist or can't be read.
Does not check timestamp or re-read.
@param MUST_READ_IF_MODIFIED
Object must be read from Istream on construction. \n
Error if Istream does not exist or can't be read. If object is
registered its timestamp will be checked every timestep and possibly
re-read.
@param READ_IF_PRESENT
Read object from Istream if Istream exists, otherwise don't. \n
Error only if Istream exists but can't be read.
Does not check timestamp or re-read.
@param NO_READ
Don't read
@ -100,6 +107,7 @@ public:
enum readOption
{
MUST_READ,
MUST_READ_IF_MODIFIED,
READ_IF_PRESENT,
NO_READ
};
@ -154,6 +162,10 @@ protected:
// The results is NULL if the stream construction failed
Istream* objectStream();
//- Construct and return an IFstream for the object given the
// exact file. The results is NULL if the stream construction failed
Istream* objectStream(const fileName&);
//- Set the object state to bad
void setBad(const string&);

View File

@ -39,7 +39,7 @@ bool Foam::IOobject::readHeader(Istream& is)
// Check Istream not already bad
if (!is.good())
{
if (rOpt_ == MUST_READ)
if (rOpt_ == MUST_READ || rOpt_ == MUST_READ_IF_MODIFIED)
{
FatalIOErrorIn("IOobject::readHeader(Istream&)", is)
<< " stream not open for reading essential object from file "
@ -102,7 +102,7 @@ bool Foam::IOobject::readHeader(Istream& is)
}
else
{
if (rOpt_ == MUST_READ)
if (rOpt_ == MUST_READ || rOpt_ == MUST_READ_IF_MODIFIED)
{
FatalIOErrorIn("IOobject::readHeader(Istream&)", is)
<< " stream failure while reading header"

View File

@ -32,9 +32,21 @@ Foam::IOField<Type>::IOField(const IOobject& io)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOField::IOField(const IOobject&)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -49,9 +61,21 @@ Foam::IOField<Type>::IOField(const IOobject& io, const label size)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOField::IOField(const IOobject&, const label)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -70,9 +94,21 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Field<Type>& f)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOField::IOField(const IOobject&, const Field<Type>&)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -91,11 +127,25 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Xfer<Field<Type> >& f)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn
(
"IOField::IOField(const IOobject&, const Xfer<Field<Type> >&)"
) << "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}
Field<Type>::transfer(f());
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{

View File

@ -32,9 +32,20 @@ Foam::IOList<T>::IOList(const IOobject& io)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOList::IOList(const IOobject&)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -49,9 +60,20 @@ Foam::IOList<T>::IOList(const IOobject& io, const label size)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOList::IOList(const IOobject&, const label)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -70,9 +92,21 @@ Foam::IOList<T>::IOList(const IOobject& io, const List<T>& list)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOList::IOList(const IOobject&, const List<T>&)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -91,11 +125,25 @@ Foam::IOList<T>::IOList(const IOobject& io, const Xfer<List<T> >& list)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn
(
"IOList::IOList(const IOobject&, const Xfer<List<T> >&)"
) << "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}
List<T>::transfer(list());
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{

View File

@ -34,7 +34,10 @@ Foam::IOMap<T>::IOMap(const IOobject& io)
{
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -50,7 +53,10 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const label size)
{
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -71,7 +77,10 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const Map<T>& map)
{
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -94,7 +103,10 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const Xfer<Map<T> >& map)
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{

View File

@ -35,7 +35,10 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const INew& inewt)
{
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -52,7 +55,10 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io)
{
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -84,7 +90,10 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list)
{
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -107,7 +116,10 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const Xfer<PtrList<T> >& list)
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{

View File

@ -43,9 +43,24 @@ Foam::IOdictionary::IOdictionary(const IOobject& io)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ)
{
WarningIn("IOdictionary::IOdictionary(const IOobject&)")
//FatalErrorIn("IOdictionary::IOdictionary(const IOobject&)")
<< "Dictionary constructed with IOobject::MUST_READ"
" instead of IOobject::MUST_READ_IF_MODIFIED." << nl
<< "Use MUST_READ_IF_MODIFIED if you need automatic rereading."
<< endl;
//<< abort(FatalError);
}
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -61,9 +76,24 @@ Foam::IOdictionary::IOdictionary(const IOobject& io, const dictionary& dict)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ)
{
WarningIn
(
"IOdictionary::IOdictionary(const IOobject& const dictionary&)"
) << "Dictionary constructed with IOobject::MUST_READ"
" instead of IOobject::MUST_READ_IF_MODIFIED." << nl
<< "Use MUST_READ_IF_MODIFIED if you need automatic rereading."
<< endl;
}
if
(
io.readOpt() == IOobject::MUST_READ
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{

View File

@ -217,7 +217,7 @@ Foam::Time::Time
controlDictName,
system(),
*this,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
@ -242,6 +242,12 @@ Foam::Time::Time
readLibs_(controlDict_, "libs"),
functionObjects_(*this)
{
// Time objects not registered so do like objectRegistry::checkIn ourselves.
if (runTimeModifiable_)
{
controlDict_.watchIndex() = addWatch(controlDict_.filePath());
}
setControls();
}
@ -298,6 +304,13 @@ Foam::Time::Time
readLibs_(controlDict_, "libs"),
functionObjects_(*this)
{
// Time objects not registered so do like objectRegistry::checkIn ourselves.
if (runTimeModifiable_)
{
controlDict_.watchIndex() = addWatch(controlDict_.filePath());
}
setControls();
}
@ -365,6 +378,38 @@ Foam::Time::~Time()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::Time::addWatch(const fileName& fName) const
{
return monitor_.addWatch(fName);
}
bool Foam::Time::removeWatch(const label watchIndex) const
{
return monitor_.removeWatch(watchIndex);
}
const Foam::fileName& Foam::Time::getFile(const label watchIndex) const
{
return monitor_.getFile(watchIndex);
}
Foam::fileMonitor::fileState Foam::Time::getState
(
const label watchFd
) const
{
return monitor_.getState(watchFd);
}
void Foam::Time::setUnmodified(const label watchFd) const
{
monitor_.setUnmodified(watchFd);
}
Foam::word Foam::Time::timeName(const scalar t)
{
std::ostringstream buf;

View File

@ -51,6 +51,7 @@ SourceFiles
#include "typeInfo.H"
#include "dlLibraryTable.H"
#include "functionObjectList.H"
#include "fileMonitor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -71,6 +72,9 @@ class Time
{
// Private data
//- file-change monitor for all registered files
mutable fileMonitor monitor_;
//- The controlDict
IOdictionary controlDict_;
@ -275,11 +279,35 @@ public:
return graphFormat_;
}
//- Supports re-reading
const Switch& runTimeModifiable() const
{
return runTimeModifiable_;
}
//- Read control dictionary, update controls and time
virtual bool read();
//- Read the objects that have been modified
void readModifiedObjects();
// Automatic rereading
//- Read the objects that have been modified
void readModifiedObjects();
//- Add watching of a file. Returns handle
label addWatch(const fileName&) const;
//- Remove watch on a file (using handle)
bool removeWatch(const label) const;
//- Get name of file being watched (using handle)
const fileName& getFile(const label) const;
//- Get current state of file (using handle)
fileMonitor::fileState getState(const label) const;
//- Set current state of file (using handle) to unmodified
void setUnmodified(const label) const;
//- Return the location of "dir" containing the file "name".
// (eg, used in reading mesh data)

View File

@ -180,6 +180,11 @@ void Foam::Time::readDict()
controlDict_.readIfPresent("graphFormat", graphFormat_);
controlDict_.readIfPresent("runTimeModifiable", runTimeModifiable_);
if (!runTimeModifiable_ && controlDict_.watchIndex() != -1)
{
removeWatch(controlDict_.watchIndex());
}
}
@ -201,35 +206,28 @@ void Foam::Time::readModifiedObjects()
{
if (runTimeModifiable_)
{
// For parallel runs check if any object's file has been modified
// and only call readIfModified on each object if this is the case
// to avoid unnecessary reductions in readIfModified for each object
// Get state of all monitored objects (=registered objects with a
// valid filePath).
// Note: requires same ordering in objectRegistries on different
// processors!
monitor_.updateStates(Pstream::parRun());
bool anyModified = true;
//Pout<< "Time : runTimeModifiable_ and watchIndex:"
// << controlDict_.watchIndex() << endl;
if (Pstream::parRun())
// Time handling is special since controlDict_ is the one dictionary
// that is not registered to any database.
if (controlDict_.readIfModified())
{
anyModified = controlDict_.modified() || objectRegistry::modified();
bool anyModifiedOnThisProc = anyModified;
reduce(anyModified, andOp<bool>());
if (anyModifiedOnThisProc && !anyModified)
{
WarningIn("Time::readModifiedObjects()")
<< "Delaying reading objects due to inconsistent "
"file time-stamps between processors"
<< endl;
}
readDict();
functionObjects_.read();
}
if (anyModified)
{
if (controlDict_.readIfModified())
{
readDict();
functionObjects_.read();
}
bool registryModified = objectRegistry::modified();
if (registryModified)
{
objectRegistry::readModifiedObjects();
}
}

View File

@ -126,7 +126,11 @@ Foam::word Foam::Time::findInstance
<< endl;
}
if (rOpt == IOobject::MUST_READ)
if
(
rOpt == IOobject::MUST_READ
|| rOpt == IOobject::MUST_READ_IF_MODIFIED
)
{
FatalErrorIn
(
@ -174,7 +178,7 @@ Foam::word Foam::Time::findInstance
return constant();
}
if (rOpt == IOobject::MUST_READ)
if (rOpt == IOobject::MUST_READ || rOpt == IOobject::MUST_READ_IF_MODIFIED)
{
FatalErrorIn
(

View File

@ -90,7 +90,7 @@ public:
const word& outputFilterName,
const objectRegistry&,
const fileName& dictName = OutputFilter::typeName() + "Dict",
const IOobject::readOption rOpt = IOobject::MUST_READ,
const IOobject::readOption rOpt = IOobject::MUST_READ_IF_MODIFIED,
const bool loadFromFile = false
);

View File

@ -273,7 +273,7 @@ void Foam::objectRegistry::rename(const word& newName)
bool Foam::objectRegistry::modified() const
{
for (const_iterator iter = cbegin(); iter != cend(); ++iter)
forAllConstIter(HashTable<regIOobject*>, *this, iter)
{
if (iter()->modified())
{
@ -317,7 +317,7 @@ bool Foam::objectRegistry::writeObject
{
bool ok = true;
for (const_iterator iter = cbegin(); iter != cend(); ++iter)
forAllConstIter(HashTable<regIOobject*>, *this, iter)
{
if (objectRegistry::debug)
{

View File

@ -173,7 +173,6 @@ public:
//- Remove an regIOobject from registry
bool checkOut(regIOobject&) const;
// Reading
//- Return true if any of the object's files have been modified

View File

@ -45,7 +45,7 @@ Foam::regIOobject::regIOobject(const IOobject& io, const bool isTime)
IOobject(io),
registered_(false),
ownedByRegistry_(false),
lastModified_(0),
watchIndex_(-1),
eventNo_ // Do not get event for top level Time database
(
isTime
@ -68,7 +68,7 @@ Foam::regIOobject::regIOobject(const regIOobject& rio)
IOobject(rio),
registered_(false),
ownedByRegistry_(false),
lastModified_(rio.lastModified_),
watchIndex_(rio.watchIndex_),
eventNo_(db().getEvent()),
isPtr_(NULL)
{
@ -83,7 +83,7 @@ Foam::regIOobject::regIOobject(const regIOobject& rio, bool registerCopy)
IOobject(rio),
registered_(false),
ownedByRegistry_(false),
lastModified_(rio.lastModified_),
watchIndex_(-1),
eventNo_(db().getEvent()),
isPtr_(NULL)
{
@ -133,6 +133,28 @@ bool Foam::regIOobject::checkIn()
// any mapping
registered_ = db().checkIn(*this);
if
(
registered_
&& readOpt() == MUST_READ_IF_MODIFIED
&& time().runTimeModifiable()
)
{
if (watchIndex_ != -1)
{
FatalErrorIn("regIOobject::checkIn()")
<< "Object " << objectPath()
<< " already watched with index " << watchIndex_
<< abort(FatalError);
}
fileName f = filePath();
if (f != fileName::null)
{
watchIndex_ = time().addWatch(f);
}
}
// check-in on defaultRegion is allowed to fail, since subsetted meshes
// are created with the same name as their originating mesh
if (!registered_ && debug && name() != polyMesh::defaultRegion)
@ -165,6 +187,12 @@ bool Foam::regIOobject::checkOut()
if (registered_)
{
registered_ = false;
if (watchIndex_ != -1)
{
time().removeWatch(watchIndex_);
watchIndex_ = -1;
}
return db().checkOut(*this);
}

View File

@ -67,8 +67,8 @@ private:
//- Is this object owned by the registry
bool ownedByRegistry_;
//- Time of last modification
mutable time_t lastModified_;
//- Modification watch index
mutable label watchIndex_;
//- eventNo of last update
label eventNo_;
@ -209,10 +209,17 @@ public:
//- Read object
virtual bool read();
//- Return true if the object's file has been modified
//- Return file-monitoring handle
inline label watchIndex() const;
//- Return file-monitoring handle
inline label& watchIndex();
//- Return true if the object's file (or files for objectRegistry)
// have been modified. (modified state is cached by Time)
virtual bool modified() const;
//- Read object if modified
//- Read object if modified (as set by call to modified)
virtual bool readIfModified();

View File

@ -90,4 +90,16 @@ inline Foam::label& Foam::regIOobject::eventNo()
}
inline Foam::label Foam::regIOobject::watchIndex() const
{
return watchIndex_;
}
inline Foam::label& Foam::regIOobject::watchIndex()
{
return watchIndex_;
}
// ************************************************************************* //

View File

@ -26,7 +26,7 @@ License
#include "regIOobject.H"
#include "IFstream.H"
#include "Time.H"
#include "PstreamReduceOps.H"
//#include "PstreamReduceOps.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -52,14 +52,26 @@ Foam::Istream& Foam::regIOobject::readStream()
// Construct object stream and read header if not already constructed
if (!isPtr_)
{
if (!(isPtr_ = objectStream()))
fileName objPath;
if (watchIndex_ != -1)
{
// File is being watched. Read exact file that is being watched.
objPath = time().getFile(watchIndex_);
}
else
{
objPath = filePath();
}
if (!(isPtr_ = objectStream(objPath)))
{
FatalIOError
(
"regIOobject::readStream()",
__FILE__,
__LINE__,
objectPath(),
objPath,
0
) << "cannot open file"
<< exit(FatalIOError);
@ -72,9 +84,10 @@ Foam::Istream& Foam::regIOobject::readStream()
}
}
if (!lastModified_)
// Mark as uptodate if read succesfully
if (watchIndex_ != -1)
{
lastModified_ = lastModified(filePath());
time().setUnmodified(watchIndex_);
}
return *isPtr_;
@ -151,49 +164,27 @@ bool Foam::regIOobject::read()
bool Foam::regIOobject::modified() const
{
return
(
lastModified_
&& lastModified(filePath()) > (lastModified_ + fileModificationSkew)
);
if (watchIndex_ != -1)
{
return time().getState(watchIndex_) != fileMonitor::UNMODIFIED;
}
else
{
return false;
}
}
bool Foam::regIOobject::readIfModified()
{
if (lastModified_)
if (watchIndex_ != -1)
{
time_t newTimeStamp = lastModified(filePath());
bool readFile = false;
if (newTimeStamp > (lastModified_ + fileModificationSkew))
if (modified())
{
readFile = true;
}
if (Pstream::parRun())
{
bool readFileOnThisProc = readFile;
reduce(readFile, andOp<bool>());
if (readFileOnThisProc && !readFile)
{
WarningIn("regIOobject::readIfModified()")
<< "Delaying reading " << name()
<< " of class " << headerClassName()
<< " due to inconsistent "
"file time-stamps between processors"
<< endl;
}
}
if (readFile)
{
lastModified_ = newTimeStamp;
const fileName& fName = time().getFile(watchIndex_);
Info<< "regIOobject::readIfModified() : " << nl
<< " Reading object " << name()
<< " from file " << filePath() << endl;
<< " Re-reading object " << name()
<< " from file " << fName << endl;
return read();
}
else

View File

@ -114,9 +114,9 @@ bool Foam::regIOobject::writeObject
// Only update the lastModified_ time if this object is re-readable,
// i.e. lastModified_ is already set
if (lastModified_)
if (watchIndex_ != -1)
{
lastModified_ = lastModified(objectPath());
time().setUnmodified(watchIndex_);
}
return osGood;

View File

@ -111,12 +111,16 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is)
template<class Type, template<class> class PatchField, class GeoMesh>
bool Foam::GeometricField<Type, PatchField, GeoMesh>::readIfPresent()
{
if (this->readOpt() == IOobject::MUST_READ)
if
(
this->readOpt() == IOobject::MUST_READ
|| this->readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
{
WarningIn
(
"GeometricField<Type, PatchField, GeoMesh>::readIfPresent()"
) << "read option IOobject::MUST_READ "
) << "read option IOobject::MUST_READ or MUST_READ_IF_MODIFIED"
<< "suggests that a read constructor for field " << this->name()
<< " would be more appropriate." << endl;
}

View File

@ -54,7 +54,7 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
dictName,
obr.time().system(),
obr,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -36,7 +36,7 @@ Foam::tolerances::tolerances(const Time& t, const fileName& dictName)
dictName,
t.system(),
t,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -62,8 +62,27 @@ Foam::polyBoundaryMesh::polyBoundaryMesh
regIOobject(io),
mesh_(mesh)
{
if (readOpt() == IOobject::MUST_READ)
if
(
readOpt() == IOobject::MUST_READ
|| readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
{
if (readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn
(
"polyBoundaryMesh::polyBoundaryMesh\n"
"(\n"
" const IOobject&,\n"
" const polyMesh&\n"
")"
) << "Specified IOobject::MUST_READ_IF_MODIFIED but class"
<< " does not support automatic rereading."
<< endl;
}
polyPatchList& patches = *this;
// Read polyPatchList

View File

@ -86,9 +86,24 @@ Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh
if
(
readOpt() == IOobject::MUST_READ
|| readOpt() == IOobject::MUST_READ_IF_MODIFIED
|| (readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
if (readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn
(
"ZoneMesh::ZoneMesh\n"
"(\n"
" const IOobject&,\n"
" const MeshType&\n"
")"
) << "Specified IOobject::MUST_READ_IF_MODIFIED but class"
<< " does not support automatic rereading."
<< endl;
}
PtrList<ZoneType>& zones = *this;
// Read zones

View File

@ -39,7 +39,7 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
"dynamicMeshDict",
io.time().constant(),
io.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -51,8 +51,9 @@ Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh(const IOobject& io)
"dynamicMeshDict",
io.time().constant(),
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).subDict(typeName + "Coeffs")
),

View File

@ -179,7 +179,7 @@ void Foam::dynamicRefineFvMesh::readDict()
"dynamicMeshDict",
time().constant(),
*this,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
@ -1016,7 +1016,7 @@ bool Foam::dynamicRefineFvMesh::update()
"dynamicMeshDict",
time().constant(),
*this,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -51,8 +51,9 @@ Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io)
"dynamicMeshDict",
io.time().constant(),
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).subDict(typeName + "Coeffs")
),

View File

@ -47,7 +47,7 @@ Foam::motionSolver::motionSolver(const polyMesh& mesh)
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
@ -67,7 +67,7 @@ Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -331,9 +331,21 @@ Foam::refinementHistory::refinementHistory(const IOobject& io)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn
(
"refinementHistory::refinementHistory(const IOobject&)"
) << "Specified IOobject::MUST_READ_IF_MODIFIED but class"
<< " does not support automatic rereading."
<< endl;
}
if
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -365,9 +377,22 @@ Foam::refinementHistory::refinementHistory
freeSplitCells_(0),
visibleCells_(visibleCells)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn
(
"refinementHistory::refinementHistory"
"(const IOobject&, const List<splitCell8>&, const labelList&)"
) << "Specified IOobject::MUST_READ_IF_MODIFIED but class"
<< " does not support automatic rereading."
<< endl;
}
if
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
@ -399,9 +424,22 @@ Foam::refinementHistory::refinementHistory
regIOobject(io),
freeSplitCells_(0)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn
(
"refinementHistory::refinementHistory"
"(const IOobject&, const label)"
) << "Specified IOobject::MUST_READ_IF_MODIFIED but class"
<< " does not support automatic rereading."
<< endl;
}
if
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{

View File

@ -43,9 +43,19 @@ void Foam::polyTopoChanger::readModifiers()
if
(
readOpt() == IOobject::MUST_READ
|| readOpt() == IOobject::MUST_READ_IF_MODIFIED
|| (readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
if (readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("polyTopoChanger::readModifiers()")
<< "Specified IOobject::MUST_READ_IF_MODIFIED but class"
<< " does not support automatic rereading."
<< endl;
}
PtrList<polyMeshModifier>& modifiers = *this;
// Read modifiers

View File

@ -40,9 +40,19 @@ Foam::featureEdgeMesh::featureEdgeMesh(const IOobject& io)
if
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
if (readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("featureEdgeMesh::featureEdgeMesh(const IOobject&)")
<< "Specified IOobject::MUST_READ_IF_MODIFIED but class"
<< " does not support automatic rereading."
<< endl;
}
readStream(typeName) >> *this;
close();
}
@ -82,9 +92,19 @@ Foam::featureEdgeMesh::featureEdgeMesh
if
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
if (readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("featureEdgeMesh::featureEdgeMesh(const IOobject&)")
<< "Specified IOobject::MUST_READ_IF_MODIFIED but class"
<< " does not support automatic rereading."
<< endl;
}
readStream(typeName) >> *this;
close();
}

View File

@ -44,7 +44,7 @@ Foam::autoPtr<Foam::engineMesh> Foam::engineMesh::New
"engineGeometry",
io.time().constant(),
io.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -72,7 +72,7 @@ Foam::engineTime::engineTime
"engineGeometry",
constant(),
*this,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -45,7 +45,7 @@ Foam::MRFZones::MRFZones(const fvMesh& mesh)
"MRFZones",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
),
MRFZone::iNew(mesh)

View File

@ -53,7 +53,7 @@ Foam::SRF::SRFModel::SRFModel
"SRFProperties",
Urel.time().constant(),
Urel.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -43,7 +43,7 @@ Foam::autoPtr<Foam::SRF::SRFModel> Foam::SRF::SRFModel::New
"SRFProperties",
Urel.time().constant(),
Urel.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -70,7 +70,7 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource
sourceName + "Properties",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -64,7 +64,7 @@ Foam::fvSchemes::fvSchemes(const objectRegistry& obr)
"fvSchemes",
obr.time().system(),
obr,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -70,7 +70,7 @@ displacementInterpolationFvMotionSolver
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -45,7 +45,7 @@ void Foam::Cloud<ParticleType>::readCloudUniformProperties()
time().timeName(),
"uniform"/cloud::prefix/name(),
db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
);

View File

@ -83,7 +83,7 @@ Foam::spray::spray
"sprayProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
@ -98,7 +98,7 @@ Foam::spray::spray
"injectorProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
),
injector::iNew(U.time())

View File

@ -608,7 +608,7 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
cloudName + "Properties",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
@ -830,7 +830,7 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
cloudName + "Properties",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -181,7 +181,7 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
cloudName + "Properties",
rho.mesh().time().constant(),
rho.mesh(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -40,7 +40,7 @@ void Foam::InjectionModel<CloudType>::readProps()
owner_.db().time().timeName(),
"uniform"/cloud::prefix/owner_.name(),
owner_.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
);

View File

@ -32,7 +32,7 @@ IOdictionary mdTransportProperitesDict
"mdTransportProperitesDict",
mesh.time().system(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -56,7 +56,7 @@ void Foam::moleculeCloud::buildConstProps()
"moleculeProperties",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -104,7 +104,7 @@ void Foam::potential::potential::readPotentialDict()
"idList",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
@ -120,7 +120,7 @@ void Foam::potential::potential::readPotentialDict()
"moleculeProperties",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
@ -151,7 +151,7 @@ void Foam::potential::potential::readPotentialDict()
"potentialDict",
mesh_.time().system(),
mesh_,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
@ -260,7 +260,7 @@ void Foam::potential::potential::readMdInitialiseDict
"moleculeProperties",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -54,7 +54,7 @@ Foam::solidParticleCloud::solidParticleCloud
"particleProperties",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -838,7 +838,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
"decomposeParDict",
searchableSurface::time().system(),
searchableSurface::time(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -189,7 +189,8 @@ void Foam::fieldToCell::applyToSet
mesh().time().timeName(),
mesh(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
IOobject::AUTO_WRITE,
false
);
if (!fieldObject.headerOk())

View File

@ -80,6 +80,7 @@ cellZoneSet::cellZoneSet
if
(
(r == IOobject::MUST_READ)
|| (r == IOobject::MUST_READ_IF_MODIFIED)
|| (r == IOobject::READ_IF_PRESENT && zoneID != -1)
)
{

View File

@ -82,6 +82,7 @@ faceZoneSet::faceZoneSet
if
(
(r == IOobject::MUST_READ)
|| (r == IOobject::MUST_READ_IF_MODIFIED)
|| (r == IOobject::READ_IF_PRESENT && zoneID != -1)
)
{

View File

@ -81,7 +81,8 @@ pointZoneSet::pointZoneSet
if
(
(r == IOobject::MUST_READ)
r == IOobject::MUST_READ
|| r == IOobject::MUST_READ_IF_MODIFIED
|| (r == IOobject::READ_IF_PRESENT && zoneID != -1)
)
{

View File

@ -309,6 +309,7 @@ Foam::topoSet::topoSet(const IOobject& obj, const word& wantedType)
if
(
readOpt() == IOobject::MUST_READ
|| readOpt() == IOobject::MUST_READ_IF_MODIFIED
|| (
readOpt() == IOobject::READ_IF_PRESENT
&& headerOk()
@ -356,6 +357,7 @@ Foam::topoSet::topoSet
if
(
readOpt() == IOobject::MUST_READ
|| readOpt() == IOobject::MUST_READ_IF_MODIFIED
|| (
readOpt() == IOobject::READ_IF_PRESENT
&& headerOk()

View File

@ -258,7 +258,7 @@ void Foam::fieldAverage::readAveragingProperties()
obr_.time().timeName(),
"uniform",
obr_,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
);

View File

@ -6,7 +6,7 @@ IOdictionary planeToPatchDict
"planeToPatchDict",
runTime.system(),
runTime,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View File

@ -374,7 +374,7 @@ Foam::MeshedSurface<Face>::MeshedSurface
"dummyName",
t.timeName(),
t,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
),

View File

@ -45,7 +45,11 @@ Foam::surfZoneIOList::surfZoneIOList
"(const IOobject& io)";
if (readOpt() == IOobject::MUST_READ)
if
(
readOpt() == IOobject::MUST_READ
|| readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
{
surfZoneList& zones = *this;

View File

@ -587,7 +587,7 @@ Foam::surfaceFilmModels::kinematicSingleLayer::kinematicSingleLayer
filmRegionName_,
time_.timeName(),
time_,
IOobject::MUST_READ
IOobject::MUST_READ_IF_MODIFIED
)
),
nHat_

View File

@ -74,7 +74,7 @@ Foam::surfaceFilmModels::surfaceFilmModel::surfaceFilmModel
"surfaceFilmProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
@ -101,7 +101,7 @@ Foam::surfaceFilmModels::surfaceFilmModel::surfaceFilmModel
"surfaceFilmProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -46,7 +46,7 @@ Foam::surfaceFilmModels::surfaceFilmModel::New
"surfaceFilmProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -153,7 +153,7 @@ Foam::basicThermo::basicThermo(const fvMesh& mesh)
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -43,7 +43,7 @@ Foam::autoPtr<Foam::basicPsiThermo> Foam::basicPsiThermo::New
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -43,7 +43,7 @@ Foam::autoPtr<Foam::basicRhoThermo> Foam::basicRhoThermo::New
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -45,7 +45,7 @@ Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh)
"chemistryProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -43,7 +43,7 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
"chemistryProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -43,7 +43,7 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
"chemistryProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -40,7 +40,7 @@ Foam::autoPtr<Foam::laminarFlameSpeed> Foam::laminarFlameSpeed::New
"combustionProperties",
ct.T().time().constant(),
ct.T().db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -203,7 +203,7 @@ void Foam::interpolationLookUpTable<Type>::readTable
fileName_,
instance,
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View File

@ -51,7 +51,7 @@ Foam::radiation::radiationModel::radiationModel(const volScalarField& T)
"radiationProperties",
T.time().constant(),
T.mesh(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
@ -79,7 +79,7 @@ Foam::radiation::radiationModel::radiationModel
"radiationProperties",
T.time().constant(),
T.mesh(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -44,7 +44,7 @@ Foam::radiation::radiationModel::New
"radiationProperties",
T.time().constant(),
T.mesh(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -44,7 +44,7 @@ Foam::autoPtr<Foam::hCombustionThermo> Foam::hCombustionThermo::New
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
@ -87,7 +87,7 @@ Foam::autoPtr<Foam::hCombustionThermo> Foam::hCombustionThermo::NewType
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -44,7 +44,7 @@ Foam::autoPtr<Foam::hhuCombustionThermo> Foam::hhuCombustionThermo::New
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -44,7 +44,7 @@ Foam::autoPtr<Foam::hsCombustionThermo> Foam::hsCombustionThermo::New
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
@ -87,7 +87,7 @@ Foam::autoPtr<Foam::hsCombustionThermo> Foam::hsCombustionThermo::NewType
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -44,7 +44,7 @@ Foam::autoPtr<Foam::hReactionThermo> Foam::hReactionThermo::New
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
@ -87,7 +87,7 @@ Foam::autoPtr<Foam::hReactionThermo> Foam::hReactionThermo::NewType
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -44,7 +44,7 @@ Foam::autoPtr<Foam::hsReactionThermo> Foam::hsReactionThermo::New
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
@ -87,7 +87,7 @@ Foam::autoPtr<Foam::hsReactionThermo> Foam::hsReactionThermo::NewType
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -272,8 +272,9 @@ Foam::linearValveFvMesh::linearValveFvMesh(const IOobject& io)
"dynamicMeshDict",
time().constant(),
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).subDict(typeName + "Coeffs")
),

View File

@ -347,8 +347,9 @@ Foam::linearValveLayersFvMesh::linearValveLayersFvMesh(const IOobject& io)
"dynamicMeshDict",
time().constant(),
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).subDict(typeName + "Coeffs")
)

View File

@ -289,8 +289,9 @@ Foam::mixerFvMesh::mixerFvMesh
"dynamicMeshDict",
time().constant(),
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).subDict(typeName + "Coeffs")
),

View File

@ -257,8 +257,9 @@ Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io)
"dynamicMeshDict",
time().constant(),
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).subDict(typeName + "Coeffs")
),

View File

@ -43,7 +43,7 @@ Foam::transportModel::transportModel
"transportProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
)

View File

@ -46,8 +46,26 @@ Foam::surfacePatchIOList::surfacePatchIOList
"(const IOobject& io)";
if (readOpt() == IOobject::MUST_READ)
if
(
readOpt() == IOobject::MUST_READ
|| readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
{
if (readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn
(
"surfacePatchIOList::surfacePatchIOList\n"
"(\n"
" const IOobject&\n"
")"
) << "Specified IOobject::MUST_READ_IF_MODIFIED but class"
<< " does not support automatic rereading."
<< endl;
}
surfacePatchList& patches = *this;
// read polyPatchList

View File

@ -70,7 +70,7 @@ LESModel::LESModel
"LESProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
@ -111,7 +111,7 @@ autoPtr<LESModel> LESModel::New
"LESProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -71,7 +71,7 @@ RASModel::RASModel
"RASProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
@ -117,7 +117,7 @@ autoPtr<RASModel> RASModel::New
"RASProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -36,7 +36,7 @@ Foam::regionProperties::regionProperties(const Time& runTime)
"regionProperties",
runTime.time().constant(),
runTime.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -81,7 +81,7 @@ autoPtr<turbulenceModel> turbulenceModel::New
"turbulenceProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -69,7 +69,7 @@ LESModel::LESModel
"LESProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
@ -108,7 +108,7 @@ autoPtr<LESModel> LESModel::New
"LESProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -70,7 +70,7 @@ RASModel::RASModel
"RASProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
@ -115,7 +115,7 @@ autoPtr<RASModel> RASModel::New
"RASProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View File

@ -138,7 +138,7 @@ nutUTabulatedWallFunctionFvPatchScalarField
uPlusTableName_,
patch().boundaryMesh().mesh().time().constant(),
patch().boundaryMesh().mesh(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
),

View File

@ -77,7 +77,7 @@ autoPtr<turbulenceModel> turbulenceModel::New
"turbulenceProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)