diff --git a/miniapp/miniapp.cpp b/miniapp/miniapp.cpp index bc4133cb15ceecc5c96b8b7649f286980acb232f..424098fcb047b0f464229ba6bd21ac4a1ec86fb9 100644 --- a/miniapp/miniapp.cpp +++ b/miniapp/miniapp.cpp @@ -9,10 +9,9 @@ #include <common_types.hpp> #include <cell.hpp> -#include <cell_group.hpp> #include <communication/communicator.hpp> #include <communication/global_policy.hpp> -#include <fvm_cell.hpp> +#include <fvm_multicell.hpp> #include <io/exporter_spike_file.hpp> #include <mechanism_catalogue.hpp> #include <model.hpp> @@ -29,7 +28,7 @@ using namespace nest::mc; using global_policy = communication::global_policy; -using lowered_cell = fvm::fvm_cell<double, cell_local_size_type>; +using lowered_cell = fvm::fvm_multicell<double, cell_local_size_type>; using model_type = model<lowered_cell>; using time_type = model_type::time_type; using sample_trace_type = sample_trace<time_type, model_type::value_type>; diff --git a/src/cell_group.hpp b/src/cell_group.hpp index 77276f49e52f12dc2b8205a7d24113d7409365f4..8d8edcf56ccdfd1b46769fa49f63ffdcc2ac01a4 100644 --- a/src/cell_group.hpp +++ b/src/cell_group.hpp @@ -9,7 +9,7 @@ #include <event_queue.hpp> #include <spike.hpp> #include <spike_source.hpp> -#include <util/singleton.hpp> +#include <util/range.hpp> #include <profiling/profiler.hpp> diff --git a/src/fvm_multicell.hpp b/src/fvm_multicell.hpp index be7a5e322b380d703b53315ad1d30a570b0245e8..8239c7e5070401cd9973a3b0cb4e7db5a9d8173a 100644 --- a/src/fvm_multicell.hpp +++ b/src/fvm_multicell.hpp @@ -48,7 +48,7 @@ public: using detector_handle = size_type; using target_handle = std::pair<size_type, size_type>; - using probe_handle = std::pair<const vector_type fvm_cell::*, size_type>; + using probe_handle = std::pair<const vector_type fvm_multicell::*, size_type>; void resting_potential(value_type potential_mV) { resting_potential_ = potential_mV; @@ -204,14 +204,14 @@ private: std::vector<std::pair<uint32_t, i_clamp>> stimulii_; - std::vector<std::pair<const vector_type fvm_cell::*, uint32_t>> probes_; + std::vector<std::pair<const vector_type fvm_multicell::*, uint32_t>> probes_; // mechanism factory using mechanism_catalogue = nest::mc::mechanisms::catalogue<value_type, size_type>; // perform area and capacitance calculation on initialization void compute_cv_area_unnormalized_capacitance( - std::pair<size_type, size_type> comps, const segment& seg, index_vector &parent); + std::pair<size_type, size_type> comps, const segment& seg, index_type &parent); }; //////////////////////////////////////////////////////////////////////////////// @@ -222,7 +222,7 @@ template <typename T, typename I> void fvm_multicell<T, I>::compute_cv_area_unnormalized_capacitance( std::pair<size_type, size_type> comps, const segment& seg, - index_vector &parent) + index_type &parent) { using util::left; using util::right; @@ -230,7 +230,7 @@ void fvm_multicell<T, I>::compute_cv_area_unnormalized_capacitance( // precondition: group_parent_index[j] holds the correct value for // j in [base_comp, base_comp+segment.num_compartments()]. - if (auto soma = seg->as_soma()) { + if (auto soma = seg.as_soma()) { // confirm assumption that there is one compartment in soma if (comps.size()!=1) throw std::logic_error("soma allocated more than one compartment"); @@ -241,7 +241,7 @@ void fvm_multicell<T, I>::compute_cv_area_unnormalized_capacitance( cv_areas_[i] += area; cv_capacitance_[i] += area * soma->mechanism("membrane").get("c_m").value; } - else if (auto cable = s->as_cable()) { + else if (auto cable = s.as_cable()) { // loop over each compartment in the cable // each compartment has the face between two CVs at its centre // the centers of the CVs are the end points of the compartment @@ -458,11 +458,7 @@ void fvm_multicell<T, I>::initialize( mechanisms_.push_back(std::move(mech)); } - // TODO: FROM HERE... - - ///////////////////////////////////////////// // build the ion species - ///////////////////////////////////////////// for(auto ion : mechanisms::ion_kinds()) { // find the compartment indexes of all compartments that have a // mechanism that depends on/influences ion diff --git a/src/util/singleton.hpp b/src/util/singleton.hpp deleted file mode 100644 index c718eef3624af2088daa9d84abb00401ed1bd6d4..0000000000000000000000000000000000000000 --- a/src/util/singleton.hpp +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -/* - * Present a single object as a (non-owning) container with one - * element. - * - * (Will be subsumed by range/view code.) - */ - -#include <algorithm> - -namespace nest { -namespace mc { -namespace util { - -template <typename X> -struct singleton_adaptor { - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - using value_type = X; - using reference = X&; - using const_reference = const X&; - using iterator = X*; - using const_iterator = const X*; - - X* xp; - singleton_adaptor(X& x): xp(&x) {} - - const X* cbegin() const { return xp; } - const X* begin() const { return xp; } - X* begin() { return xp; } - - const X* cend() const { return xp+1; } - const X* end() const { return xp+1; } - X* end() { return xp+1; } - - std::size_t size() const { return 1u; } - - bool empty() const { return false; } - - const X* front() const { return *xp; } - X* front() { return *xp; } - - const X* back() const { return *xp; } - X* back() { return *xp; } - - const X* operator[](difference_type) const { return *xp; } - X* operator[](difference_type) { return *xp; } - - void swap(singleton_adaptor& s) { std::swap(xp, s.xp); } - friend void swap(singleton_adaptor& r, singleton_adaptor& s) { - r.swap(s); - } -}; - -template <typename X> -singleton_adaptor<X> singleton_view(X& x) { - return singleton_adaptor<X>(x); -} - -} // namespace util -} // namespace mc -} // namespace nest diff --git a/tests/unit/test_fvm.cpp b/tests/unit/test_fvm.cpp index 39fdb6c837f71820c3fd6981f9be2bc38cee91c8..ae7f0b5a3c15c01fc2c952c3ca84ff860bd10294 100644 --- a/tests/unit/test_fvm.cpp +++ b/tests/unit/test_fvm.cpp @@ -5,7 +5,7 @@ #include <common_types.hpp> #include <cell.hpp> #include <fvm_cell.hpp> -#include <util/singleton.hpp> +#include <util/range.hpp> #include "../test_util.hpp" diff --git a/tests/unit/test_probe.cpp b/tests/unit/test_probe.cpp index 13a12ad6bd067ed91b37f2867f22b0f6405ba89a..cf7562c94fbf9ddcf33e16308d418dbdddd0ebf7 100644 --- a/tests/unit/test_probe.cpp +++ b/tests/unit/test_probe.cpp @@ -3,7 +3,7 @@ #include <common_types.hpp> #include <cell.hpp> #include <fvm_cell.hpp> -#include <util/singleton.hpp> +#include <util/range.hpp> TEST(probe, instantiation) { diff --git a/tests/validation/validate_ball_and_stick.cpp b/tests/validation/validate_ball_and_stick.cpp index 59e952de58de61ae32cdbfb721ac991ec2119f8b..aa5102eabfc6131fa0bc6d12893cf5c257339836 100644 --- a/tests/validation/validate_ball_and_stick.cpp +++ b/tests/validation/validate_ball_and_stick.cpp @@ -4,7 +4,7 @@ #include <common_types.hpp> #include <cell.hpp> #include <fvm_cell.hpp> -#include <util/singleton.hpp> +#include <util/range.hpp> #include "gtest.h" #include "../test_util.hpp" diff --git a/tests/validation/validate_soma.cpp b/tests/validation/validate_soma.cpp index af4d32826acb12bcc522daf7aa3f84c80dcc6bb2..b5b1517fcfdd1878c5386b89bf55cb2b4cec2d11 100644 --- a/tests/validation/validate_soma.cpp +++ b/tests/validation/validate_soma.cpp @@ -4,7 +4,7 @@ #include <common_types.hpp> #include <cell.hpp> #include <fvm_cell.hpp> -#include <util/singleton.hpp> +#include <util/range.hpp> #include "gtest.h" #include "../test_util.hpp"