From 19493c05bb6fc6e9c1621201d3cddfe4c9a5d870 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 - 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ComputeForce.h b/src/ComputeForce.h index d774e6a..b5954ac 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 f956b92..7fb589d 100644 --- a/src/Configuration.h +++ b/src/Configuration.h @@ -272,7 +272,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; -- GitLab