From a867d77b90b4e910f8ee6c7f7d62f53f6c772065 Mon Sep 17 00:00:00 2001 From: Sam Yates <halfflat@gmail.com> Date: Mon, 27 Jun 2016 23:37:12 +0200 Subject: [PATCH] Voltage and current probes * First implementation of simple current/voltage probe interface * Sample a specific collection of voltage or current values at independent dt (current implementation chooses to provide at most one sample per simulation dt per request.) * Miniapp uses samplers to write soma and dendrite membrane potentials from first three cells. * Also: fix noncompliant use of nullptr -> bool conversion in test_optional.cpp --- src/fvm_cell.hpp | 8 ++++---- tests/test_optional.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fvm_cell.hpp b/src/fvm_cell.hpp index 5cadd291..678ee5e1 100644 --- a/src/fvm_cell.hpp +++ b/src/fvm_cell.hpp @@ -138,7 +138,7 @@ public: value_type probe(uint32_t i) const { auto p = probes_[i]; - return (*p.first)[p.second]; + return (this->*p.first)[p.second]; } std::size_t num_probes() const { return probes_.size(); } @@ -187,7 +187,7 @@ private: std::vector<std::pair<uint32_t, i_clamp>> stimulii_; - std::vector<std::pair<const vector_type*, uint32_t>> probes_; + std::vector<std::pair<const vector_type fvm_cell::*, uint32_t>> probes_; /* /// spike event queue @@ -415,10 +415,10 @@ fvm_cell<T, I>::fvm_cell(nest::mc::cell const& cell) uint32_t comp = find_compartment_index(probe.first, graph); switch (probe.second) { case nest::mc::cell::membrane_voltage: - probes_.push_back({&voltage_, comp}); + probes_.push_back({&fvm_cell::voltage_, comp}); break; case nest::mc::cell::membrane_current: - probes_.push_back({¤t_, comp}); + probes_.push_back({&fvm_cell::current_, comp}); break; default: throw std::logic_error("unrecognized probe sort"); diff --git a/tests/test_optional.cpp b/tests/test_optional.cpp index 6755525a..9c6f35cf 100644 --- a/tests/test_optional.cpp +++ b/tests/test_optional.cpp @@ -282,7 +282,7 @@ TEST(optionalm,conversion) { TEST(optionalm,or_operator) { optional<const char *> default_msg="default"; - auto x=nullptr | default_msg; + auto x=(char *)0 | default_msg; EXPECT_TRUE((bool)x); EXPECT_STREQ("default",x.get()); -- GitLab