From 9e1610143f0e96b77ca962a7113d79a2fbcbf6f5 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Fri, 28 Dec 2018 17:33:35 -0500 Subject: partially fixed problems that arise in small systems by reworking the way that boundary edges are identified --- lib/include/array_hash.hpp | 27 +++++++++++++++++++++++++++ lib/include/graph.hpp | 2 ++ lib/include/network.hpp | 1 + 3 files changed, 30 insertions(+) create mode 100644 lib/include/array_hash.hpp (limited to 'lib/include') diff --git a/lib/include/array_hash.hpp b/lib/include/array_hash.hpp new file mode 100644 index 0000000..3b35e4a --- /dev/null +++ b/lib/include/array_hash.hpp @@ -0,0 +1,27 @@ + +#pragma once + +#include +#include + +namespace std +{ + template + struct hash > + { + typedef array argument_type; + typedef size_t result_type; + + result_type operator()(const argument_type& a) const + { + hash hasher; + result_type h = 0; + for (result_type i = 0; i < N; ++i) + { + h = h * 31 + hasher(a[i]); + } + return h; + } + }; +} + diff --git a/lib/include/graph.hpp b/lib/include/graph.hpp index c1ad4f0..ea08214 100644 --- a/lib/include/graph.hpp +++ b/lib/include/graph.hpp @@ -9,6 +9,7 @@ #include #include +#include "array_hash.hpp" class graph { public: @@ -25,6 +26,7 @@ class graph { typedef struct edge { std::array v; coordinate r; + std::array crossings; } edge; coordinate L; diff --git a/lib/include/network.hpp b/lib/include/network.hpp index d955e43..70173e6 100644 --- a/lib/include/network.hpp +++ b/lib/include/network.hpp @@ -12,6 +12,7 @@ #include "graph.hpp" #include "hooks.hpp" #include "current_info.hpp" +#include "array_hash.hpp" #ifdef FRACTURE_LONGINT -- cgit v1.2.3-70-g09d2