ENH: output finiteArea patchID with foamToVTK -with-ids
- can be quite useful for debugging/orientation with complex geometries
This commit is contained in:
parent
f462a850ce
commit
31600c96d4
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -52,7 +52,7 @@ if (doFiniteArea)
|
||||
outputDir/regionDir/"finite-area"
|
||||
/ "finiteArea" + timeDesc
|
||||
),
|
||||
Pstream::parRun()
|
||||
UPstream::parRun()
|
||||
);
|
||||
Info<< " Area : "
|
||||
<< args.relativePath(writer.output()) << nl;
|
||||
@ -62,10 +62,10 @@ if (doFiniteArea)
|
||||
writer.writeTimeValue(timeValue);
|
||||
writer.writeGeometry();
|
||||
|
||||
// Optionally with (cellID, faceLabels, procID) fields
|
||||
// Optionally with (cellID, patchID, faceLabels, procID) fields
|
||||
writer.beginCellData
|
||||
(
|
||||
(withMeshIds ? 2 + (writer.parallel() ? 1 : 0) : 0)
|
||||
(withMeshIds ? 3 + (writer.parallel() ? 1 : 0) : 0)
|
||||
+ nAreaFields
|
||||
);
|
||||
|
||||
@ -76,6 +76,16 @@ if (doFiniteArea)
|
||||
// Use global indexed values for the 'cell' ids
|
||||
writer.writeCellData("cellID", identity(procAddr.range()));
|
||||
|
||||
// The patch ids can also be quite useful
|
||||
const polyBoundaryMesh& pbm = areaMesh.mesh().boundaryMesh();
|
||||
|
||||
labelList patchIds
|
||||
(
|
||||
areaMesh.mesh().boundaryMesh().patchID(areaMesh.faceLabels())
|
||||
);
|
||||
|
||||
writer.writeCellData("patchID", patchIds);
|
||||
|
||||
// Use proc-local data for faceLabels
|
||||
// (confusing enough already without renumbering)
|
||||
writer.writeCellData("faceLabels", areaMesh.faceLabels());
|
||||
@ -95,7 +105,7 @@ if (doFiniteArea)
|
||||
|
||||
writer.close();
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
// Add to file-series and emit as JSON
|
||||
|
||||
|
@ -30,7 +30,7 @@ if (doLagrangian)
|
||||
nameOp<fileName>()
|
||||
);
|
||||
|
||||
if (Pstream::parRun())
|
||||
if (UPstream::parRun())
|
||||
{
|
||||
// Synchronise cloud names
|
||||
Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
|
||||
@ -78,7 +78,7 @@ if (doLagrangian)
|
||||
outputDir/regionDir/cloud::prefix
|
||||
/ cloudName/cloudName + timeDesc
|
||||
),
|
||||
Pstream::parRun()
|
||||
UPstream::parRun()
|
||||
);
|
||||
|
||||
Info<< " Lagrangian: "
|
||||
@ -101,7 +101,7 @@ if (doLagrangian)
|
||||
|
||||
writer.close();
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
// Add to file-series and emit as JSON
|
||||
|
||||
|
@ -71,9 +71,8 @@ Description
|
||||
|
||||
label nPatchWriters = 0;
|
||||
|
||||
List<wordList> procPatchNames(Pstream::nProcs());
|
||||
|
||||
procPatchNames[Pstream::myProcNo()].resize(patchIds.size());
|
||||
List<wordList> procPatchNames(UPstream::nProcs());
|
||||
procPatchNames[UPstream::myProcNo()].resize(patchIds.size());
|
||||
|
||||
for (const label patchId : patchIds)
|
||||
{
|
||||
@ -87,13 +86,13 @@ Description
|
||||
nearCellValue,
|
||||
(
|
||||
vtmOutputBase
|
||||
/ subDirNaming(Pstream::myProcNo())
|
||||
/ subDirNaming(UPstream::myProcNo())
|
||||
/ pp.name()
|
||||
),
|
||||
false // This MUST be non-parallel (serial only)
|
||||
);
|
||||
|
||||
procPatchNames[Pstream::myProcNo()][nPatchWriters] = pp.name();
|
||||
procPatchNames[UPstream::myProcNo()][nPatchWriters] = pp.name();
|
||||
|
||||
writer->writeTimeValue(timeValue);
|
||||
writer->writeGeometry();
|
||||
@ -111,10 +110,10 @@ Description
|
||||
for (vtk::patchWriter& writer : patchWriters)
|
||||
{
|
||||
// Optionally with patchID, procID, neighID fields
|
||||
// - use Pstream::parRun() not writer.parallel() !!
|
||||
// - use UPstream::parRun() not writer.parallel() !!
|
||||
writer.beginCellData
|
||||
(
|
||||
(withMeshIds ? 1 + (Pstream::parRun() ? 2 : 0) : 0)
|
||||
(withMeshIds ? 1 + (UPstream::parRun() ? 2 : 0) : 0)
|
||||
+ nVolFields
|
||||
);
|
||||
|
||||
@ -158,10 +157,10 @@ Description
|
||||
|
||||
const label nProcPatches = returnReduce(nPatchWriters, sumOp<label>());
|
||||
|
||||
if (Pstream::master() && nProcPatches)
|
||||
if (UPstream::master() && nProcPatches)
|
||||
{
|
||||
Info<< "Wrote " << nProcPatches << " processor boundaries from "
|
||||
<< Pstream::nProcs() << " processes" << nl;
|
||||
<< UPstream::nProcs() << " processes" << nl;
|
||||
|
||||
|
||||
// Collect individual boundaries into a vtm file
|
||||
|
@ -82,7 +82,7 @@ Description
|
||||
outputDir/regionDir
|
||||
/ "surface-fields"/"surfaceFields" + timeDesc
|
||||
),
|
||||
Pstream::parRun()
|
||||
UPstream::parRun()
|
||||
);
|
||||
|
||||
Info<< " Surface : "
|
||||
@ -103,7 +103,7 @@ Description
|
||||
|
||||
writer.close();
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
// Add to file-series and emit as JSON
|
||||
|
||||
@ -173,7 +173,7 @@ Description
|
||||
/ (meshProxy.useSubMesh() ? meshProxy.name() : fz.name())
|
||||
+ timeDesc
|
||||
),
|
||||
Pstream::parRun()
|
||||
UPstream::parRun()
|
||||
);
|
||||
|
||||
Info<< " FaceZone : "
|
||||
@ -199,7 +199,7 @@ Description
|
||||
|
||||
writer.close();
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
// Add to file-series and emit as JSON
|
||||
|
||||
|
@ -39,7 +39,7 @@ if (faceSetName.size())
|
||||
set,
|
||||
writeOpts,
|
||||
outputName,
|
||||
Pstream::parRun()
|
||||
UPstream::parRun()
|
||||
);
|
||||
|
||||
wroteTopoSet = true;
|
||||
@ -67,7 +67,7 @@ if (pointSetName.size())
|
||||
set,
|
||||
writeOpts,
|
||||
outputName,
|
||||
Pstream::parRun()
|
||||
UPstream::parRun()
|
||||
);
|
||||
|
||||
wroteTopoSet = true;
|
||||
|
@ -103,7 +103,7 @@ Description
|
||||
? vtmOutputBase
|
||||
: (vtmOutputBase / "internal")
|
||||
),
|
||||
Pstream::parRun()
|
||||
UPstream::parRun()
|
||||
);
|
||||
|
||||
// No sub-block for internal
|
||||
@ -158,7 +158,7 @@ Description
|
||||
)
|
||||
: (vtmOutputBase / "boundary")
|
||||
),
|
||||
Pstream::parRun()
|
||||
UPstream::parRun()
|
||||
);
|
||||
|
||||
// No sub-block for one-patch
|
||||
@ -213,7 +213,7 @@ Description
|
||||
)
|
||||
: (vtmOutputBase / "boundary" / pp.name())
|
||||
),
|
||||
Pstream::parRun()
|
||||
UPstream::parRun()
|
||||
);
|
||||
|
||||
if (!nPatchWriters)
|
||||
@ -432,7 +432,7 @@ Description
|
||||
|
||||
// Collective output
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
// Naming for vtm, file series etc.
|
||||
fileName outputName(vtmOutputBase);
|
||||
|
@ -203,7 +203,7 @@ labelList getSelectedPatches
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (Pstream::parRun() && bool(isA<processorPolyPatch>(pp)))
|
||||
else if (UPstream::parRun() && bool(isA<processorPolyPatch>(pp)))
|
||||
{
|
||||
break; // No processor patches for parallel output
|
||||
}
|
||||
@ -499,7 +499,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (args.found("processor-fields"))
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
if (!UPstream::parRun())
|
||||
{
|
||||
Info<< "Ignoring processor patch writing in serial"
|
||||
<< nl << endl;
|
||||
@ -689,7 +689,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
const fileName outputDir(args.globalPath()/vtkDirName);
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
// Overwrite or create the VTK/regionName directories.
|
||||
// For the default region, this is simply "VTK/"
|
||||
@ -832,7 +832,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Emit multi-region vtm
|
||||
if (Pstream::master() && regionNames.size() > 1)
|
||||
if (UPstream::master() && regionNames.size() > 1)
|
||||
{
|
||||
fileName outputName
|
||||
(
|
||||
|
Loading…
Reference in New Issue
Block a user