From eee0dd02c5a060dcffa322924c76fca18dbc8d9e Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Wed, 10 Aug 2016 14:09:09 +0200
Subject: [PATCH] ENH: meshedSurf API for passing around points/faces (issue
 #104)

---
 src/surfMesh/meshedSurf/meshedSurf.H    |  85 +++++++++++++++++
 src/surfMesh/meshedSurf/meshedSurfRef.H | 119 ++++++++++++++++++++++++
 2 files changed, 204 insertions(+)
 create mode 100644 src/surfMesh/meshedSurf/meshedSurf.H
 create mode 100644 src/surfMesh/meshedSurf/meshedSurfRef.H

diff --git a/src/surfMesh/meshedSurf/meshedSurf.H b/src/surfMesh/meshedSurf/meshedSurf.H
new file mode 100644
index 00000000000..0d7281be04c
--- /dev/null
+++ b/src/surfMesh/meshedSurf/meshedSurf.H
@@ -0,0 +1,85 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 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::meshedSurf
+
+Description
+    Abstract definition of a meshed surface defined by faces and points.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef meshedSurf_H
+#define meshedSurf_H
+
+#include "pointField.H"
+#include "faceList.H"
+#include "ListOps.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                         Class meshedSurf Declaration
+\*---------------------------------------------------------------------------*/
+
+class meshedSurf
+{
+public:
+
+    // Constructors
+
+        //- Construct null
+        meshedSurf()
+        {}
+
+
+    //- Destructor
+    virtual ~meshedSurf()
+    {}
+
+
+    // Access Member Functions
+
+        //- Const access to (global) points used for the surface
+        virtual const pointField& points() const = 0;
+
+        //- Const access to the surface faces
+        virtual const faceList& faces() const = 0;
+
+        //- Const access to per-face zone/region information
+        virtual const labelList& zoneIds() const = 0;
+
+};
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/surfMesh/meshedSurf/meshedSurfRef.H b/src/surfMesh/meshedSurf/meshedSurfRef.H
new file mode 100644
index 00000000000..8390795fb69
--- /dev/null
+++ b/src/surfMesh/meshedSurf/meshedSurfRef.H
@@ -0,0 +1,119 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 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::meshedSurfRef
+
+Description
+    Implements a meshed surface by referencing existing faces and points.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef meshedSurfRef_H
+#define meshedSurfRef_H
+
+#include "meshedSurf.H"
+#include "labelList.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                        Class meshedSurfRef Declaration
+\*---------------------------------------------------------------------------*/
+
+class meshedSurfRef
+:
+    public meshedSurf
+{
+    const pointField& points_;
+    const faceList&   faces_;
+    const labelList&  zoneIds_;
+
+
+    // Private Member Functions
+
+        //- Disallow construct as copy
+        meshedSurfRef(const meshedSurfRef&) = delete;
+
+        //- Disallow default bitwise assignment
+        void operator=(const meshedSurfRef&) = delete;
+
+public:
+
+    // Public Member Functions
+
+    // Constructors
+
+        //- Construct from components
+        meshedSurfRef
+        (
+            const pointField& pts,
+            const faceList& faces,
+            const labelList& ids = Foam::emptyLabelList
+        )
+        :
+            points_(pts),
+            faces_(faces),
+            zoneIds_(ids)
+        {}
+
+
+    //- Destructor
+    virtual ~meshedSurfRef()
+    {}
+
+
+    // Access Member Functions
+
+        //- Const access to (global) points used for the surface
+        virtual const pointField& points() const
+        {
+            return points_;
+        }
+
+        //- Const access to the surface faces
+        virtual const faceList& faces() const
+        {
+            return faces_;
+        }
+
+        //- Const access to per-face zone/region information
+        virtual const labelList& zoneIds() const
+        {
+            return zoneIds_;
+        }
+
+};
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
-- 
GitLab