From 5a00d60a472492d75274a50ef4964f62c95c3140 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 25 Feb 2011 15:25:43 +0000 Subject: [PATCH] Added option to dump all wall patches into a single file --- .../dataConversion/foamToVTK/foamToVTK.C | 100 ++++++++++++++++-- 1 file changed, 93 insertions(+), 7 deletions(-) diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index b6870b17f..c6d713d7a 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -82,6 +82,9 @@ Usage @param -allPatches \n Combine all patches into a single file + @param -allWallPatches \n + Combine all wall patches into a single file + @param -excludePatches \\n Specify patches to exclude. For example, @verbatim @@ -137,9 +140,9 @@ Note // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -static const label VTK_TETRA = 10; -static const label VTK_PYRAMID = 14; -static const label VTK_WEDGE = 13; +static const label VTK_TETRA = 10; +static const label VTK_PYRAMID = 14; +static const label VTK_WEDGE = 13; static const label VTK_HEXAHEDRON = 12; @@ -221,6 +224,7 @@ int main(int argc, char *argv[]) argList::validOptions.insert("noInternal",""); argList::validOptions.insert("noPointValues",""); argList::validOptions.insert("allPatches",""); + argList::validOptions.insert("allWallPatches",""); argList::validOptions.insert("excludePatches","patches to exclude"); argList::validOptions.insert("noFaceZones",""); argList::validOptions.insert("faMesh",""); @@ -248,8 +252,7 @@ int main(int argc, char *argv[]) if (nearCellValue) { - WarningIn(args.executable()) - << "Using neighbouring cell value instead of patch value" + Info<< "Using neighbouring cell value instead of patch value" << nl << endl; } @@ -257,11 +260,11 @@ int main(int argc, char *argv[]) if (noPointValues) { - WarningIn(args.executable()) - << "Outputting cell values only" << nl << endl; + Info<< "Outputting cell values only" << nl << endl; } bool allPatches = args.optionFound("allPatches"); + bool allWallPatches = args.optionFound("allWallPatches"); HashSet excludePatches; if (args.optionFound("excludePatches")) @@ -793,6 +796,89 @@ int main(int argc, char *argv[]) // create the patchInterpolation for all subpatches. } } + else if (allWallPatches) + { + mkDir(fvPath/"allWallPatches"); + + fileName wallPatchFileName; + + if (vMesh.useSubMesh()) + { + wallPatchFileName = + fvPath/"allWallPatches"/cellSetName + + "_" + + timeDesc + + ".vtk"; + } + else + { + wallPatchFileName = + fvPath/"allWallPatches"/"allWallPatches" + + "_" + + timeDesc + + ".vtk"; + } + + // Go through the boundary and add all patches that are not + // of type wall onto the exclude{atches list + forAll (patches, patchI) + { + if (!isA(patches[patchI])) + { + excludePatches.insert(patches[patchI].name()); + } + } + + Info<< " Combined wall patches : " << wallPatchFileName + << endl; + + patchWriter writer + ( + vMesh, + binary, + nearCellValue, + wallPatchFileName, + getSelectedPatches(patches, excludePatches) + ); + + // VolFields + patchID + writeFuns::writeCellDataHeader + ( + writer.os(), + writer.nFaces(), + 1+nVolFields + ); + + // Write patchID field + writer.writePatchIDs(); + + // Write volFields + writer.write(vsf); + writer.write(vvf); + writer.write(vSpheretf); + writer.write(vSymmtf); + writer.write(vtf); + + if (!noPointValues) + { + writeFuns::writePointDataHeader + ( + writer.os(), + writer.nPoints(), + nPointFields + ); + + // Write pointFields + writer.write(psf); + writer.write(pvf); + writer.write(pSpheretf); + writer.write(pSymmtf); + writer.write(ptf); + + // no interpolated volFields since I cannot be bothered to + // create the patchInterpolation for all subpatches. + } + } else { forAll(patches, patchI)