1717def createScene (root ):
1818 root .gravity = [0 ,0 ,9.81 ]
1919 ##Solvers
20- setupDefaultHeader (root , displayFlags = "showVisualModels" ,backgroundColor = [0.8 , 0.8 , 0.8 , 1 ],
21- parallelComputing = True )
22- # setupLagrangianCollision(root, displayFlags = "showVisualModels",backgroundColor=[0.8, 0.8, 0.8, 1],
23- # parallelComputing = True,alarmDistance=0.3, contactDistance=0.02,
24- # frictionCoef=0.5, tolerance=1.0e-4, maxIterations=20)
20+ # setupDefaultHeader(root, displayFlags = "showVisualModels",backgroundColor=[0.8, 0.8, 0.8, 1],
21+ # parallelComputing = True)
22+ setupLagrangianCollision (root , displayFlags = "showVisualModels" ,backgroundColor = [0.8 , 0.8 , 0.8 , 1 ],
23+ parallelComputing = True ,alarmDistance = 0.3 , contactDistance = 0.02 ,
24+ frictionCoef = 0.5 , tolerance = 1.0e-4 , maxIterations = 20 )
2525
2626 ##Environement
2727 planes_lengthNormal = np .array ([0 , 1 , 0 ])
@@ -55,13 +55,15 @@ def createScene(root):
5555
5656
5757 ## Real models
58- Beam = root .addChild ("Beam" )
59-
60- VolumetricObjects = root .addChild ("VolumetricObjects" )
61- addImplicitODE (VolumetricObjects )
62- addLinearSolver (VolumetricObjects , constantSparsity = True )
58+ # VolumetricObjects = root.addChild("VolumetricObjects")
59+ # addImplicitODE(VolumetricObjects)
60+ # addLinearSolver(VolumetricObjects, constantSparsity=False, )
6361
6462 ### Logo
63+ LogoNode = root .addChild ("LogoNode" )
64+ addImplicitODE (LogoNode )
65+ addLinearSolver (LogoNode , constantSparsity = False , )
66+
6567 LogoParams = EntityParameters ()
6668 LogoParams .name = "Logo"
6769 LogoParams .geometry = FileParameters (filename = "mesh/SofaScene/Logo.vtk" )
@@ -74,7 +76,7 @@ def logoAddMaterial(node):
7476 DeformableBehaviorParameters .addDeformableMaterial (node )
7577 node .addObject ("ConstantForceField" , name = "ConstantForceUpwards" , totalForce = [0 , 0 , - 5.0 ])
7678 #TODO deal with that is a more smooth way in the material directly
77- node .addObject ("LinearSolverConstraintCorrection" , name = "ConstraintCorrection" , linearSolver = VolumetricObjects .LinearSolver .linkpath , ODESolver = VolumetricObjects .ODESolver .linkpath )
79+ node .addObject ("LinearSolverConstraintCorrection" , name = "ConstraintCorrection" , linearSolver = LogoNode .LinearSolver .linkpath , ODESolver = LogoNode .ODESolver .linkpath )
7880
7981
8082 LogoParams .material .addMaterial = logoAddMaterial
@@ -88,9 +90,13 @@ def logoAddMaterial(node):
8890 LogoParams .visual .geometry = FileParameters (filename = "mesh/SofaScene/LogoVisu.obj" )
8991 LogoParams .visual .color = [0.7 , .35 , 0 , 0.8 ]
9092
91- Logo = VolumetricObjects .add (Entity , parameters = LogoParams )
93+ Logo = LogoNode .add (Entity , parameters = LogoParams )
9294
9395 ### S
96+ SNode = root .addChild ("SNode" )
97+ addImplicitODE (SNode )
98+ addLinearSolver (SNode , constantSparsity = False , )
99+
94100 SParams = EntityParameters ()
95101 SParams .name = "S"
96102 SParams .geometry = FileParameters (filename = "mesh/SofaScene/S.vtk" )
@@ -102,19 +108,19 @@ def logoAddMaterial(node):
102108 def SAddMaterial (node ):
103109 DeformableBehaviorParameters .addDeformableMaterial (node )
104110 #TODO deal with that is a more smooth way in the material directly
105- node .addObject ("LinearSolverConstraintCorrection" , name = "ConstraintCorrection" , linearSolver = VolumetricObjects .LinearSolver .linkpath , ODESolver = VolumetricObjects .ODESolver .linkpath )
111+ node .addObject ("LinearSolverConstraintCorrection" , name = "ConstraintCorrection" , linearSolver = SNode .LinearSolver .linkpath , ODESolver = SNode .ODESolver .linkpath )
106112
107113 SParams .material .addMaterial = SAddMaterial
108114 SParams .material .massDensity = 0.011021
109115 SParams .collision = CollisionParameters ()
110116 SParams .collision .primitives = [CollisionPrimitive .TRIANGLES ]
111- # #TODO: to fix link issues for extracted geometry, it might be better to give source geometry relative link + parameters
117+ # # # TODO: to fix link issues for extracted geometry, it might be better to give source geometry relative link + parameters
112118 SParams .collision .geometry = ExtractParameters (destinationType = ElementType .TRIANGLES , sourceParameters = SParams .geometry )
113119 SParams .visual = VisualParameters ()
114120 SParams .visual .geometry = FileParameters (filename = "mesh/SofaScene/SVisu.obj" )
115121 SParams .visual .color = [0.7 , .7 , 0.7 , 0.8 ]
116122
117- S = VolumetricObjects .add (Entity , parameters = SParams )
123+ S = SNode .add (Entity , parameters = SParams )
118124
119125
120126 SDensity = 0.011021
0 commit comments