Skip to content

Commit

Permalink
add/fix checks that inline expressions, parameters and internals cann…
Browse files Browse the repository at this point in the history
…ot be assigned to
  • Loading branch information
C.A.P. Linssen committed Sep 13, 2023
1 parent be71111 commit c6978c4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,7 @@ std::vector< std::tuple< int, int > > {{neuronName}}::rport_to_nestml_buffer_idx
{
const double __resolution = nest::Time::get_resolution().get_ms(); // do not remove, this is necessary for the resolution() function

{%- if nest_version.startswith("v2") %}
init_state_({{neuronName}}());
{%- else %}
init_state_();
{%- endif %}
init_state_internal_();

{%- if has_state_vectors %}
recordablesMap_.create(*this);
Expand Down Expand Up @@ -319,18 +315,28 @@ std::vector< std::tuple< int, int > > {{neuronName}}::rport_to_nestml_buffer_idx

{%- if nest_version.startswith("v2") %}
void {{neuronName}}::init_state_(const Node& proto)
{%- else %}
void {{neuronName}}::init_state_()
{%- endif %}
{
#ifdef DEBUG
std::cout << "{{neuronName}}::init_state_()" << std::endl;
#endif
{%- if nest_version.startswith("v2") %}
const {{neuronName}}& pr = downcast<{{neuronName}}>(proto);
S_ = pr.S_;
}
{%- endif %}

void {{neuronName}}::calibrate_time( const nest::TimeConverter& tc )
{
LOG( nest::M_WARNING,
"{{neuronName}}",
"Simulation resolution has changed. Internal state and parameters of the"
"model have been reset!" );

init_state_internal_();
}

void {{neuronName}}::init_state_internal_()
{
#ifdef DEBUG
std::cout << "{{neuronName}}::init_state_internal_()" << std::endl;
#endif

{%- if uses_numeric_solver %}
{%- if numeric_solver == "rk45" %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ public:
{%- endfor %}
{%- endif %}

// -------------------------------------------------------------------------
// Initialization functions
// -------------------------------------------------------------------------

void calibrate_time( const nest::TimeConverter& tc ) override;

protected:
{%- if paired_synapse is defined %}
// support for spike archiving
Expand Down Expand Up @@ -458,10 +464,10 @@ private:
**/
{%- if nest_version.startswith("v2") %}
void init_state_(const Node& proto) override;
{%- else %}
void init_state_() override;
{%- endif %}

void init_state_internal_();

/**
* Reset internal buffers of neuron.
**/
Expand Down
2 changes: 1 addition & 1 deletion tests/nest_tests/test_static_synapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def setUp(self):
logging_level="DEBUG",
suffix="_nestml",
codegen_opts=codegen_opts)
nest.Install("nestmlmodule")

@pytest.mark.skipif(NESTTools.detect_nest_version().startswith("v2"),
reason="This test does not support NEST 2")
Expand All @@ -67,7 +68,6 @@ def test_static_synapse(self):
sim_time = 100. # [ms]

nest.set_verbosity("M_ALL")
nest.Install("nestmlmodule")
nest.ResetKernel()
nest.SetKernelStatus({"resolution": resolution})

Expand Down

0 comments on commit c6978c4

Please sign in to comment.