reconstructPar: -newTimes no longer constructs the mesh if all times are already reconstructed

This commit is contained in:
Henry
2013-01-25 12:42:54 +00:00
parent 7a86319cc0
commit 2eb05ebb87

View File

@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,6 +43,24 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool haveAllTimes
(
const HashSet<word>& masterTimeDirSet,
const instantList& timeDirs
)
{
// Loop over all times
forAll(timeDirs, timeI)
{
if (!masterTimeDirSet.found(timeDirs[timeI].name()))
{
return false;
}
}
return true;
}
int main(int argc, char *argv[])
{
argList::addNote
@ -169,6 +187,11 @@ int main(int argc, char *argv[])
{
masterTimeDirs = runTime.times();
}
HashSet<word> masterTimeDirSet(2*masterTimeDirs.size());
forAll(masterTimeDirs, i)
{
masterTimeDirSet.insert(masterTimeDirs[i].name());
}
// Set all times on processor meshes equal to reconstructed mesh
@ -222,6 +245,21 @@ int main(int argc, char *argv[])
Info<< "\n\nReconstructing fields for mesh " << regionName << nl
<< endl;
if
(
newTimes
&& regionNames.size() == 1
&& regionDirs[0].empty()
&& haveAllTimes(masterTimeDirSet, timeDirs)
)
{
Info<< "Skipping region " << regionName
<< " since already have all times"
<< endl << endl;
continue;
}
fvMesh mesh
(
IOobject
@ -245,25 +283,12 @@ int main(int argc, char *argv[])
// Loop over all times
forAll(timeDirs, timeI)
{
if (newTimes)
{
// Compare on timeName, not value
bool foundTime = false;
forAll(masterTimeDirs, i)
{
if (masterTimeDirs[i].name() == timeDirs[timeI].name())
{
foundTime = true;
break;
}
}
if (foundTime)
if (newTimes && masterTimeDirSet.found(timeDirs[timeI].name()))
{
Info<< "Skipping time " << timeDirs[timeI].name()
<< endl << endl;
continue;
}
}
// Set time for global database