diff --git a/applications/test/edges/Make/files b/applications/test/edges/Make/files
new file mode 100644
index 0000000000..8903c60b8c
--- /dev/null
+++ b/applications/test/edges/Make/files
@@ -0,0 +1,3 @@
+Test-edges.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-edges
diff --git a/applications/test/edges/Make/options b/applications/test/edges/Make/options
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/applications/test/edges/Test-edges.C b/applications/test/edges/Test-edges.C
new file mode 100644
index 0000000000..abd5f9d8a1
--- /dev/null
+++ b/applications/test/edges/Test-edges.C
@@ -0,0 +1,114 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2017 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 .
+
+Application
+ Test-edges
+
+Description
+ Simple tests for edges
+
+\*---------------------------------------------------------------------------*/
+
+#include "argList.H"
+#include "edgeList.H"
+
+using namespace Foam;
+
+void printInfo(const edge& e)
+{
+ Info<< "edge: " << e << " count:" << e.count() << nl;
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Main program:
+
+int main(int argc, char *argv[])
+{
+ edge e1;
+ printInfo(e1);
+ Info<<"has '2'? " << e1.found(2) << endl;
+
+ edge e2(1, 2);
+ printInfo(e2);
+ Info<<"has '2'? " << e2.found(2) << endl;
+
+ edge e3{2, 3};
+ printInfo(e3);
+ Info<<"has '2'? " << e3.found(2) << endl;
+
+ edge e4(4, 4);
+ printInfo(e4);
+ Info<<"has '2'? " << e4.found(2) << endl;
+
+ Info<<"collapse? -> " << e4.collapse() << endl;
+ printInfo(e4);
+
+ Info<< e3 << " connects " << e2 << " => " << e2.connects(e3) << endl;
+
+ Info<< nl << "hash-like functionality" << nl;
+
+ // doesn't work e4 = -1;
+ e4.start() = e4.end() = -1;
+
+ printInfo(e4);
+ for (label i : {2, -1, 2, 1, 4, 1, 2, 3})
+ {
+ bool ok = e4.insert(i);
+ Info<< "insert(" << i << ") = " << ok << " resulting ";
+ printInfo(e4);
+ }
+
+ for (label i : {-1, 0, 1, 3})
+ {
+ bool ok = e4.erase(i);
+ Info<< "erase(" << i << ") = " << ok << " resulting ";
+ printInfo(e4);
+ }
+
+ for (label i : {-1, 0, 1, 3})
+ {
+ bool ok = e4.insert(i);
+ Info<< "insert(" << i << ") = " << ok << " resulting ";
+ printInfo(e4);
+ }
+ e4.flip();
+ Info<< "flipped ";
+ printInfo(e4);
+
+ for (label i : {-1, 0, 1, 3})
+ {
+ bool ok = e4.erase(i);
+ Info<< "erase(" << i << ") = " << ok << " resulting ";
+ printInfo(e4);
+ }
+
+ e4.sort();
+ Info<< "sorted ";
+ printInfo(e4);
+
+ return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/meshes/meshShapes/edge/edge.H b/src/OpenFOAM/meshes/meshShapes/edge/edge.H
index e1c314d1f2..f804fda814 100644
--- a/src/OpenFOAM/meshes/meshShapes/edge/edge.H
+++ b/src/OpenFOAM/meshes/meshShapes/edge/edge.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -70,17 +70,23 @@ public:
// Constructors
- //- Null constructor for lists
+ //- Construct null with invalid point labels (-1)
inline edge();
//- Construct from components
- inline edge(const label a, const label b);
+ inline edge(const label from, const label to);
+
+ //- Construct, optionally sorted with start less-than end
+ inline edge(const label from, const label to, const bool doSort);
//- Construct from FixedList
- inline edge(const FixedList