Skip to content
Snippets Groups Projects
Commit 74f8bb26 authored by Sam Yates's avatar Sam Yates
Browse files

Address PR review: no functional changes

* Remove vestigial #if 0
* Add missing cstring include, std:: in validate.cpp
* Simpler synapse index logic in fvm_cell.hpp
parent 016b5775
No related branches found
No related tags found
No related merge requests found
......@@ -183,11 +183,6 @@ private:
/// the potential in mV in each CV
vector_type voltage_;
#if 0
/// synapses
using synapse_type =
mechanisms::ExpSyn::mechanism_ExpSyn<value_type, size_type>;
#endif
std::size_t synapse_index_; // synapses at the end of mechanisms_, from here
/// the set of mechanisms present in the cell
......@@ -344,49 +339,22 @@ fvm_cell<T, I>::fvm_cell(nest::mc::cell const& cell)
synapse_index_ = mechanisms_.size();
std::multimap<std::string, int> syn_map;
for (const auto& syn: cell.synapses()) {
syn_map.insert({syn.mechanism.name(), find_compartment_index(syn.location, graph)});
std::map<std::string, std::vector<int>> syn_map;
for (const auto& syn : cell.synapses()) {
syn_map[syn.mechanism.name()].push_back(find_compartment_index(syn.location, graph));
}
auto syn_i = syn_map.begin();
while (syn_i!=syn_map.end()) {
const auto& mech_name = syn_i->first;
for (const auto &syni : syn_map) {
const auto& mech_name = syni.first;
auto& helper = nest::mc::mechanisms::get_mechanism_helper(mech_name);
auto span = syn_map.equal_range(mech_name);
auto num_comp = std::distance(span.first, span.second);
index_type compartment_index(num_comp);
for (auto p = compartment_index.data(); syn_i!=span.second; ++p, ++syn_i) {
*p = syn_i->second;
}
index_type compartment_index(syni.second);
auto mech = helper->new_mechanism(voltage_, current_, compartment_index);
mech->set_areas(cv_areas_);
mechanisms_.push_back(std::move(mech));
}
#if 0
// add the synapses
std::vector<size_type> synapse_indexes;
synapse_indexes.reserve(cell.synapses().size());
for(auto loc : cell.synapses()) {
synapse_indexes.push_back(
find_compartment_index(loc, graph)
);
}
mechanisms_.push_back(
mechanisms::make_mechanism<synapse_type>(
voltage_, current_, index_view(synapse_indexes)
)
);
synapse_index_ = mechanisms_.size()-1;
// don't forget to give point processes access to cv_areas_
mechanisms_[synapse_index_]->set_areas(cv_areas_);
#endif
/////////////////////////////////////////////
// build the ion species
......
#include <cstring>
#include <iostream>
#include <fstream>
#include <numeric>
......@@ -14,7 +15,7 @@ int usage(const char* argv0) {
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
if (argv[1] && (!strcmp(argv[1], "-p") || !strcmp(argv[1], "--path"))) {
if (argv[1] && (!std::strcmp(argv[1], "-p") || !std::strcmp(argv[1], "--path"))) {
if (argv[2]) {
testing::g_validation_data.set_path(argv[2]);
}
......
#pragma once
#include <string>
#include <json/src/json.hpp>
#ifndef DATADIR
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment