mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: reduce startup time for ensight conversion (issue #240).
- Less looping when detecting lagrangian clouds and their fields. - Avoid using Time::setTime() and IOobjectList in tight loops. They both kill performance immensely. ENH: provide a -noLagrangian option to foamToEnsight and foamToEnsightParts for even more control.
This commit is contained in:
@ -44,6 +44,9 @@ Usage
|
||||
\param -noZero \n
|
||||
Exclude the often incomplete initial conditions.
|
||||
|
||||
\param -noLagrangian \n
|
||||
Suppress writing lagrangian positions and fields.
|
||||
|
||||
\param -index \<start\>\n
|
||||
Ignore the time index contained in the time file and use a
|
||||
simple indexing when creating the \c Ensight/data/######## files.
|
||||
@ -101,6 +104,11 @@ int main(int argc, char *argv[])
|
||||
"and use simple indexing when creating the files"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noLagrangian",
|
||||
"suppress writing lagrangian positions and fields"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noMesh",
|
||||
"suppress writing the geometry. "
|
||||
@ -158,7 +166,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
// control for renumbering iterations
|
||||
label indexingNumber = 0;
|
||||
bool optIndex = args.optionReadIfPresent("index", indexingNumber);
|
||||
const bool optIndex = args.optionReadIfPresent("index", indexingNumber);
|
||||
const bool noLagrangian = args.optionFound("noLagrangian");
|
||||
|
||||
// always write the geometry, unless the -noMesh option is specified
|
||||
bool optNoMesh = args.optionFound("noMesh");
|
||||
@ -389,15 +398,9 @@ int main(int argc, char *argv[])
|
||||
forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
||||
{
|
||||
const word& cloudName = cloudIter.key();
|
||||
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
|
||||
|
||||
if
|
||||
(
|
||||
!isDir
|
||||
(
|
||||
runTime.timePath()/regionPrefix/
|
||||
cloud::prefix/cloudName
|
||||
)
|
||||
)
|
||||
if (!isDir(runTime.timePath()/cloudPrefix/cloudName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -406,27 +409,24 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
mesh,
|
||||
runTime.timeName(),
|
||||
cloud::prefix/cloudName
|
||||
cloudPrefix/cloudName
|
||||
);
|
||||
|
||||
// check that the positions field is present for this time
|
||||
IOobject* positionPtr = cloudObjs.lookup(word("positions"));
|
||||
if (positionPtr != NULL)
|
||||
{
|
||||
ensightParticlePositions
|
||||
(
|
||||
mesh,
|
||||
dataDir,
|
||||
subDir,
|
||||
cloudName,
|
||||
format
|
||||
);
|
||||
}
|
||||
else
|
||||
if (!cloudObjs.found("positions"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ensightParticlePositions
|
||||
(
|
||||
mesh,
|
||||
dataDir,
|
||||
subDir,
|
||||
cloudName,
|
||||
format
|
||||
);
|
||||
|
||||
Info<< "write " << cloudName << " (" << flush;
|
||||
|
||||
forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
|
||||
@ -439,7 +439,7 @@ int main(int argc, char *argv[])
|
||||
if (!fieldObject)
|
||||
{
|
||||
Info<< "missing "
|
||||
<< runTime.timeName()/cloud::prefix/cloudName
|
||||
<< runTime.timeName()/cloudPrefix/cloudName
|
||||
/ fieldName
|
||||
<< endl;
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user