meshCheck: New library for mesh checking functions

Used by the checkMesh utility and functionObject
This commit is contained in:
Henry Weller
2023-10-19 15:00:28 +01:00
parent 738f205ac8
commit 715dcd97d0
31 changed files with 107 additions and 84 deletions

View File

@ -1,6 +1,3 @@
checkTools.C
checkTopology.C
checkGeometry.C
checkMeshQuality.C
checkMesh.C

View File

@ -1,14 +1,14 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/meshCheck/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lmeshTools \
-lgenericPatches \
-lmeshCheck \
-lfiniteVolume \
-lsampling \
-lsurfMesh \
-ldynamicMesh
-ldynamicMesh \
-lgenericPatches

View File

@ -196,13 +196,13 @@ int main(int argc, char *argv[])
// Reconstruct globalMeshData
mesh.globalData();
printMeshStats(mesh, allTopology);
meshTools::printMeshStats(mesh, allTopology);
label nFailedChecks = 0;
if (!noTopology)
{
nFailedChecks += checkTopology
nFailedChecks += meshCheck::checkTopology
(
mesh,
allTopology,
@ -211,7 +211,7 @@ int main(int argc, char *argv[])
);
}
nFailedChecks += checkGeometry
nFailedChecks += meshCheck::checkGeometry
(
mesh,
allGeometry,
@ -242,7 +242,7 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.userTimeName() << nl << endl;
label nFailedChecks = checkGeometry
label nFailedChecks = meshCheck::checkGeometry
(
mesh,
allGeometry,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -58,7 +58,7 @@ Foam::label Foam::checkMeshQuality
faces.write();
if (writer.valid())
{
mergeAndWrite(writer(), faces);
meshTools::mergeAndWrite(writer(), faces);
}
}
}

View File

@ -40,15 +40,17 @@ wmake $targetType lagrangian/basic
generic/Allwmake $targetType $*
wmake $targetType sampling
wmake $targetType meshCheck
wmake $targetType mesh/extrudeModel
wmake $targetType dynamicMesh
wmake $targetType conversion
# Compile scotchDecomp, metisDecomp etc.
parallel/Allwmake $targetType $*
wmake $targetType conversion
wmake $targetType sampling
wmake $targetType fvMeshStitchers
wmake $targetType fvMeshMovers
fvMeshTopoChangers/Allwmake $targetType $*

View File

@ -1,11 +1,3 @@
ensight/file/ensightFile.C
ensight/file/ensightGeoFile.C
ensight/part/ensightPart.C
ensight/part/ensightPartIO.C
ensight/part/ensightPartCells.C
ensight/part/ensightPartFaces.C
ensight/part/ensightParts.C
mergedCyclic/mergedCyclicPolyPatch.C
mergedCyclic/polyMeshUnMergeCyclics.C

5
src/meshCheck/Make/files Normal file
View File

@ -0,0 +1,5 @@
checkTools/checkTools.C
checkTools/checkTopology.C
checkTools/checkGeometry.C
LIB = $(FOAM_LIBBIN)/libmeshCheck

View File

@ -0,0 +1,13 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
LIB_LIBS = \
-lmeshTools \
-ltriSurface \
-lsurfMesh \
-lfileFormats \
-lsampling

View File

@ -44,7 +44,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::label Foam::findOppositeWedge
Foam::label Foam::meshCheck::findOppositeWedge
(
const polyMesh& mesh,
const wedgePolyPatch& wpp
@ -84,7 +84,7 @@ Foam::label Foam::findOppositeWedge
}
bool Foam::checkWedges
bool Foam::meshCheck::checkWedges
(
const polyMesh& mesh,
const bool report,
@ -357,7 +357,7 @@ namespace Foam
}
bool Foam::checkCoupledPoints
bool Foam::meshCheck::checkCoupledPoints
(
const polyMesh& mesh,
const bool report,
@ -505,7 +505,7 @@ bool Foam::checkCoupledPoints
}
Foam::label Foam::checkGeometry
Foam::label Foam::meshCheck::checkGeometry
(
const polyMesh& mesh,
const bool allGeometry,
@ -608,7 +608,7 @@ Foam::label Foam::checkGeometry
nonAlignedPoints.write();
if (setWriter.valid())
{
mergeAndWrite(setWriter, nonAlignedPoints);
meshTools::mergeAndWrite(setWriter, nonAlignedPoints);
}
}
}
@ -643,7 +643,7 @@ Foam::label Foam::checkGeometry
cells.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), cells);
meshTools::mergeAndWrite(surfWriter(), cells);
}
}
}
@ -659,7 +659,7 @@ Foam::label Foam::checkGeometry
aspectCells.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), aspectCells);
meshTools::mergeAndWrite(surfWriter(), aspectCells);
}
}
}
@ -680,7 +680,7 @@ Foam::label Foam::checkGeometry
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -702,7 +702,7 @@ Foam::label Foam::checkGeometry
cells.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), cells);
meshTools::mergeAndWrite(surfWriter(), cells);
}
}
}
@ -725,7 +725,7 @@ Foam::label Foam::checkGeometry
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -747,7 +747,7 @@ Foam::label Foam::checkGeometry
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -769,7 +769,7 @@ Foam::label Foam::checkGeometry
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -793,7 +793,7 @@ Foam::label Foam::checkGeometry
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -826,7 +826,7 @@ Foam::label Foam::checkGeometry
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -851,7 +851,7 @@ Foam::label Foam::checkGeometry
points.write();
if (setWriter.valid())
{
mergeAndWrite(setWriter, points);
meshTools::mergeAndWrite(setWriter, points);
}
}
}
@ -874,7 +874,7 @@ Foam::label Foam::checkGeometry
nearPoints.write();
if (setWriter.valid())
{
mergeAndWrite(setWriter, nearPoints);
meshTools::mergeAndWrite(setWriter, nearPoints);
}
}
}
@ -898,7 +898,7 @@ Foam::label Foam::checkGeometry
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -921,7 +921,7 @@ Foam::label Foam::checkGeometry
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -942,7 +942,7 @@ Foam::label Foam::checkGeometry
cells.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), cells);
meshTools::mergeAndWrite(surfWriter(), cells);
}
}
}
@ -962,7 +962,7 @@ Foam::label Foam::checkGeometry
cells.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), cells);
meshTools::mergeAndWrite(surfWriter(), cells);
}
}
}
@ -983,7 +983,7 @@ Foam::label Foam::checkGeometry
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -1004,7 +1004,7 @@ Foam::label Foam::checkGeometry
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,6 +45,8 @@ namespace Foam
class wedgePolyPatch;
class surfaceWriter;
namespace meshCheck
{
//- Find wedge with opposite orientation. Note: does not actually check
// that it is opposite, only that it has opposite normal and same axis.
label findOppositeWedge(const polyMesh&, const wedgePolyPatch&);
@ -70,6 +72,7 @@ namespace Foam
const autoPtr<setWriter>&
);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -46,7 +46,11 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
void Foam::meshTools::printMeshStats
(
const polyMesh& mesh,
const bool allTopology
)
{
Info<< "Mesh stats" << nl
<< " points: "
@ -205,7 +209,7 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
}
void Foam::mergeAndWrite
void Foam::meshTools::mergeAndWrite
(
const polyMesh& mesh,
const surfaceWriter& writer,
@ -257,7 +261,7 @@ void Foam::mergeAndWrite
}
Foam::fileName Foam::checkMeshOutputDir(const polyMesh& mesh)
Foam::fileName Foam::meshTools::checkMeshOutputDir(const polyMesh& mesh)
{
return
mesh.time().globalPath()
@ -272,7 +276,7 @@ Foam::fileName Foam::checkMeshOutputDir(const polyMesh& mesh)
}
void Foam::mergeAndWrite
void Foam::meshTools::mergeAndWrite
(
const surfaceWriter& writer,
const faceSet& set
@ -290,7 +294,7 @@ void Foam::mergeAndWrite
}
void Foam::mergeAndWrite
void Foam::meshTools::mergeAndWrite
(
const surfaceWriter& writer,
const cellSet& set
@ -377,7 +381,7 @@ void Foam::mergeAndWrite
}
void Foam::mergeAndWrite
void Foam::meshTools::mergeAndWrite
(
const setWriter& writer,
const pointSet& set

View File

@ -32,7 +32,6 @@ SourceFiles
#ifndef checkTools_H
#define checkTools_H
#include "scalar.H"
#include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,9 +44,9 @@ namespace Foam
class pointSet;
class faceSet;
class cellSet;
class fileName;
class polyMesh;
namespace meshTools
{
//- Output directory for sets and surfaces
fileName checkMeshOutputDir(const polyMesh& mesh);
@ -77,6 +76,7 @@ namespace Foam
// postProcessing/ directory
void mergeAndWrite(const setWriter&, const pointSet&);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -38,7 +38,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::label Foam::checkTopology
Foam::label Foam::meshCheck::checkTopology
(
const polyMesh& mesh,
const bool allTopology,
@ -131,7 +131,7 @@ Foam::label Foam::checkTopology
cells.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), cells);
meshTools::mergeAndWrite(surfWriter(), cells);
}
}
@ -156,7 +156,7 @@ Foam::label Foam::checkTopology
points.write();
if (setWriter.valid())
{
mergeAndWrite(setWriter, points);
meshTools::mergeAndWrite(setWriter, points);
}
}
}
@ -178,7 +178,7 @@ Foam::label Foam::checkTopology
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -198,7 +198,7 @@ Foam::label Foam::checkTopology
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -219,7 +219,7 @@ Foam::label Foam::checkTopology
cells.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), cells);
meshTools::mergeAndWrite(surfWriter(), cells);
}
}
@ -243,7 +243,7 @@ Foam::label Foam::checkTopology
faces.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), faces);
meshTools::mergeAndWrite(surfWriter(), faces);
}
}
}
@ -298,7 +298,7 @@ Foam::label Foam::checkTopology
oneCells.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), oneCells);
meshTools::mergeAndWrite(surfWriter(), oneCells);
}
}
@ -314,7 +314,7 @@ Foam::label Foam::checkTopology
twoCells.write();
if (surfWriter.valid())
{
mergeAndWrite(surfWriter(), twoCells);
meshTools::mergeAndWrite(surfWriter(), twoCells);
}
}
}
@ -459,7 +459,7 @@ Foam::label Foam::checkTopology
points.write();
if (setWriter.valid())
{
mergeAndWrite(setWriter, points);
meshTools::mergeAndWrite(setWriter, points);
}
}
}

View File

@ -43,6 +43,8 @@ namespace Foam
class surfaceWriter;
class setWriter;
namespace meshCheck
{
label checkTopology
(
const polyMesh& mesh,
@ -51,6 +53,7 @@ namespace Foam
const autoPtr<Foam::setWriter>& setWriter
);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -27,6 +27,14 @@ sampledSet/faceSetSampledSet/faceSetSampledSet.C
setWriters = sampledSet/writers
$(setWriters)/setWriter.C
$(setWriters)/ensight/file/ensightFile.C
$(setWriters)/ensight/file/ensightGeoFile.C
$(setWriters)/ensight/part/ensightPart.C
$(setWriters)/ensight/part/ensightPartIO.C
$(setWriters)/ensight/part/ensightPartCells.C
$(setWriters)/ensight/part/ensightPartFaces.C
$(setWriters)/ensight/part/ensightParts.C
$(setWriters)/ensight/ensightSetWriter.C
$(setWriters)/raw/rawSetWriter.C
$(setWriters)/vtk/vtkSetWriter.C

View File

@ -4,8 +4,6 @@ EXE_INC = \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/conversion/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude
LIB_LIBS = \
@ -14,6 +12,4 @@ LIB_LIBS = \
-lsurfMesh \
-lfileFormats \
-ltriSurface \
-llagrangian \
-ldynamicMesh \
-lconversion
-llagrangian

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License