Created
January 23, 2019 10:04
-
-
Save zbounik/5727030a0e57d934b798da32c71c92cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$MeshFormat | |
2.2 0 8 | |
$EndMeshFormat | |
$Nodes | |
35 | |
1 -0.61499337 -0.0484317699 5.36816453 | |
2 0.812514411 -0.224246388 3.92371916 | |
3 -0.286570095 0.448780059 4.16442226 | |
4 -2.21090404 0.754796302 1.79384971 | |
5 -1.53226451 1.92160278 2.16019369 | |
6 -1.02190058 0.678964973 3.26120319 | |
7 -3.8877326 -0.0537930737 5.44094152 | |
8 -4.36472658 0.419372421 4.1951112 | |
9 -4.81342443 0.09946183190000001 2.33414038 | |
10 -3.65567745 0.75867486 3.1211874 | |
11 -2.77216711 0.688673448 2.57126101 | |
12 -6.09936661 -0.29119235 2.32081016 | |
13 -4.24999511 0.222252801 1.10490955 | |
14 -5.12608617 0.914872809 1.67317197 | |
15 -4.11825288 2.63586893 1.97466993 | |
16 -3.48180051 1.64926495 1.07959839 | |
17 0.822754743 0.479804517 4.20907593 | |
18 -0.0027294432 0.961267884 4.99965829 | |
19 -1.74996588 0.774506307 5.55006161 | |
20 -3.30785972 1.2427605 5.17274782 | |
21 -1.87303502 2.67407524 3.68314469 | |
22 -1.12733421 1.63339565 4.83011372 | |
23 -5.83838732 0.085646924 4.68471097 | |
24 -2.67240674 2.59936924 4.33401049 | |
25 -4.96790206 1.86099459 4.10476423 | |
26 -5.30446608 1.58180611 2.86938485 | |
27 -6.42269561 0.075041895 3.51005989 | |
28 -3.72239826 2.95377608 3.41360499 | |
29 -2.5723779 2.82961962 2.43106783 | |
30 -2.40112036 0.538267301 4.37567499 | |
31 -0.247265305 0.879308486 2.52984287 | |
32 0.885815677 0.222778118 2.79849979 | |
33 -0.0193845699 1.4910914 3.42650021 | |
34 -0.461302286 1.73535239 4.15535809 | |
35 -2.27090401 0.6863731320000001 2.60810726 | |
$EndNodes | |
$Elements | |
76 | |
1 4 2 0 0 26 14 9 12 | |
2 4 2 0 0 25 10 28 24 | |
3 4 2 0 0 14 9 12 13 | |
4 4 2 0 0 30 21 6 35 | |
5 4 2 0 0 26 27 23 25 | |
6 4 2 0 0 14 26 9 10 | |
7 4 2 0 0 14 26 10 15 | |
8 4 2 0 0 23 26 25 8 | |
9 4 2 0 0 30 21 24 22 | |
10 4 2 0 0 33 6 5 31 | |
11 4 2 0 0 20 30 7 8 | |
12 4 2 0 0 10 14 15 16 | |
13 4 2 0 0 30 1 3 19 | |
14 4 2 0 0 4 6 5 35 | |
15 4 2 0 0 17 3 33 32 | |
16 4 2 0 0 30 20 7 19 | |
17 4 2 0 0 10 25 20 24 | |
18 4 2 0 0 23 25 7 8 | |
19 4 2 0 0 20 10 30 8 | |
20 4 2 0 0 25 10 20 8 | |
21 4 2 0 0 3 1 22 19 | |
22 4 2 0 0 25 20 7 8 | |
23 4 2 0 0 1 30 7 19 | |
24 4 2 0 0 6 3 33 34 | |
25 4 2 0 0 30 3 6 22 | |
26 4 2 0 0 26 9 10 8 | |
27 4 2 0 0 26 10 25 8 | |
28 4 2 0 0 15 10 29 28 | |
29 4 2 0 0 3 6 33 31 | |
30 4 2 0 0 29 4 16 5 | |
31 4 2 0 0 4 29 11 5 | |
32 4 2 0 0 21 6 34 22 | |
33 4 2 0 0 3 17 2 32 | |
34 4 2 0 0 17 1 3 2 | |
35 4 2 0 0 27 26 9 12 | |
36 4 2 0 0 23 25 20 7 | |
37 4 2 0 0 26 27 9 8 | |
38 4 2 0 0 27 26 23 8 | |
39 4 2 0 0 16 10 13 11 | |
40 4 2 0 0 11 4 5 35 | |
41 4 2 0 0 9 14 10 13 | |
42 4 2 0 0 10 14 16 13 | |
43 4 2 0 0 4 16 13 11 | |
44 4 2 0 0 4 29 16 11 | |
45 4 2 0 0 15 10 16 11 | |
46 4 2 0 0 10 15 29 11 | |
47 4 2 0 0 29 15 16 11 | |
48 4 2 0 0 10 26 25 28 | |
49 4 2 0 0 26 10 15 28 | |
50 4 2 0 0 20 30 24 22 | |
51 4 2 0 0 21 30 6 22 | |
52 4 2 0 0 29 21 28 24 | |
53 4 2 0 0 10 29 28 24 | |
54 4 2 0 0 10 20 30 24 | |
55 4 2 0 0 21 29 11 24 | |
56 4 2 0 0 29 10 11 24 | |
57 4 2 0 0 10 30 11 24 | |
58 4 2 0 0 20 30 22 19 | |
59 4 2 0 0 33 21 5 34 | |
60 4 2 0 0 6 33 5 34 | |
61 4 2 0 0 21 6 5 34 | |
62 4 2 0 0 6 3 34 22 | |
63 4 2 0 0 30 3 22 19 | |
64 4 2 0 0 1 17 3 18 | |
65 4 2 0 0 3 34 22 18 | |
66 4 2 0 0 1 3 22 18 | |
67 4 2 0 0 3 17 33 18 | |
68 4 2 0 0 3 33 34 18 | |
69 4 2 0 0 33 3 31 32 | |
70 4 2 0 0 6 21 5 35 | |
71 4 2 0 0 11 21 24 35 | |
72 4 2 0 0 30 11 24 35 | |
73 4 2 0 0 21 30 24 35 | |
74 4 2 0 0 29 11 5 35 | |
75 4 2 0 0 21 29 5 35 | |
76 4 2 0 0 29 21 11 35 | |
$EndElements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Jan 23 13:13:55 2019 | |
@author: zahra | |
""" | |
import Sofa | |
def createScene(rootNode): | |
rootNode.createObject('RequiredPlugin', name='SofaPython') | |
mySimulation = liverVolumeSurface(rootNode,[]) | |
return 0; | |
class liverVolumeSurface (Sofa.PythonScriptController): | |
def initGraph(self,rootNode): | |
# rootNode | |
rootNode.createObject('DefaultPipeline', name='CollisionPipeline', verbose='0') | |
rootNode.createObject('BruteForceDetection', name='N2') | |
# rootNode.createObject('DefaultContactManager', name='collision response', response='default') | |
rootNode.createObject('CollisionResponse', response='FrictionContact', responseParams='mu=0.9') | |
rootNode.createObject('DiscreteIntersection', name='discreteIntersection1') | |
# rootNode.createObject('PythonScriptController', classname="controller", filename='liverSurface_controller.py') | |
# rootNode/Liver | |
Liver = rootNode.createChild('Liver') | |
Liver.depend = 'topo dofs' | |
Liver.createObject('EulerImplicitSolver', name='cg_odesolver', printLog='0') | |
Liver.createObject('CGLinearSolver', threshold='1e-09', tolerance='1e-09', name='linear solver', iterations='25', template='GraphScattered') | |
Liver.createObject('MeshGmshLoader', tetrahedraGroups=' -1 0 38144', name='loader', filename='L1v.msh') | |
Liver.createObject('TetrahedronSetTopologyContainer', triangles='@loader.triangles', position='@loader.position', edges='@loader.edges', name='topo', tetrahedra='@loader.tetras') | |
Liver.createObject('MechanicalObject', force='0 0 0', name='dofs', template='Vec3d', position='@loader.position', velocity='0 0 0', externalForce='0 0 0', restScale='1') | |
Liver.createObject('TetrahedronSetGeometryAlgorithms', drawColorEdges='0.4 1 0.298039 1', showIndicesScale='0.01', name='GeomAlgo', showPointIndices='1', template='Vec3d') | |
Liver.createObject('DiagonalMass', massDensity='1', name='computed using mass density', template='Vec3d') | |
Liver.createObject('TetrahedralCorotationalFEMForceField', poissonRatio='0.4', name='FEM', computeGlobalMatrix='0', method='large', template='Vec3d', youngModulus='120') | |
Liver.createObject('PlaneForceField', name='planeFF0', template='Vec3d', normal='0 1 0', stiffness='10000',draw='1', drawSize='8') | |
Liver.createObject('ConstantForceField', indices='27', name='constantFF0', template='Vec3d', forces='0 0 0') | |
# Liver.createObject('FixedConstraint', indices='0 1 6 22 26 11 12 31', drawSize='0', name='fixedConstraint0', template='Vec3d') | |
Liver.createObject('MeshExporter', exportEveryNumberOfSteps='0', quads='0', name='meshExporter3', format='gmsh', exportAtEnd='1', filename='L1v_sofa', exportAtBegin='0', tetras='1', hexas='0', edges='0', triangles='0', listening='0') | |
Liver.createObject('TetrahedronSetTopologyModifier', name='tetrahedronSetTopologyModifier9') | |
Liver.createObject('TetrahedronSetTopologyAlgorithms', name='tetrahedronSetTopologyAlgorithms10', template='Vec3d') | |
# rootNode/Liver/surface_fine | |
surface_fine = Liver.createChild('surface_fine') | |
surface_fine.createObject('TriangleSetTopologyContainer', name='triangleSetTopologyContainer0') | |
surface_fine.createObject('TriangleSetTopologyModifier', name='triangleSetTopologyModifier1') | |
surface_fine.createObject('TriangleSetTopologyAlgorithms', name='triangleSetTopologyAlgorithms2', template='Vec3d') | |
surface_fine.createObject('TriangleSetGeometryAlgorithms', name='triangleSetGeometryAlgorithms3', template='Vec3d') | |
surface_fine.createObject('Tetra2TriangleTopologicalMapping', input='@../', name='tetra2TriangleTopologicalMapping4', output='@./') | |
# surface_fine.createObject('TriangularFEMForceField', name='triangularFEMFF5', template='Vec3d', poissonRatio='0.3', youngModulus='60') | |
# surface_fine.createObject('TriangularBendingSprings', name='triangularBendingSprings6', template='Vec3d') | |
# surface_fine.createObject('TTriangleModel', name='tTriangleModel15', template='Vec3d') | |
# surface_fine.createObject('TrianglePressureForceField', name='trianglePressureFF22', template='Vec3d') | |
surface_fine.createObject('MeshExporter', exportEveryNumberOfSteps='0', quads='0', name='meshExporter0', format='gmsh', exportAtEnd='1', filename='L1s_sofa', exportAtBegin='0', tetras='0', hexas='0', edges='0', triangles='1', listening='0') | |
# rootNode/Liver/surface_fine/visu_surface_fine | |
visu_surface_fine = surface_fine.createChild('visu_surface_fine') | |
visu_surface_fine.createObject('OglModel', sfactor='GL_SRC_ALPHA', blendEquation='GL_FUNC_ADD', name='oglModel18', template='ExtVec3f', dfactor='GL_ONE_MINUS_SRC_ALPHA', material='Default Diffuse 1 0.74902 0.74902 0.74902 1 Ambient 1 0.592157 0.2 0.2 1 Specular 0 1 1 1 1 Emissive 0 0 0 0 0 Shininess 0 45 ', primitiveType='DEFAULT') | |
visu_surface_fine.createObject('IdentityMapping', input='@../', name='identityMap20', template='Vec3d,ExtVec3f', output='@./') | |
return 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment