Home › Forum › SOFA › Using SOFA › [SOLVED] How to generate one specific deformation in two different mesh resolutions?
Tagged: msvc12, sofa 16.12, win 10 64 bits
- This topic has 18 replies, 3 voices, and was last updated 7 years ago by Zahra.
-
AuthorPosts
-
22 February 2017 at 22:07 #8677ZahraBlocked
Hi,
I need to simulate one soft-tissue deformation model with specific physical properties in two different resolutions. The high and the low resolution deformations are supposed to match each other in the overall shape, except that the high resolution mesh must have more details (wrinkles).
I use sofa for this purpose, however, I receive two completely different deformations. Is there any way that I can simulate two compatible deformations in two different resolutions?
Thanks in advance for your kind help,
Zahra
22 February 2017 at 22:14 #8678HugoKeymasterHi Zahra,
Such multi-level / multi-resolution simulations have already been done in the past with SOFA.
Could you share with us an example scene ?
Some images / videos illustrating the simulations would help as well.Cheers
Hugo
22 February 2017 at 23:42 #8680ZahraBlockedI have sent some scene files by email. Thank you for your help.
Cheers,
Zahra
23 February 2017 at 18:36 #8689HugoKeymasterDear Zahra,
As I wrote you per email, tailored support is a charged service of the SOFA consortium. Could you please share your scene and files here with the community ?
What do you expect from the multiresolution ? the fine level drives the coarse level ?
If both are computed in the same time, they obviously won’t give the same result.
Best,
Hugo
9 March 2017 at 22:25 #8765ZahraBlockedDear Hugo,
Thank you very much for your reply. I am trying to share the scene here. I simply copied the contents of the scene here, and added the link of the files as a github link, But I receive this message all the time: *** Forbidden. Contains contacts. Message seems to be spam. ***
I am sorry for this but could you please tell me what is the problem?
Best regards,
Zahra
10 March 2017 at 10:48 #8767GuillaumeKeymasterHi Zahra,
Our anti-spam may detect something suspicious in your scene.
Could you share it via an online pad like https://titanpad.com/6wuBrtFOxI?
I will then add your code here.Cheers,
Guillaume.10 March 2017 at 14:27 #8771ZahraBlockedHi Guillaume,
Thank you for your help. It seems that the “@” character in the scene file makes this problem as it is considered to be a contact message.
Here is the scene file for the coarse simulation: https://titanpad.com/F0I5r0in3j
<Node name="root" gravity="0 -9.81 0" dt="0.005" > <VisualStyle name="visualStyle1" displayFlags="showVisual showBehaviorModels" /> <DefaultPipeline name="DefaultCollisionPipeline" depth="6" /> <BruteForceDetection name="Detection" /> <MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" /> <DefaultContactManager name="Response" response="default" /> <DefaultCollisionGroupManager name="Group" /> <Node name="Cloth Dynamic Mesh" > <MeshGmshLoader name="loader" filename="HighResolutionMesh.gmsh" edgesGroups="-1 0 40 0 40 40 -1 80 40 -1 -1 39 10 39 49 10 -1 59 88 -1 -1 87 40 87 127 40 -1 167 214 -1 -1 213 40 213 253 40 -1 293 466 -1 -1 465 40 465 505 40 -1 545 970 -1 -1 969 40 969 1009 40 -1 1049 1978 -1 -1 1977 40 1977 2017 40 -1 2057 3994 -1 -1 3993 40 3993 4033 40 -1 4073 8026 -1 -1 8025 40 8025 8065 40 -1 8105 16090 -1 -1 16089 40 16089 16129 40 -1 16169 32218 -1 -1 32217 40 32217 32257 40 -1 32297 64474 -1 -1 64473 40 64473 64513 40 -1 64553 128986 -1 -1 128985 40 128985 129025 40 -1 129065 258010 -1 -1 258009 40 258009 258049 40 -1 258089 516058 -1 -1 516057 40 516057 516097 40 -1 516137 1032154 -1 -1 1032153 40 1032153 1032193 40 -1 1032233 2064346 -1 -1 2064345 40 2064345 2064385 40 -1 2064425 4128730 -1 -1 4128729 64 4128729 4128793 64 -1 4128857 8257522 -1 -1 8257521 64 8257521 8257585 64 -1 8257649 16515106 -1 -1 16515105 64 16515105 16515169 64 -1 16515233 33030274 -1 -1 33030273 64 33030273 33030337 64 -1 33030401 66060610 -1 -1 66060609 64 66060609 66060673 64 -1 66060737 132121282 -1 -1 132121281 64 132121281 132121345 64 -1 132121409 264242626 -1 -1 264242625 64 264242625 264242689 64 -1 264242753 528485314 -1 -1 528485313 64 528485313 528485377 64 -1 528485441 1056970690 -1 -1 1056970689 64 1056970689 1056970753 64 -1 1056970817 2113941442 -1 -1 2113941441 80 2113941441 2113941521 80 -1 2113941601 -67084334 -1 -1 -67084335 80 -67084335 -67084255 80 -1 -67084175 -134168590 -1 -1 -134168591 160 -134168591 -134168431 160 -1 -134168271 -268337022 -1" trianglesGroups=" -1 0 32258" createSubelements="1" /> <MechanicalObject template="Vec3d" name="MechObj" position="@loader.position" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" restScale="1" showIndices="0" showIndicesScale="2e-005" translation="10 0 20" rotation="0 90 90" scale3d="10 10 10" /> <FixedConstraint template="Vec3d" name="Fixed dof" group="0" indices="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 255 256 383 384 511 512 639 640 767 768 895 896 1023 1024 1151 1152 1279 1280 1407 1408 1535 1536 1663 1664 1791 1792 1919 1920 2047 2048 2175 2176 2303 2304 2431 2432 2559 2560 2687 2688 2815 2816 2943 2944 3071 3072 3199 3200 3327 3328 3455 3456 3583 3584 3711 3712 3839 3840 3967 3968 4095 4096 4223 4224 4351 4352 4479 4480 4607 4608 4735 4736 4863 4864 4991 4992 5119 5120 5247 5248 5375 5376 5503 5504 5631 5632 5759 5760 5887 5888 6015 6016 6143 6144 6271 6272 6399 6400 6527 6528 6655 6656 6783 6784 6911 6912 7039 7040 7167 7168 7295 7296 7423 7424 7551 7552 7679 7680 7807 7808 7935 7936 8063 8064 8191 8192 8319 8320 8447 8448 8575 8576 8703 8704 8831 8832 8959 8960 9087 9088 9215 9216 9343 9344 9471 9472 9599 9600 9727 9728 9855 9856 9983 9984 10111 10112 10239 10240 10367 10368 10495 10496 10623 10624 10751 10752 10879 10880 11007 11008 11135 11136 11263 11264 11391 11392 11519 11520 11647 11648 11775 11776 11903 11904 12031 12032 12159 12160 12287 12288 12415 12416 12543 12544 12671 12672 12799 12800 12927 12928 13055 13056 13183 13184 13311 13312 13439 13440 13567 13568 13695 13696 13823 13824 13951 13952 14079 14080 14207 14208 14335 14336 14463 14464 14591 14592 14719 14720 14847 14848 14975 14976 15103 15104 15231 15232 15359 15360 15487 15488 15615 15616 15743 15744 15871 15872 15999 16000 16127 16128 16255 16256 16257 16258 16259 16260 16261 16262 16263 16264 16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 16338 16339 16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 16350 16351 16352 16353 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383" /> <UniformMass template="Vec3d" name="Mass" mass="1" totalmass="50" showGravityCenter="1" /> <CGLinearSolver template="GraphScattered" name="linear solver" iterations="40" tolerance="1e-009" threshold="1e-009" /> <TriangleSetTopologyContainer name="Topology Container" position="@loader.position" edges="@loader.edges" triangles="@loader.triangles" /> <TriangleSetTopologyModifier name="Topology Modifier" /> <TriangleSetTopologyAlgorithms template="Vec3d" name="Topology Algorithms" /> <TriangleSetGeometryAlgorithms template="Vec3d" name="Geometry Algorithms" showIndicesScale="0.005" showPointIndices="0" showEdgeIndices="0" showTriangleIndices="0" /> <TriangularBendingSprings template="Vec3d" name="FEM-Bend" rayleighStiffness="0" stiffness="300" damping="1" /> <TriangularFEMForceField template="Vec3d" name="FEM" rayleighStiffness="0" method="large" poissonRatio="0.45" youngModulus="100" damping="0" /> <TTriangleModel template="Vec3d" name="models" selfCollision="0" /> <OglModel template="ExtVec3f" name="Visual" material="Default Diffuse 1 0 1 0 1 Ambient 1 0 0.2 0 1 Specular 0 0 1 0 1 Emissive 0 0 1 0 1 Shininess 0 45 " primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA" /> <IdentityMapping template="Vec3d,ExtVec3f" name="Mapping" input="@." output="@Visual" /> <PlaneForceField template="Vec3d" name="planeFF0" normal="0 1 0" /> <NewmarkImplicitSolver name="newmarkImplicitSolver5" /> <ConstantForceField template="Vec3d" name="constantFF0" points="8240 8264" forces="-1000 -1000 0 1000 -1000 0" /> </Node> </Node>
and the scene file for the fine simulation: https://titanpad.com/6wuBrtFOxI
<Node name="root" gravity="0 -9.81 0" dt="0.005" > <VisualStyle name="visualStyle1" displayFlags="showVisual showBehaviorModels" /> <DefaultPipeline name="DefaultCollisionPipeline" depth="6" /> <BruteForceDetection name="Detection" /> <MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" /> <DefaultContactManager name="Response" response="default" /> <DefaultCollisionGroupManager name="Group" /> <Node name="Cloth Dynamic Mesh" > <MeshGmshLoader name="loader" filename="HighResolutionMesh.gmsh" edgesGroups="-1 0 40 0 40 40 -1 80 40 -1 -1 39 10 39 49 10 -1 59 88 -1 -1 87 40 87 127 40 -1 167 214 -1 -1 213 40 213 253 40 -1 293 466 -1 -1 465 40 465 505 40 -1 545 970 -1 -1 969 40 969 1009 40 -1 1049 1978 -1 -1 1977 40 1977 2017 40 -1 2057 3994 -1 -1 3993 40 3993 4033 40 -1 4073 8026 -1 -1 8025 40 8025 8065 40 -1 8105 16090 -1 -1 16089 40 16089 16129 40 -1 16169 32218 -1 -1 32217 40 32217 32257 40 -1 32297 64474 -1 -1 64473 40 64473 64513 40 -1 64553 128986 -1 -1 128985 40 128985 129025 40 -1 129065 258010 -1 -1 258009 40 258009 258049 40 -1 258089 516058 -1 -1 516057 40 516057 516097 40 -1 516137 1032154 -1 -1 1032153 40 1032153 1032193 40 -1 1032233 2064346 -1 -1 2064345 40 2064345 2064385 40 -1 2064425 4128730 -1 -1 4128729 64 4128729 4128793 64 -1 4128857 8257522 -1 -1 8257521 64 8257521 8257585 64 -1 8257649 16515106 -1 -1 16515105 64 16515105 16515169 64 -1 16515233 33030274 -1 -1 33030273 64 33030273 33030337 64 -1 33030401 66060610 -1 -1 66060609 64 66060609 66060673 64 -1 66060737 132121282 -1 -1 132121281 64 132121281 132121345 64 -1 132121409 264242626 -1 -1 264242625 64 264242625 264242689 64 -1 264242753 528485314 -1 -1 528485313 64 528485313 528485377 64 -1 528485441 1056970690 -1 -1 1056970689 64 1056970689 1056970753 64 -1 1056970817 2113941442 -1 -1 2113941441 80 2113941441 2113941521 80 -1 2113941601 -67084334 -1 -1 -67084335 80 -67084335 -67084255 80 -1 -67084175 -134168590 -1 -1 -134168591 160 -134168591 -134168431 160 -1 -134168271 -268337022 -1" trianglesGroups=" -1 0 32258" createSubelements="1" /> <MechanicalObject template="Vec3d" name="MechObj" position="@loader.position" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" restScale="1" showIndices="0" showIndicesScale="2e-005" translation="10 0 20" rotation="0 90 90" scale3d="10 10 10" /> <FixedConstraint template="Vec3d" name="Fixed dof" group="0" indices="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 255 256 383 384 511 512 639 640 767 768 895 896 1023 1024 1151 1152 1279 1280 1407 1408 1535 1536 1663 1664 1791 1792 1919 1920 2047 2048 2175 2176 2303 2304 2431 2432 2559 2560 2687 2688 2815 2816 2943 2944 3071 3072 3199 3200 3327 3328 3455 3456 3583 3584 3711 3712 3839 3840 3967 3968 4095 4096 4223 4224 4351 4352 4479 4480 4607 4608 4735 4736 4863 4864 4991 4992 5119 5120 5247 5248 5375 5376 5503 5504 5631 5632 5759 5760 5887 5888 6015 6016 6143 6144 6271 6272 6399 6400 6527 6528 6655 6656 6783 6784 6911 6912 7039 7040 7167 7168 7295 7296 7423 7424 7551 7552 7679 7680 7807 7808 7935 7936 8063 8064 8191 8192 8319 8320 8447 8448 8575 8576 8703 8704 8831 8832 8959 8960 9087 9088 9215 9216 9343 9344 9471 9472 9599 9600 9727 9728 9855 9856 9983 9984 10111 10112 10239 10240 10367 10368 10495 10496 10623 10624 10751 10752 10879 10880 11007 11008 11135 11136 11263 11264 11391 11392 11519 11520 11647 11648 11775 11776 11903 11904 12031 12032 12159 12160 12287 12288 12415 12416 12543 12544 12671 12672 12799 12800 12927 12928 13055 13056 13183 13184 13311 13312 13439 13440 13567 13568 13695 13696 13823 13824 13951 13952 14079 14080 14207 14208 14335 14336 14463 14464 14591 14592 14719 14720 14847 14848 14975 14976 15103 15104 15231 15232 15359 15360 15487 15488 15615 15616 15743 15744 15871 15872 15999 16000 16127 16128 16255 16256 16257 16258 16259 16260 16261 16262 16263 16264 16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 16338 16339 16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 16350 16351 16352 16353 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383" /> <UniformMass template="Vec3d" name="Mass" mass="1" totalmass="50" showGravityCenter="1" /> <CGLinearSolver template="GraphScattered" name="linear solver" iterations="40" tolerance="1e-009" threshold="1e-009" /> <TriangleSetTopologyContainer name="Topology Container" position="@loader.position" edges="@loader.edges" triangles="@loader.triangles" /> <TriangleSetTopologyModifier name="Topology Modifier" /> <TriangleSetTopologyAlgorithms template="Vec3d" name="Topology Algorithms" /> <TriangleSetGeometryAlgorithms template="Vec3d" name="Geometry Algorithms" showIndicesScale="0.005" showPointIndices="0" showEdgeIndices="0" showTriangleIndices="0" /> <TriangularBendingSprings template="Vec3d" name="FEM-Bend" rayleighStiffness="0" stiffness="300" damping="1" /> <TriangularFEMForceField template="Vec3d" name="FEM" rayleighStiffness="0" method="large" poissonRatio="0.45" youngModulus="100" damping="0" /> <TTriangleModel template="Vec3d" name="models" selfCollision="0" /> <OglModel template="ExtVec3f" name="Visual" material="Default Diffuse 1 0 1 0 1 Ambient 1 0 0.2 0 1 Specular 0 0 1 0 1 Emissive 0 0 1 0 1 Shininess 0 45 " primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA" /> <IdentityMapping template="Vec3d,ExtVec3f" name="Mapping" input="@." output="@Visual" /> <PlaneForceField template="Vec3d" name="planeFF0" normal="0 1 0" /> <NewmarkImplicitSolver name="newmarkImplicitSolver5" /> <ConstantForceField template="Vec3d" name="constantFF0" points="8240 8264" forces="-1000 -1000 0 1000 -1000 0" /> </Node> </Node>
The low-resolution mesh: https://gist.github.com/zbounik/1f7749322f1f53084a0740b97e20d80e
The high-resolution mesh: https://gist.github.com/zbounik/908863a3c064069ad37c6bbe4d0ef955At a steady state, the deformation in the coarse simulation do not correspond to the fine simulation.
In fact I expect the coarse simulation to drive the fine simulation. I would appreciate if you kindly give me some hints to solve this problem.
Best regards,
Zahra
10 March 2017 at 15:44 #8773GuillaumeKeymasterJust edited your post with the code 😉
Guillaume
10 March 2017 at 16:55 #8774ZahraBlockedThank you Guillaume.
17 March 2017 at 08:04 #8796HugoKeymasterDear Zahra,
I looked at both fine and coarse simulations.
It obviously does not give the same results, due to the mesh resolutions.However, in order to have the coarse simulation driving the fine mesh, I tried to put them in one single scene with a BarycentricMapping (input=coarseMesh output=fineMesh). But it won’t work well since, look, the meshes are not the same size:
Cheers,
Hugo
17 March 2017 at 21:59 #8802ZahraBlockedHi Hugo,
Thank you for your kind reply. I will try your guidance about using BarycentricMapping.
Best regards,
Zahra21 April 2017 at 22:04 #8976HugoKeymasterHey Zahra,
Any news ? any progress ?
Cheers,Hugo
13 September 2017 at 13:28 #9979ZahraBlockedHi Hugo,
Sorry for not responding to your following up for this long time, as I have solved my previous problem using another approach and forget about this topic.
Now again I need to use your hint in using barycentric mapping to drive the coarse resolution by fine resolution. I did not succeed as sofa crashes with no error when I want to use this mapping.
Would you please give me more information on how to do that?
– Should I create the fine model and make the coarse model as a child node of it? Or should I put both models at the same level of nodes?
– What kind of barycentric mapping should I use for mapping the fine model onto the coarse one?
Thank you for any guidance in advance,
Zahra
13 September 2017 at 17:10 #9982HugoKeymasterHi Zahra
For the BarycentricMapping, you can see many scenes are using it. Or simply in the examples (examples/Components/mapping). What kind of template are you using in your scene (Rigid, Vec3 ..) ?
Using Vec3, the standard usage is:
... <Node name="Liver"> <!-- ... your solvers , loaders .. --> <!-- Master object --> <MechanicalObject template="Vec3d" name="myObject1" /> <!-- ... your physics (mass etc) --> <Node name="Subnode" > <!-- Slave object --> <MechanicalObject template="Vec3d" name="myObject2" /> <BarycentricMapping name="Mapping" input="@myObject1" output="@myObject2" /> </Node> ...
HTH
Hugo
18 September 2017 at 11:35 #9987ZahraBlockedDear Hugo,
Thank you for your reply. I have implemented your guide before, but I always face errors. I have put a lot of time to find the cause of the error, but I failed. I am wondering if it is possible for you to kindly have a look on my scene:
<?xml version=”1.0″?> <Node name=”root” dt=”0.02″ > <DefaultPipeline name=”CollisionPipeline” verbose=”0″ /> <BruteForceDetection name=”N2″ /> <DefaultContactManager name=”collision response” response=”default” /> <DiscreteIntersection name=”discreteIntersection1″ /> <Node name=”Liver” depend=”topo dofs” > <EulerImplicitSolver name=”cg_odesolver” printLog=”0″ /> <CGLinearSolver template=”GraphScattered” name=”linear solver” iterations=”25″ tolerance=”1e-009″ threshold=”1e-009″ /> <MeshGmshLoader name=”loader” filename=”d:/work/phd/sofa/liver/liverfinal/testbygmsh/livertetra7509.msh” tetrahedraGroups=” -1 0 38144″ /> <TetrahedronSetTopologyContainer name=”topo” position=”@loader.position” edges=”@loader.edges” triangles=”@loader.triangles” tetrahedra=”@loader.tetras” /> <MechanicalObject template=”Vec3d” name=”dofs” position=”@loader.position” velocity=”0 0 0″ force=”0 0 0″ externalForce=”0 0 0″ restScale=”1″ /> <TetrahedronSetGeometryAlgorithms template=”Vec3d” name=”GeomAlgo” showPointIndices=”0″ /> <DiagonalMass template=”Vec3d” name=”computed using mass density” massDensity=”1″ /> <TetrahedralCorotationalFEMForceField template=”Vec3d” name=”FEM” method=”large” poissonRatio=”0.45″ youngModulus=”1000″ computeGlobalMatrix=”0″ /> <PlaneForceField template=”Vec3d” name=”planeFF0″ normal=”0 1 0″ /> <ConstantForceField template=”Vec3d” name=”constantFF0″ points=”111″ forces=”0 -120 0″ /> <FixedConstraint template=”Vec3d” name=”fixedConstraint0″ indices=”11 17 16 15 14 4 3 0 45 95 42 40 38 39 53 62 61 60 4 63 59 125 24 20 19 9″ drawSize=”0″ /> <MeshExporter name=”meshExporter3″ filename=”c:/users/zahra/desktop/barytestfine” edges=”0″ quads=”0″ hexas=”0″ exportEveryNumberOfSteps=”1″ exportAtBegin=”1″ exportAtEnd=”1″ /> <TetrahedronSetTopologyModifier name=”tetrahedronSetTopologyModifier9″ /> <TetrahedronSetTopologyAlgorithms template=”Vec3d” name=”tetrahedronSetTopologyAlgorithms10″ /> <OglModel template=”ExtVec3f” name=”oglModel0″ material=”Default Diffuse 1 0.666667 0 0 1 Ambient 1 0.2 0.2 0.2 1 Specular 0 1 1 1 1 Emissive 0 0 0 0 0 Shininess 0 45 ” primitiveType=”DEFAULT” blendEquation=”GL_FUNC_ADD” sfactor=”GL_SRC_ALPHA” dfactor=”GL_ONE_MINUS_SRC_ALPHA” /> <BarycentricMapping template=”Vec3d,ExtVec3f” name=”barycentricMap1″ input=”@.” output=”@oglModel0″ /> <Node name=”node3″ > <MechanicalObject template=”Vec3d” name=”mObject0″ position=”0 0 0″ velocity=”0 0 0″ force=”0 0 0″ externalForce=”0 0 0″ restScale=”1″ /> <MeshGmshLoader name=”meshGmshLoader1″ filename=”d:/work/phd/sofa/liver/liverfinal/testbygmsh/livertetra181.gmsh” tetrahedraGroups=” -1 0 596″ /> <BarycentricMapping template=”Vec3d,Vec3d” name=”mapping” input=”@dofs” output=”@mObject0″ /> <VTKExporter name=”vTKExporter1″ filename=”c:/users/zahra/desktop/fromtut19″ edges=”0″ tetras=”1″ exportEveryNumberOfSteps=”1″ exportAtBegin=”1″ exportAtEnd=”1″ overwrite=”1″ /> <TetrahedronSetGeometryAlgorithms template=”Vec3d” name=”tetrahedronSetGeometryAlgorithms0″ /> <TetrahedronSetTopologyAlgorithms template=”Vec3d” name=”tetrahedronSetTopologyAlgorithms1″ /> <TetrahedronSetTopologyContainer name=”tetrahedronSetTopologyContainer2″ /> <TetrahedronSetTopologyModifier name=”tetrahedronSetTopologyModifier3″ /> <Node name=”node2″ > <OglModel template=”ExtVec3f” name=”ogl1″ translation=”0 3 0″ material=”Default Diffuse 1 0.74902 0.74902 0.74902 1 Ambient 1 0.2 0.2 0.2 1 Specular 0 1 1 1 1 Emissive 0 0 0 0 0 Shininess 0 45 ” primitiveType=”DEFAULT” blendEquation=”GL_FUNC_ADD” sfactor=”GL_SRC_ALPHA” dfactor=”GL_ONE_MINUS_SRC_ALPHA” /> <BarycentricMapping template=”Vec3d,ExtVec3f” name=”barycentric2″ output=”@ogl1″ /> </Node> </Node> </Node> </Node>
If it is needed, you can find the two resolutions of liver mesh in the following links:
https://gist.github.com/anonymous/b2ebdecfc51c343abf176722e14390b5
https://gist.github.com/anonymous/79e048b09721684ea43f4fa07f9b0d4b
Also, I use vec3… as my template, however, I am not exactly sure what is the difference between vec3d and extvec3f and … that I used in barycentricmappig. I just used them based on what I have learned from examples. Is there any reference that explains their differences?
Thank you very much for your help.
Best regards,
Zahra27 September 2017 at 03:24 #10010HugoKeymasterDear Zahra,
I gave a try to your scene. I guess there was some issue in the ordering of components. Here is a corrected version, but I am not sure what it’ supposed to do:
<?xml version="1.0"?> <Node name="root" dt="0.02" > <DefaultPipeline name="CollisionPipeline" verbose="0" /> <BruteForceDetection name="N2" /> <DefaultContactManager name="collision response" response="default" /> <DiscreteIntersection name="discreteIntersection1" /> <Node name="Liver" depend="topo dofs" > <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver template="GraphScattered" name="linear solver" iterations="25" tolerance="1e-009" threshold="1e-009" /> <MeshGmshLoader name="loader" filename="/Users/sofaconsortium/Desktop/Bnk/livertetra7509.msh" tetrahedraGroups=" -1 0 38144" /> <TetrahedronSetTopologyContainer name="topo" position="@loader.position" edges="@loader.edges" triangles="@loader.triangles" tetrahedra="@loader.tetras" /> <MechanicalObject template="Vec3d" name="dofs" position="@loader.position" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" restScale="1" /> <TetrahedronSetGeometryAlgorithms template="Vec3d" name="GeomAlgo" showPointIndices="0" /> <DiagonalMass template="Vec3d" name="computed using mass density" massDensity="1" /> <TetrahedralCorotationalFEMForceField template="Vec3d" name="FEM" method="large" poissonRatio="0.45" youngModulus="1000" computeGlobalMatrix="0" /> <PlaneForceField template="Vec3d" name="planeFF0" normal="0 1 0" /> <ConstantForceField template="Vec3d" name="constantFF0" indices="111" forces="0 -120 0" /> <FixedConstraint template="Vec3d" name="fixedConstraint0" indices="11 17 16 15 14 4 3 0 45 95 42 40 38 39 53 62 61 60 4 63 59 125 24 20 19 9" drawSize="0" /> <MeshExporter name="meshExporter3" filename="/Users/sofaconsortium/Desktop/Bnk/barytestfine" edges="0" quads="0" hexas="0" exportEveryNumberOfSteps="1" exportAtBegin="1" exportAtEnd="1" /> <TetrahedronSetTopologyModifier name="tetrahedronSetTopologyModifier9" /> <TetrahedronSetTopologyAlgorithms template="Vec3d" name="tetrahedronSetTopologyAlgorithms10" /> <OglModel template="ExtVec3f" name="oglModel0" material="Default Diffuse 1 0.666667 0 0 1 Ambient 1 0.2 0.2 0.2 1 Specular 0 1 1 1 1 Emissive 0 0 0 0 0 Shininess 0 45 " primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA" /> <BarycentricMapping template="Vec3d,ExtVec3f" name="barycentricMap1" input="@." output="@oglModel0" /> <Node name="node3" > <MeshGmshLoader name="meshGmshLoader1" filename="/Users/sofaconsortium/Desktop/Bnk/livertetra181.msh" tetrahedraGroups=" -1 0 596" /> <TetrahedronSetTopologyContainer name="tetrahedronSetTopologyContainer2" /> <MechanicalObject template="Vec3d" name="mObject0" position="0 0 0" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" restScale="1" /> <TetrahedronSetTopologyModifier name="tetrahedronSetTopologyModifier3" /> <TetrahedronSetGeometryAlgorithms template="Vec3d" name="tetrahedronSetGeometryAlgorithms0" /> <TetrahedronSetTopologyAlgorithms template="Vec3d" name="tetrahedronSetTopologyAlgorithms1" /> <BarycentricMapping template="Vec3d,Vec3d" name="mapping" input="@dofs" output="@mObject0" /> <VTKExporter name="vTKExporter1" filename="/Users/sofaconsortium/Desktop/Bnk/fromtut19" edges="0" tetras="1" exportEveryNumberOfSteps="1" exportAtBegin="1" exportAtEnd="1" overwrite="1" /> <OglModel template="ExtVec3f" name="ogl1" translation="0 3 0" material="Default Diffuse 1 0.74902 0.74902 0.74902 1 Ambient 1 0.2 0.2 0.2 1 Specular 0 1 1 1 1 Emissive 0 0 0 0 0 Shininess 0 45 " primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA" /> </Node> </Node> </Node>
HTH. Cheers,
Hugo
2 October 2017 at 09:49 #10024ZahraBlockedDear Hugo,
I appreciate your kind help, however, you deleted the part that I needed for my simulation. I think I did not obviously explain my problem on this topic. What I want from this simulation is to drive a coarse mesh by a fine one and I want to illustrate both of the meshes, i.e. coarse and fine mesh in one scene. To do this, I used three barycentric mapping component:
– a visual barycentric mapping for the visual model of the fine mesh
– a mechanical barycentric mapping to map from fine to coarse mesh
– a visual barycentric mapping for the visual model of the coarse meshIs this a true procedure? If so, my problem is that I can not see the final result in the scene, i.e. the coarse mesh which is derived by the fine mesh. I receive the following error by adding the barycentric mapping for the visual model of the “coarse mesh”:
FROM SOFA [ERR] >> ########## SIG 11 – SIGSEGV: segfault ########## FROM SOFA [ERR] >> 26 FROM SOFA [ERR] >> : sofa::helper::BackTrace::dump – 0x7ffd94693f90 25: sofa::helper::BackTrace::sig – 0x7ffd94694120 24: XcptFilter – 0x7ffd9f5dfaf0 23: XcptFilter – 0x7ffd9f5dfaf0 22: _C_specific_handler – 0x7ffd9f5df238 FROM SOFA [ERR] >> 21: _chkstk – 0x7ffdc664aa50 20: RtlImageNtHeaderEx – 0x7ffdc65e94b0 19: KiUserExceptionDispatcher – 0x7ffdc6649c50 18: sofa::component::mapping::BarycentricMapperTetrahedronSetTopology<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>,sofa::defaulttype::ExtVectorTypes<sofa::defaulttype::Vec<3,float>,sofa::defaultty – 0x7ffd791d9220 17: sofa::component::mapping::BarycentricMapping<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>,sofa::defaulttype::ExtVectorTypes<sofa::defaulttype::Vec<3,float>,sofa::defaulttype::Vec<3,float>,floa – 0x7ffd791dad20 16: sofa::core::Mapping<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3,double>,sofa::defaulttype::Vec<3,double>,double>,sofa::defaulttype::ExtVectorTypes<sofa::defaulttype::Vec<3,float>,sofa::defaulttype::Vec<3,float>,float> >::apply – 0x7ffd79f1b9a0 15: sofa::simulation::UpdateMappingVisitor::processMapping – 0x7ffd9e244f30 14: sofa::simulation::UpdateMappingEndEvent::~UpdateMappingEndEvent – 0x7ffd9e244ba0 13: sofa::simulation::UpdateMappingVisitor::processNodeTopDown – 0x7ffd9e245030 12: sofa::simulation::graph::DAGNode::executeVisitorTopDown – 0x7ffd9b028a20 11: sofa::simulation::graph::DAGNode::executeVisitorTopDown – 0x7ffd9b028a20 10: sofa::simulation::graph::DAGNode::executeVisitorTopDown – 0x7ffd9b028a20 9: sofa::simulation::graph::DAGNode::doExecuteVisitor – 0x7ffd9b0275f0 8: sofa::simulation::Node::executeVisitor – 0x7ffd9e2246c0 7: sofa::simulation::Simulation::reset – 0x7ffd9e242500 6: sofa::gui::qt::RealGUI::resetScene – 0x7ffd8acbb4f0 5: sofa::gui::qt::RealGUI::setScene – 0x7ffd8acbbe00 4: sofa::gui::GUIManager::SetScene – 0x7ffdbb297220 3: sofa::gui::GUIManager::SetScene – 0x7ffdbb297220 2: sofa::gui::GUIManager::SetScene – 0x7ffdbb297220 1: BaseThreadInitThunk – 0x7ffdc6228350 0: RtlUserThreadStart – 0x7ffdc6607070 FROM SOFA [OUT] >> [WARNING] [SofaSimulationTree] the library has not been cleaned up (sofa::simulation::tree::cleanup() has never been called, see sofa/helper/init.h) FROM SOFA [OUT] >> [WARNING] [SofaSimulationGraph] the library has not been cleaned up (sofa::simulation::graph::cleanup() has never been called, see sofa/helper/init.h) [WARNING] [SofaSimulationCommon] the library has not been cleaned up (sofa::simulation::common::cleanup() has never been called, see sofa/helper/init.h) [WARNING] [SofaSimulationCore] the library has not been cleaned up (sofa::simulation::core::cleanup() has never been called, see sofa/helper/init.h) [WARNING] [SofaCore] the library has not been cleaned up (sofa::core::cleanup() has never been called, see sofa/helper/init.h) [WARNING] [SofaDefaultType] the library has not been cleaned up (sofa::defaulttype::cleanup() has never been called, see sofa/helper/init.h)
Sofa exited safely.
I even can not extract the mapped coarse mesh using any kind of exporters.
I’d be really grateful if you could help me out with this.
Best,
Zahra
3 October 2017 at 16:08 #10028HugoKeymasterThis should do what you want with the three mappings:
<?xml version="1.0"?> <Node name="root" dt="0.02" > <DefaultPipeline name="CollisionPipeline" verbose="0" /> <BruteForceDetection name="N2" /> <DefaultContactManager name="collision response" response="default" /> <DiscreteIntersection name="discreteIntersection1" /> <Node name="Liver" depend="topo dofs" > <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver template="GraphScattered" name="linear solver" iterations="25" tolerance="1e-009" threshold="1e-009" /> <MeshGmshLoader name="loader" filename="/Users/sofaconsortium/Desktop/Bnk/livertetra7509.msh" tetrahedraGroups=" -1 0 38144" /> <TetrahedronSetTopologyContainer name="topo" position="@loader.position" edges="@loader.edges" triangles="@loader.triangles" tetrahedra="@loader.tetras" /> <MechanicalObject template="Vec3d" name="dofs" position="@loader.position" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" restScale="1" /> <TetrahedronSetGeometryAlgorithms template="Vec3d" name="GeomAlgo" showPointIndices="0" /> <DiagonalMass template="Vec3d" name="computed using mass density" massDensity="1" /> <TetrahedralCorotationalFEMForceField template="Vec3d" name="FEM" method="large" poissonRatio="0.45" youngModulus="1000" computeGlobalMatrix="0" /> <PlaneForceField template="Vec3d" name="planeFF0" normal="0 1 0" /> <ConstantForceField template="Vec3d" name="constantFF0" indices="111" forces="0 -120 0" /> <FixedConstraint template="Vec3d" name="fixedConstraint0" indices="11 17 16 15 14 4 3 0 45 95 42 40 38 39 53 62 61 60 4 63 59 125 24 20 19 9" drawSize="0" /> <MeshExporter name="meshExporter3" filename="/Users/sofaconsortium/Desktop/Bnk/barytestfine" edges="0" quads="0" hexas="0" exportEveryNumberOfSteps="1" exportAtBegin="1" exportAtEnd="1" /> <TetrahedronSetTopologyModifier name="tetrahedronSetTopologyModifier9" /> <TetrahedronSetTopologyAlgorithms template="Vec3d" name="tetrahedronSetTopologyAlgorithms10" /> <Node name="Visu-fine" > <OglModel template="ExtVec3f" name="oglModel0" color="red" /> <IdentityMapping /> </Node> <Node name="coarse" > <MeshGmshLoader name="meshGmshLoader1" filename="/Users/sofaconsortium/Desktop/Bnk/livertetra181.msh" tetrahedraGroups=" -1 0 596" /> <TetrahedronSetTopologyContainer name="tetrahedronSetTopologyContainer2" src="@meshGmshLoader1"/> <MechanicalObject template="Vec3d" name="mObject0" src="@meshGmshLoader1" restScale="1" /> <TetrahedronSetTopologyModifier name="tetrahedronSetTopologyModifier3" /> <TetrahedronSetGeometryAlgorithms template="Vec3d" name="tetrahedronSetGeometryAlgorithms0" flipNormals="1" recomputeTrianglesOrientation="0" /> <TetrahedronSetTopologyAlgorithms template="Vec3d" name="tetrahedronSetTopologyAlgorithms1" /> <BarycentricMapping template="Vec3d,Vec3d" name="mapping" input="@../dofs" output="@mObject0" /> <VTKExporter name="vTKExporter1" filename="/Users/sofaconsortium/Desktop/Bnk/fromtut19" edges="0" tetras="1" exportEveryNumberOfSteps="1" exportAtBegin="1" exportAtEnd="1" overwrite="1" /> <Node name="Visu-coarse" > <OglModel template="ExtVec3f" name="oglModel0" color="blue"/> <IdentityMapping /> </Node> </Node> </Node> </Node>
HTH
Hugo
28 October 2017 at 08:30 #10096ZahraBlockedDear Hugo,
Yes, now I can see both of the models. Thank you very much for your kind help.
Best regards,
Zahra
-
AuthorPosts
- You must be logged in to reply to this topic.