Changed the interface for the upToDate check to avoid unnecessary object lookups
by providing the independent objects directly.
This commit is contained in:
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
Info<< "p.eventNo:" << p.eventNo() << endl;
|
||||
Info<< "p.uptodate:" << p.upToDate("T")<< endl;
|
||||
Info<< "p.uptodate:" << p.upToDate(T)<< endl;
|
||||
|
||||
// Change T and mark as uptodate.
|
||||
Info<< "Changing T" << endl;
|
||||
@ -84,12 +84,12 @@ int main(int argc, char *argv[])
|
||||
Info<< "T.eventNo:" << T.eventNo() << endl;
|
||||
|
||||
// Check p dependency:
|
||||
Info<< "p.uptodate:" << p.upToDate("T")<< endl;
|
||||
Info<< "p.uptodate:" << p.upToDate(T)<< endl;
|
||||
|
||||
// Change p and mark as uptodate.
|
||||
Info<< "Changing p." << endl;
|
||||
p.setUpToDate();
|
||||
Info<< "p.uptodate:" << p.upToDate("T")<< endl;
|
||||
Info<< "p.uptodate:" << p.upToDate(T)<< endl;
|
||||
Info<< "p.eventNo:" << p.eventNo() << endl;
|
||||
|
||||
|
||||
|
||||
@ -173,9 +173,9 @@ bool Foam::regIOobject::checkOut()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::regIOobject::upToDate(const word& a) const
|
||||
bool Foam::regIOobject::upToDate(const regIOobject& a) const
|
||||
{
|
||||
if (db().lookupObject<regIOobject>(a).eventNo() >= eventNo_)
|
||||
if (a.eventNo() >= eventNo_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -186,12 +186,16 @@ bool Foam::regIOobject::upToDate(const word& a) const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::regIOobject::upToDate(const word& a, const word& b) const
|
||||
bool Foam::regIOobject::upToDate
|
||||
(
|
||||
const regIOobject& a,
|
||||
const regIOobject& b
|
||||
) const
|
||||
{
|
||||
if
|
||||
(
|
||||
db().lookupObject<regIOobject>(a).eventNo() >= eventNo_
|
||||
|| db().lookupObject<regIOobject>(b).eventNo() >= eventNo_
|
||||
a.eventNo() >= eventNo_
|
||||
|| b.eventNo() >= eventNo_
|
||||
)
|
||||
{
|
||||
return false;
|
||||
@ -205,16 +209,16 @@ bool Foam::regIOobject::upToDate(const word& a, const word& b) const
|
||||
|
||||
bool Foam::regIOobject::upToDate
|
||||
(
|
||||
const word& a,
|
||||
const word& b,
|
||||
const word& c
|
||||
const regIOobject& a,
|
||||
const regIOobject& b,
|
||||
const regIOobject& c
|
||||
) const
|
||||
{
|
||||
if
|
||||
(
|
||||
db().lookupObject<regIOobject>(a).eventNo() >= eventNo_
|
||||
|| db().lookupObject<regIOobject>(b).eventNo() >= eventNo_
|
||||
|| db().lookupObject<regIOobject>(c).eventNo() >= eventNo_
|
||||
a.eventNo() >= eventNo_
|
||||
|| b.eventNo() >= eventNo_
|
||||
|| c.eventNo() >= eventNo_
|
||||
)
|
||||
{
|
||||
return false;
|
||||
@ -228,18 +232,18 @@ bool Foam::regIOobject::upToDate
|
||||
|
||||
bool Foam::regIOobject::upToDate
|
||||
(
|
||||
const word& a,
|
||||
const word& b,
|
||||
const word& c,
|
||||
const word& d
|
||||
const regIOobject& a,
|
||||
const regIOobject& b,
|
||||
const regIOobject& c,
|
||||
const regIOobject& d
|
||||
) const
|
||||
{
|
||||
if
|
||||
(
|
||||
db().lookupObject<regIOobject>(a).eventNo() >= eventNo_
|
||||
|| db().lookupObject<regIOobject>(b).eventNo() >= eventNo_
|
||||
|| db().lookupObject<regIOobject>(c).eventNo() >= eventNo_
|
||||
|| db().lookupObject<regIOobject>(d).eventNo() >= eventNo_
|
||||
a.eventNo() >= eventNo_
|
||||
|| b.eventNo() >= eventNo_
|
||||
|| c.eventNo() >= eventNo_
|
||||
|| d.eventNo() >= eventNo_
|
||||
)
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -154,19 +154,38 @@ public:
|
||||
//- Event number at last update.
|
||||
inline label& eventNo();
|
||||
|
||||
//- Am I uptodate with respect to other regIOobjects
|
||||
bool upToDate(const word&) const;
|
||||
bool upToDate(const word&, const word&) const;
|
||||
bool upToDate(const word&, const word&, const word&) const;
|
||||
//- Return true if up-to-date with respect to given object
|
||||
// otherwise false
|
||||
bool upToDate(const regIOobject&) const;
|
||||
|
||||
//- Return true if up-to-date with respect to given objects
|
||||
// otherwise false
|
||||
bool upToDate
|
||||
(
|
||||
const word&,
|
||||
const word&,
|
||||
const word&,
|
||||
const word&
|
||||
const regIOobject&,
|
||||
const regIOobject&
|
||||
) const;
|
||||
|
||||
//- Flag me as up to date
|
||||
//- Return true if up-to-date with respect to given objects
|
||||
// otherwise false
|
||||
bool upToDate
|
||||
(
|
||||
const regIOobject&,
|
||||
const regIOobject&,
|
||||
const regIOobject&
|
||||
) const;
|
||||
|
||||
//- Return true if up-to-date with respect to given objects
|
||||
// otherwise false
|
||||
bool upToDate
|
||||
(
|
||||
const regIOobject&,
|
||||
const regIOobject&,
|
||||
const regIOobject&,
|
||||
const regIOobject&
|
||||
) const;
|
||||
|
||||
//- Set up to date (obviously)
|
||||
void setUpToDate();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user