summaryrefslogtreecommitdiff
path: root/src/measurements.hpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-11-20 13:09:40 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-11-20 13:09:40 -0500
commitd350b4f3424572a63d734afc8fa5f53983e2e714 (patch)
tree17cb6764150fcb01efcdbac8e31fd7c241765771 /src/measurements.hpp
parente4e9fe66f237b0f3091c7d433876997c97844cf2 (diff)
downloadfuse_networks-d350b4f3424572a63d734afc8fa5f53983e2e714.tar.gz
fuse_networks-d350b4f3424572a63d734afc8fa5f53983e2e714.tar.bz2
fuse_networks-d350b4f3424572a63d734afc8fa5f53983e2e714.zip
automated a field class
Diffstat (limited to 'src/measurements.hpp')
-rw-r--r--src/measurements.hpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/measurements.hpp b/src/measurements.hpp
index 7bc8137..18b2e8e 100644
--- a/src/measurements.hpp
+++ b/src/measurements.hpp
@@ -12,6 +12,24 @@
#include "analysis_tools.hpp"
+class RealField {
+ public:
+ coordinate L;
+ std::array<unsigned, 2> M;
+ std::vector<long unsigned> N;
+ std::vector<double> F;
+
+ RealField(coordinate L, std::array<unsigned, 2> M) : L(L), M(M), N(M[0] * M[1], 0), F(M[0] * M[1], 0.0) {}
+
+ void add(coordinate r, double x) {
+ unsigned ind = (unsigned)floor(M[1] * (r.y / L.y)) + M[1] *
+ (unsigned)floor(M[0] * (r.x / L.x));
+ N[ind]++;
+ F[ind] += x;
+ }
+
+};
+
class ma : public hooks {
// need:
// - interface for turning on and off specific measurements
@@ -55,8 +73,7 @@ class ma : public hooks {
std::vector<uint64_t> cq;
std::list<std::array<double, 2>> aG;
- std::vector<double> cS;
- std::vector<uint64_t> NS;
+ RealField fS;
std::vector<uint64_t> sp;
ClusterTree last_clusters;