SofaPython3 icon indicating copy to clipboard operation
SofaPython3 copied to clipboard

ODE solver in python

Open jnbrunet opened this issue 4 years ago • 4 comments

This PR brings:

  • Bindings for BaseState
  • Bindings for VecId and MultiVecId
  • Bindings for ExecParams and MechanicalParams
  • Bindings for VectorOperations and MechanicalOperations (aka vop and mop)
  • Bindings for OdeSolver

It also provide an example on how a static solver can be fully implemented in python.

jnbrunet avatar May 27 '21 15:05 jnbrunet

Cool PR Jean Nico, but manipulating multivecs from python should be carefully done. But I understand this is definitely needed to create new integration schemes

hugtalbot avatar May 30 '21 16:05 hugtalbot

Can we merge this @hugtalbot ?

It is very useful to quickly try out new ODE formulations before implementing them in c++.

jnbrunet avatar Jun 26 '21 15:06 jnbrunet

Some unit tests are still failing here :cry:

[ RUN      ] SofaPython3/Sofa.all_tests/67_Sofa_Core_BaseObject_test_slave_master
======================================================================
ERROR: test_slave_master (BaseObject.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "BaseObject.py", line 50, in test_slave_master
    c_master.addSlave(c_slave)
TypeError: addSlave(): incompatible function arguments. The following argument types are supported:
    1. (self: Sofa.Core.Object, arg0: Sofa.Core.Object) -> None

Invoked with: <Sofa.Core.BaseState object at 0x7fdea30fa450>, <Sofa.Core.BaseState object at 0x7fdea30fa3b0>

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)
/home/runner/work/SofaPython3/SofaPython3/SofaPython3/bin/Bindings.Sofa.Tests.d/Core/BaseObject.py:0: Failure
Failed
[  FAILED  ] SofaPython3/Sofa.all_tests/67_Sofa_Core_BaseObject_test_slave_master, where GetParam() = /home/runner/work/SofaPython3/SofaPython3/SofaPython3/bin/Bindings.Sofa.Tests.d/Core/BaseObject.py with args {test_slave_master, } (1 ms)
[ RUN      ] SofaPython3/Sofa.all_tests/100_Sofa_Simulation_Node_test_getItem
======================================================================
ERROR: test_getItem (Node.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Node.py", line 173, in test_getItem
    self.assertEqual(object1["."].name, object1.name)
RuntimeError: return_value_policy = copy, but the object is non-copyable!

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)
/home/runner/work/SofaPython3/SofaPython3/SofaPython3/bin/Bindings.Sofa.Tests.d/Simulation/Node.py:0: Failure
Failed
[  FAILED  ] SofaPython3/Sofa.all_tests/100_Sofa_Simulation_Node_test_getItem, where GetParam() = /home/runner/work/SofaPython3/SofaPython3/SofaPython3/bin/Bindings.Sofa.Tests.d/Simulation/Node.py with args {test_getItem, } (1 ms)

guparan avatar Oct 25 '21 08:10 guparan

Crap, I'll try to fix it somewhere this week

jnbrunet avatar Oct 27 '21 01:10 jnbrunet