ENH: include file tracking: missed out adding files to list of files to check
This commit is contained in:
parent
d7ac243dfc
commit
70525fe75e
@ -70,11 +70,52 @@ Foam::dlLibraryTable& Foam::functionEntries::codeStream::libs
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
const IOdictionary& d = static_cast<const IOdictionary&>(dict.topDict());
|
||||
const baseIOdictionary& d = static_cast<const baseIOdictionary&>
|
||||
(
|
||||
dict.topDict()
|
||||
);
|
||||
return const_cast<Time&>(d.time()).libs();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionEntries::codeStream::doingMasterOnlyReading
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
const dictionary& topDict = dict.topDict();
|
||||
|
||||
if (isA<baseIOdictionary>(topDict))
|
||||
{
|
||||
const baseIOdictionary& d = static_cast<const baseIOdictionary&>
|
||||
(
|
||||
topDict
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "codeStream : baseIOdictionary:" << dict.name()
|
||||
<< " master-only-reading:" << d.globalObject()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return d.globalObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "codeStream : not a baseIOdictionary:" << dict.name()
|
||||
<< " master-only-reading:" << regIOobject::masterOnlyReading
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Fall back to regIOobject::masterOnlyReading
|
||||
return regIOobject::masterOnlyReading;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::functionEntries::codeStream::streamingFunctionType
|
||||
Foam::functionEntries::codeStream::getFunction
|
||||
(
|
||||
@ -96,7 +137,10 @@ Foam::functionEntries::codeStream::getFunction
|
||||
|
||||
// see if library is loaded
|
||||
void* lib = NULL;
|
||||
if (isA<IOdictionary>(parentDict.topDict()))
|
||||
|
||||
const dictionary& topDict = parentDict.topDict();
|
||||
|
||||
if (isA<baseIOdictionary>(topDict))
|
||||
{
|
||||
lib = libs(parentDict).findLibrary(libPath);
|
||||
}
|
||||
@ -111,7 +155,7 @@ Foam::functionEntries::codeStream::getFunction
|
||||
// avoid compilation if possible by loading an existing library
|
||||
if (!lib)
|
||||
{
|
||||
if (isA<IOdictionary>(parentDict.topDict()))
|
||||
if (isA<baseIOdictionary>(topDict))
|
||||
{
|
||||
// Cached access to dl libs. Guarantees clean up upon destruction
|
||||
// of Time.
|
||||
@ -178,10 +222,10 @@ Foam::functionEntries::codeStream::getFunction
|
||||
}
|
||||
|
||||
//- Only block if we're not doing master-only reading. (flag set by
|
||||
// regIOobject::read, IOdictionary constructor)
|
||||
// regIOobject::read, baseIOdictionary constructor)
|
||||
if
|
||||
(
|
||||
!regIOobject::masterOnlyReading
|
||||
!doingMasterOnlyReading(topDict)
|
||||
&& regIOobject::fileModificationSkew > 0
|
||||
)
|
||||
{
|
||||
@ -246,7 +290,7 @@ Foam::functionEntries::codeStream::getFunction
|
||||
}
|
||||
}
|
||||
|
||||
if (isA<IOdictionary>(parentDict.topDict()))
|
||||
if (isA<baseIOdictionary>(topDict))
|
||||
{
|
||||
// Cached access to dl libs. Guarantees clean up upon destruction
|
||||
// of Time.
|
||||
@ -282,7 +326,7 @@ Foam::functionEntries::codeStream::getFunction
|
||||
}
|
||||
|
||||
bool haveLib = lib;
|
||||
if (!regIOobject::masterOnlyReading)
|
||||
if (!doingMasterOnlyReading(topDict))
|
||||
{
|
||||
reduce(haveLib, andOp<bool>());
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -123,6 +123,10 @@ class codeStream
|
||||
//- Helper function: parent (of parent etc.) of dictionary up to the top
|
||||
static const dictionary& topDict(const dictionary&);
|
||||
|
||||
//- Helper function: access IOobject for master-only-reading
|
||||
// functionality
|
||||
static bool doingMasterOnlyReading(const dictionary& dict);
|
||||
|
||||
//- Helper function: access to dlLibraryTable of Time
|
||||
static dlLibraryTable& libs(const dictionary& dict);
|
||||
|
||||
|
@ -24,10 +24,10 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "includeEntry.H"
|
||||
#include "dictionary.H"
|
||||
#include "IFstream.H"
|
||||
#include "addToMemberFunctionSelectionTable.H"
|
||||
#include "stringOps.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -127,6 +127,9 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
(
|
||||
includeFileName(is.name().path(), rawFName, parentDict)
|
||||
);
|
||||
|
||||
|
||||
// Read contents of file into parentDict
|
||||
IFstream ifs(fName);
|
||||
|
||||
if (ifs)
|
||||
@ -135,6 +138,21 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
{
|
||||
Info<< fName << endl;
|
||||
}
|
||||
|
||||
// Add watch on included file
|
||||
const dictionary& top = parentDict.topDict();
|
||||
if (isA<regIOobject>(top))
|
||||
{
|
||||
regIOobject& rio = const_cast<regIOobject&>
|
||||
(
|
||||
dynamic_cast<const regIOobject&>(top)
|
||||
);
|
||||
//Info<< rio.name() << " : adding depenency on included file "
|
||||
// << fName << endl;
|
||||
|
||||
rio.addWatch(fName);
|
||||
}
|
||||
|
||||
parentDict.read(ifs);
|
||||
return true;
|
||||
}
|
||||
@ -165,6 +183,9 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
(
|
||||
includeFileName(is.name().path(), rawFName, parentDict)
|
||||
);
|
||||
|
||||
|
||||
// Read contents of file into parentDict
|
||||
IFstream ifs(fName);
|
||||
|
||||
if (ifs)
|
||||
@ -173,6 +194,21 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
{
|
||||
Info<< fName << endl;
|
||||
}
|
||||
|
||||
// Add watch on included file
|
||||
const dictionary& top = parentDict.topDict();
|
||||
if (isA<regIOobject>(top))
|
||||
{
|
||||
regIOobject& rio = const_cast<regIOobject&>
|
||||
(
|
||||
dynamic_cast<const regIOobject&>(top)
|
||||
);
|
||||
//Info<< rio.name() << " : adding depenency on included file "
|
||||
// << fName << endl;
|
||||
|
||||
rio.addWatch(fName);
|
||||
}
|
||||
|
||||
entry.read(parentDict, ifs);
|
||||
return true;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "includeIfPresentEntry.H"
|
||||
#include "dictionary.H"
|
||||
#include "IFstream.H"
|
||||
#include "regIOobject.H"
|
||||
#include "addToMemberFunctionSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -78,6 +79,18 @@ bool Foam::functionEntries::includeIfPresentEntry::execute
|
||||
{
|
||||
Info<< fName << endl;
|
||||
}
|
||||
|
||||
// Add watch on included file
|
||||
const dictionary& top = parentDict.topDict();
|
||||
if (isA<regIOobject>(top))
|
||||
{
|
||||
regIOobject& rio = const_cast<regIOobject&>
|
||||
(
|
||||
dynamic_cast<const regIOobject&>(top)
|
||||
);
|
||||
rio.addWatch(fName);
|
||||
}
|
||||
|
||||
parentDict.read(ifs);
|
||||
}
|
||||
|
||||
@ -101,6 +114,18 @@ bool Foam::functionEntries::includeIfPresentEntry::execute
|
||||
{
|
||||
Info<< fName << endl;
|
||||
}
|
||||
|
||||
// Add watch on included file
|
||||
const dictionary& top = parentDict.topDict();
|
||||
if (isA<regIOobject>(top))
|
||||
{
|
||||
regIOobject& rio = const_cast<regIOobject&>
|
||||
(
|
||||
dynamic_cast<const regIOobject&>(top)
|
||||
);
|
||||
rio.addWatch(fName);
|
||||
}
|
||||
|
||||
entry.read(parentDict, ifs);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user