Skip to content

Commit f2e8974

Browse files
committed
Add HyperreducedFixedWeakConstraint
1 parent ab668bd commit f2e8974

15 files changed

Lines changed: 187 additions & 80 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ set(HEADER_FILES
2727
${MOR_SRC}/component/forcefield/HyperReducedHexahedronFEMForceField.h
2828
${MOR_SRC}/component/forcefield/HyperReducedHexahedronFEMForceField.inl
2929
${MOR_SRC}/component/forcefield/HyperReducedRestShapeSpringsForceField.h
30-
${MOR_SRC}/component/forcefield/HyperReducedRestShapeSpringsForceField.inl
30+
${MOR_SRC}/component/forcefield/HyperReducedFixedWeakConstraint.h
31+
${MOR_SRC}/component/forcefield/HyperReducedFixedWeakConstraint.inl
3132
${MOR_SRC}/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.h
3233
${MOR_SRC}/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.inl
3334
${MOR_SRC}/component/forcefield/HyperReducedTetrahedronFEMForceField.h
@@ -58,6 +59,7 @@ set(SOURCE_FILES
5859
${MOR_SRC}/component/forcefield/HyperReducedHelper.cpp
5960
${MOR_SRC}/component/forcefield/HyperReducedHexahedronFEMForceField.cpp
6061
${MOR_SRC}/component/forcefield/HyperReducedRestShapeSpringsForceField.cpp
62+
${MOR_SRC}/component/forcefield/HyperReducedFixedWeakConstraint.cpp
6163
${MOR_SRC}/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.cpp
6264
${MOR_SRC}/component/forcefield/HyperReducedTetrahedronFEMForceField.cpp
6365
${MOR_SRC}/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.cpp

examples/organs/liver/reduced/liver/reduced_liverFine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def Reduced_test(
7777
liver.addObject('BoxROI' , name= 'boxROIactuation' , orientedBox= newBox([[-5.0, 0.5, -0.5], [-5.0, 0.0, -0.5], [-4.0, 0.0, -0.5]] , [0.0, 0.0, 0.0],translation,rotation,[0, 0, 0.5],scale) + multiply(scale[2],[1.0]).tolist(),drawBoxes=True)
7878
liver.addObject('UniformMass' , totalMass = 0.3)
7979
liver.addObject('HyperReducedTetrahedronFEMForceField' , poissonRatio = '0.3', youngModulus = '5000', name = 'reducedFF_liver_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_0_RID.txt', weightsPath = path + r'/data/reducedFF_liver_0_weight.txt')
80-
liver.addObject('HyperReducedRestShapeSpringsForceField' , indices = '@ROI1.indices', stiffness = '1e8', name = 'reducedFF_liver_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_1_RID.txt', weightsPath = path + r'/data/reducedFF_liver_1_weight.txt')
80+
liver.addObject('HyperReducedFixedWeakConstraint' , indices = '@ROI1.indices', stiffness = '1e8', name = 'reducedFF_liver_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_1_RID.txt', weightsPath = path + r'/data/reducedFF_liver_1_weight.txt')
8181
liver.addObject('HyperReducedRestShapeSpringsForceField' , externalIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], indices = '@boxROIactuation.indices', name = 'reducedFF_liver_2', stiffness = '1e8', external_rest_shape = '@actuator/actuatorState', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_2_RID.txt', weightsPath = path + r'/data/reducedFF_liver_2_weight.txt')
8282
liver.addObject('ModelOrderReductionMapping' , input = '@../MechanicalObject', modesPath = path + r'/data/modes.txt', output = '@./MechanicalObject')
8383

examples/organs/liver/reduced/liver_hyperElastic/reduced_liverFineHyperElastic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def Reduced_test(
7777
liver.addObject('BoxROI' , name= 'boxROIactuation' , orientedBox= newBox([[-5.0, 0.5, -0.5], [-5.0, 0.0, -0.5], [-4.0, 0.0, -0.5]] , [0.0, 0.0, 0.0],translation,rotation,[0, 0, 0.5],scale) + multiply(scale[2],[1.0]).tolist(),drawBoxes=True)
7878
liver.addObject('UniformMass' , totalMass = 0.3)
7979
liver.addObject('HyperReducedTetrahedronHyperelasticityFEMForceField' , materialName = 'NeoHookean', ParameterSet = '1923.076923076923 4166.666666666666', AnisotropyDirections = '', name = 'reducedFF_liver_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_0_RID.txt', weightsPath = path + r'/data/reducedFF_liver_0_weight.txt')
80-
liver.addObject('HyperReducedRestShapeSpringsForceField' , indices = '@ROI1.indices', stiffness = '1e8', name = 'reducedFF_liver_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_1_RID.txt', weightsPath = path + r'/data/reducedFF_liver_1_weight.txt')
80+
liver.addObject('HyperReducedFixedWeakConstraint' , indices = '@ROI1.indices', stiffness = '1e8', name = 'reducedFF_liver_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_1_RID.txt', weightsPath = path + r'/data/reducedFF_liver_1_weight.txt')
8181
liver.addObject('HyperReducedRestShapeSpringsForceField' , externalIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], indices = '@boxROIactuation.indices', name = 'reducedFF_liver_2', stiffness = '1e8', external_rest_shape = '@actuator/actuatorState', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_2_RID.txt', weightsPath = path + r'/data/reducedFF_liver_2_weight.txt')
8282
liver.addObject('ModelOrderReductionMapping' , input = '@../MechanicalObject', modesPath = path + r'/data/modes.txt', output = '@./MechanicalObject')
8383

examples/others/hexaBeam/reduced/reduced_hexaBeam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def Reduced_test(
7373
M1.addObject('MechanicalObject')
7474
M1.addObject('UniformMass' , totalMass = '0.1')
7575
M1.addObject('RegularGridTopology' , nx = '4', ny = '4', nz = '20', xmin = '-9', xmax = '-6', ymin = '0', ymax = '3', zmin = '0', zmax = '19')
76-
M1.addObject('HyperReducedRestShapeSpringsForceField' , indices = '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15', stiffness = 1000000000000.0, name = 'reducedFF_M1_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_M1_0_RID.txt', weightsPath = path + r'/data/reducedFF_M1_0_weight.txt')
76+
M1.addObject('HyperReducedFixedWeakConstraint' , indices = '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15', stiffness = 1000000000000.0, name = 'reducedFF_M1_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_M1_0_RID.txt', weightsPath = path + r'/data/reducedFF_M1_0_weight.txt')
7777
M1.addObject('HyperReducedHexahedronFEMForceField' , name = 'reducedFF_M1_1', youngModulus = '4000', poissonRatio = '0.3', method = 'large', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_M1_1_RID.txt', weightsPath = path + r'/data/reducedFF_M1_1_weight.txt')
7878
M1.addObject('ModelOrderReductionMapping' , input = '@../MechanicalObject', modesPath = path + r'/data/modes.txt', output = '@./MechanicalObject')
7979

examples/softRobots/diamond/reduced/diamond/reduced_diamondRobot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def Reduced_test(
8787

8888
FixedBox = modelNode.addChild('FixedBox')
8989
FixedBox.addObject('BoxROI' , name= 'BoxROI' , orientedBox= newBox([[-15, 15, -40], [-15, -15, -40], [15, -15, -40]] , [0.0, 0.0, 35],translation,rotation,[0, 0, 25.0],scale) + multiply(scale[2],[50]).tolist(),drawBoxes=True)
90-
FixedBox.addObject('HyperReducedRestShapeSpringsForceField' , indices = '@BoxROI.indices', stiffness = 1000000000000.0, name = 'reducedFF_FixedBox_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_FixedBox_1_RID.txt', weightsPath = path + r'/data/reducedFF_FixedBox_1_weight.txt')
90+
FixedBox.addObject('HyperReducedFixedWeakConstraint' , indices = '@BoxROI.indices', stiffness = 1000000000000.0, name = 'reducedFF_FixedBox_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_FixedBox_1_RID.txt', weightsPath = path + r'/data/reducedFF_FixedBox_1_weight.txt')
9191

9292

9393
north = modelNode.addChild('north')

examples/softRobots/diamond/reduced/diamond_hyperElastic/reduced_diamondRobotHyperElastic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def Reduced_test(
8181

8282
FixedBox = modelNode.addChild('FixedBox')
8383
FixedBox.addObject('BoxROI' , name= 'BoxROI' , orientedBox= newBox([[-15, 15, -40], [-15, -15, -40], [15, -15, -40]] , [0.0, 0.0, 35],translation,rotation,[0, 0, 25.0],scale) + multiply(scale[2],[50]).tolist(),drawBoxes=True)
84-
FixedBox.addObject('HyperReducedRestShapeSpringsForceField' , indices = '@BoxROI.indices', stiffness = 1000000000000.0, name = 'reducedFF_FixedBox_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_FixedBox_1_RID.txt', weightsPath = path + r'/data/reducedFF_FixedBox_1_weight.txt')
84+
FixedBox.addObject('HyperReducedFixedWeakConstraint' , indices = '@BoxROI.indices', stiffness = 1000000000000.0, name = 'reducedFF_FixedBox_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_FixedBox_1_RID.txt', weightsPath = path + r'/data/reducedFF_FixedBox_1_weight.txt')
8585

8686

8787
north = modelNode.addChild('north')

examples/softRobots/finger/reduced/reduced_finger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def Reduced_test(
7777
finger.addObject('UniformMass' , totalMass = 0.05)
7878
finger.addObject('HyperReducedTetrahedronFEMForceField' , poissonRatio = '0.45', youngModulus = '600', name = 'reducedFF_finger_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_finger_0_RID.txt', weightsPath = path + r'/data/reducedFF_finger_0_weight.txt')
7979
finger.addObject('BoxROI' , name= 'ROI1' , orientedBox= newBox([[-15, 10, 0], [-15, 0, 0], [5, 0, 0]] , [0.0, 0.0, 0.0],translation,rotation,[0, 0, 7.5],scale) + multiply(scale[2],[15]).tolist(),drawBoxes=True)
80-
finger.addObject('HyperReducedRestShapeSpringsForceField' , indices = '@ROI1.indices', stiffness = 1000000000000.0, name = 'reducedFF_finger_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_finger_1_RID.txt', weightsPath = path + r'/data/reducedFF_finger_1_weight.txt')
80+
finger.addObject('HyperReducedFixedWeakConstraint' , indices = '@ROI1.indices', stiffness = 1000000000000.0, name = 'reducedFF_finger_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_finger_1_RID.txt', weightsPath = path + r'/data/reducedFF_finger_1_weight.txt')
8181
finger.addObject('ModelOrderReductionMapping' , input = '@../MechanicalObject', modesPath = path + r'/data/modes.txt', output = '@./MechanicalObject')
8282

8383

examples/softRobots/sofiaLeg/reduced/reduced_sofiaLeg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def Reduced_SofiaLeg(
7676
SofiaLeg.addObject('UniformMass' , totalMass = 0.01)
7777
SofiaLeg.addObject('HyperReducedTetrahedronFEMForceField' , youngModulus = 300, poissonRatio = 0.45, name = 'reducedFF_SofiaLeg_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_SofiaLeg_0_RID.txt', weightsPath = path + r'/data/reducedFF_SofiaLeg_0_weight.txt')
7878
SofiaLeg.addObject('BoxROI' , name = 'boxROITop', orientedBox = [[-12.0, 53.0, 0.0], [12.0, 53.0, 0.0], [12.0, 64.0, 0.0], 16.0], drawBoxes = True)
79-
SofiaLeg.addObject('HyperReducedRestShapeSpringsForceField' , name = 'reducedFF_SofiaLeg_1', indices = '@boxROITop.indices', stiffness = '1e8', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_SofiaLeg_1_RID.txt', weightsPath = path + r'/data/reducedFF_SofiaLeg_1_weight.txt')
79+
SofiaLeg.addObject('HyperReducedFixedWeakConstraint' , name = 'reducedFF_SofiaLeg_1', indices = '@boxROITop.indices', stiffness = '1e8', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_SofiaLeg_1_RID.txt', weightsPath = path + r'/data/reducedFF_SofiaLeg_1_weight.txt')
8080
SofiaLeg.addObject('BoxROI' , name = 'boxROICollision', orientedBox = [[-25.0, -41.0, -7.0], [25.0, -42.0, -7.0], [25.0, -39.0, -7.0], 2.0, [-25.0, -42.0, 7.0], [25.0, -42.0, 7.0], [25.0, -39.0, 7.0], 2.0], drawPoints = '0', computeEdges = '0', computeTriangles = '0', computeTetrahedra = '0', computeHexahedra = '0', computeQuad = '0', drawSize = 5, drawBoxes = True)
8181
SofiaLeg.addObject('BoxROI' , name = 'boxROIMiddle', orientedBox = [[-2.5, -8.5, 0.0], [2.5, -8.5, 0.0], [2.5, -3.5, 0.0], 18.0], drawBoxes = True)
8282
SofiaLeg.addObject('HyperReducedRestShapeSpringsForceField' , externalIndices = [0, 1, 2], indices = '@boxROIMiddle.indices', name = 'reducedFF_SofiaLeg_2', stiffness = '1e8', external_rest_shape = '@../../SofiaLeg_actuator/actuatorState', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_SofiaLeg_2_RID.txt', weightsPath = path + r'/data/reducedFF_SofiaLeg_2_weight.txt')

python/mor/utility/sceneCreation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
'HyperReducedHexahedronFEMForceField':'hexahedra',
3535
'HyperReducedTetrahedronFEMForceField':'tetrahedra',
3636
'HyperReducedTriangleFEMForceField':'triangles',
37-
'HyperReducedRestShapeSpringsForceField':'indices'
37+
'HyperReducedRestShapeSpringsForceField':'indices',
38+
'FixedWeakConstraint':'indices'
3839
}
3940

4041
import Sofa

python/mor/wrapper/replaceAndSave.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
'HexahedronFEMForceField':('HyperReducedHexahedronFEMForceField','hexahedra'),
3838
'TetrahedronFEMForceField':('HyperReducedTetrahedronFEMForceField','tetrahedra'),
3939
'TriangleFEMForceField':('HyperReducedTriangleFEMForceField','triangles'),
40-
'RestShapeSpringsForceField':('HyperReducedRestShapeSpringsForceField','indices')
40+
'RestShapeSpringsForceField':('HyperReducedRestShapeSpringsForceField','indices'),
41+
'FixedWeakConstraint':('HyperReducedFixedWeakConstraint','indices')
4142

4243
}
4344

0 commit comments

Comments
 (0)