diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H index dcc3ddd4ea..8116fcbe24 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H @@ -1,21 +1,33 @@ -// ignore special fields or fields that we don't handle -// -bool variableGood = true; -for (label n1=0; n1 2 && fieldName(fieldName.size() - 2, 2) == "_0") + bool variableGood = false; + + forAll(timeDirs, n1) { - variableGood = false; - } - else - { - variableGood = IOobject + variableGood = ( - fieldName, - timeDirs[n1].name(), - mesh, - IOobject::NO_READ - ).typeHeaderOk(false); + fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0" + ? false + : IOobject + ( + fieldName, + timeDirs[n1].name(), + mesh, + IOobject::NO_READ + ).typeHeaderOk(false) + ); + + if (variableGood) + { + break; + } } + + reduce(variableGood, andOp()); + fieldsToUse.set(fieldName, variableGood); } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H index a1b23a53a9..455fa33c66 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H @@ -1,27 +1,48 @@ // check for "points" in any of the result directories bool meshMoving = false; -if (timeDirs.size() > 1) + +if (timeDirs.size() > 1 && Pstream::master()) { - // We already loaded a mesh (usually from constant). See if any other - // points files + // 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) { - if (timeDirs[timeI].name() != mesh.pointsInstance()) - { - meshMoving = IOobject + meshMoving = + ( + timeDirs[timeI].name() != mesh.pointsInstance() + && isDir(baseDir/timeDirs[timeI].name()/polyMesh::meshSubDir) + && IOobject ( "points", timeDirs[timeI].name(), polyMesh::meshSubDir, mesh, - IOobject::NO_READ - ).typeHeaderOk(true); + IOobject::NO_READ, + IOobject::NO_WRITE, + false // no register + ).typeHeaderOk(true) + ); - if (meshMoving) - { - break; - } + if (meshMoving) + { + break; } } + + if (meshMoving) + { + Info<< "found." << nl + << " Writing meshes for every timestep." << endl; + } + else + { + Info<< "none detected." << endl; + } } + +reduce(meshMoving, orOp()); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index ecfb4fe74d..eaf7577815 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" // default to binary output, unless otherwise specified - const enum IOstream::streamFormat format = + const IOstream::streamFormat format = ( args.optionFound("ascii") ? IOstream::ASCII @@ -255,7 +255,9 @@ int main(int argc, char *argv[]) if (Pstream::master()) { fileName caseFileName = args.globalCaseName() + ".case"; - Info<< nl << "write case: " << caseFileName.c_str() << endl; + + Info<< "Converting " << timeDirs.size() << " time steps" << nl + << "Ensight case: " << caseFileName.c_str() << endl; // The case file is always ASCII ensightCaseFilePtr = new OFstream @@ -333,12 +335,6 @@ int main(int argc, char *argv[]) #include "checkMeshMoving.H" - if (meshMoving) - { - Info<< "Detected a moving mesh (multiple polyMesh/points files)." - << " Writing meshes for every timestep." << endl; - } - if (Pstream::master()) { // test the pre-check variable if there is a moving mesh @@ -400,6 +396,11 @@ int main(int argc, char *argv[]) cloudNames = allCloudNames.sortedToc(); } + // ignore special fields (_0 fields), + // ignore fields we don't handle, + // ignore fields that are not available for all time-steps + HashTable fieldsToUse; + HashTable> allCloudFields; forAll(cloudNames, cloudNo) { @@ -451,6 +452,10 @@ int main(int argc, char *argv[]) } } + Info<< "Startup in " + << timer.cpuTimeIncrement() << " s, " + << mem.update().size() << " kB" << nl << endl; + label nTimeSteps = 0; forAll(timeDirs, timeIndex) { @@ -515,7 +520,7 @@ int main(int argc, char *argv[]) // ~~~~~~~~~~~~~~~~~~~~~~ Info<< "Write volume field ("; - for (label i=0; i 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(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(true) + ); + + if (hasMovingMesh) + { + break; + } + } + + if (hasMovingMesh) + { + Info<< "found." << nl + << " Writing meshes for every timestep." << endl; + } + else + { + Info<< "none detected." << endl; } } + +reduce(hasMovingMesh, orOp()); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index 894361e38a..8f00f0128c 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -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