From b490acc1a5379a8617d8d53878e33e9b0180817f Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Wed, 6 Jul 2011 18:58:48 +0100
Subject: [PATCH] ENH: closedTriSurfaceMesh: triSurfaceMesh that fakes to be
 closed.

---
 src/meshTools/Make/files                      |   1 +
 .../searchableSurface/closedTriSurfaceMesh.C  |  74 ++++++++++++
 .../searchableSurface/closedTriSurfaceMesh.H  | 111 ++++++++++++++++++
 3 files changed, 186 insertions(+)
 create mode 100644 src/meshTools/searchableSurface/closedTriSurfaceMesh.C
 create mode 100644 src/meshTools/searchableSurface/closedTriSurfaceMesh.H

diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files
index e9b137abc72..cac3aa685c1 100644
--- a/src/meshTools/Make/files
+++ b/src/meshTools/Make/files
@@ -62,6 +62,7 @@ $(searchableSurface)/searchableSurfaces.C
 $(searchableSurface)/searchableSurfacesQueries.C
 $(searchableSurface)/searchableSurfaceWithGaps.C
 $(searchableSurface)/triSurfaceMesh.C
+$(searchableSurface)/closedTriSurfaceMesh.C
 
 topoSets = sets/topoSets
 $(topoSets)/cellSet.C
diff --git a/src/meshTools/searchableSurface/closedTriSurfaceMesh.C b/src/meshTools/searchableSurface/closedTriSurfaceMesh.C
new file mode 100644
index 00000000000..14a505e3564
--- /dev/null
+++ b/src/meshTools/searchableSurface/closedTriSurfaceMesh.C
@@ -0,0 +1,74 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2009-2011 OpenCFD Ltd.
+     \\/     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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "closedTriSurfaceMesh.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+defineTypeNameAndDebug(closedTriSurfaceMesh, 0);
+addToRunTimeSelectionTable(searchableSurface, closedTriSurfaceMesh, dict);
+
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::closedTriSurfaceMesh::closedTriSurfaceMesh
+(
+    const IOobject& io,
+    const triSurface& s
+)
+:
+    triSurfaceMesh(io, s)
+{}
+
+
+Foam::closedTriSurfaceMesh::closedTriSurfaceMesh(const IOobject& io)
+:
+    triSurfaceMesh(io)
+{}
+
+
+Foam::closedTriSurfaceMesh::closedTriSurfaceMesh
+(
+    const IOobject& io,
+    const dictionary& dict
+)
+:
+    triSurfaceMesh(io, dict)
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::closedTriSurfaceMesh::~closedTriSurfaceMesh()
+{}
+
+
+// ************************************************************************* //
diff --git a/src/meshTools/searchableSurface/closedTriSurfaceMesh.H b/src/meshTools/searchableSurface/closedTriSurfaceMesh.H
new file mode 100644
index 00000000000..92907827196
--- /dev/null
+++ b/src/meshTools/searchableSurface/closedTriSurfaceMesh.H
@@ -0,0 +1,111 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2009-2011 OpenCFD Ltd.
+     \\/     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::closedTriSurfaceMesh
+
+Description
+    A triSurfaceMesh where it is forced to check volumeTypes, used for surfaces
+    that are topologically non-manifold (small holes or multiple parts) but are
+    geometrically essentially closed
+
+SourceFiles
+    closedTriSurfaceMesh.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef closedTriSurfaceMesh_H
+#define closedTriSurfaceMesh_H
+
+#include "triSurfaceMesh.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                           Class closedTriSurfaceMesh Declaration
+\*---------------------------------------------------------------------------*/
+
+class closedTriSurfaceMesh
+:
+    public triSurfaceMesh
+{
+private:
+
+        //- Disallow default bitwise copy construct
+        closedTriSurfaceMesh(const closedTriSurfaceMesh&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const closedTriSurfaceMesh&);
+
+
+public:
+
+    //- Runtime type information
+    TypeName("closedTriSurfaceMesh");
+
+
+    // Constructors
+
+        //- Construct from triSurface
+        closedTriSurfaceMesh(const IOobject&, const triSurface&);
+
+        //- Construct read.
+        closedTriSurfaceMesh(const IOobject& io);
+
+        //- Construct from IO and dictionary (used by searchableSurface).
+        //  Dictionary may contain a 'scale' entry (eg, 0.001: mm -> m)
+        closedTriSurfaceMesh
+        (
+            const IOobject& io,
+            const dictionary& dict
+        );
+
+
+    // Destructor
+
+        virtual ~closedTriSurfaceMesh();
+
+    // Member Functions
+
+        //- Whether supports volume type, forcing to true to force getVolumeType
+        //  queries for this type
+        virtual bool hasVolumeType() const
+        {
+            return true;
+        }
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
-- 
GitLab