foamFormatConvert: Added support for both compact and non-compact faceLists

This commit is contained in:
Henry Weller
2024-07-03 15:40:20 +01:00
parent 28ee79e7a4
commit 728c14c902

View File

@ -130,6 +130,7 @@ bool writeZones(const word& name, const fileName& meshDir, Time& runTime)
}
const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(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<polyMesh> 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<labelIOList>("owner", meshDir, runTime);
writeMeshObject<labelIOList>("neighbour", meshDir, runTime);
writeMeshObject<faceCompactIOList>("faces", meshDir, runTime);
if (!writeMeshObject<faceCompactIOList>("faces", meshDir, runTime))
{
writeMeshObject<faceCompactIOList, faceIOList>
(
"faces",
meshDir,
runTime
);
}
writeMeshObject<pointIOField>("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<passiveParticle> parcels(meshPtr(), cloudDirs[i], false);