Added join() operation for a Simplex dev
authorDmitriy Morozov <dmitriy@mrzv.org>
Mon, 15 Sep 2008 16:38:54 -0700
branchdev
changeset 91 436ed9bc39a7
parent 89 089d799d7ea2
child 92 75b66d8dfa7c
Added join() operation for a Simplex
include/topology/simplex.h
include/topology/simplex.hpp
--- a/include/topology/simplex.h	Tue Sep 09 18:04:04 2008 -0700
+++ b/include/topology/simplex.h	Mon Sep 15 16:38:54 2008 -0700
@@ -60,6 +60,7 @@
 		bool					contains(const Vertex& v) const;
 		const VertexContainer&	vertices() const									{ return vertices_; }
 		void					add(const Vertex& v);
+        void                    join(const Self& other);
 		/// @}
 
 		/// \name Assignment and comparison
--- a/include/topology/simplex.hpp	Tue Sep 09 18:04:04 2008 -0700
+++ b/include/topology/simplex.hpp	Mon Sep 15 16:38:54 2008 -0700
@@ -38,6 +38,15 @@
 SimplexWithVertices<V>::
 add(const Vertex& v)
 { vertices_.push_back(v); std::sort(vertices_.begin(), vertices_.end()); }
+	
+template<class V>
+void
+SimplexWithVertices<V>::
+join(const Self& other)
+{ 
+    vertices_.insert(vertices_.end(), other.vertices_.begin(), other.vertices_.end());
+    std::sort(vertices_.begin(), vertices_.end()); 
+}
 
 template<class V>
 std::ostream&