Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug in the SecondaryEvent delivery #963

Merged
merged 1 commit into from Jun 5, 2018
Merged

Conversation

@janhahne
Copy link

@janhahne janhahne commented Jun 4, 2018

This PR fixes #955. The origin of the error is explained in the corresponding issue.

All SecondaryEvents which exist at the moment use double as data type. In this cases the sizes in question are the same (this is actually the case for most data types that I checked), which is why this error remained undetected until now (and cannot be tested with the current master).

I have created a branch (based on 5g) where I created an additional SecondaryEvent with bool data (see https://github.com/janhahne/nest-simulator/tree/5g_bool_sec_event). After merging the fix everything works fine there now.

Copy link
Contributor

@heplesser heplesser left a comment

Looks fine in principle, but see my inline comment.

for ( typename std::vector< DataType >::iterator i = coeffarray_as_d_begin_;
i != coeffarray_as_d_end_;
i++ )
{
write_to_comm_buffer( *i, pos );
elem = *i;
write_to_comm_buffer( elem, pos );

This comment has been minimized.

@heplesser

heplesser Jun 4, 2018
Contributor

I would make this even more compact as

const DataType elem = *i;

And one should probably be able to do it as a one-liner:

write_to_comm_buffer( static_cast< DataType >(*i), pos );

I would prefer that, keeping things as tight as possible.

I would also strongly suggest adding a comment here why this extra effort is necessary.

janhahne
@janhahne janhahne force-pushed the janhahne:fix955 branch from 8b925c9 to 140549d Jun 5, 2018
@janhahne
Copy link
Author

@janhahne janhahne commented Jun 5, 2018

@heplesser You are right, a static_cast is more compact. Please have another look.

@heplesser heplesser requested a review from hakonsbm Jun 5, 2018
Copy link
Contributor

@hakonsbm hakonsbm left a comment

Looks good to me.

@heplesser heplesser merged commit 5a841f0 into nest:master Jun 5, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@janhahne janhahne deleted the janhahne:fix955 branch Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants
You can’t perform that action at this time.