-
Notifications
You must be signed in to change notification settings - Fork 41
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
[Binding/Sofa.Core] PointSetTopologyModifier #290
[Binding/Sofa.Core] PointSetTopologyModifier #290
Conversation
…nts works as expected, every call after that does not. Remove points works well, but validity of point to be removed is not checked yet.
Maybe the @epernod 's expert 👀 would be useful here :) |
Hi, could you develop what you mean by: every call after that does not Regarding removing of points, the process of renumbering is the same as I explained for removing tetrahedron in this issue: sofa-framework/sofa#3156 |
Case A:
So for 2. I would expect 10 more points to show up :D Case B:
Which is particularly weird, because I "reposition" them after trying to add them
|
Still WIP ? |
Yes, because I still do not know where the observed behavior comes from. |
Ok I have further investigated the problem a bit, and I have a feeling that the changes are not properly passed to the MechanicalObject. |
During the sofadevmeeting we look at this PR. any update is it still in WIP ? |
Hi @damienmarchal |
Hello @damienmarchal, |
Hi all, After a quick investigation with @younesssss i would say the problem is in the c++ part. And @epernod is clearly the one to ask for insight, on my side I have zero knowledge on the topology change. |
Hi @damienmarchal @hugtalbot , When trying to write into py::array getPythonArrayFor(BaseData* d)
{
auto& memcache = getObjectCache();
if(d->isDirty() || memcache.find(d) == memcache.end())
{
auto capsule = py::capsule(new Base::SPtr(d->getOwner()), [](void*p){ delete static_cast<Base::SPtr*>(p); } );
py::buffer_info ninfo = toBufferInfo(*d);
py::array a(pybind11::dtype(ninfo), ninfo.shape,
ninfo.strides, ninfo.ptr, capsule);
memcache[d] = a;
return a;
}
return memcache[d];
} Since the binding itself is functional, I would like to merge it, and then open another issue to address the actual problem.
Cheers, |
Hi @damienmarchal could you have you 🐍 python eyes 👁️ on above Paul's comment? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ScheiklP for me this PR is ready as the problem of updateIfDirty is a more general problem not linked to your PR. An issue has been created to keep track this.
Could you "undraft" your PR so we can merge it.
Hello @damienmarchal, |
I want to add bindings for
PointSetTopologyModifier
'saddPoints
andremovePoints
in order to change the size of aPointSetTopologyContainer
that are propagated to components that are linked with the container (e.g.MechanicalObject
,RestShapeSpringsForceField
,FixedConstraint
, ...).Work in Progress, because the binding does not work as expected and I could use some help on that.
I added an example in https://github.com/ScheiklP/SofaPython3/blob/point_topology_modifier/examples/pointSetTopologyModifier.py
On first call,
addPoints
works as expected, every call after that does not.removePoints
works well, but validity of point to be removed is not checked yet. Shouldrenumber
also be called?topology-2022-07-24_16.24.15.mp4
Also if I try to open the
MechanicalObject
from within the GUI after modifying the topology, I get a SegFault.