diff --git a/miniapp/miniapp_recipes.cpp b/miniapp/miniapp_recipes.cpp index 88474975f345814222edf3959be323b322501d63..0aa559a555898fb3ac00bbeaa3f95e81b0555dd2 100644 --- a/miniapp/miniapp_recipes.cpp +++ b/miniapp/miniapp_recipes.cpp @@ -111,6 +111,11 @@ public: return cell; } + cell_kind get_cell_kind(cell_gid_type) const override { + // The basic_cell_recipe only produces mc cells, so return cable1d_neuron for now + return cell_kind::cable1d_neuron; + } + cell_count_info get_cell_count_info(cell_gid_type i) const override { cell_count_info cc = {1, param_.num_synapses, 0 }; unsigned cell_segments = get_morphology(i).components(); diff --git a/src/cell.hpp b/src/cell.hpp index 0c2bdd13a095e724062a430ad8ca24a8fdba1c7e..40a49b51b17bfa7ee5be39ab21f560d3ab7f01b7 100644 --- a/src/cell.hpp +++ b/src/cell.hpp @@ -99,6 +99,11 @@ public: } } + /// Return the kind of cell, used for grouping into cell_groups + cell_kind const get_cell_kind() const { + return cell_kind::cable1d_neuron; + } + /// add a soma to the cell /// radius must be specified soma_segment* add_soma(value_type radius, point_type center=point_type()); diff --git a/src/cell_group.hpp b/src/cell_group.hpp index e6153024eff204b3c55bd825bba80ae6ebf826ab..9f5dc5951435435ac39f9b6009f6caacfd66bffe 100644 --- a/src/cell_group.hpp +++ b/src/cell_group.hpp @@ -18,6 +18,8 @@ class cell_group { public: virtual ~cell_group() = default; + virtual cell_kind const get_cell_kind() const = 0; + virtual void reset() = 0; virtual void set_binning_policy(binning_kind policy, time_type bin_interval) = 0; virtual void advance(time_type tfinal, time_type dt) = 0; diff --git a/src/common_types.hpp b/src/common_types.hpp index c6731a2b9808c390cc8aa2bfa0098f141f704f46..81c7dbe8c2a8f28fddf6027ac7e20be79a862b07 100644 --- a/src/common_types.hpp +++ b/src/common_types.hpp @@ -53,6 +53,13 @@ DEFINE_LEXICOGRAPHIC_ORDERING(cell_member_type,(a.gid,a.index),(b.gid,b.index)) using time_type = float; +// Enumeration used to indentify the cell type/kind, used by the model to +// group equal kinds in the same cell group. + +enum cell_kind { + cable1d_neuron // Our own special mc neuron +}; + } // namespace mc } // namespace nest diff --git a/src/mc_cell_group.hpp b/src/mc_cell_group.hpp index ec3cbc72649f5db0075290ae3b0007d0c9618e5e..d198a5b7f650c13a1a5e32a2b2a72b969511287f 100644 --- a/src/mc_cell_group.hpp +++ b/src/mc_cell_group.hpp @@ -11,6 +11,7 @@ #include <common_types.hpp> #include <event_binner.hpp> #include <event_queue.hpp> +#include <recipe.hpp> #include <sampler_function.hpp> #include <spike.hpp> #include <util/debug.hpp> @@ -60,6 +61,10 @@ public: EXPECTS(spike_sources_.size()==n_detectors); } + cell_kind const get_cell_kind() const override { + return cell_kind::cable1d_neuron; + } + void reset() override { spikes_.clear(); events_.clear(); @@ -173,7 +178,6 @@ public: } private: - // gid of first cell in group. cell_gid_type gid_base_; diff --git a/src/recipe.hpp b/src/recipe.hpp index fbc78656c0038b67c2bab89364730a2cba06ed71..f64c7992e33d65e87fd18588dae49f86d8718211 100644 --- a/src/recipe.hpp +++ b/src/recipe.hpp @@ -46,6 +46,8 @@ public: virtual cell_size_type num_cells() const =0; virtual cell get_cell(cell_gid_type) const =0; + virtual cell_kind get_cell_kind(cell_gid_type) const = 0; + virtual cell_count_info get_cell_count_info(cell_gid_type) const =0; virtual std::vector<cell_connection> connections_on(cell_gid_type) const =0; }; @@ -69,6 +71,10 @@ public: return cell(clone_cell, cell_); } + cell_kind get_cell_kind(cell_gid_type) const override { + return cell_.get_cell_kind(); + } + cell_count_info get_cell_count_info(cell_gid_type) const override { cell_count_info k; k.num_sources = cell_.detectors().size(); diff --git a/tests/unit/test_cell.cpp b/tests/unit/test_cell.cpp index e08c0650b62e3e20383d683bb6cac56ea3307325..f36a62f6f16dbf1cb3fd4008acd2278adff5a12a 100644 --- a/tests/unit/test_cell.cpp +++ b/tests/unit/test_cell.cpp @@ -220,3 +220,12 @@ TEST(cell_type, clone) EXPECT_NE(c.segment(1)->num_compartments(), d.segment(1)->num_compartments()); EXPECT_EQ(c.segment(2)->num_compartments(), d.segment(2)->num_compartments()); } + +TEST(cell_type, get_kind) +{ + using namespace nest::mc; + + // make a MC cell + cell c; + EXPECT_EQ( cell_kind::cable1d_neuron, c.get_cell_kind()); +} diff --git a/tests/unit/test_mc_cell_group.cpp b/tests/unit/test_mc_cell_group.cpp index 004915370348d038e5f61dec0ac3e5c3ff6dbc1c..75c6d355d6ef2ec9b8c798059785d3710c4049b2 100644 --- a/tests/unit/test_mc_cell_group.cpp +++ b/tests/unit/test_mc_cell_group.cpp @@ -21,6 +21,14 @@ cell make_cell() { return c; } + +TEST(mc_cell_group, get_kind) { + mc_cell_group<fvm_cell> group{ 0, util::singleton_view(make_cell()) }; + + // we are generating a mc_cell_group which should be of the correct type + EXPECT_EQ(cell_kind::cable1d_neuron, group.get_cell_kind()); +} + TEST(mc_cell_group, test) { mc_cell_group<fvm_cell> group{0, util::singleton_view(make_cell())};