diff --git a/bindings/Sofa/tests/CMakeLists.txt b/bindings/Sofa/tests/CMakeLists.txt index 5bacc9b3..855f8d34 100644 --- a/bindings/Sofa/tests/CMakeLists.txt +++ b/bindings/Sofa/tests/CMakeLists.txt @@ -18,7 +18,6 @@ set(PYTHON_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Core/ForceField.py ${CMAKE_CURRENT_SOURCE_DIR}/Core/DataEngine.py ${CMAKE_CURRENT_SOURCE_DIR}/Core/MyRestShapeForceField.py - ${CMAKE_CURRENT_SOURCE_DIR}/Core/PythonRestShapeForceField.py ${CMAKE_CURRENT_SOURCE_DIR}/Core/BaseLink.py ${CMAKE_CURRENT_SOURCE_DIR}/Helper/Message.py ${CMAKE_CURRENT_SOURCE_DIR}/Types/RGBAColor.py diff --git a/bindings/Sofa/tests/Core/PythonRestShapeForceField.py b/bindings/Sofa/tests/Core/PythonRestShapeForceField.py deleted file mode 100644 index 95e80490..00000000 --- a/bindings/Sofa/tests/Core/PythonRestShapeForceField.py +++ /dev/null @@ -1,57 +0,0 @@ -import unittest -import Sofa -import Sofa.Core -import numpy as np - -class MyForceField(Sofa.Core.ForceFieldVec3d): - def __init__(self, *args, **kwargs): - kwargs["ks"] = kwargs.get("ks", 1.0) - kwargs["kd"] = kwargs.get("kd", 0.1) - Sofa.Core.ForceFieldVec3d.__init__(self, *args, **kwargs) - - def init(self): - self.initpos = self.mstate.position.array().copy() - - def addForce(self, m, out_force, pos, vel): - out_force += ((self.initpos-pos) * self.ks.value) - - def addDForce(self, df, dx, kFactor, bFactor): - df -= dx * self.ks.value * kFactor - -class CreateObject(object): - def __init__(self, *args, **kwargs): - self.args = args - self.kwargs = kwargs - -def RestShapeObject(impl, name="unnamed", position=[]): - node = Sofa.Core.Node(name) - c = node.addObject("MechanicalObject", name="mechanical", position=position) - c.showObject = True - c.drawMode = 1 - - m = node.addObject("UniformMass", name="mass", vertexMass=0.1) - - if isinstance(impl, CreateObject): - node.createObject(*impl.args, **impl.kwargs) - else: - d = node.addObject(impl) - return node - -def createScene(node): - node.addObject("RequiredPlugin", name="SofaBaseMechanics") - node.addObject("RequiredPlugin", name="SofaBaseLinearSolver") - node.addObject("RequiredPlugin", name="SofaImplicitOdeSolver") - node.addObject("DefaultAnimationLoop", name="loop") - node.addObject("EulerImplicitSolver") - node.addObject("CGLinearSolver", tolerance=1e-12, threshold=1e-12) - - a=node.addChild( RestShapeObject( MyForceField("customFF", ks=5.0) , name="python", position=[[i-10.0, 0, 0] for i in range(100)] ) ) - a.mechanical.showColor = [1.0,0.0,0.0,1.0] - - -######################################### TESTS #################################################### -## In the following is the code used to consider this example as a test. -#################################################################################################### -class Test(unittest.TestCase): - def test_example(self): - createScene(Sofa.Core.Node("root"))