ENH: searchableSurfaces: add checking routines

This commit is contained in:
mattijs
2012-11-13 12:20:02 +00:00
parent 6bd16e1eef
commit 434e2fafcd
11 changed files with 648 additions and 5 deletions

View File

@ -17,6 +17,7 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude
@ -29,5 +30,6 @@ EXE_LIBS = \
-ldecompositionMethods \
-L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
-ledgeMesh \
-lsampling \
-ltriSurface \
-ldynamicMesh

View File

@ -17,6 +17,7 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I../vectorTools

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,6 +36,7 @@ Description
#include "argList.H"
#include "conformalVoronoiMesh.H"
#include "vtkSetWriter.H"
using namespace Foam;
@ -48,6 +49,11 @@ int main(int argc, char *argv[])
"noFilter",
"Do not filter the mesh"
);
Foam::argList::addBoolOption
(
"checkGeometry",
"check all surface geometry for quality"
);
#include "setRootCase.H"
#include "createTime.H"
@ -55,6 +61,7 @@ int main(int argc, char *argv[])
runTime.functionObjects().off();
const bool noFilter = !args.optionFound("noFilter");
const bool checkGeometry = args.optionFound("checkGeometry");
Info<< "Mesh filtering is " << (noFilter ? "on" : "off") << endl;
@ -74,6 +81,29 @@ int main(int argc, char *argv[])
conformalVoronoiMesh mesh(runTime, cvMeshDict);
if (checkGeometry)
{
const searchableSurfaces& allGeometry = mesh.allGeometry();
// Write some stats
allGeometry.writeStats(List<wordList>(0), Info);
// Check topology
allGeometry.checkTopology(true);
// Check geometry
allGeometry.checkGeometry
(
100.0, // max size ratio
1e-9, // intersection tolerance
autoPtr<writer<scalar> >(new vtkSetWriter<scalar>()),
0.01, // min triangle quality
true
);
return 0;
}
while (runTime.loop())
{
Info<< nl << "Time = " << runTime.timeName() << endl;

View File

@ -9,6 +9,7 @@ EXE_INC = \
-I$(FASTDUALOCTREE_SRC_PATH) \
-I../conformalVoronoiMesh/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
@ -21,6 +22,7 @@ EXE_LIBS = \
-lconformalVoronoiMesh \
-ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lscotchDecomp \
-ledgeMesh \
-lsampling \
-ltriSurface \
-lmeshTools \
-ldynamicMesh

View File

@ -3,6 +3,7 @@ EXE_INC = \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/mesh/autoMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \
@ -13,5 +14,6 @@ EXE_LIBS = \
-ldecompositionMethods \
-L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
-lmeshTools \
-lsampling \
-ldynamicMesh \
-lautoMesh

View File

@ -46,7 +46,7 @@ Description
#include "refinementParameters.H"
#include "snapParameters.H"
#include "layerParameters.H"
#include "vtkSetWriter.H"
using namespace Foam;
@ -122,6 +122,12 @@ void writeMesh
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
Foam::argList::addBoolOption
(
"checkGeometry",
"check all surface geometry for quality"
);
# include "setRootCase.H"
# include "createTime.H"
runTime.functionObjects().off();
@ -131,6 +137,7 @@ int main(int argc, char *argv[])
<< runTime.cpuTimeIncrement() << " s" << endl;
const bool overwrite = args.optionFound("overwrite");
const bool checkGeometry = args.optionFound("checkGeometry");
// Check patches and faceZones are synchronised
mesh.boundaryMesh().checkParallelSync(true);
@ -244,6 +251,56 @@ int main(int argc, char *argv[])
<< mesh.time().cpuTimeIncrement() << " s" << nl << endl;
// Checking only?
if (checkGeometry)
{
// Extract patchInfo
List<wordList> patchTypes(allGeometry.size());
const PtrList<dictionary>& patchInfo = surfaces.patchInfo();
const labelList& surfaceGeometry = surfaces.surfaces();
forAll(surfaceGeometry, surfI)
{
label geomI = surfaceGeometry[surfI];
const wordList& regNames = allGeometry.regionNames()[geomI];
patchTypes[geomI].setSize(regNames.size());
forAll(regNames, regionI)
{
label globalRegionI = surfaces.globalRegion(surfI, regionI);
if (patchInfo.set(globalRegionI))
{
patchTypes[geomI][regionI] =
word(patchInfo[globalRegionI].lookup("type"));
}
else
{
patchTypes[geomI][regionI] = wallPolyPatch::typeName;
}
}
}
// Write some stats
allGeometry.writeStats(patchTypes, Info);
// Check topology
allGeometry.checkTopology(true);
// Check geometry
allGeometry.checkGeometry
(
100.0, // max size ratio
1e-9, // intersection tolerance
autoPtr<writer<scalar> >(new vtkSetWriter<scalar>()),
0.01, // min triangle quality
true
);
return 0;
}
// Read refinement shells
// ~~~~~~~~~~~~~~~~~~~~~~