Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 4b79fde

Browse files
committed
Remove template from 'emplace_ids()' and add Python CI test
1 parent 6820997 commit 4b79fde

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

python/tests/test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,14 @@ def test_get_reports_from_population(self):
330330
keys_all_ref = np.asarray([10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9])
331331
self.assertTrue((keys_all == keys_all_ref).all())
332332

333+
data_begin = sel_all.data[0][:10]
334+
data_begin_ref = np.asarray([10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0], dtype=np.float32)
335+
self.assertTrue((data_begin == data_begin_ref).all())
336+
337+
data_end = sel_all.data[-1][-10:]
338+
data_end_ref = np.asarray([20.9, 1.9, 2.9, 3.9, 4.9, 5.9, 6.9, 7.9, 8.9, 9.9], dtype=np.float32)
339+
self.assertTrue((data_end == data_end_ref).all())
340+
333341
sel_empty = self.test_obj['All'].get(node_ids=[])
334342
np.testing.assert_allclose(sel_empty.data, np.empty(shape=(0, 0)))
335343

src/report_reader.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,11 @@ void filterTimestampSorted(Spikes& spikes, double tstart, double tstop) {
8181
spikes.erase(spikes.begin(), begin);
8282
}
8383

84-
template <typename T>
85-
void emplace_ids(T& key, NodeID node_id, ElementID element_id);
86-
87-
template <>
88-
void emplace_ids(NodeID& key, NodeID node_id, ElementID /* element_id */) {
84+
inline void emplace_ids(NodeID& key, NodeID node_id, ElementID /* element_id */) {
8985
key = node_id;
9086
}
9187

92-
template <>
93-
void emplace_ids(CompartmentID& key, NodeID node_id, ElementID element_id) {
88+
inline void emplace_ids(CompartmentID& key, NodeID node_id, ElementID element_id) {
9489
key[0] = node_id;
9590
key[1] = element_id;
9691
}
@@ -402,7 +397,7 @@ ReportReader<T>::Population::getNodeIdElementLayout(
402397

403398
auto offset = result.node_offsets[index];
404399
for (auto i = range.first; i < range.second; i++, offset++) {
405-
emplace_ids<T>(result.ids[offset], node_id, element_ids[i]);
400+
emplace_ids(result.ids[offset], node_id, element_ids[i]);
406401
}
407402
}
408403
}

0 commit comments

Comments
 (0)