From 4ef15a45cb81581fdbabe304bbe27a91401ac2b5 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Tue, 22 Jul 2014 14:45:51 +0200
Subject: [PATCH] [Cleanup] Extend simplex manager capabilities

---
 src/sand-wedge-data/mygrid.cc | 43 +++++++++++++++++++++--------------
 src/sand-wedge-data/mygrid.hh |  3 ++-
 2 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/src/sand-wedge-data/mygrid.cc b/src/sand-wedge-data/mygrid.cc
index 5929d422..b6001067 100644
--- a/src/sand-wedge-data/mygrid.cc
+++ b/src/sand-wedge-data/mygrid.cc
@@ -9,24 +9,33 @@
 SimplexManager::SimplexManager(unsigned int shift) : shift_(shift) {}
 #endif
 
-void SimplexManager::addFromVertices(unsigned int U, unsigned int V,
-                                     unsigned int W) {
+// back-to-front, front-to-back, front-to-back
+void SimplexManager::addFromVerticesFBB(unsigned int U, unsigned int V,
+                                        unsigned int W) {
 #if MY_DIM == 3
   unsigned int const U2 = U + shift_;
   unsigned int const V2 = V + shift_;
   unsigned int const W2 = W + shift_;
 
-  // back-to-front, back-to-front, back-to-front
   simplices_.push_back({ U, V, W, U2 });
   simplices_.push_back({ V, V2, W2, U2 });
   simplices_.push_back({ W, W2, U2, V });
+#else
+  simplices_.push_back({ U, V, W });
+#endif
+}
+
+// back-to-front, back-to-front, front-to-back
+void SimplexManager::addFromVerticesFFB(unsigned int U, unsigned int V,
+                                        unsigned int W) {
+#if MY_DIM == 3
+  unsigned int const U2 = U + shift_;
+  unsigned int const V2 = V + shift_;
+  unsigned int const W2 = W + shift_;
 
-// back-to-front, front-to-back, back-to-front would be
-/*
   simplices_.push_back({ U, V, W, U2 });
   simplices_.push_back({ V, V2, W, U2 });
-  simplices_.push_back({ V2, W2, U2, W });
-*/
+  simplices_.push_back({ V2, W, U2, W2 });
 #else
   simplices_.push_back({ U, V, W });
 #endif
@@ -108,16 +117,16 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() {
 #else
   SimplexManager sm;
 #endif
-  sm.addFromVertices(1, 5, 0);
-  sm.addFromVertices(1, 6, 5);
-  sm.addFromVertices(2, 6, 1);
-  sm.addFromVertices(7, 6, 2);
-  sm.addFromVertices(7, 2, 3);
-  sm.addFromVertices(7, 3, 8);
-  sm.addFromVertices(7, 8, 10);
-  sm.addFromVertices(7, 10, 9);
-  sm.addFromVertices(7, 9, 6);
-  sm.addFromVertices(8, 3, 4);
+  sm.addFromVerticesFBB(1, 5, 0);
+  sm.addFromVerticesFBB(1, 6, 5);
+  sm.addFromVerticesFBB(2, 6, 1);
+  sm.addFromVerticesFBB(7, 6, 2);
+  sm.addFromVerticesFBB(7, 2, 3);
+  sm.addFromVerticesFBB(7, 3, 8);
+  sm.addFromVerticesFBB(7, 8, 10);
+  sm.addFromVerticesFBB(7, 10, 9);
+  sm.addFromVerticesFBB(7, 9, 6);
+  sm.addFromVerticesFBB(8, 3, 4);
   auto const &simplices = sm.getSimplices();
 
   // sanity-check choices of simplices
diff --git a/src/sand-wedge-data/mygrid.hh b/src/sand-wedge-data/mygrid.hh
index cb4593e6..efdc989d 100644
--- a/src/sand-wedge-data/mygrid.hh
+++ b/src/sand-wedge-data/mygrid.hh
@@ -49,7 +49,8 @@ class SimplexManager {
   SimplexManager(unsigned int shift);
 #endif
 
-  void addFromVertices(unsigned int U, unsigned int V, unsigned int W);
+  void addFromVerticesFBB(unsigned int U, unsigned int V, unsigned int W);
+  void addFromVerticesFFB(unsigned int U, unsigned int V, unsigned int W);
 
   SimplexList const &getSimplices();
 
-- 
GitLab