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

Remove knots fails with first and last knot #215

Closed
jzwar opened this issue Aug 3, 2023 · 8 comments · Fixed by #298
Closed

Remove knots fails with first and last knot #215

jzwar opened this issue Aug 3, 2023 · 8 comments · Fixed by #298
Assignees
Labels
bug Something isn't working

Comments

@jzwar
Copy link
Collaborator

jzwar commented Aug 3, 2023

Minimal example:

import splinepy as sp

# Create a simple spline
a = sp.BSpline([1],[[0,0,1,2,2]],[[0],[1],[2]])
# Remove first knot (optional)
a.remove_knots(0,[1]) # works just fine
# Error 
a.remove_knots(0,[0]) # Segfault
# Similarly
a.remove_knots(0,[2]) # Segfault
@jzwar jzwar added the bug Something isn't working label Aug 3, 2023
@jzwar jzwar assigned j042 and jzwar Aug 3, 2023
@deltaLuki
Copy link
Member

If you compile splinepy in debug mode and run this, you will see that SplineLib throws the following exception:
ValueError: bsplinelib::parameter_spaces::ParameterSpace::RemoveKnot: Throws the following —> for dimension 0: for dimension0: Cannot insert or remove the first or last knot 2.000000 as only clamped knot vectors are allowed.

@jzwar
Copy link
Collaborator Author

jzwar commented Aug 8, 2023

Yes, but IMO, throwing exceptions only in debug mode is like an assertion. Exceptions should also be thrown if the user inputs faulty data. Especially, as we provide wheels that are built in release mode. Just some random segfault should never occur!

@jzwar
Copy link
Collaborator Author

jzwar commented Aug 8, 2023

As long as this is the case, the bug remains an issue

@deltaLuki
Copy link
Member

Yes, but IMO, throwing exceptions only in debug mode is like an assertion. Exceptions should also be thrown if the user inputs faulty data. Especially, as we provide wheels that are built in release mode. Just some random segfault should never occur!

This is because #ifndef NDEBUG is used in the SplineLib. Do you think we should do our own checks inside splinepy? However, this would mean that the values are checked twice. Once in splinepy and once in SplineLib.

@jzwar
Copy link
Collaborator Author

jzwar commented Sep 14, 2023

@danielwolff1

1 similar comment
@j042
Copy link
Member

j042 commented Oct 5, 2023

@danielwolff1

@danielwolff1
Copy link
Member

I'll look into that after I'm back from Munich

@jzwar
Copy link
Collaborator Author

jzwar commented Nov 7, 2023

Maybe also a good start if knot insertion for C^(-1) is implemented ❤️ @j042

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants