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

WIP

parent e86d961a
No related branches found
No related tags found
No related merge requests found
......@@ -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>;
......
......@@ -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>
......
......@@ -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
......
#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
......@@ -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"
......
......@@ -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)
{
......
......@@ -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"
......
......@@ -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"
......
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