-
-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Hi,
I think it would make sense to have more descriptive assertions, especially with the changes in the new Python bindings (python_future). A lot of things changed in the API making it likely that things break in user code. I was a bit surprised that the new bindings not only change the number of arguments a preCICE function takes (set_mesh_vertices takes 3 arguments instead of 4 in the C++ interface), but also it expects different argument types/shapes.
In the old bindings set_mesh_vertices would accept a list of coordinates where it was basically a 1D list/array of length numPoints*dimension. The data passed to tthe function did not have to be an numpy array. In precice_future it worked for me only when I use 2D numpy.array with numPoints entries that have the coordinates (dimension).
I started with using an older code with the new interface that used a 1D list (no numpy) of coordinates. This was caught by the exception in line 135, but the exception was not really helpful as there was no explanation what I did wrong. From the documentation it is also not obvious what type/dimension the input arguments should have.
I would suggest to replace the line
assert(dimensions == self.get_dimensions())by something like
assert(dimensions == self.get_dimensions(),"Descriptive message what failed and why (what did the binding expect here?)")This holds true for the other assertions as well. At least for me as a user it was not immediately obvious why it failed and what the binding actually expects. This is also somehow related to the documentation of the bindings as discussed in precice/precice#450 and #3.
Thank you!