changeDictionary: Added time-loop

Resolves feature request https://bugs.openfoam.org/view.php?id=2569
This commit is contained in:
Henry Weller
2017-06-26 19:12:03 +01:00
parent 21aeea88a4
commit ed8538a85c

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -428,8 +428,26 @@ int main(int argc, char *argv[])
FatalErrorInFunction FatalErrorInFunction
<< "No times selected." << exit(FatalError); << "No times selected." << exit(FatalError);
} }
runTime.setTime(times[0], 0);
word instance = args.optionLookupOrDefault("instance", runTime.timeName()); forAll(times, timei)
{
word instance;
if (args.optionFound("instance"))
{
if (times.size() > 1)
{
FatalErrorInFunction
<< "Multiple times selected with 'instance' option"
<< exit(FatalError);
}
args.optionLookup("instance")() >> instance;
}
else
{
runTime.setTime(times[timei], timei);
instance = runTime.timeName();
}
#include "createNamedMesh.H" #include "createNamedMesh.H"
@ -445,7 +463,8 @@ int main(int argc, char *argv[])
const bool enableEntries = args.optionFound("enableFunctionEntries"); const bool enableEntries = args.optionFound("enableFunctionEntries");
if (enableEntries) if (enableEntries)
{ {
Info<< "Allowing dictionary preprocessing ('#include', '#codeStream')." Info<< "Allowing dictionary preprocessing "
"('#include', '#codeStream')."
<< endl; << endl;
} }
@ -649,7 +668,8 @@ int main(int argc, char *argv[])
const_cast<word&>(IOdictionary::typeName) = oldTypeName; const_cast<word&>(IOdictionary::typeName) = oldTypeName;
// Fake type back to what was in field // Fake type back to what was in field
const_cast<word&>(fieldDict.type()) = fieldDict.headerClassName(); const_cast<word&>(fieldDict.type()) =
fieldDict.headerClassName();
Info<< "Loaded dictionary " << fieldName Info<< "Loaded dictionary " << fieldName
<< " with entries " << fieldDict.toc() << endl; << " with entries " << fieldDict.toc() << endl;
@ -667,6 +687,7 @@ int main(int argc, char *argv[])
} }
entry::disableFunctionEntries = oldFlag; entry::disableFunctionEntries = oldFlag;
}
Info<< "\nEnd\n" << endl; Info<< "\nEnd\n" << endl;