Commit 4b1eea0c authored by Andrew Heather's avatar Andrew Heather Committed by Andrew Heather
Browse files

Merge branch 'feature-postpro' into 'develop'

Feature postpro

See merge request OpenFOAM-plus!236
parents 48e3590b 42fbf6d3
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "wedgePolyPatch.H" #include "wedgePolyPatch.H"
#include "unitConversion.H" #include "unitConversion.H"
#include "polyMeshTetDecomposition.H" #include "polyMeshTetDecomposition.H"
#include "surfaceWriter.H"
#include "checkTools.H" #include "checkTools.H"
#include "functionObject.H" #include "functionObject.H"
...@@ -482,7 +481,7 @@ Foam::label Foam::checkGeometry ...@@ -482,7 +481,7 @@ Foam::label Foam::checkGeometry
( (
const polyMesh& mesh, const polyMesh& mesh,
const bool allGeometry, const bool allGeometry,
const autoPtr<surfaceWriter>& surfWriter, autoPtr<surfaceWriter>& surfWriter,
const autoPtr<writer<scalar>>& setWriter const autoPtr<writer<scalar>>& setWriter
) )
{ {
...@@ -542,7 +541,7 @@ Foam::label Foam::checkGeometry ...@@ -542,7 +541,7 @@ Foam::label Foam::checkGeometry
nonAlignedPoints.write(); nonAlignedPoints.write();
if (setWriter.valid()) if (setWriter.valid())
{ {
mergeAndWrite(setWriter(), nonAlignedPoints); mergeAndWrite(*setWriter, nonAlignedPoints);
} }
} }
} }
...@@ -576,7 +575,7 @@ Foam::label Foam::checkGeometry ...@@ -576,7 +575,7 @@ Foam::label Foam::checkGeometry
cells.write(); cells.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), cells); mergeAndWrite(*surfWriter, cells);
} }
} }
} }
...@@ -592,7 +591,7 @@ Foam::label Foam::checkGeometry ...@@ -592,7 +591,7 @@ Foam::label Foam::checkGeometry
aspectCells.write(); aspectCells.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), aspectCells); mergeAndWrite(*surfWriter, aspectCells);
} }
} }
} }
...@@ -613,7 +612,7 @@ Foam::label Foam::checkGeometry ...@@ -613,7 +612,7 @@ Foam::label Foam::checkGeometry
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), faces); mergeAndWrite(*surfWriter, faces);
} }
} }
} }
...@@ -635,7 +634,7 @@ Foam::label Foam::checkGeometry ...@@ -635,7 +634,7 @@ Foam::label Foam::checkGeometry
cells.write(); cells.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), cells); mergeAndWrite(*surfWriter, cells);
} }
} }
} }
...@@ -658,7 +657,7 @@ Foam::label Foam::checkGeometry ...@@ -658,7 +657,7 @@ Foam::label Foam::checkGeometry
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), faces); mergeAndWrite(*surfWriter, faces);
} }
} }
} }
...@@ -680,7 +679,7 @@ Foam::label Foam::checkGeometry ...@@ -680,7 +679,7 @@ Foam::label Foam::checkGeometry
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), faces); mergeAndWrite(*surfWriter, faces);
} }
} }
} }
...@@ -702,7 +701,7 @@ Foam::label Foam::checkGeometry ...@@ -702,7 +701,7 @@ Foam::label Foam::checkGeometry
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), faces); mergeAndWrite(*surfWriter, faces);
} }
} }
} }
...@@ -726,7 +725,7 @@ Foam::label Foam::checkGeometry ...@@ -726,7 +725,7 @@ Foam::label Foam::checkGeometry
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), faces); mergeAndWrite(*surfWriter, faces);
} }
} }
} }
...@@ -759,7 +758,7 @@ Foam::label Foam::checkGeometry ...@@ -759,7 +758,7 @@ Foam::label Foam::checkGeometry
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), faces); mergeAndWrite(*surfWriter, faces);
} }
} }
} }
...@@ -784,7 +783,7 @@ Foam::label Foam::checkGeometry ...@@ -784,7 +783,7 @@ Foam::label Foam::checkGeometry
points.write(); points.write();
if (setWriter.valid()) if (setWriter.valid())
{ {
mergeAndWrite(setWriter(), points); mergeAndWrite(*setWriter, points);
} }
} }
} }
...@@ -807,7 +806,7 @@ Foam::label Foam::checkGeometry ...@@ -807,7 +806,7 @@ Foam::label Foam::checkGeometry
nearPoints.write(); nearPoints.write();
if (setWriter.valid()) if (setWriter.valid())
{ {
mergeAndWrite(setWriter(), nearPoints); mergeAndWrite(*setWriter, nearPoints);
} }
} }
} }
...@@ -831,7 +830,7 @@ Foam::label Foam::checkGeometry ...@@ -831,7 +830,7 @@ Foam::label Foam::checkGeometry
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), faces); mergeAndWrite(*surfWriter, faces);
} }
} }
} }
...@@ -854,7 +853,7 @@ Foam::label Foam::checkGeometry ...@@ -854,7 +853,7 @@ Foam::label Foam::checkGeometry
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), faces); mergeAndWrite(*surfWriter, faces);
} }
} }
} }
...@@ -875,7 +874,7 @@ Foam::label Foam::checkGeometry ...@@ -875,7 +874,7 @@ Foam::label Foam::checkGeometry
cells.write(); cells.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), cells); mergeAndWrite(*surfWriter, cells);
} }
} }
} }
...@@ -895,7 +894,7 @@ Foam::label Foam::checkGeometry ...@@ -895,7 +894,7 @@ Foam::label Foam::checkGeometry
cells.write(); cells.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), cells); mergeAndWrite(*surfWriter, cells);
} }
} }
} }
...@@ -916,7 +915,7 @@ Foam::label Foam::checkGeometry ...@@ -916,7 +915,7 @@ Foam::label Foam::checkGeometry
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), faces); mergeAndWrite(*surfWriter, faces);
} }
} }
} }
...@@ -937,7 +936,7 @@ Foam::label Foam::checkGeometry ...@@ -937,7 +936,7 @@ Foam::label Foam::checkGeometry
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter.valid())
{ {
mergeAndWrite(surfWriter(), faces); mergeAndWrite(*surfWriter, faces);
} }
} }
} }
...@@ -952,14 +951,10 @@ Foam::label Foam::checkGeometry ...@@ -952,14 +951,10 @@ Foam::label Foam::checkGeometry
autoPtr<surfaceWriter> patchWriter; autoPtr<surfaceWriter> patchWriter;
if (!surfWriter.valid()) if (!surfWriter.valid())
{ {
patchWriter.reset(new vtkSurfaceWriter()); patchWriter.reset(new surfaceWriters::vtkWriter());
} }
const surfaceWriter& wr =
( surfaceWriter& wr = (surfWriter.valid() ? *surfWriter : *patchWriter);
surfWriter.valid()
? surfWriter()
: patchWriter()
);
// Currently only do AMI checks // Currently only do AMI checks
...@@ -1017,22 +1012,22 @@ Foam::label Foam::checkGeometry ...@@ -1017,22 +1012,22 @@ Foam::label Foam::checkGeometry
if (Pstream::master()) if (Pstream::master())
{ {
wr.write const word fName
( (
outputDir, "patch" + Foam::name(cpp.index())
( + "-src_" + tmName
"patch" + Foam::name(cpp.index()) );
+ "-src_" + tmName
), wr.open
meshedSurfRef (
( mergedPoints,
mergedPoints, mergedFaces,
mergedFaces (outputDir / fName),
), false // serial - already merged
"weightsSum",
mergedWeights,
false
); );
wr.write("weightsSum", mergedWeights);
wr.clear();
} }
if (isA<cyclicACMIPolyPatch>(pbm[patchi])) if (isA<cyclicACMIPolyPatch>(pbm[patchi]))
...@@ -1049,22 +1044,22 @@ Foam::label Foam::checkGeometry ...@@ -1049,22 +1044,22 @@ Foam::label Foam::checkGeometry
if (Pstream::master()) if (Pstream::master())
{ {
wr.write const word fName
( (
outputDir, "patch" + Foam::name(cpp.index())
( + "-src_" + tmName
"patch" + Foam::name(cpp.index()) );
+ "-src_" + tmName
), wr.open
meshedSurfRef (
( mergedPoints,
mergedPoints, mergedFaces,
mergedFaces (outputDir / fName),
), false // serial - already merged
"mask",
mergedMask,
false
); );
wr.write("mask", mergedMask);
wr.clear();
} }
} }
} }
...@@ -1101,22 +1096,22 @@ Foam::label Foam::checkGeometry ...@@ -1101,22 +1096,22 @@ Foam::label Foam::checkGeometry
if (Pstream::master()) if (Pstream::master())
{ {
wr.write const word fName
( (
outputDir, "patch" + Foam::name(cpp.index())
( + "-tgt_" + tmName
"patch" + Foam::name(cpp.index()) );
+ "-tgt_" + tmName
), wr.open
meshedSurfRef (
( mergedPoints,
mergedPoints, mergedFaces,
mergedFaces (outputDir / fName),
), false // serial - already merged
"weightsSum",
mergedWeights,
false
); );
wr.write("weightsSum", mergedWeights);
wr.clear();
} }
if (isA<cyclicACMIPolyPatch>(pbm[patchi])) if (isA<cyclicACMIPolyPatch>(pbm[patchi]))
...@@ -1129,24 +1124,25 @@ Foam::label Foam::checkGeometry ...@@ -1129,24 +1124,25 @@ Foam::label Foam::checkGeometry
pp.neighbPatch().mask(), pp.neighbPatch().mask(),
mergedMask mergedMask
); );
if (Pstream::master()) if (Pstream::master())
{ {
wr.write const word fName
( (
outputDir, "patch" + Foam::name(cpp.index())
( + "-tgt_" + tmName
"patch" + Foam::name(cpp.index())
+ "-tgt_" + tmName
),
meshedSurfRef
(
mergedPoints,
mergedFaces
),
"mask",
mergedMask,
false
); );
wr.open
(
mergedPoints,
mergedFaces,
(outputDir / fName),
false // serial - already merged
);
wr.write("mask", mergedMask);
wr.clear();
} }
} }
} }
......
...@@ -27,7 +27,7 @@ namespace Foam ...@@ -27,7 +27,7 @@ namespace Foam
( (
const polyMesh& mesh, const polyMesh& mesh,
const bool allGeometry, const bool allGeometry,
const autoPtr<surfaceWriter>&, autoPtr<surfaceWriter>& surfWriter,
const autoPtr<writer<scalar>>& const autoPtr<writer<scalar>>& setWriter
); );
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation | Copyright (C) 2011-2017 OpenFOAM Foundation
...@@ -67,8 +67,8 @@ Usage ...@@ -67,8 +67,8 @@ Usage
#include "Time.H" #include "Time.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "surfaceWriter.H"
#include "vtkSetWriter.H" #include "vtkSetWriter.H"
#include "vtkSurfaceWriter.H"
#include "IOdictionary.H" #include "IOdictionary.H"
#include "checkTools.H" #include "checkTools.H"
...@@ -149,16 +149,19 @@ int main(int argc, char *argv[]) ...@@ -149,16 +149,19 @@ int main(int argc, char *argv[])
); );
if (!writeFields && args.found("writeAllFields")) if (!writeFields && args.found("writeAllFields"))
{ {
selectedFields.insert("nonOrthoAngle"); selectedFields.insert
selectedFields.insert("faceWeight"); ({
selectedFields.insert("skewness"); "nonOrthoAngle",
selectedFields.insert("cellDeterminant"); "faceWeight",
selectedFields.insert("aspectRatio"); "skewness",
selectedFields.insert("cellShapes"); "cellDeterminant",
selectedFields.insert("cellVolume"); "aspectRatio",
selectedFields.insert("cellVolumeRatio"); "cellShapes",
selectedFields.insert("minTetVolume"); "cellVolume",
selectedFields.insert("cellRegion"); "cellVolumeRatio",
"minTetVolume",
"cellRegion"
});
} }
......
...@@ -10,7 +10,7 @@ Foam::label Foam::checkMeshQuality ...@@ -10,7 +10,7 @@ Foam::label Foam::checkMeshQuality
( (
const polyMesh& mesh, const polyMesh& mesh,
const dictionary& dict, const dictionary& dict,
const autoPtr<surfaceWriter>& writer autoPtr<surfaceWriter>& writer
) )
{ {
label noFailedChecks = 0; label noFailedChecks = 0;
...@@ -29,9 +29,10 @@ Foam::label Foam::checkMeshQuality ...@@ -29,9 +29,10 @@ Foam::label Foam::checkMeshQuality
<< " faces in error to set " << faces.name() << endl; << " faces in error to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (writer.valid()) if (writer.valid())
{ {
mergeAndWrite(writer(), faces); mergeAndWrite(*writer, faces);
} }
} }
} }
......
...@@ -6,8 +6,8 @@ namespace Foam ...@@ -6,8 +6,8 @@ namespace Foam
label checkMeshQuality label checkMeshQuality
( (
const polyMesh&, const polyMesh& mesh,
const dictionary&, const dictionary& dict,
const autoPtr<surfaceWriter>& autoPtr<surfaceWriter>& writer
); );
} }
...@@ -209,7 +209,7 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology) ...@@ -209,7 +209,7 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
void Foam::mergeAndWrite void Foam::mergeAndWrite
( (
const polyMesh& mesh, const polyMesh& mesh,
const surfaceWriter& writer, surfaceWriter& writer,
const word& name, const word& name,
const indirectPrimitivePatch& setPatch, const indirectPrimitivePatch& setPatch,
const fileName& outputDir const fileName& outputDir
...@@ -242,37 +242,37 @@ void Foam::mergeAndWrite ...@@ -242,37 +242,37 @@ void Foam::mergeAndWrite
// Write // Write
if (Pstream::master())