Skip to content

Commit

Permalink
Change the way models are registered in NEST
Browse files Browse the repository at this point in the history
  • Loading branch information
pnbabu committed Jan 8, 2024
1 parent 8328aea commit 39a8c6d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ along with NEST. If not, see <http://www.gnu.org/licenses/>.
// Includes from nestkernel:
#include "exceptions.h"
#include "kernel_manager.h"
#include "nest_impl.h"
#include "universal_data_logger_impl.h"

// Includes from sli:
Expand All @@ -68,6 +69,12 @@ along with NEST. If not, see <http://www.gnu.org/licenses/>.

#include "{{neuronName}}.h"

void
register_{{ neuronName }}( const std::string& name )
{
nest::register_node_model< {{ neuronName }} >( name );
}

// ---------------------------------------------------------------------------
// Recordables map
// ---------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ size_t access_counter )

Receives: {% if has_spike_input %}Spike, {% endif %}{% if has_continuous_input %}Current,{% endif %} DataLoggingRequest
*/

// Register the neuron model
void register_{{ neuronName }}( const std::string& name );

class {{neuronName}} : public nest::{{neuron_parent_class}}
{
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ along with NEST. If not, see <http://www.gnu.org/licenses/>.
#include "connection.h"
#include "connector_model.h"
#include "event.h"
#include "nest_impl.h"
{%- if norm_rng %}

// Includes for random number generator
Expand Down Expand Up @@ -82,6 +83,8 @@ along with NEST. If not, see <http://www.gnu.org/licenses/>.

namespace nest
{
// Register the synapse model
void register_{{ synapseName }}( const std::string& name );

namespace {{names_namespace}}
{
Expand Down Expand Up @@ -218,6 +221,11 @@ public:
{%- endif %}
};

void
register_{{ synapseName }}( const std::string& name )
{
nest::register_connection_model< {{ synapseName }} >( name );
}

template < typename targetidentifierT >
class {{synapseName}} : public Connection< targetidentifierT >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ void
{%- if neurons %}
// register neurons
{%- for neuron in neurons %}
nest::kernel().model_manager.register_node_model<{{neuron.get_name()}}>("{{neuron.get_name()}}");
register_{{neuron.get_name()}}("{{neuron.get_name()}}");
{%- endfor %}
{%- endif %}
{%- if synapses %}

// register synapses
{%- for synapse in synapses %}
nest::register_connection_model< nest::{{synapse.get_name()}} >( "{{synapse.get_name()}}" );
register_{{synapse.get_name()}}( "{{synapse.get_name()}}" );
{%- endfor %}
{%- endif %}
} // {{moduleName}}::init()

0 comments on commit 39a8c6d

Please sign in to comment.