Skip to content
Snippets Groups Projects
Commit 0a4f0c3b authored by Benjamin Cumming's avatar Benjamin Cumming
Browse files

fix OS X initializer list issue

parent 6871a9c7
No related branches found
No related tags found
No related merge requests found
......@@ -47,3 +47,5 @@ CMakeCache.txt
cmake_install.cmake
Makefile
# mechanism implementations generated my modparser
include/mechanisms
......@@ -88,6 +88,39 @@ class fvm_cell {
return mechanisms_;
}
/// return reference to list of ions
//std::map<mechanisms::ionKind, ion_type> ions_;
std::map<mechanisms::ionKind, ion_type>& ions() {
return ions_;
}
std::map<mechanisms::ionKind, ion_type> const& ions() const {
return ions_;
}
/// return reference to sodium ion
ion_type& ion_na() {
return ions_[mechanisms::ionKind::na];
}
ion_type const& ion_na() const {
return ions_[mechanisms::ionKind::na];
}
/// return reference to calcium ion
ion_type& ion_ca() {
return ions_[mechanisms::ionKind::ca];
}
ion_type const& ion_ca() const {
return ions_[mechanisms::ionKind::ca];
}
/// return reference to pottasium ion
ion_type& ion_k() {
return ions_[mechanisms::ionKind::k];
}
ion_type const& ion_k() const {
return ions_[mechanisms::ionKind::k];
}
private:
/// the linear system for implicit time stepping of cell state
......@@ -303,6 +336,24 @@ fvm_cell<T, I>::fvm_cell(nest::mc::cell const& cell)
}
}
}
// FIXME: Hard code parameters for now.
// Take defaults for reversal potential of sodium and potassium from
// the default values in Neuron.
// We don't use the other parameters for the HH model, so I leave the NaN.
// To set them I would have to go spelunking in the Neuron source.
using memory::all;
ion_ca().reversal_potential()(all) = std::numeric_limits<value_type>::quiet_NaN();
ion_ca().internal_concentration()(all) = std::numeric_limits<value_type>::quiet_NaN();
ion_ca().external_concentration()(all) = std::numeric_limits<value_type>::quiet_NaN();
ion_na().reversal_potential()(all) = -50.0;
ion_na().internal_concentration()(all) = std::numeric_limits<value_type>::quiet_NaN();
ion_na().external_concentration()(all) = std::numeric_limits<value_type>::quiet_NaN();
ion_k().reversal_potential()(all) = -77.0;
ion_k().internal_concentration()(all) = std::numeric_limits<value_type>::quiet_NaN();
ion_k().external_concentration()(all) = std::numeric_limits<value_type>::quiet_NaN();
}
template <typename T, typename I>
......@@ -348,7 +399,6 @@ void fvm_cell<T, I>::setup_matrix(T dt)
}
}
} // namespace fvm
} // namespace mc
} // namespace nest
......
......@@ -28,15 +28,17 @@ enum class ionKind {ca, na, k};
[[gnu::unused]] static
std::string to_string(ionKind k)
{
if(k==ionKind::na) return "sodium";
if(k==ionKind::ca) return "calcium";
if(k==ionKind::k) return "pottasium";
return "unkown ion";
switch(k) {
case ionKind::na : return "sodium";
case ionKind::ca : return "calcium";
case ionKind::k : return "pottasium";
}
return "unkown";
}
/// and a little helper to iterate over them
[[gnu::unused]] static
std::initializer_list<ionKind> ion_kinds()
std::vector<ionKind> ion_kinds()
{
return {ionKind::ca, ionKind::na, ionKind::k};
}
......
......@@ -9,6 +9,9 @@ TEST(run, cable)
nest::mc::cell cell;
// setup global state for the mechanisms
nest::mc::mechanisms::setup_mechanism_helpers();
cell.add_soma(6e-4); // 6um in cm
// 1um radius and 4mm long, all in cm
......@@ -44,6 +47,17 @@ TEST(run, cable)
fvcell.setup_matrix(0.02);
EXPECT_EQ(fvcell.cv_areas().size(), J.size());
// inspect ion channels
/*
std::cout << "ion na index : " << fvcell.ion_na().node_index() << "\n";
std::cout << "ion ca index : " << fvcell.ion_ca().node_index() << "\n";
std::cout << "ion k index : " << fvcell.ion_k().node_index() << "\n";
std::cout << "ion na E : " << fvcell.ion_na().reversal_potential() << "\n";
std::cout << "ion ca E : " << fvcell.ion_ca().reversal_potential() << "\n";
std::cout << "ion k E : " << fvcell.ion_k().reversal_potential() << "\n";
*/
//auto& cable_parms = cell.segment(1)->mechanism("membrane");
//std::cout << soma_hh << std::endl;
//std::cout << cable_parms << std::endl;
......@@ -65,6 +79,9 @@ TEST(run, init)
nest::mc::cell cell;
// setup global state for the mechanisms
nest::mc::mechanisms::setup_mechanism_helpers();
cell.add_soma(12.6157/2.0);
//auto& props = cell.soma()->properties;
......
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