primitiveMeshGeometry, polyMeshGeometry: Removed unused code

The utilised static parts of polyMeshGeometry are now part of a
polyMeshCheck namespace. Everything else has been removed, as they were
unused, out of date, and/or duplicated elsewhere.
This commit is contained in:
Will Bainbridge
2020-02-13 09:04:24 +00:00
parent ba52c4047c
commit 2d3b02c130
12 changed files with 290 additions and 3172 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,7 +26,7 @@ License
#include "conformalVoronoiMesh.H" #include "conformalVoronoiMesh.H"
#include "motionSmoother.H" #include "motionSmoother.H"
#include "backgroundMeshDecomposition.H" #include "backgroundMeshDecomposition.H"
#include "polyMeshGeometry.H" #include "polyMeshCheck.H"
#include "indexedCellChecks.H" #include "indexedCellChecks.H"
#include "OBJstream.H" #include "OBJstream.H"
#include "indexedCellOps.H" #include "indexedCellOps.H"
@ -846,7 +846,7 @@ void Foam::conformalVoronoiMesh::checkCellSizing()
if (maxNonOrtho < 180.0 - small) if (maxNonOrtho < 180.0 - small)
{ {
polyMeshGeometry::checkFaceDotProduct polyMeshCheck::checkFaceDotProduct
( (
false, false,
maxNonOrtho, maxNonOrtho,

View File

@ -711,7 +711,6 @@ DebugSwitches
pointZone 0; pointZone 0;
polyBoundaryMesh 0; polyBoundaryMesh 0;
polyMesh 0; polyMesh 0;
polyMeshGeometry 0;
polyMeshInfo 0; polyMeshInfo 0;
polyTopoChange 0; polyTopoChange 0;
polyTopoChanger 0; polyTopoChanger 0;
@ -724,7 +723,6 @@ DebugSwitches
pressureNormalInletOutletVelocity 0; pressureNormalInletOutletVelocity 0;
pressureSwirlInjector 0; pressureSwirlInjector 0;
primitiveMesh 0; primitiveMesh 0;
primitiveMeshGeometry 0;
probes 0; probes 0;
processor 0; processor 0;
processorLduInterface 0; processorLduInterface 0;

View File

@ -94,7 +94,7 @@ motionSmoother/motionSmoother.C
motionSmoother/motionSmootherAlgo.C motionSmoother/motionSmootherAlgo.C
motionSmoother/motionSmootherAlgoCheck.C motionSmoother/motionSmootherAlgoCheck.C
motionSmoother/motionSmootherData.C motionSmoother/motionSmootherData.C
motionSmoother/polyMeshGeometry/polyMeshGeometry.C motionSmoother/polyMeshCheck/polyMeshCheck.C
motionSmoother/badQualityToCell/badQualityToCell.C motionSmoother/badQualityToCell/badQualityToCell.C
motionSmoother/badQualityToFace/badQualityToFace.C motionSmoother/badQualityToFace/badQualityToFace.C

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -87,7 +87,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
class polyMeshGeometry;
class faceSet; class faceSet;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -460,31 +459,6 @@ public:
labelHashSet& wrongFaces labelHashSet& wrongFaces
); );
//- Check part of mesh with mesh settings in dict.
// Collects incorrect faces in set. Returns true if one or
// more faces in error. Parallel ok.
static bool checkMesh
(
const bool report,
const dictionary& dict,
const polyMeshGeometry&,
const labelList& checkFaces,
labelHashSet& wrongFaces
);
//- Check part of mesh including baffles with mesh settings in dict.
// Collects incorrect faces in set. Returns true if one or
// more faces in error. Parallel ok.
static bool checkMesh
(
const bool report,
const dictionary& dict,
const polyMeshGeometry&,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet& wrongFaces
);
// Helper functions to manipulate displacement vector. // Helper functions to manipulate displacement vector.
//- Fully explicit smoothing of fields (not positions) //- Fully explicit smoothing of fields (not positions)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "motionSmootherAlgo.H" #include "motionSmootherAlgo.H"
#include "polyMeshGeometry.H" #include "polyMeshCheck.H"
#include "IOmanip.H" #include "IOmanip.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -117,7 +117,7 @@ bool Foam::motionSmootherAlgo::checkMesh
if (maxNonOrtho < 180.0-small) if (maxNonOrtho < 180.0-small)
{ {
polyMeshGeometry::checkFaceDotProduct polyMeshCheck::checkFaceDotProduct
( (
report, report,
maxNonOrtho, maxNonOrtho,
@ -141,7 +141,7 @@ bool Foam::motionSmootherAlgo::checkMesh
if (minVol > -great) if (minVol > -great)
{ {
polyMeshGeometry::checkFacePyramids polyMeshCheck::checkFacePyramids
( (
report, report,
minVol, minVol,
@ -164,7 +164,7 @@ bool Foam::motionSmootherAlgo::checkMesh
if (minTetQuality > -great) if (minTetQuality > -great)
{ {
polyMeshGeometry::checkFaceTets polyMeshCheck::checkFaceTets
( (
report, report,
minTetQuality, minTetQuality,
@ -188,7 +188,7 @@ bool Foam::motionSmootherAlgo::checkMesh
if (maxConcave < 180.0-small) if (maxConcave < 180.0-small)
{ {
polyMeshGeometry::checkFaceAngles polyMeshCheck::checkFaceAngles
( (
report, report,
maxConcave, maxConcave,
@ -211,7 +211,7 @@ bool Foam::motionSmootherAlgo::checkMesh
if (minArea > -small) if (minArea > -small)
{ {
polyMeshGeometry::checkFaceArea polyMeshCheck::checkFaceArea
( (
report, report,
minArea, minArea,
@ -233,7 +233,7 @@ bool Foam::motionSmootherAlgo::checkMesh
if (maxIntSkew > 0 || maxBounSkew > 0) if (maxIntSkew > 0 || maxBounSkew > 0)
{ {
polyMeshGeometry::checkFaceSkewness polyMeshCheck::checkFaceSkewness
( (
report, report,
maxIntSkew, maxIntSkew,
@ -260,7 +260,7 @@ bool Foam::motionSmootherAlgo::checkMesh
if (minWeight >= 0 && minWeight < 1) if (minWeight >= 0 && minWeight < 1)
{ {
polyMeshGeometry::checkFaceWeights polyMeshCheck::checkFaceWeights
( (
report, report,
minWeight, minWeight,
@ -285,7 +285,7 @@ bool Foam::motionSmootherAlgo::checkMesh
if (minVolRatio >= 0) if (minVolRatio >= 0)
{ {
polyMeshGeometry::checkVolRatio polyMeshCheck::checkVolRatio
( (
report, report,
minVolRatio, minVolRatio,
@ -310,7 +310,7 @@ bool Foam::motionSmootherAlgo::checkMesh
{ {
// Pout<< "Checking face twist: dot product of face normal " // Pout<< "Checking face twist: dot product of face normal "
// << "with face triangle normals" << endl; // << "with face triangle normals" << endl;
polyMeshGeometry::checkFaceTwist polyMeshCheck::checkFaceTwist
( (
report, report,
minTwist, minTwist,
@ -337,7 +337,7 @@ bool Foam::motionSmootherAlgo::checkMesh
{ {
// Pout<< "Checking triangle twist: dot product of consecutive triangle" // Pout<< "Checking triangle twist: dot product of consecutive triangle"
// << " normals resulting from face-centre decomposition" << endl; // << " normals resulting from face-centre decomposition" << endl;
polyMeshGeometry::checkTriangleTwist polyMeshCheck::checkTriangleTwist
( (
report, report,
minTriangleTwist, minTriangleTwist,
@ -361,7 +361,7 @@ bool Foam::motionSmootherAlgo::checkMesh
if (minFaceFlatness > -small) if (minFaceFlatness > -small)
{ {
polyMeshGeometry::checkFaceFlatness polyMeshCheck::checkFaceFlatness
( (
report, report,
minFaceFlatness, minFaceFlatness,
@ -385,14 +385,13 @@ bool Foam::motionSmootherAlgo::checkMesh
if (minDet > -1) if (minDet > -1)
{ {
polyMeshGeometry::checkCellDeterminant polyMeshCheck::checkCellDeterminant
( (
report, report,
minDet, minDet,
mesh, mesh,
mesh.faceAreas(), mesh.faceAreas(),
checkFaces, checkFaces,
polyMeshGeometry::affectedCells(mesh, checkFaces),
&wrongFaces &wrongFaces
); );
@ -429,351 +428,5 @@ bool Foam::motionSmootherAlgo::checkMesh
); );
} }
bool Foam::motionSmootherAlgo::checkMesh
(
const bool report,
const dictionary& dict,
const polyMeshGeometry& meshGeom,
const labelList& checkFaces,
labelHashSet& wrongFaces
)
{
List<labelPair> emptyBaffles;
return checkMesh
(
report,
dict,
meshGeom,
checkFaces,
emptyBaffles,
wrongFaces
);
}
bool Foam::motionSmootherAlgo::checkMesh
(
const bool report,
const dictionary& dict,
const polyMeshGeometry& meshGeom,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet& wrongFaces
)
{
const scalar maxNonOrtho
(
dict.lookup<scalar>("maxNonOrtho", true)
);
const scalar minVol
(
dict.lookup<scalar>("minVol", true)
);
const scalar minTetQuality
(
dict.lookup<scalar>("minTetQuality", true)
);
const scalar maxConcave
(
dict.lookup<scalar>("maxConcave", true)
);
const scalar minArea
(
dict.lookup<scalar>("minArea", true)
);
// const scalar maxIntSkew
//(
// dict.lookup<scalar>("maxInternalSkewness", true)
//);
// const scalar maxBounSkew
//(
// dict.lookup<scalar>("maxBoundarySkewness", true)
//);
const scalar minWeight
(
dict.lookup<scalar>("minFaceWeight", true)
);
const scalar minVolRatio
(
dict.lookup<scalar>("minVolRatio", true)
);
const scalar minTwist
(
dict.lookup<scalar>("minTwist", true)
);
const scalar minTriangleTwist
(
dict.lookup<scalar>("minTriangleTwist", true)
);
scalar minFaceFlatness = -1.0;
dict.readIfPresent("minFaceFlatness", minFaceFlatness, true);
const scalar minDet
(
dict.lookup<scalar>("minDeterminant", true)
);
label nWrongFaces = 0;
Info<< "Checking faces in error :" << endl;
// Pout.setf(ios_base::left);
if (maxNonOrtho < 180.0-small)
{
meshGeom.checkFaceDotProduct
(
report,
maxNonOrtho,
checkFaces,
baffles,
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " non-orthogonality > "
<< setw(3) << maxNonOrtho
<< " degrees : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
if (minVol > -great)
{
meshGeom.checkFacePyramids
(
report,
minVol,
meshGeom.mesh().points(),
checkFaces,
baffles,
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces with face pyramid volume < "
<< setw(5) << minVol << " : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
if (minTetQuality > -great)
{
meshGeom.checkFaceTets
(
report,
minTetQuality,
meshGeom.mesh().points(),
checkFaces,
baffles,
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces with face-decomposition tet quality < "
<< setw(5) << minTetQuality << " : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
if (maxConcave < 180.0-small)
{
meshGeom.checkFaceAngles
(
report,
maxConcave,
meshGeom.mesh().points(),
checkFaces,
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces with concavity > "
<< setw(3) << maxConcave
<< " degrees : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
if (minArea > -small)
{
meshGeom.checkFaceArea(report, minArea, checkFaces, &wrongFaces);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces with area < "
<< setw(5) << minArea
<< " m^2 : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
//- Note: cannot check the skewness without the points and don't want
// to store them on polyMeshGeometry.
// if (maxIntSkew > 0 || maxBounSkew > 0)
//{
// meshGeom.checkFaceSkewness
// (
// report,
// maxIntSkew,
// maxBounSkew,
// checkFaces,
// baffles,
// &wrongFaces
// );
//
// label nNewWrongFaces = returnReduce(wrongFaces.size(),sumOp<label>());
//
// Info<< " faces with skewness > "
// << setw(3) << maxIntSkew
// << " (internal) or " << setw(3) << maxBounSkew
// << " (boundary) : " << nNewWrongFaces-nWrongFaces << endl;
//
// nWrongFaces = nNewWrongFaces;
//}
if (minWeight >= 0 && minWeight < 1)
{
meshGeom.checkFaceWeights
(
report,
minWeight,
checkFaces,
baffles,
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces with interpolation weights (0..1) < "
<< setw(5) << minWeight
<< " : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
if (minVolRatio >= 0)
{
meshGeom.checkVolRatio
(
report,
minVolRatio,
checkFaces,
baffles,
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces with volume ratio of neighbour cells < "
<< setw(5) << minVolRatio
<< " : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
if (minTwist > -1)
{
// Pout<< "Checking face twist: dot product of face normal "
// << "with face triangle normals" << endl;
meshGeom.checkFaceTwist
(
report,
minTwist,
meshGeom.mesh().points(),
checkFaces,
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces with face twist < "
<< setw(5) << minTwist
<< " : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
if (minTriangleTwist > -1)
{
// Pout<< "Checking triangle twist: dot product of consecutive triangle"
// << " normals resulting from face-centre decomposition" << endl;
meshGeom.checkTriangleTwist
(
report,
minTriangleTwist,
meshGeom.mesh().points(),
checkFaces,
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces with triangle twist < "
<< setw(5) << minTriangleTwist
<< " : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
if (minFaceFlatness > -1)
{
meshGeom.checkFaceFlatness
(
report,
minFaceFlatness,
meshGeom.mesh().points(),
checkFaces,
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces with flatness < "
<< setw(5) << minFaceFlatness
<< " : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
if (minDet > -1)
{
meshGeom.checkCellDeterminant
(
report,
minDet,
checkFaces,
meshGeom.affectedCells(meshGeom.mesh(), checkFaces),
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces on cells with determinant < "
<< setw(5) << minDet << " : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
// Pout.setf(ios_base::right);
return nWrongFaces > 0;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "polyMeshGeometry.H" #include "polyMeshCheck.H"
#include "polyMeshTetDecomposition.H" #include "polyMeshTetDecomposition.H"
#include "pyramidPointFaceRef.H" #include "pyramidPointFaceRef.H"
#include "tetPointRef.H" #include "tetPointRef.H"
@ -31,188 +31,16 @@ License
#include "unitConversion.H" #include "unitConversion.H"
#include "primitiveMeshTools.H" #include "primitiveMeshTools.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(polyMeshGeometry, 0); namespace polyMeshCheck
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::polyMeshGeometry::updateFaceCentresAndAreas
(
const pointField& p,
const labelList& changedFaces
)
{ {
const faceList& fs = mesh_.faces();
forAll(changedFaces, i) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
{
label facei = changedFaces[i];
const labelList& f = fs[facei]; scalar checkNonOrtho
label nPoints = f.size();
// If the face is a triangle, do a direct calculation for efficiency
// and to avoid round-off error-related problems
if (nPoints == 3)
{
faceCentres_[facei] = (1.0/3.0)*(p[f[0]] + p[f[1]] + p[f[2]]);
faceAreas_[facei] = 0.5*((p[f[1]] - p[f[0]])^(p[f[2]] - p[f[0]]));
}
else
{
vector sumN = Zero;
scalar sumA = 0.0;
vector sumAc = Zero;
point fCentre = p[f[0]];
for (label pi = 1; pi < nPoints; pi++)
{
fCentre += p[f[pi]];
}
fCentre /= nPoints;
for (label pi = 0; pi < nPoints; pi++)
{
const point& nextPoint = p[f[(pi + 1) % nPoints]];
vector c = p[f[pi]] + nextPoint + fCentre;
vector n = (nextPoint - p[f[pi]])^(fCentre - p[f[pi]]);
scalar a = mag(n);
sumN += n;
sumA += a;
sumAc += a*c;
}
faceCentres_[facei] = (1.0/3.0)*sumAc/(sumA + vSmall);
faceAreas_[facei] = 0.5*sumN;
}
}
}
void Foam::polyMeshGeometry::updateCellCentresAndVols
(
const labelList& changedCells,
const labelList& changedFaces
)
{
// Clear the fields for accumulation
UIndirectList<vector>(cellCentres_, changedCells) = Zero;
UIndirectList<scalar>(cellVolumes_, changedCells) = 0.0;
const labelList& own = mesh_.faceOwner();
const labelList& nei = mesh_.faceNeighbour();
// first estimate the approximate cell centre as the average of face centres
vectorField cEst(mesh_.nCells());
UIndirectList<vector>(cEst, changedCells) = Zero;
scalarField nCellFaces(mesh_.nCells());
UIndirectList<scalar>(nCellFaces, changedCells) = 0.0;
forAll(changedFaces, i)
{
label facei = changedFaces[i];
cEst[own[facei]] += faceCentres_[facei];
nCellFaces[own[facei]] += 1;
if (mesh_.isInternalFace(facei))
{
cEst[nei[facei]] += faceCentres_[facei];
nCellFaces[nei[facei]] += 1;
}
}
forAll(changedCells, i)
{
label celli = changedCells[i];
cEst[celli] /= nCellFaces[celli];
}
forAll(changedFaces, i)
{
label facei = changedFaces[i];
// Calculate 3*face-pyramid volume
scalar pyr3Vol = max
(
faceAreas_[facei] & (faceCentres_[facei] - cEst[own[facei]]),
vSmall
);
// Calculate face-pyramid centre
vector pc = (3.0/4.0)*faceCentres_[facei] + (1.0/4.0)*cEst[own[facei]];
// Accumulate volume-weighted face-pyramid centre
cellCentres_[own[facei]] += pyr3Vol*pc;
// Accumulate face-pyramid volume
cellVolumes_[own[facei]] += pyr3Vol;
if (mesh_.isInternalFace(facei))
{
// Calculate 3*face-pyramid volume
scalar pyr3Vol = max
(
faceAreas_[facei] & (cEst[nei[facei]] - faceCentres_[facei]),
vSmall
);
// Calculate face-pyramid centre
vector pc =
(3.0/4.0)*faceCentres_[facei]
+ (1.0/4.0)*cEst[nei[facei]];
// Accumulate volume-weighted face-pyramid centre
cellCentres_[nei[facei]] += pyr3Vol*pc;
// Accumulate face-pyramid volume
cellVolumes_[nei[facei]] += pyr3Vol;
}
}
forAll(changedCells, i)
{
label celli = changedCells[i];
cellCentres_[celli] /= cellVolumes_[celli] + vSmall;
cellVolumes_[celli] *= (1.0/3.0);
}
}
Foam::labelList Foam::polyMeshGeometry::affectedCells
(
const polyMesh& mesh,
const labelList& changedFaces
)
{
const labelList& own = mesh.faceOwner();
const labelList& nei = mesh.faceNeighbour();
labelHashSet affectedCells(2*changedFaces.size());
forAll(changedFaces, i)
{
label facei = changedFaces[i];
affectedCells.insert(own[facei]);
if (mesh.isInternalFace(facei))
{
affectedCells.insert(nei[facei]);
}
}
return affectedCells.toc();
}
Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
( (
const polyMesh& mesh, const polyMesh& mesh,
const bool report, const bool report,
@ -279,8 +107,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
} }
// Create the neighbour pyramid - it will have positive volume bool checkFaceTet
bool Foam::polyMeshGeometry::checkFaceTet
( (
const polyMesh& mesh, const polyMesh& mesh,
const bool report, const bool report,
@ -309,7 +136,7 @@ bool Foam::polyMeshGeometry::checkFaceTet
{ {
if (report) if (report)
{ {
Pout<< "bool polyMeshGeometry::checkFaceTets(" Pout<< "bool polyMeshCheck::checkFaceTets("
<< "const bool, const scalar, const pointField&" << "const bool, const scalar, const pointField&"
<< ", const pointField&" << ", const pointField&"
<< ", const labelList&, labelHashSet*) : " << ", const labelList&, labelHashSet*) : "
@ -332,42 +159,39 @@ bool Foam::polyMeshGeometry::checkFaceTet
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // labelList getAffectedCells
// Construct from components
Foam::polyMeshGeometry::polyMeshGeometry(const polyMesh& mesh)
:
mesh_(mesh)
{
correct();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::polyMeshGeometry::correct()
{
faceAreas_ = mesh_.faceAreas();
faceCentres_ = mesh_.faceCentres();
cellCentres_ = mesh_.cellCentres();
cellVolumes_ = mesh_.cellVolumes();
}
void Foam::polyMeshGeometry::correct
( (
const pointField& p, const polyMesh& mesh,
const labelList& changedFaces const labelList& changedFaces
) )
{ {
// Update face quantities const labelList& own = mesh.faceOwner();
updateFaceCentresAndAreas(p, changedFaces); const labelList& nei = mesh.faceNeighbour();
// Update cell quantities from face quantities
updateCellCentresAndVols(affectedCells(mesh_, changedFaces), changedFaces); labelHashSet affectedCells(2*changedFaces.size());
forAll(changedFaces, i)
{
label facei = changedFaces[i];
affectedCells.insert(own[facei]);
if (mesh.isInternalFace(facei))
{
affectedCells.insert(nei[facei]);
}
}
return affectedCells.toc();
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool Foam::polyMeshGeometry::checkFaceDotProduct } // End namespace polyMeshCheck
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool Foam::polyMeshCheck::checkFaceDotProduct
( (
const bool report, const bool report,
const scalar orthWarn, const scalar orthWarn,
@ -549,7 +373,7 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
} }
bool Foam::polyMeshGeometry::checkFacePyramids bool Foam::polyMeshCheck::checkFacePyramids
( (
const bool report, const bool report,
const scalar minPyrVol, const scalar minPyrVol,
@ -584,7 +408,7 @@ bool Foam::polyMeshGeometry::checkFacePyramids
{ {
if (report) if (report)
{ {
Pout<< "bool polyMeshGeometry::checkFacePyramids(" Pout<< "bool polyMeshCheck::checkFacePyramids("
<< "const bool, const scalar, const pointField&" << "const bool, const scalar, const pointField&"
<< ", const labelList&, labelHashSet*): " << ", const labelList&, labelHashSet*): "
<< "face " << facei << " points the wrong way. " << endl << "face " << facei << " points the wrong way. " << endl
@ -615,7 +439,7 @@ bool Foam::polyMeshGeometry::checkFacePyramids
{ {
if (report) if (report)
{ {
Pout<< "bool polyMeshGeometry::checkFacePyramids(" Pout<< "bool polyMeshCheck::checkFacePyramids("
<< "const bool, const scalar, const pointField&" << "const bool, const scalar, const pointField&"
<< ", const labelList&, labelHashSet*): " << ", const labelList&, labelHashSet*): "
<< "face " << facei << " points the wrong way. " << endl << "face " << facei << " points the wrong way. " << endl
@ -655,7 +479,7 @@ bool Foam::polyMeshGeometry::checkFacePyramids
{ {
if (report) if (report)
{ {
Pout<< "bool polyMeshGeometry::checkFacePyramids(" Pout<< "bool polyMeshCheck::checkFacePyramids("
<< "const bool, const scalar, const pointField&" << "const bool, const scalar, const pointField&"
<< ", const labelList&, labelHashSet*): " << ", const labelList&, labelHashSet*): "
<< "face " << face0 << " points the wrong way. " << endl << "face " << face0 << " points the wrong way. " << endl
@ -684,7 +508,7 @@ bool Foam::polyMeshGeometry::checkFacePyramids
{ {
if (report) if (report)
{ {
Pout<< "bool polyMeshGeometry::checkFacePyramids(" Pout<< "bool polyMeshCheck::checkFacePyramids("
<< "const bool, const scalar, const pointField&" << "const bool, const scalar, const pointField&"
<< ", const labelList&, labelHashSet*): " << ", const labelList&, labelHashSet*): "
<< "face " << face0 << " points the wrong way. " << endl << "face " << face0 << " points the wrong way. " << endl
@ -730,7 +554,7 @@ bool Foam::polyMeshGeometry::checkFacePyramids
} }
bool Foam::polyMeshGeometry::checkFaceTets bool Foam::polyMeshCheck::checkFaceTets
( (
const bool report, const bool report,
const scalar minTetQuality, const scalar minTetQuality,
@ -959,7 +783,7 @@ bool Foam::polyMeshGeometry::checkFaceTets
} }
bool Foam::polyMeshGeometry::checkFaceSkewness bool Foam::polyMeshCheck::checkFaceSkewness
( (
const bool report, const bool report,
const scalar internalSkew, const scalar internalSkew,
@ -1172,7 +996,7 @@ bool Foam::polyMeshGeometry::checkFaceSkewness
} }
bool Foam::polyMeshGeometry::checkFaceWeights bool Foam::polyMeshCheck::checkFaceWeights
( (
const bool report, const bool report,
const scalar warnWeight, const scalar warnWeight,
@ -1327,7 +1151,7 @@ bool Foam::polyMeshGeometry::checkFaceWeights
} }
bool Foam::polyMeshGeometry::checkVolRatio bool Foam::polyMeshCheck::checkVolRatio
( (
const bool report, const bool report,
const scalar warnRatio, const scalar warnRatio,
@ -1465,11 +1289,7 @@ bool Foam::polyMeshGeometry::checkVolRatio
} }
// Check convexity of angles in a face. Allow a slight non-convexity. bool Foam::polyMeshCheck::checkFaceAngles
// E.g. maxDeg = 10 allows for angles < 190 (or 10 degrees concavity)
// (if truly concave and points not visible from face centre the face-pyramid
// check in checkMesh will fail)
bool Foam::polyMeshGeometry::checkFaceAngles
( (
const bool report, const bool report,
const scalar maxDeg, const scalar maxDeg,
@ -1600,9 +1420,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
} }
// Check twist of faces. Is calculated as the difference between normals of bool Foam::polyMeshCheck::checkFaceTwist
// individual triangles and the cell-cell centre edge.
bool Foam::polyMeshGeometry::checkFaceTwist
( (
const bool report, const bool report,
const scalar minTwist, const scalar minTwist,
@ -1786,8 +1604,7 @@ bool Foam::polyMeshGeometry::checkFaceTwist
} }
// Like checkFaceTwist but compares normals of consecutive triangles. bool Foam::polyMeshCheck::checkTriangleTwist
bool Foam::polyMeshGeometry::checkTriangleTwist
( (
const bool report, const bool report,
const scalar minTwist, const scalar minTwist,
@ -1937,7 +1754,7 @@ bool Foam::polyMeshGeometry::checkTriangleTwist
} }
bool Foam::polyMeshGeometry::checkFaceFlatness bool Foam::polyMeshCheck::checkFaceFlatness
( (
const bool report, const bool report,
const scalar minFlatness, const scalar minFlatness,
@ -2035,7 +1852,7 @@ bool Foam::polyMeshGeometry::checkFaceFlatness
} }
bool Foam::polyMeshGeometry::checkFaceArea bool Foam::polyMeshCheck::checkFaceArea
( (
const bool report, const bool report,
const scalar minArea, const scalar minArea,
@ -2096,14 +1913,13 @@ bool Foam::polyMeshGeometry::checkFaceArea
} }
bool Foam::polyMeshGeometry::checkCellDeterminant bool Foam::polyMeshCheck::checkCellDeterminant
( (
const bool report, const bool report,
const scalar warnDet, const scalar warnDet,
const polyMesh& mesh, const polyMesh& mesh,
const vectorField& faceAreas, const vectorField& faceAreas,
const labelList& checkFaces, const labelList& checkFaces,
const labelList& affectedCells,
labelHashSet* setPtr labelHashSet* setPtr
) )
{ {
@ -2114,6 +1930,8 @@ bool Foam::polyMeshGeometry::checkCellDeterminant
label nSumDet = 0; label nSumDet = 0;
label nWarnDet = 0; label nWarnDet = 0;
const labelList affectedCells(getAffectedCells(mesh, checkFaces));
forAll(affectedCells, i) forAll(affectedCells, i)
{ {
const cell& cFaces = cells[affectedCells[i]]; const cell& cFaces = cells[affectedCells[i]];
@ -2197,282 +2015,4 @@ bool Foam::polyMeshGeometry::checkCellDeterminant
} }
bool Foam::polyMeshGeometry::checkFaceDotProduct
(
const bool report,
const scalar orthWarn,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const
{
return checkFaceDotProduct
(
report,
orthWarn,
mesh_,
cellCentres_,
faceAreas_,
checkFaces,
baffles,
setPtr
);
}
bool Foam::polyMeshGeometry::checkFacePyramids
(
const bool report,
const scalar minPyrVol,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const
{
return checkFacePyramids
(
report,
minPyrVol,
mesh_,
cellCentres_,
p,
checkFaces,
baffles,
setPtr
);
}
bool Foam::polyMeshGeometry::checkFaceTets
(
const bool report,
const scalar minTetQuality,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const
{
return checkFaceTets
(
report,
minTetQuality,
mesh_,
cellCentres_,
faceCentres_,
p,
checkFaces,
baffles,
setPtr
);
}
//bool Foam::polyMeshGeometry::checkFaceSkewness
//(
// const bool report,
// const scalar internalSkew,
// const scalar boundarySkew,
// const labelList& checkFaces,
// const List<labelPair>& baffles,
// labelHashSet* setPtr
//) const
//{
// return checkFaceSkewness
// (
// report,
// internalSkew,
// boundarySkew,
// mesh_,
// cellCentres_,
// faceCentres_,
// faceAreas_,
// checkFaces,
// baffles,
// setPtr
// );
//}
bool Foam::polyMeshGeometry::checkFaceWeights
(
const bool report,
const scalar warnWeight,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const
{
return checkFaceWeights
(
report,
warnWeight,
mesh_,
cellCentres_,
faceCentres_,
faceAreas_,
checkFaces,
baffles,
setPtr
);
}
bool Foam::polyMeshGeometry::checkVolRatio
(
const bool report,
const scalar warnRatio,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const
{
return checkVolRatio
(
report,
warnRatio,
mesh_,
cellVolumes_,
checkFaces,
baffles,
setPtr
);
}
bool Foam::polyMeshGeometry::checkFaceAngles
(
const bool report,
const scalar maxDeg,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
) const
{
return checkFaceAngles
(
report,
maxDeg,
mesh_,
faceAreas_,
p,
checkFaces,
setPtr
);
}
bool Foam::polyMeshGeometry::checkFaceTwist
(
const bool report,
const scalar minTwist,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
) const
{
return checkFaceTwist
(
report,
minTwist,
mesh_,
cellCentres_,
faceAreas_,
faceCentres_,
p,
checkFaces,
setPtr
);
}
bool Foam::polyMeshGeometry::checkTriangleTwist
(
const bool report,
const scalar minTwist,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
) const
{
return checkTriangleTwist
(
report,
minTwist,
mesh_,
faceAreas_,
faceCentres_,
p,
checkFaces,
setPtr
);
}
bool Foam::polyMeshGeometry::checkFaceFlatness
(
const bool report,
const scalar minFlatness,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
) const
{
return checkFaceFlatness
(
report,
minFlatness,
mesh_,
faceAreas_,
faceCentres_,
p,
checkFaces,
setPtr
);
}
bool Foam::polyMeshGeometry::checkFaceArea
(
const bool report,
const scalar minArea,
const labelList& checkFaces,
labelHashSet* setPtr
) const
{
return checkFaceArea
(
report,
minArea,
mesh_,
faceAreas_,
checkFaces,
setPtr
);
}
bool Foam::polyMeshGeometry::checkCellDeterminant
(
const bool report,
const scalar warnDet,
const labelList& checkFaces,
const labelList& affectedCells,
labelHashSet* setPtr
) const
{
return checkCellDeterminant
(
report,
warnDet,
mesh_,
faceAreas_,
checkFaces,
affectedCells,
setPtr
);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,214 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
PolyMesh checking routines. Checks various criteria for a mesh and supplied
geometry, with the mesh only used for topology. Coupled patch aware (i.e.,
coupled faces are treated as internal).
SourceFiles
polyMeshCheck.C
\*---------------------------------------------------------------------------*/
#ifndef polyMeshCheck_H
#define polyMeshCheck_H
#include "pointFields.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace polyMeshCheck
{
//- Check face non-orthogonality
bool checkFaceDotProduct
(
const bool report,
const scalar orthWarn,
const polyMesh&,
const vectorField& cellCentres,
const vectorField& faceAreas,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
);
//- Check face pyramid volumes
bool checkFacePyramids
(
const bool report,
const scalar minPyrVol,
const polyMesh&,
const vectorField& cellCentres,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet*
);
//- Check face tetrahedra volumes
bool checkFaceTets
(
const bool report,
const scalar minPyrVol,
const polyMesh&,
const vectorField& cellCentres,
const vectorField& faceCentres,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet*
);
//- Check face skewness
bool checkFaceSkewness
(
const bool report,
const scalar internalSkew,
const scalar boundarySkew,
const polyMesh& mesh,
const pointField& points,
const vectorField& cellCentres,
const vectorField& faceCentres,
const vectorField& faceAreas,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
);
//- Check interpolation weights (0.5 for regular mesh)
bool checkFaceWeights
(
const bool report,
const scalar warnWeight,
const polyMesh& mesh,
const vectorField& cellCentres,
const vectorField& faceCentres,
const vectorField& faceAreas,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
);
//- Cell volume ratio of neighbouring cells (1 for regular mesh)
bool checkVolRatio
(
const bool report,
const scalar warnRatio,
const polyMesh& mesh,
const scalarField& cellVolumes,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
);
//- Check convexity of angles in a face. See primitiveMesh for explanation.
bool checkFaceAngles
(
const bool report,
const scalar maxDeg,
const polyMesh& mesh,
const vectorField& faceAreas,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
);
// Check the difference between normals of individual face-triangles (from
// face-centre decomposition) and the cell-cell centre vector
bool checkFaceTwist
(
const bool report,
const scalar minTwist,
const polyMesh&,
const vectorField& cellCentres,
const vectorField& faceAreas,
const vectorField& faceCentres,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
);
//- Check consecutive face-triangle (from face-centre decomposition) normals
bool checkTriangleTwist
(
const bool report,
const scalar minTwist,
const polyMesh&,
const vectorField& faceAreas,
const vectorField& faceCentres,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
);
//- Check for face areas v.s. sum of face-triangle (from face-centre
// decomposition) areas
bool checkFaceFlatness
(
const bool report,
const scalar minFlatness,
const polyMesh&,
const vectorField& faceAreas,
const vectorField& faceCentres,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
);
//- Check for small faces
bool checkFaceArea
(
const bool report,
const scalar minArea,
const polyMesh&,
const vectorField& faceAreas,
const labelList& checkFaces,
labelHashSet* setPtr
);
//- Check the area of internal faces v.s. boundary faces
bool checkCellDeterminant
(
const bool report,
const scalar minDet,
const polyMesh&,
const vectorField& faceAreas,
const labelList& checkFaces,
labelHashSet* setPtr
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace polyMeshCheck
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,456 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::polyMeshGeometry
Description
Updateable mesh geometry and checking routines.
- non-ortho done across coupled faces.
- faceWeight (delta factors) done across coupled faces.
SourceFiles
polyMeshGeometry.C
\*---------------------------------------------------------------------------*/
#ifndef polyMeshGeometry_H
#define polyMeshGeometry_H
#include "pointFields.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class polyMeshGeometry Declaration
\*---------------------------------------------------------------------------*/
class polyMeshGeometry
{
//- Reference to polyMesh.
const polyMesh& mesh_;
//- Uptodate copy of face areas
vectorField faceAreas_;
//- Uptodate copy of face centres
vectorField faceCentres_;
//- Uptodate copy of cell centres
vectorField cellCentres_;
//- Uptodate copy of cell volumes
scalarField cellVolumes_;
// Private Member Functions
//- Update face areas and centres on selected faces.
void updateFaceCentresAndAreas
(
const pointField& p,
const labelList& changedFaces
);
//- Update cell volumes and centres on selected cells. Requires
// cells and faces to be consistent set.
void updateCellCentresAndVols
(
const labelList& changedCells,
const labelList& changedFaces
);
//- Detect&report non-ortho error for single face.
static scalar checkNonOrtho
(
const polyMesh& mesh,
const bool report,
const scalar severeNonorthogonalityThreshold,
const label facei,
const vector& s, // face area vector
const vector& d, // cc-cc vector
label& severeNonOrth,
label& errorNonOrth,
labelHashSet* setPtr
);
//- Calculate skewness given two cell centres and one face centre.
static scalar calcSkewness
(
const point& ownCc,
const point& neiCc,
const point& fc
);
//- Detect&report incorrect face-triangle orientation
static bool checkFaceTet
(
const polyMesh&,
const bool report,
const scalar minTetQuality,
const pointField& p,
const label facei,
const point& fc, // face centre
const point& cc, // cell centre
labelHashSet* setPtr
);
public:
ClassName("polyMeshGeometry");
// Constructors
//- Construct from mesh
polyMeshGeometry(const polyMesh&);
// Member Functions
// Access
const polyMesh& mesh() const
{
return mesh_;
}
const vectorField& faceAreas() const
{
return faceAreas_;
}
const vectorField& faceCentres() const
{
return faceCentres_;
}
const vectorField& cellCentres() const
{
return cellCentres_;
}
const scalarField& cellVolumes() const
{
return cellVolumes_;
}
// Edit
//- Take over properties from mesh
void correct();
//- Recalculate on selected faces. Recalculates cell properties
// on owner and neighbour of these cells.
void correct
(
const pointField& p,
const labelList& changedFaces
);
//- Helper function: get affected cells from faces
static labelList affectedCells
(
const polyMesh&,
const labelList& changedFaces
);
// Checking of selected faces with supplied geometry (mesh only used for
// topology). Coupled aware (coupled faces treated as internal ones)
//- See primitiveMesh
static bool checkFaceDotProduct
(
const bool report,
const scalar orthWarn,
const polyMesh&,
const vectorField& cellCentres,
const vectorField& faceAreas,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
);
//- See primitiveMesh
static bool checkFacePyramids
(
const bool report,
const scalar minPyrVol,
const polyMesh&,
const vectorField& cellCentres,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet*
);
//- See primitiveMesh
static bool checkFaceTets
(
const bool report,
const scalar minPyrVol,
const polyMesh&,
const vectorField& cellCentres,
const vectorField& faceCentres,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet*
);
//- See primitiveMesh
static bool checkFaceSkewness
(
const bool report,
const scalar internalSkew,
const scalar boundarySkew,
const polyMesh& mesh,
const pointField& points,
const vectorField& cellCentres,
const vectorField& faceCentres,
const vectorField& faceAreas,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
);
//- Interpolation weights (0.5 for regular mesh)
static bool checkFaceWeights
(
const bool report,
const scalar warnWeight,
const polyMesh& mesh,
const vectorField& cellCentres,
const vectorField& faceCentres,
const vectorField& faceAreas,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
);
//- Cell volume ratio of neighbouring cells (1 for regular mesh)
static bool checkVolRatio
(
const bool report,
const scalar warnRatio,
const polyMesh& mesh,
const scalarField& cellVolumes,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
);
//- See primitiveMesh
static bool checkFaceAngles
(
const bool report,
const scalar maxDeg,
const polyMesh& mesh,
const vectorField& faceAreas,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
);
//- Triangle (from face-centre decomposition) normal v.s.
// average face normal
static bool checkFaceTwist
(
const bool report,
const scalar minTwist,
const polyMesh&,
const vectorField& cellCentres,
const vectorField& faceAreas,
const vectorField& faceCentres,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
);
//- Consecutive triangle (from face-centre decomposition) normals
static bool checkTriangleTwist
(
const bool report,
const scalar minTwist,
const polyMesh&,
const vectorField& faceAreas,
const vectorField& faceCentres,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
);
//- Area of faces v.s. sum of triangle areas
static bool checkFaceFlatness
(
const bool report,
const scalar minFlatness,
const polyMesh&,
const vectorField& faceAreas,
const vectorField& faceCentres,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
);
//- Small faces
static bool checkFaceArea
(
const bool report,
const scalar minArea,
const polyMesh&,
const vectorField& faceAreas,
const labelList& checkFaces,
labelHashSet* setPtr
);
//- Area of internal faces v.s. boundary faces
static bool checkCellDeterminant
(
const bool report,
const scalar minDet,
const polyMesh&,
const vectorField& faceAreas,
const labelList& checkFaces,
const labelList& affectedCells,
labelHashSet* setPtr
);
// Checking of selected faces with local geometry. Uses above static
// functions. Parallel aware.
bool checkFaceDotProduct
(
const bool report,
const scalar orthWarn,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const;
bool checkFacePyramids
(
const bool report,
const scalar minPyrVol,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const;
bool checkFaceTets
(
const bool report,
const scalar minTetQuality,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const;
bool checkFaceWeights
(
const bool report,
const scalar warnWeight,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const;
bool checkVolRatio
(
const bool report,
const scalar warnRatio,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const;
bool checkFaceAngles
(
const bool report,
const scalar maxDeg,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
bool checkFaceTwist
(
const bool report,
const scalar minTwist,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
bool checkTriangleTwist
(
const bool report,
const scalar minTwist,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
bool checkFaceFlatness
(
const bool report,
const scalar minFlatness,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
bool checkFaceArea
(
const bool report,
const scalar minArea,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
bool checkCellDeterminant
(
const bool report,
const scalar warnDet,
const labelList& checkFaces,
const labelList& affectedCells,
labelHashSet* setPtr
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,7 +33,7 @@ License
#include "indirectPrimitivePatch.H" #include "indirectPrimitivePatch.H"
#include "cellSet.H" #include "cellSet.H"
#include "searchableSurfaces.H" #include "searchableSurfaces.H"
#include "polyMeshGeometry.H" #include "polyMeshCheck.H"
#include "IOmanip.H" #include "IOmanip.H"
#include "unitConversion.H" #include "unitConversion.H"
#include "snappySnapDriver.H" #include "snappySnapDriver.H"
@ -1213,7 +1213,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
// const scalar minV(motionDict.lookup<scalar>("minVol", true)); // const scalar minV(motionDict.lookup<scalar>("minVol", true));
// if (minV > -great) // if (minV > -great)
//{ //{
// polyMeshGeometry::checkFacePyramids // polyMeshCheck::checkFacePyramids
// ( // (
// false, // false,
// minV, // minV,
@ -1242,7 +1242,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
scalar minArea(motionDict.lookup<scalar>("minArea")); scalar minArea(motionDict.lookup<scalar>("minArea"));
if (minArea > -small) if (minArea > -small)
{ {
polyMeshGeometry::checkFaceArea polyMeshCheck::checkFaceArea
( (
false, false,
minArea, minArea,
@ -1269,14 +1269,13 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
scalar minDet(motionDict.lookup<scalar>("minDeterminant")); scalar minDet(motionDict.lookup<scalar>("minDeterminant"));
if (minDet > -1) if (minDet > -1)
{ {
polyMeshGeometry::checkCellDeterminant polyMeshCheck::checkCellDeterminant
( (
false, false,
minDet, minDet,
mesh_, mesh_,
mesh_.faceAreas(), mesh_.faceAreas(),
allFaces, allFaces,
polyMeshGeometry::affectedCells(mesh_, allFaces),
&wrongFaces &wrongFaces
); );

View File

@ -66,7 +66,6 @@ $(csys)/coordinateRotation/cylindrical.C
edgeFaceCirculator/edgeFaceCirculator.C edgeFaceCirculator/edgeFaceCirculator.C
polyMeshZipUpCells/polyMeshZipUpCells.C polyMeshZipUpCells/polyMeshZipUpCells.C
primitiveMeshGeometry/primitiveMeshGeometry.C
meshSearch/meshSearch.C meshSearch/meshSearch.C
meshSearch/meshSearchFACE_CENTRE_TRISMeshObject.C meshSearch/meshSearchFACE_CENTRE_TRISMeshObject.C

File diff suppressed because it is too large Load Diff

View File

@ -1,335 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::primitiveMeshGeometry
Description
Updateable mesh geometry + checking routines.
SourceFiles
primitiveMeshGeometry.C
\*---------------------------------------------------------------------------*/
#ifndef primitiveMeshGeometry_H
#define primitiveMeshGeometry_H
#include "pointFields.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class primitiveMeshGeometry Declaration
\*---------------------------------------------------------------------------*/
class primitiveMeshGeometry
{
//- Reference to primitiveMesh.
const primitiveMesh& mesh_;
//- Uptodate copy of face areas
vectorField faceAreas_;
//- Uptodate copy of face centres
vectorField faceCentres_;
//- Uptodate copy of cell centres
vectorField cellCentres_;
//- Uptodate copy of cell volumes
scalarField cellVolumes_;
// Private Member Functions
//- Update face areas and centres on selected faces.
void updateFaceCentresAndAreas
(
const pointField& p,
const labelList& changedFaces
);
//- Update cell volumes and centres on selected cells. Requires
// cells and faces to be consistent set.
void updateCellCentresAndVols
(
const labelList& changedCells,
const labelList& changedFaces
);
public:
ClassName("primitiveMeshGeometry");
// Constructors
//- Construct from mesh
primitiveMeshGeometry(const primitiveMesh&);
// Member Functions
// Access
const primitiveMesh& mesh() const
{
return mesh_;
}
const vectorField& faceAreas() const
{
return faceAreas_;
}
const vectorField& faceCentres() const
{
return faceCentres_;
}
const vectorField& cellCentres() const
{
return cellCentres_;
}
const scalarField& cellVolumes() const
{
return cellVolumes_;
}
// Edit
//- Take over properties from mesh
void correct();
//- Recalculate on selected faces. Recalculates cell properties
// on owner and neighbour of these cells.
void correct
(
const pointField& p,
const labelList& changedFaces
);
//- Helper function: get affected cells from faces
labelList affectedCells(const labelList& changedFaces) const;
// Checking of selected faces with supplied geometry (mesh only used for
// topology). Parallel aware.
static bool checkFaceDotProduct
(
const bool report,
const scalar orthWarn,
const primitiveMesh&,
const vectorField& cellCentres,
const vectorField& faceAreas,
const labelList& checkFaces,
labelHashSet* setPtr
);
static bool checkFacePyramids
(
const bool report,
const scalar minPyrVol,
const primitiveMesh&,
const vectorField& cellCentres,
const pointField& p,
const labelList& checkFaces,
labelHashSet*
);
static bool checkFaceSkewness
(
const bool report,
const scalar internalSkew,
const scalar boundarySkew,
const primitiveMesh& mesh,
const vectorField& cellCentres,
const vectorField& faceCentres,
const vectorField& faceAreas,
const labelList& checkFaces,
labelHashSet* setPtr
);
static bool checkFaceWeights
(
const bool report,
const scalar warnWeight,
const primitiveMesh& mesh,
const vectorField& cellCentres,
const vectorField& faceCentres,
const vectorField& faceAreas,
const labelList& checkFaces,
labelHashSet* setPtr
);
static bool checkFaceAngles
(
const bool report,
const scalar maxDeg,
const primitiveMesh& mesh,
const vectorField& faceAreas,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
);
// static bool checkFaceFlatness
//(
// const bool report,
// const scalar warnFlatness,
// const primitiveMesh&,
// const vectorField& faceAreas,
// const vectorField& faceCentres,
// const pointField& p,
// const labelList& checkFaces,
// labelHashSet* setPtr
//);
static bool checkFaceTwist
(
const bool report,
const scalar minTwist,
const primitiveMesh&,
const vectorField& faceAreas,
const vectorField& faceCentres,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
);
static bool checkFaceArea
(
const bool report,
const scalar minArea,
const primitiveMesh&,
const vectorField& faceAreas,
const labelList& checkFaces,
labelHashSet* setPtr
);
static bool checkCellDeterminant
(
const bool report,
const scalar minDet,
const primitiveMesh&,
const vectorField& faceAreas,
const labelList& checkFaces,
const labelList& affectedCells,
labelHashSet* setPtr
);
// Checking of selected faces with local geometry. Uses above static
// functions. Parallel aware.
bool checkFaceDotProduct
(
const bool report,
const scalar orthWarn,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
bool checkFacePyramids
(
const bool report,
const scalar minPyrVol,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
bool checkFaceSkewness
(
const bool report,
const scalar internalSkew,
const scalar boundarySkew,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
bool checkFaceWeights
(
const bool report,
const scalar warnWeight,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
bool checkFaceAngles
(
const bool report,
const scalar maxDeg,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
// bool checkFaceFlatness
//(
// const bool report,
// const scalar warnFlatness,
// const pointField& p,
// const labelList& checkFaces,
// labelHashSet* setPtr
//) const;
bool checkFaceTwist
(
const bool report,
const scalar minTwist,
const pointField& p,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
bool checkFaceArea
(
const bool report,
const scalar minArea,
const labelList& checkFaces,
labelHashSet* setPtr
) const;
bool checkCellDeterminant
(
const bool report,
const scalar warnDet,
const labelList& checkFaces,
const labelList& affectedCells,
labelHashSet* setPtr
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //