From 72e03b1799b1bab01cc75bddd37fd8da2de76f8d Mon Sep 17 00:00:00 2001 From: Henry Weller <http://cfd.direct> Date: Mon, 10 Aug 2015 10:01:36 +0100 Subject: [PATCH] face: Add handling for duplicate vertices in sameVertices Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1821 --- src/OpenFOAM/meshes/meshShapes/face/face.C | 18 +++++++++++------- src/mesh/blockMesh/blockMesh/blockMeshCheck.C | 3 +-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index e7b8c5e3e92..30847ce3ca6 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.C +++ b/src/OpenFOAM/meshes/meshShapes/face/face.C @@ -427,18 +427,22 @@ bool Foam::face::sameVertices(const face& a, const face& b) forAll(a, i) { - bool found = false; + // Count occurrences of a[i] in a + label aOcc = 0; + forAll(a, j) + { + if (a[i] == a[j]) aOcc++; + } + // Count occurrences of a[i] in b + label bOcc = 0; forAll(b, j) { - if (a[i] == b[j]) - { - found = true; - break; - } + if (a[i] == b[j]) bOcc++; } - if (!found) return false; + // Check if occurrences of a[i] in a and b are the same + if (aOcc != bOcc) return false; } return true; diff --git a/src/mesh/blockMesh/blockMesh/blockMeshCheck.C b/src/mesh/blockMesh/blockMesh/blockMeshCheck.C index b44f7259b88..39c7ed6c109 100644 --- a/src/mesh/blockMesh/blockMesh/blockMeshCheck.C +++ b/src/mesh/blockMesh/blockMesh/blockMeshCheck.C @@ -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-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Check the blockMesh topology void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const { if (verboseOutput) -- GitLab