mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improve startup time for foamToEnsight conversion (issue #240).
Old code:
Found 10990 time steps
Search for moving mesh ... no moving mesh detected.
Startup in 329.09 s
Updated:
Found 10990 time steps
Search for moving mesh ... no moving mesh detected.
Startup in 1.6 s
- Cause was checking "polyMesh/points" via an IOobject.
Short-circuit with a check for a polyMesh/ directory first.
Limit the check to the master-node as well to further reduce
load on the file-system.
------------------------------
ENH: improve per-step conversion times for foamToEnsight.
Old code:
Converting 11001 time steps
Time [0] = 0 Wrote in 1.53 s
Time [1] = 1 Wrote in 1.52 s
...
Time [100] = 100 Elapsed time 205.35 s
Updated:
Converting 11001 time steps
Time [0] = 0 Wrote in 1.4 s
Time [1] = 1 Wrote in 0.07 s
...
Time [100] = 100 Elapsed time 42.4 s
- Speedup by hashing test results from the first conversion step
instead of checking each time.
Check data on all nodes to avoid problems with incomplete writes.
------------------------------
BUG: moving mesh detection failed for foamToEnsightParts
- adjusted to agree with updated foamToEnsight
------------------------------
Note:
- foamToEnsightParts (serial) still has about twice the throughput of
foamToEnsight.
This commit is contained in:
@ -2,18 +2,47 @@
|
||||
// - could restrict to the selected times
|
||||
|
||||
bool hasMovingMesh = false;
|
||||
if (timeDirs.size() > 1)
|
||||
|
||||
if (timeDirs.size() > 1 && Pstream::master())
|
||||
{
|
||||
hasMovingMesh = true;
|
||||
for (label i=0; i < timeDirs.size() && hasMovingMesh; ++i)
|
||||
// We already loaded a mesh (usually from constant).
|
||||
// See if any other "polyMesh/points" files exist too.
|
||||
|
||||
const fileName& baseDir = mesh.time().path();
|
||||
|
||||
Info<< "Search for moving mesh ... " << flush;
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
hasMovingMesh = IOobject
|
||||
hasMovingMesh =
|
||||
(
|
||||
"points",
|
||||
timeDirs[i].name(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
).typeHeaderOk<pointIOField>(true);
|
||||
isDir(baseDir/timeDirs[timeI].name()/polyMesh::meshSubDir)
|
||||
&& IOobject
|
||||
(
|
||||
"points",
|
||||
timeDirs[timeI].name(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // no register
|
||||
).typeHeaderOk<pointIOField>(true)
|
||||
);
|
||||
|
||||
if (hasMovingMesh)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasMovingMesh)
|
||||
{
|
||||
Info<< "found." << nl
|
||||
<< " Writing meshes for every timestep." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "none detected." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(hasMovingMesh, orOp<bool>());
|
||||
|
||||
@ -149,11 +149,12 @@ int main(int argc, char *argv[])
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
// default to binary output, unless otherwise specified
|
||||
IOstream::streamFormat format = IOstream::BINARY;
|
||||
if (args.optionFound("ascii"))
|
||||
{
|
||||
format = IOstream::ASCII;
|
||||
}
|
||||
const IOstream::streamFormat format =
|
||||
(
|
||||
args.optionFound("ascii")
|
||||
? IOstream::ASCII
|
||||
: IOstream::BINARY
|
||||
);
|
||||
|
||||
// control for renumbering iterations
|
||||
label indexingNumber = 0;
|
||||
@ -204,6 +205,11 @@ int main(int argc, char *argv[])
|
||||
regionPrefix = regionName;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
Info<< "Converting " << timeDirs.size() << " time steps" << endl;
|
||||
}
|
||||
|
||||
// Construct the list of ensight parts for the entire mesh
|
||||
ensightParts partsList(mesh);
|
||||
|
||||
@ -244,6 +250,9 @@ int main(int argc, char *argv[])
|
||||
cloudTimesUsed.insert(cloudIter.key(), DynamicList<label>());
|
||||
}
|
||||
|
||||
Info<< "Startup in "
|
||||
<< timer.cpuTimeIncrement() << " s, "
|
||||
<< mem.update().size() << " kB" << nl << endl;
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
|
||||
@ -39,5 +39,5 @@
|
||||
}
|
||||
|
||||
timeIndices.insert(timeIndex, timeDirs[timeI].value());
|
||||
Info<< "\nTime [" << timeIndex << "] = " << runTime.timeName() << nl;
|
||||
Info<< nl << "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user