From a537334559e59cd2d570a0c5c59d003d6d16d5f8 Mon Sep 17 00:00:00 2001
From: Chris Maffeo <cmaffeo2@illinois.edu>
Date: Wed, 6 Jan 2021 11:50:00 -0600
Subject: [PATCH] Macro USE_BOOST for boost::unordered_map rather than std::map
 for configuring productPotential

---
 src/ComputeForce.h  | 16 ++++++++++++----
 src/Configuration.h |  1 -
 src/Makefile        |  4 ++++
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/ComputeForce.h b/src/ComputeForce.h
index 8270fd5..a523404 100644
--- a/src/ComputeForce.h
+++ b/src/ComputeForce.h
@@ -28,20 +28,28 @@
 #include "GPUManager.h"
 
 // #include <map>
-#include <boost/unordered_map.hpp>
+
 #include <cstdio>
 // #include <cuda_runtime.h>
 #include <thrust/transform_reduce.h>	// thrust::reduce
 #include <thrust/functional.h>				// thrust::plus
 
+#ifdef USE_BOOST
+#include <boost/unordered_map.hpp>
+typedef boost::unordered_map<String,unsigned int> XpotMap;
 inline std::size_t hash_value(String const& s) {
     if (s.length() == 0) return 0;
-    // return hash_value(s.val());
     return boost::hash_range(s.val(), s.val()+s.length());
 }
+#else
+#include <map>
+typedef std::map<String,unsigned int> XpotMap;
+inline std::size_t hash_value(String const& s) {
+    if (s.length() == 0) return 0;
+    return hash_value(s.val());
+}
+#endif
 
-typedef boost::unordered_map<String,unsigned int> XpotMap;
-// typedef std::map<String,unsigned int> XpotMap;
 
 
 const unsigned int NUM_THREADS = 256;
diff --git a/src/Configuration.h b/src/Configuration.h
index 55b0ad2..85ae13f 100644
--- a/src/Configuration.h
+++ b/src/Configuration.h
@@ -251,7 +251,6 @@ public:
 	int numProductPotentials;
 	bool readProductPotentialsFromFile;
         ProductPotentialConf* productPotentials;
-        // boost::unordered_map<String, unsigned int> simple_potential_ids;
 	XpotMap simple_potential_ids;
         std::vector<SimplePotential> simple_potentials;
 
diff --git a/src/Makefile b/src/Makefile
index 23b9905..2ada08a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -66,6 +66,10 @@ $(foreach SM,$(SMPTXS), $(eval NV_FLAGS += -gencode arch=compute_$(SM),code=comp
 NVLD_FLAGS := $(NV_FLAGS) --device-link 
 LD_FLAGS = -L$(LIBRARY) -lcurand -lcudart -lcudadevrt -Wl,-rpath,$(LIBRARY)
 
+ifdef USE_BOOST
+	CC_FLAGS += -DUSE_BOOST
+endif
+
 ### Sources
 CC_SRC := $(wildcard *.cpp)
 CC_SRC := $(filter-out arbd.cpp, $(CC_SRC))
-- 
GitLab