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

Collision detection maintenance #4484

Merged
merged 4 commits into from
Apr 8, 2022
Merged

Conversation

jngrad
Copy link
Member

@jngrad jngrad commented Mar 31, 2022

Description of changes:

  • convert the Cython file collision_detection.pyx to a Python file
  • reduce the complexity of the Python code by hiding implementation details in the C++ ScriptInterface class
  • delegate the Python-to-C++ type conversion logic to the AutoParameters class instance
  • bugfix: a runtime warning would print at random during collision due to undefined behavior
  • fix broken error message: glue_to_surface and bind_at_point_of_collision require VIRTUAL_SITES_RELATIVE
  • test all error messages
  • calling collision_detection.set_params() with invalid arguments no longer leaves the system in an indeterminate state

jngrad added 2 commits March 31, 2022 16:04
Rely on the C++ AutoParameters class to remove all the type
conversion code from the Cython class. Convert the Cython file
to a Python file. Use the standard checkpointing mechanism.
Setting a protocol with invalid arguments no longer overwrites
the global state; the old protocol is automatically restored.
@jngrad
Copy link
Member Author

jngrad commented Mar 31, 2022

Note: this PR is only meant to make the code more maintainable for the 4.2.0 release. It also lays the groundwork for a possible overhaul in a future minor release, e.g. 4.3.0 (#4483).

@jngrad
Copy link
Member Author

jngrad commented Apr 7, 2022

ping

reinaual
reinaual previously approved these changes Apr 8, 2022
Copy link
Contributor

@reinaual reinaual left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you are right with #4483...

auto const param_name = get_value<std::string>(kv.first);
if (expected_param_names.count(param_name) == 0) {
// throw if parameter is unknown
static_cast<void>(get_parameter(param_name));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably violating the SRP...

@jngrad jngrad added the automerge Merge with kodiak label Apr 8, 2022
kodiakhq bot and others added 2 commits April 8, 2022 13:18
The uninitialized class member `bool exception_on_collision`
could take any value and would randomly trigger a runtime warning
or a fatal UBSAN report. The corresponding COLLISION_MODE_EXCEPTION
feature was removed in the Tcl version of ESPResSo in 2017.
@kodiakhq kodiakhq bot merged commit cdc1f86 into espressomd:python Apr 8, 2022
@jngrad jngrad deleted the coldet_refactor branch April 8, 2022 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants