Commit f6fdc827 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

core: remove name from model base class

parent acfd8d6a
......@@ -12,6 +12,7 @@
#include "imnodes.hpp"
#include "implot.h"
#include <cinttypes>
#include <fstream>
#include <string>
......@@ -373,14 +374,14 @@ editor::free_group(cluster& group) noexcept
auto id = std::get<model_id>(child);
models_mapper[get_index(id)] = undefined<cluster_id>();
if (auto* mdl = sim.models.try_to_get(id); mdl) {
log_w.log(7, "delete model %s\n", mdl->name.c_str());
log_w.log(7, "delete model %" PRIu64 "\n", id);
sim.deallocate(id);
}
} else {
auto id = std::get<cluster_id>(child);
clusters_mapper[get_index(id)] = undefined<cluster_id>();
if (auto* gp = clusters.try_to_get(id); gp) {
log_w.log(7, "delete group %s\n", gp->name.c_str());
log_w.log(7, "delete group %" PRIu64 "\n", gp);
free_group(*gp);
}
}
......@@ -404,7 +405,7 @@ editor::free_children(const ImVector<int>& nodes) noexcept
const auto id = std::get<model_id>(child.first);
if (auto* mdl = sim.models.try_to_get(id); mdl) {
models_mapper[get_index(id)] = undefined<cluster_id>();
log_w.log(7, "delete %s\n", mdl->name.c_str());
log_w.log(7, "delete %" PRIu64 "\n", id);
parent(id, undefined<cluster_id>());
sim.deallocate(id);
}
......@@ -412,7 +413,7 @@ editor::free_children(const ImVector<int>& nodes) noexcept
const auto id = std::get<cluster_id>(child.first);
if (auto* gp = clusters.try_to_get(id); gp) {
clusters_mapper[get_index(id)] = undefined<cluster_id>();
log_w.log(7, "delete group %s\n", gp->name.c_str());
log_w.log(7, "delete group %" PRIu64 "\n", id);
free_group(*gp);
}
}
......@@ -583,8 +584,7 @@ struct copier
std::size(new_dyn.y),
static_cast<output_port_id>(0));
irt_return_if_bad(
sim.alloc(new_dyn, new_dyn_id, mdl->name.c_str()));
irt_return_if_bad(sim.alloc(new_dyn, new_dyn_id));
*mdl_id_dst = new_dyn.id;
......@@ -1006,20 +1006,17 @@ editor::add_lotka_volterra() noexcept
sum_b.default_input_coeffs[0] = -1.0;
sum_b.default_input_coeffs[1] = 0.1;
irt_return_if_bad(sim.alloc(sum_a, sim.adder_2_models.get_id(sum_a)));
irt_return_if_bad(sim.alloc(sum_b, sim.adder_2_models.get_id(sum_b)));
irt_return_if_bad(sim.alloc(product, sim.mult_2_models.get_id(product)));
irt_return_if_bad(
sim.alloc(sum_a, sim.adder_2_models.get_id(sum_a), "sum_a"));
sim.alloc(integrator_a, sim.integrator_models.get_id(integrator_a)));
irt_return_if_bad(
sim.alloc(sum_b, sim.adder_2_models.get_id(sum_b), "sum_b"));
sim.alloc(integrator_b, sim.integrator_models.get_id(integrator_b)));
irt_return_if_bad(
sim.alloc(product, sim.mult_2_models.get_id(product), "prod"));
irt_return_if_bad(sim.alloc(
integrator_a, sim.integrator_models.get_id(integrator_a), "int_a"));
irt_return_if_bad(sim.alloc(
integrator_b, sim.integrator_models.get_id(integrator_b), "int_b"));
irt_return_if_bad(sim.alloc(
quantifier_a, sim.quantifier_models.get_id(quantifier_a), "qua_a"));
irt_return_if_bad(sim.alloc(
quantifier_b, sim.quantifier_models.get_id(quantifier_b), "qua_b"));
sim.alloc(quantifier_a, sim.quantifier_models.get_id(quantifier_a)));
irt_return_if_bad(
sim.alloc(quantifier_b, sim.quantifier_models.get_id(quantifier_b)));
irt_return_if_bad(sim.connect(sum_a.y[0], integrator_a.x[1]));
irt_return_if_bad(sim.connect(sum_b.y[0], integrator_b.x[1]));
......@@ -1125,35 +1122,28 @@ editor::add_izhikevitch() noexcept
sum_d.default_input_coeffs[1] = d;
irt_return_if_bad(
sim.alloc(constant3, sim.constant_models.get_id(constant3), "tfun"));
sim.alloc(constant3, sim.constant_models.get_id(constant3)));
irt_return_if_bad(
sim.alloc(constant, sim.constant_models.get_id(constant), "1.0"));
sim.alloc(constant, sim.constant_models.get_id(constant)));
irt_return_if_bad(
sim.alloc(constant2, sim.constant_models.get_id(constant2), "-56.0"));
sim.alloc(constant2, sim.constant_models.get_id(constant2)));
irt_return_if_bad(
sim.alloc(sum_a, sim.adder_2_models.get_id(sum_a), "sum_a"));
irt_return_if_bad(
sim.alloc(sum_b, sim.adder_2_models.get_id(sum_b), "sum_b"));
irt_return_if_bad(
sim.alloc(sum_c, sim.adder_4_models.get_id(sum_c), "sum_c"));
irt_return_if_bad(
sim.alloc(sum_d, sim.adder_2_models.get_id(sum_d), "sum_d"));
irt_return_if_bad(sim.alloc(sum_a, sim.adder_2_models.get_id(sum_a)));
irt_return_if_bad(sim.alloc(sum_b, sim.adder_2_models.get_id(sum_b)));
irt_return_if_bad(sim.alloc(sum_c, sim.adder_4_models.get_id(sum_c)));
irt_return_if_bad(sim.alloc(sum_d, sim.adder_2_models.get_id(sum_d)));
irt_return_if_bad(sim.alloc(product, sim.mult_2_models.get_id(product)));
irt_return_if_bad(
sim.alloc(integrator_a, sim.integrator_models.get_id(integrator_a)));
irt_return_if_bad(
sim.alloc(product, sim.mult_2_models.get_id(product), "prod"));
irt_return_if_bad(sim.alloc(
integrator_a, sim.integrator_models.get_id(integrator_a), "int_a"));
irt_return_if_bad(sim.alloc(
integrator_b, sim.integrator_models.get_id(integrator_b), "int_b"));
irt_return_if_bad(sim.alloc(
quantifier_a, sim.quantifier_models.get_id(quantifier_a), "qua_a"));
irt_return_if_bad(sim.alloc(
quantifier_b, sim.quantifier_models.get_id(quantifier_b), "qua_b"));
sim.alloc(integrator_b, sim.integrator_models.get_id(integrator_b)));
irt_return_if_bad(
sim.alloc(cross, sim.cross_models.get_id(cross), "cross"));
sim.alloc(quantifier_a, sim.quantifier_models.get_id(quantifier_a)));
irt_return_if_bad(
sim.alloc(cross2, sim.cross_models.get_id(cross2), "cross2"));
sim.alloc(quantifier_b, sim.quantifier_models.get_id(quantifier_b)));
irt_return_if_bad(sim.alloc(cross, sim.cross_models.get_id(cross)));
irt_return_if_bad(sim.alloc(cross2, sim.cross_models.get_id(cross2)));
irt_return_if_bad(sim.connect(integrator_a.y[0], cross.x[0]));
irt_return_if_bad(sim.connect(constant2.y[0], cross.x[1]));
......@@ -2025,8 +2015,7 @@ editor::show_model_dynamics(model& mdl) noexcept
}
} else {
if (!obs) {
auto& o =
sim.observers.alloc(0.01, mdl.name.c_str(), nullptr);
auto& o = sim.observers.alloc(0.01, "TODO", nullptr);
sim.observe(mdl, o);
}
......@@ -2178,18 +2167,19 @@ editor::show_top() noexcept
imnodes::BeginNode(top.children[i].second);
imnodes::BeginNodeTitleBar();
ImGui::TextUnformatted(mdl->name.c_str());
ImGui::OpenPopupOnItemClick("Rename model", 1);
bool is_rename = true;
ImGui::SetNextWindowSize(ImVec2(250, 200), ImGuiCond_Always);
if (ImGui::BeginPopupModal("Rename model", &is_rename)) {
ImGui::InputText(
"Name##edit-1", mdl->name.begin(), mdl->name.capacity());
if (ImGui::Button("Close"))
ImGui::CloseCurrentPopup();
ImGui::EndPopup();
}
// ImGui::TextUnformatted(mdl->name.c_str());
// ImGui::OpenPopupOnItemClick("Rename model", 1);
// bool is_rename = true;
// ImGui::SetNextWindowSize(ImVec2(250, 200), ImGuiCond_Always);
// if (ImGui::BeginPopupModal("Rename model", &is_rename)) {
// ImGui::InputText(
// "Name##edit-1", mdl->name.begin(),
// mdl->name.capacity());
// if (ImGui::Button("Close"))
// ImGui::CloseCurrentPopup();
// ImGui::EndPopup();
//}
ImGui::Text("%s",
dynamics_type_names[static_cast<int>(mdl->type)]);
......@@ -2247,9 +2237,7 @@ add_popup_menuitem(editor& ed, dynamics_type type, model_id* new_model)
return status::data_array_not_enough_memory;
auto& dyn = d_array.alloc();
ed.sim.alloc(dyn,
d_array.get_id(dyn),
dynamics_type_names[static_cast<i8>(type)]);
ed.sim.alloc(dyn, d_array.get_id(dyn));
const auto mdl_id = dyn.id;
auto* mdl = ed.sim.models.try_to_get(mdl_id);
......@@ -2590,7 +2578,7 @@ editor::show_editor() noexcept
if (new_model != undefined<model_id>()) {
parent(new_model, undefined<cluster_id>());
imnodes::SetNodeScreenSpacePos(top.emplace_back(new_model),
click_pos);
click_pos);
}
}
......
......@@ -243,35 +243,34 @@ izhikevich_benchmark(double simulation_duration,
expect(sim.models.can_alloc(14));
!expect(irt::is_success(
sim.alloc(constant3, sim.constant_models.get_id(constant3), "tfun")));
sim.alloc(constant3, sim.constant_models.get_id(constant3))));
!expect(irt::is_success(
sim.alloc(constant, sim.constant_models.get_id(constant), "1.0")));
sim.alloc(constant, sim.constant_models.get_id(constant))));
!expect(irt::is_success(
sim.alloc(constant2, sim.constant_models.get_id(constant2), "-56.0")));
!expect(irt::is_success(
sim.alloc(sum_a, sim.adder_2_models.get_id(sum_a), "sum_a")));
!expect(irt::is_success(
sim.alloc(sum_b, sim.adder_2_models.get_id(sum_b), "sum_b")));
sim.alloc(constant2, sim.constant_models.get_id(constant2))));
!expect(
irt::is_success(sim.alloc(sum_a, sim.adder_2_models.get_id(sum_a))));
!expect(
irt::is_success(sim.alloc(sum_b, sim.adder_2_models.get_id(sum_b))));
!expect(
irt::is_success(sim.alloc(sum_c, sim.adder_4_models.get_id(sum_c))));
!expect(
irt::is_success(sim.alloc(sum_d, sim.adder_2_models.get_id(sum_d))));
!expect(
irt::is_success(sim.alloc(product, sim.mult_2_models.get_id(product))));
!expect(irt::is_success(
sim.alloc(sum_c, sim.adder_4_models.get_id(sum_c), "sum_c")));
!expect(irt::is_success(
sim.alloc(sum_d, sim.adder_2_models.get_id(sum_d), "sum_d")));
sim.alloc(integrator_a, sim.integrator_models.get_id(integrator_a))));
!expect(irt::is_success(
sim.alloc(product, sim.mult_2_models.get_id(product), "prod")));
!expect(irt::is_success(sim.alloc(
integrator_a, sim.integrator_models.get_id(integrator_a), "int_a")));
!expect(irt::is_success(sim.alloc(
integrator_b, sim.integrator_models.get_id(integrator_b), "int_b")));
!expect(irt::is_success(sim.alloc(
quantifier_a, sim.quantifier_models.get_id(quantifier_a), "qua_a")));
!expect(irt::is_success(sim.alloc(
quantifier_b, sim.quantifier_models.get_id(quantifier_b), "qua_b")));
sim.alloc(integrator_b, sim.integrator_models.get_id(integrator_b))));
!expect(irt::is_success(
sim.alloc(cross, sim.cross_models.get_id(cross), "cross")));
sim.alloc(quantifier_a, sim.quantifier_models.get_id(quantifier_a))));
!expect(irt::is_success(
sim.alloc(cross2, sim.cross_models.get_id(cross2), "cross2")));
sim.alloc(quantifier_b, sim.quantifier_models.get_id(quantifier_b))));
!expect(irt::is_success(sim.alloc(cross, sim.cross_models.get_id(cross))));
!expect(
irt::is_success(sim.alloc(cross2, sim.cross_models.get_id(cross2))));
!expect(sim.models.size() == 14_ul);
......
......@@ -2424,8 +2424,6 @@ struct model
observer_id obs_id{ 0 };
dynamics_type type{ dynamics_type::none };
small_string<7> name;
};
struct observer
......@@ -6000,8 +5998,8 @@ public:
irt_return_if_bad(models.init(model_capacity));
irt_return_if_bad(messages.init(messages_capacity));
irt_return_if_bad(input_ports.init(model_capacity));
irt_return_if_bad(output_ports.init(model_capacity));
irt_return_if_bad(input_ports.init(model_capacity * ten));
irt_return_if_bad(output_ports.init(model_capacity * ten));
irt_return_if_bad(none_models.init(model_capacity));
......@@ -6130,7 +6128,7 @@ public:
*
*/
template<typename Dynamics>
Dynamics& alloc(const char* name) noexcept
Dynamics& alloc() noexcept
{
/* Use can_alloc before using this function. */
irt_assert(!models.full());
......@@ -6147,9 +6145,6 @@ public:
auto& dynamics = dynamics_models.alloc();
auto dynamics_id = dynamics_models.get_id(dynamics);
if (name)
mdl.name.assign(name);
mdl.id = dynamics_id;
dynamics.id = mdl_id;
......@@ -6177,9 +6172,7 @@ public:
}
template<typename Dynamics>
status alloc(Dynamics& dynamics,
dynamics_id id,
const char* name = nullptr) noexcept
status alloc(Dynamics& dynamics, dynamics_id id) noexcept
{
irt_return_if_fail(!models.full(), status::simulation_not_enough_model);
......@@ -6188,9 +6181,6 @@ public:
mdl.handle = nullptr;
mdl.id = id;
if (name)
mdl.name.assign(name);
mdl.type = dynamics_typeof<Dynamics>();
dynamics.id = mdl_id;
......
......@@ -32,21 +32,21 @@ example_qss_lotka_volterra(simulation& sim, F f) noexcept
irt_return_if_fail(success, status::simulation_not_enough_model);
auto& integrator_a = sim.alloc<abstract_integrator<QssLevel>>("int_a");
auto& integrator_a = sim.alloc<abstract_integrator<QssLevel>>();
integrator_a.default_X = 18.0;
integrator_a.default_dQ = 0.1;
auto& integrator_b = sim.alloc<abstract_integrator<QssLevel>>("int_b");
auto& integrator_b = sim.alloc<abstract_integrator<QssLevel>>();
integrator_b.default_X = 7.0;
integrator_b.default_dQ = 0.1;
auto& product = sim.alloc<abstract_multiplier<QssLevel>>("prod");
auto& product = sim.alloc<abstract_multiplier<QssLevel>>();
auto& sum_a = sim.alloc<abstract_wsum<QssLevel, 2>>("sum_a");
auto& sum_a = sim.alloc<abstract_wsum<QssLevel, 2>>();
sum_a.default_input_coeffs[0] = 2.0;
sum_a.default_input_coeffs[1] = -0.4;
auto& sum_b = sim.alloc<abstract_wsum<QssLevel, 2>>("sum_b");
auto& sum_b = sim.alloc<abstract_wsum<QssLevel, 2>>();
sum_b.default_input_coeffs[0] = -1.0;
sum_b.default_input_coeffs[1] = 0.1;
......@@ -86,21 +86,21 @@ example_qss_lif(simulation& sim, F f) noexcept
constexpr double V0 = 10.0;
constexpr double Vr = -V0;
auto& cst = sim.alloc<constant>("cte");
auto& cst = sim.alloc<constant>();
cst.default_value = 1.0;
auto& cst_cross = sim.alloc<constant>("ctecro");
auto& cst_cross = sim.alloc<constant>();
cst_cross.default_value = Vr;
auto& sum = sim.alloc<abstract_wsum<QssLevel, 2>>("sum");
auto& sum = sim.alloc<abstract_wsum<QssLevel, 2>>();
sum.default_input_coeffs[0] = -1.0 / tau;
sum.default_input_coeffs[1] = V0 / tau;
auto& integrator = sim.alloc<abstract_integrator<QssLevel>>("int");
auto& integrator = sim.alloc<abstract_integrator<QssLevel>>();
integrator.default_X = 0.0;
integrator.default_dQ = 0.001;
auto& cross = sim.alloc<abstract_cross<QssLevel>>("cro");
auto& cross = sim.alloc<abstract_cross<QssLevel>>();
cross.default_threshold = Vt;
sim.connect(cross.y[0], integrator.x[1]);
......@@ -134,18 +134,18 @@ example_qss_izhikevich(simulation& sim, F f) noexcept
irt_return_if_fail(success, status::simulation_not_enough_model);
auto& cst = sim.alloc<constant>("1");
auto& cst2 = sim.alloc<constant>("-56");
auto& cst3 = sim.alloc<constant>("tfun");
auto& sum_a = sim.alloc<abstract_wsum<QssLevel, 2>>("sum-a");
auto& sum_b = sim.alloc<abstract_wsum<QssLevel, 2>>("sum-b");
auto& sum_c = sim.alloc<abstract_wsum<QssLevel, 4>>("sum-c");
auto& sum_d = sim.alloc<abstract_wsum<QssLevel, 2>>("sum-d");
auto& product = sim.alloc<abstract_multiplier<QssLevel>>("prod");
auto& integrator_a = sim.alloc<abstract_integrator<QssLevel>>("int-a");
auto& integrator_b = sim.alloc<abstract_integrator<QssLevel>>("int-b");
auto& cross = sim.alloc<abstract_cross<QssLevel>>("cross");
auto& cross2 = sim.alloc<abstract_cross<QssLevel>>("cross2");
auto& cst = sim.alloc<constant>();
auto& cst2 = sim.alloc<constant>();
auto& cst3 = sim.alloc<constant>();
auto& sum_a = sim.alloc<abstract_wsum<QssLevel, 2>>();
auto& sum_b = sim.alloc<abstract_wsum<QssLevel, 2>>();
auto& sum_c = sim.alloc<abstract_wsum<QssLevel, 4>>();
auto& sum_d = sim.alloc<abstract_wsum<QssLevel, 2>>();
auto& product = sim.alloc<abstract_multiplier<QssLevel>>();
auto& integrator_a = sim.alloc<abstract_integrator<QssLevel>>();
auto& integrator_b = sim.alloc<abstract_integrator<QssLevel>>();
auto& cross = sim.alloc<abstract_cross<QssLevel>>();
auto& cross2 = sim.alloc<abstract_cross<QssLevel>>();
constexpr double a = 0.2;
constexpr double b = 2.0;
......@@ -233,11 +233,11 @@ example_qss_van_der_pol(simulation& sim, F f) noexcept
irt_return_if_fail(success, status::simulation_not_enough_model);
auto& sum = sim.alloc<abstract_wsum<QssLevel, 3>>("sum");
auto& product1 = sim.alloc<abstract_multiplier<QssLevel>>("prod1");
auto& product2 = sim.alloc<abstract_multiplier<QssLevel>>("prod2");
auto& integrator_a = sim.alloc<abstract_integrator<QssLevel>>("int-a");
auto& integrator_b = sim.alloc<abstract_integrator<QssLevel>>("int-b");
auto& sum = sim.alloc<abstract_wsum<QssLevel, 3>>();
auto& product1 = sim.alloc<abstract_multiplier<QssLevel>>();
auto& product2 = sim.alloc<abstract_multiplier<QssLevel>>();
auto& integrator_a = sim.alloc<abstract_integrator<QssLevel>>();
auto& integrator_b = sim.alloc<abstract_integrator<QssLevel>>();
integrator_a.default_X = 0.0;
integrator_a.default_dQ = 0.001;
......@@ -280,11 +280,11 @@ example_qss_negative_lif(simulation& sim, F f) noexcept
irt_return_if_fail(success, status::simulation_not_enough_model);
auto& sum = sim.alloc<abstract_wsum<QssLevel, 2>>("sum");
auto& integrator = sim.alloc<abstract_integrator<QssLevel>>("int");
auto& cross = sim.alloc<abstract_cross<QssLevel>>("cro");
auto& cst = sim.alloc<constant>("cte");
auto& cst_cross = sim.alloc<constant>("ctecro");
auto& sum = sim.alloc<abstract_wsum<QssLevel, 2>>();
auto& integrator = sim.alloc<abstract_integrator<QssLevel>>();
auto& cross = sim.alloc<abstract_cross<QssLevel>>();
auto& cst = sim.alloc<constant>();
auto& cst_cross = sim.alloc<constant>();
constexpr double tau = 10.0;
constexpr double Vt = -1.0;
......
......@@ -405,13 +405,13 @@ public:
int id;
for (int i = 0; i != model_number; ++i, ++model_error) {
irt_return_if_fail((is >> id >> temp_1 >> temp_2),
irt_return_if_fail((is >> id >> temp_1),
status::io_file_format_model_error);
irt_return_if_fail(0 <= id && id < model_number,
status::io_file_format_model_error);
irt_return_if_bad(read(sim, id, temp_1, temp_2));
irt_return_if_bad(read(sim, id, temp_1));
}
while (is) {
......@@ -537,10 +537,7 @@ private:
return false;
}
status read(simulation& sim,
int id,
const char* name,
const char* dynamics_name) noexcept
status read(simulation& sim, int id, const char* dynamics_name) noexcept
{
dynamics_type type;
......@@ -548,13 +545,13 @@ private:
status::io_file_format_dynamics_unknown);
model_id mdl = static_cast<model_id>(0);
auto ret = sim.dispatch(type, [this, &sim, name](auto& dyn_models) {
auto ret = sim.dispatch(type, [this, &sim](auto& dyn_models) {
irt_return_if_fail(dyn_models.can_alloc(1),
status::io_file_format_dynamics_limit_reach);
auto& dyn = dyn_models.alloc();
auto dyn_id = dyn_models.get_id(dyn);
sim.alloc(dyn, dyn_id, name);
sim.alloc(dyn, dyn_id);
irt_return_if_fail(read(dyn),
status::io_file_format_dynamics_init_error);
......@@ -926,7 +923,7 @@ struct writer
while (sim.models.next(mdl)) {
const auto mdl_id = sim.models.get_id(mdl);
os << id << ' ' << mdl->name.c_str() << ' ';
os << id << ' ';
map[id] = mdl_id;
sim.dispatch(mdl->type, [this, mdl](auto& dyn_models) {
......@@ -1292,24 +1289,13 @@ public:
if (!(mdl_src && mdl_dst))
continue;
if (mdl_src->name.empty())
os << irt::get_key(output_port->model);
else
os << mdl_src->name.c_str();
os << irt::get_key(output_port->model);
os << " -> ";
if (mdl_dst->name.empty())
os << irt::get_key(input_port->model);
else
os << mdl_dst->name.c_str();
os << irt::get_key(input_port->model);
os << " [label=\"";
os << irt::get_key(sim.output_ports.get_id(*output_port));
os << " - ";
os << irt::get_key(sim.input_ports.get_id(*input_port));
os << "\"];\n";
......
This diff is collapsed.
......@@ -52,30 +52,14 @@ dot_graph_save(const irt::simulation& sim, std::FILE* os)
auto* mdl_dst = sim.models.try_to_get(input_port->model);
if (!(mdl_src && mdl_dst))
continue;
if (mdl_src->name.empty())
fmt::print(os, "{} -> ", irt::get_key(output_port->model));
else
fmt::print(os, "{} -> ", mdl_src->name.c_str());
if (mdl_dst->name.empty())
fmt::print(os, "{}", irt::get_key(input_port->model));
else
fmt::print(os, "{}", mdl_dst->name.c_str());
fmt::print(os, " [label=\"");
fmt::print(os,
"{}",
irt::get_key(sim.output_ports.get_id(*output_port)));
fmt::print(os, "-");
fmt::print(
os, "{}", irt::get_key(sim.input_ports.get_id(*input_port)));
fmt::print(os, "\"];\n");
"{} -> {} [label=\"{}-{}\"];\n",
irt::get_key(output_port->model),
irt::get_key(input_port->model),
irt::get_key(sim.output_ports.get_id(*output_port)),
irt::get_key(sim.input_ports.get_id(*input_port)));
}
}
}
......@@ -274,33 +258,31 @@ make_synapse(irt::simulation* sim,
snprintf(accumsyn, 7, "acc%ld%ld", source, target);
!expect(irt::is_success(
sim->alloc(int_pre, sim->integrator_models.get_id(int_pre), intpre)));
sim->alloc(int_pre, sim->integrator_models.get_id(int_pre))));
!expect(irt::is_success(
sim->alloc(quant_pre, sim->quantifier_models.get_id(quant_pre), quapre)));
sim->alloc(quant_pre, sim->quantifier_models.get_id(quant_pre))));
!expect(irt::is_success(
sim->alloc(sum_pre, sim->adder_2_models.get_id(sum_pre), addpre)));
sim->alloc(sum_pre, sim->adder_2_models.get_id(sum_pre))));
!expect(irt::is_success(
sim->alloc(mult_pre, sim->adder_2_models.get_id(mult_pre), propre)));
sim->alloc(mult_pre, sim->adder_2_models.get_id(mult_pre))));
!expect(irt::is_success(
sim->alloc(cross_pre, sim->cross_models.get_id(cross_pre), crosspre)));
sim->alloc(cross_pre, sim->cross_models.get_id(cross_pre))));
!expect(irt::is_success(
sim->alloc(int_post, sim->integrator_models.get_id(int_post), intpost)));
!expect(irt::is_success(sim->alloc(
quant_post, sim->quantifier_models.get_id(quant_post), quapost)));
sim->alloc(int_post, sim->integrator_models.get_id(int_post))));
!expect(irt::is_success(
sim->alloc(sum_post, sim->adder_2_models.get_id(sum_post), addpost)));
sim->alloc(quant_post, sim->quantifier_models.get_id(quant_post))));
!expect(irt::is_success(
sim->alloc(mult_post, sim->adder_2_models.get_id(mult_post), propost)));
sim->alloc(sum_post, sim->adder_2_models.get_id(sum_post))));
!expect(irt::is_success(
sim->alloc(cross_post, sim->cross_models.get_id(cross_post), crosspost)));
sim->alloc(mult_post, sim->adder_2_models.get_id(mult_post))));
!expect(irt::is_success(
sim->alloc(const_syn, sim->constant_models.get_id(const_syn), ctesyn)));