reconstructPar: -newTimes no longer constructs the mesh if all times are already reconstructed
This commit is contained in:
parent
7a86319cc0
commit
2eb05ebb87
@ -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-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
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[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::addNote
|
argList::addNote
|
||||||
@ -54,7 +72,7 @@ int main(int argc, char *argv[])
|
|||||||
// enable -zeroTime to prevent accidentally trashing the initial fields
|
// enable -zeroTime to prevent accidentally trashing the initial fields
|
||||||
timeSelector::addOptions(true, true);
|
timeSelector::addOptions(true, true);
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
# include "addRegionOption.H"
|
#include "addRegionOption.H"
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"allRegions",
|
"allRegions",
|
||||||
@ -86,8 +104,8 @@ int main(int argc, char *argv[])
|
|||||||
"only reconstruct new times (i.e. that do not exist already)"
|
"only reconstruct new times (i.e. that do not exist already)"
|
||||||
);
|
);
|
||||||
|
|
||||||
# include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
# include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
HashSet<word> selectedFields;
|
HashSet<word> selectedFields;
|
||||||
if (args.optionFound("fields"))
|
if (args.optionFound("fields"))
|
||||||
@ -169,6 +187,11 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
masterTimeDirs = runTime.times();
|
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
|
// 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
|
Info<< "\n\nReconstructing fields for mesh " << regionName << nl
|
||||||
<< endl;
|
<< 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
|
fvMesh mesh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -240,30 +278,17 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// check face addressing for meshes that have been decomposed
|
// check face addressing for meshes that have been decomposed
|
||||||
// with a very old foam version
|
// with a very old foam version
|
||||||
# include "checkFaceAddressingComp.H"
|
#include "checkFaceAddressingComp.H"
|
||||||
|
|
||||||
// Loop over all times
|
// Loop over all times
|
||||||
forAll(timeDirs, timeI)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
if (newTimes)
|
if (newTimes && masterTimeDirSet.found(timeDirs[timeI].name()))
|
||||||
{
|
|
||||||
// Compare on timeName, not value
|
|
||||||
bool foundTime = false;
|
|
||||||
forAll(masterTimeDirs, i)
|
|
||||||
{
|
|
||||||
if (masterTimeDirs[i].name() == timeDirs[timeI].name())
|
|
||||||
{
|
|
||||||
foundTime = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (foundTime)
|
|
||||||
{
|
{
|
||||||
Info<< "Skipping time " << timeDirs[timeI].name()
|
Info<< "Skipping time " << timeDirs[timeI].name()
|
||||||
<< endl << endl;
|
<< endl << endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Set time for global database
|
// Set time for global database
|
||||||
|
Loading…
Reference in New Issue
Block a user