From 728c14c9021bf61e63ca8fbb08c14d595302390a Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 3 Jul 2024 15:40:20 +0100 Subject: [PATCH] foamFormatConvert: Added support for both compact and non-compact faceLists --- .../foamFormatConvert/foamFormatConvert.C | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C index afa8f2664c..6a793e7394 100644 --- a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C +++ b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C @@ -130,6 +130,7 @@ bool writeZones(const word& name, const fileName& meshDir, Time& runTime) } const_cast(IOPtrList::typeName) = oldTypeName; + // Fake type back to what was in field const_cast(meshObject.type()) = io.headerClassName(); @@ -199,7 +200,7 @@ bool writeOptionalMeshObject bool writeOk = false; - bool haveFile = io.headerOk(); + const bool haveFile = io.headerOk(); // Make sure all know if there is a valid class name stringList classNames(1, io.headerClassName()); @@ -243,17 +244,15 @@ int main(int argc, char *argv[]) Info<< "Excluding the constant directory." << nl << endl; } - #include "createTime.H" + // Optional mesh (used to read Clouds) autoPtr meshPtr; - // Make sure we do not use the master-only reading since we read // fields (different per processor) as dictionaries. regIOobject::fileModificationChecking = regIOobject::timeStamp; - fileName meshDir = polyMesh::meshSubDir; fileName regionPrefix = ""; word regionName = polyMesh::defaultRegion; @@ -264,7 +263,7 @@ int main(int argc, char *argv[]) meshDir = regionName/polyMesh::meshSubDir; } - Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); + const instantList timeDirs = Foam::timeSelector::select0(runTime, args); forAll(timeDirs, timeI) { @@ -280,7 +279,15 @@ int main(int argc, char *argv[]) ); writeMeshObject("owner", meshDir, runTime); writeMeshObject("neighbour", meshDir, runTime); - writeMeshObject("faces", meshDir, runTime); + if (!writeMeshObject("faces", meshDir, runTime)) + { + writeMeshObject + ( + "faces", + meshDir, + runTime + ); + } writeMeshObject("points", meshDir, runTime); // Write boundary in ascii. This is only needed for fileHandler to // kick in. Should not give problems since always writing ascii. @@ -342,16 +349,12 @@ int main(int argc, char *argv[]) } } - - // Check for lagrangian const fileName lagrangianDir ( fileHandler().filePath ( - runTime.timePath() - / regionPrefix - / cloud::prefix + runTime.timePath()/regionPrefix/cloud::prefix ) ); stringList lagrangianDirs @@ -401,7 +404,7 @@ int main(int argc, char *argv[]) forAll(cloudDirs, i) { - fileName dir(cloud::prefix/cloudDirs[i]); + const fileName dir(cloud::prefix/cloudDirs[i]); Cloud parcels(meshPtr(), cloudDirs[i], false);