Skip to content
Snippets Groups Projects
Commit 75ce2205 authored by w.klijn's avatar w.klijn
Browse files

Small textual changes and additional comments

parent ae276099
No related branches found
No related tags found
......@@ -66,37 +66,37 @@ int main(int argc, char** argv) {
auto recipe = make_recipe(options, pdist);
auto cell_range = distribute_cells(recipe->num_cells());
// build model from recipe
// TODO: I would rather just forward the options object.
model_type m(*recipe, cell_range.first, cell_range.second);
std::unique_ptr<file_export_type> file_exporter;
// File output is depending on the input arguments
std::unique_ptr<file_export_type> file_exporter;
if (!options.spike_file_output) {
m.set_global_spike_callback(
file_export_type::do_nothing);
m.set_local_spike_callback(
file_export_type::do_nothing);
// TODO: use the no_function if PR:77
m.set_global_spike_callback(file_export_type::do_nothing);
m.set_local_spike_callback(file_export_type::do_nothing);
}
else {
file_exporter = nest::mc::util::make_unique<file_export_type>(
options.file_name, options.output_path,
options.file_extention, true);
// The exporter is the same for both global and local output
// just registered as a different callback
file_exporter =
util::make_unique<file_export_type>(
options.file_name, options.output_path,
options.file_extention, options.over_write);
if (options.single_file_per_rank) {
m.set_global_spike_callback(
file_export_type::do_nothing);
m.set_global_spike_callback(file_export_type::do_nothing);
m.set_local_spike_callback(
[&](const std::vector<spike_type>& spikes) { file_exporter->do_export(spikes); });
[&](const std::vector<spike_type>& spikes) {
file_exporter->do_export(spikes); });
}
else {
m.set_global_spike_callback(
[&](const std::vector<spike_type>& spikes) { file_exporter->do_export(spikes); });
m.set_local_spike_callback(
file_export_type::do_nothing);
[&](const std::vector<spike_type>& spikes) {
file_exporter->do_export(spikes); });
m.set_local_spike_callback(file_export_type::do_nothing);
}
}
// inject some artificial spikes, 1 per 20 neurons.
cell_gid_type spike_cell = 20*((cell_range.first+19)/20);
......
......@@ -27,7 +27,7 @@ public:
// Returns the status of the exporter
virtual bool good() const = 0;
// Static NULL version of the do_export function for NOP callbacks
// Static version of the do_export function for NOP callbacks
static void do_nothing(const std::vector<spike_type>&)
{}
};
......
......@@ -178,11 +178,16 @@ public:
std::size_t num_spikes() const { return communicator_.num_spikes(); }
std::size_t num_groups() const { return cell_groups_.size(); }
// register a callback that will perform a export of the global
// spike vector
void set_global_spike_callback(std::function<void(
const std::vector<spike_type>&)> global_export_callback)
{
global_export_callback_ = global_export_callback;
}
// register a callback that will perform a export of the rank local
// spike vector
void set_local_spike_callback(std::function<void(
const std::vector<spike_type>&)> local_export_callback)
{
......
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