Skip to content

Commit 9fc4753

Browse files
fredroyhugtalbot
andauthored
[SofaCUDA] ElementForceField(s): add support for Prisms and Pyramids (#6171)
* add instanciations and registration for nodalmass density (explicit double and float) * SofaCUDA: add instanciations and registrations for FEMMass * SofaCUDA: add support for pyramid and prism --------- Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
1 parent 46c3835 commit 9fc4753

8 files changed

Lines changed: 218 additions & 60 deletions

applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cpp

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,17 @@ template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTyp
3535
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Quad>;
3636
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Tetrahedron>;
3737
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Hexahedron>;
38+
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Prism>;
39+
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Pyramid>;
3840

3941
#ifdef SOFA_GPU_CUDA_DOUBLE
4042
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Edge>;
4143
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Triangle>;
4244
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Quad>;
4345
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Tetrahedron>;
4446
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Hexahedron>;
47+
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Prism>;
48+
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Pyramid>;
4549
#endif
4650

4751
} // namespace sofa::component::solidmechanics::fem::elastic
@@ -54,48 +58,24 @@ void registerCorotationalFEMForceField(sofa::core::ObjectFactory* factory)
5458
using namespace sofa::component::solidmechanics::fem::elastic;
5559

5660
factory->registerObjects(sofa::core::ObjectRegistrationData(
57-
"Supports GPU-side computations using CUDA for EdgeCorotationalFEMForceField")
61+
"Supports GPU-side computations using CUDA for CorotationalFEMForceField")
5862
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Edge> >()
59-
);
60-
factory->registerObjects(sofa::core::ObjectRegistrationData(
61-
"Supports GPU-side computations using CUDA for TriangleCorotationalFEMForceField")
6263
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Triangle> >()
63-
);
64-
factory->registerObjects(sofa::core::ObjectRegistrationData(
65-
"Supports GPU-side computations using CUDA for QuadCorotationalFEMForceField")
6664
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Quad> >()
67-
);
68-
factory->registerObjects(sofa::core::ObjectRegistrationData(
69-
"Supports GPU-side computations using CUDA for TetrahedronCorotationalFEMForceField")
7065
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Tetrahedron> >()
71-
);
72-
factory->registerObjects(sofa::core::ObjectRegistrationData(
73-
"Supports GPU-side computations using CUDA for HexahedronCorotationalFEMForceField")
7466
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Hexahedron> >()
75-
);
76-
67+
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Prism> >()
68+
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Pyramid> >()
7769
#ifdef SOFA_GPU_CUDA_DOUBLE
78-
factory->registerObjects(sofa::core::ObjectRegistrationData(
79-
"Supports GPU-side computations using CUDA (double) for EdgeCorotationalFEMForceField")
8070
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Edge> >()
81-
);
82-
factory->registerObjects(sofa::core::ObjectRegistrationData(
83-
"Supports GPU-side computations using CUDA (double) for TriangleCorotationalFEMForceField")
8471
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Triangle> >()
85-
);
86-
factory->registerObjects(sofa::core::ObjectRegistrationData(
87-
"Supports GPU-side computations using CUDA (double) for QuadCorotationalFEMForceField")
8872
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Quad> >()
89-
);
90-
factory->registerObjects(sofa::core::ObjectRegistrationData(
91-
"Supports GPU-side computations using CUDA (double) for TetrahedronCorotationalFEMForceField")
9273
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Tetrahedron> >()
93-
);
94-
factory->registerObjects(sofa::core::ObjectRegistrationData(
95-
"Supports GPU-side computations using CUDA (double) for HexahedronCorotationalFEMForceField")
9674
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Hexahedron> >()
97-
);
75+
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Prism> >()
76+
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Pyramid> >()
9877
#endif
78+
);
9979
}
10080

10181
} // namespace sofa::gpu::cuda

applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cu

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,17 +315,25 @@ void CorotationalFEMForceFieldCuda_addDForce(
315315
INSTANTIATE_COROTATIONAL(float, 2)
316316
INSTANTIATE_COROTATIONAL(float, 3)
317317
INSTANTIATE_COROTATIONAL(float, 4)
318+
INSTANTIATE_COROTATIONAL(float, 5) // Pyramid
319+
INSTANTIATE_COROTATIONAL(float, 6) // Prism
318320
INSTANTIATE_COROTATIONAL(float, 8)
319321
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(float, 3)
320322
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(float, 4)
323+
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(float, 5) // Pyramid
324+
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(float, 6) // Prism
321325
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(float, 8)
322326

323327
INSTANTIATE_COROTATIONAL(double, 2)
324328
INSTANTIATE_COROTATIONAL(double, 3)
325329
INSTANTIATE_COROTATIONAL(double, 4)
330+
INSTANTIATE_COROTATIONAL(double, 5) // Pyramid
331+
INSTANTIATE_COROTATIONAL(double, 6) // Prism
326332
INSTANTIATE_COROTATIONAL(double, 8)
327333
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(double, 3)
328334
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(double, 4)
335+
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(double, 5) // Pyramid
336+
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(double, 6) // Prism
329337
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(double, 8)
330338

331339
#undef INSTANTIATE_COROTATIONAL

applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cpp

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,17 @@ template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec
3535
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Quad>;
3636
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Tetrahedron>;
3737
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Hexahedron>;
38+
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Prism>;
39+
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Pyramid>;
3840

3941
#ifdef SOFA_GPU_CUDA_DOUBLE
4042
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Edge>;
4143
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Triangle>;
4244
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Quad>;
4345
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Tetrahedron>;
4446
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Hexahedron>;
47+
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Prism>;
48+
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Pyramid>;
4549
#endif
4650

4751
} // namespace sofa::component::solidmechanics::fem::elastic
@@ -54,48 +58,24 @@ void registerLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory)
5458
using namespace sofa::component::solidmechanics::fem::elastic;
5559

5660
factory->registerObjects(sofa::core::ObjectRegistrationData(
57-
"Supports GPU-side computations using CUDA for EdgeLinearSmallStrainFEMForceField")
61+
"Supports GPU-side computations using CUDA for LinearSmallStrainFEMForceField")
5862
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Edge> >()
59-
);
60-
factory->registerObjects(sofa::core::ObjectRegistrationData(
61-
"Supports GPU-side computations using CUDA for TriangleLinearSmallStrainFEMForceField")
6263
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Triangle> >()
63-
);
64-
factory->registerObjects(sofa::core::ObjectRegistrationData(
65-
"Supports GPU-side computations using CUDA for QuadLinearSmallStrainFEMForceField")
6664
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Quad> >()
67-
);
68-
factory->registerObjects(sofa::core::ObjectRegistrationData(
69-
"Supports GPU-side computations using CUDA for TetrahedronLinearSmallStrainFEMForceField")
7065
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Tetrahedron> >()
71-
);
72-
factory->registerObjects(sofa::core::ObjectRegistrationData(
73-
"Supports GPU-side computations using CUDA for HexahedronLinearSmallStrainFEMForceField")
7466
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Hexahedron> >()
75-
);
76-
67+
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Prism> >()
68+
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Pyramid> >()
7769
#ifdef SOFA_GPU_CUDA_DOUBLE
78-
factory->registerObjects(sofa::core::ObjectRegistrationData(
79-
"Supports GPU-side computations using CUDA (double) for EdgeLinearSmallStrainFEMForceField")
8070
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Edge> >()
81-
);
82-
factory->registerObjects(sofa::core::ObjectRegistrationData(
83-
"Supports GPU-side computations using CUDA (double) for TriangleLinearSmallStrainFEMForceField")
8471
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Triangle> >()
85-
);
86-
factory->registerObjects(sofa::core::ObjectRegistrationData(
87-
"Supports GPU-side computations using CUDA (double) for QuadLinearSmallStrainFEMForceField")
8872
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Quad> >()
89-
);
90-
factory->registerObjects(sofa::core::ObjectRegistrationData(
91-
"Supports GPU-side computations using CUDA (double) for TetrahedronLinearSmallStrainFEMForceField")
9273
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Tetrahedron> >()
93-
);
94-
factory->registerObjects(sofa::core::ObjectRegistrationData(
95-
"Supports GPU-side computations using CUDA (double) for HexahedronLinearSmallStrainFEMForceField")
9674
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Hexahedron> >()
97-
);
75+
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Prism> >()
76+
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Pyramid> >()
9877
#endif
78+
);
9979
}
10080

10181
} // namespace sofa::gpu::cuda

applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cu

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,15 @@ void LinearSmallStrainFEMForceFieldCuda_addDForce(
177177
INSTANTIATE_LINEAR(float, 2)
178178
INSTANTIATE_LINEAR(float, 3)
179179
INSTANTIATE_LINEAR(float, 4)
180+
INSTANTIATE_LINEAR(float, 5) // Pyramid
181+
INSTANTIATE_LINEAR(float, 6) // Prism
180182
INSTANTIATE_LINEAR(float, 8)
181183

182184
INSTANTIATE_LINEAR(double, 2)
183185
INSTANTIATE_LINEAR(double, 3)
184186
INSTANTIATE_LINEAR(double, 4)
187+
INSTANTIATE_LINEAR(double, 5) // Pyramid
188+
INSTANTIATE_LINEAR(double, 6) // Prism
185189
INSTANTIATE_LINEAR(double, 8)
186190

187191
#undef INSTANTIATE_LINEAR
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" ?>
2+
<Node name="root" gravity="0 -9.81 0" dt="0.01">
3+
<RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/>
4+
<RequiredPlugin pluginName="Sofa.Component.Engine.Select"/>
5+
<RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/>
6+
<RequiredPlugin pluginName="Sofa.Component.Mass"/>
7+
<RequiredPlugin pluginName="Sofa.Component.ODESolver.Backward"/>
8+
<RequiredPlugin pluginName="Sofa.Component.SolidMechanics.FEM.Elastic"/>
9+
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Constant"/>
10+
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Grid"/>
11+
<RequiredPlugin pluginName="Sofa.Component.Topology.Mapping"/>
12+
<RequiredPlugin pluginName="Sofa.Component.Visual"/>
13+
<RequiredPlugin pluginName="SofaCUDA"/>
14+
15+
<VisualStyle displayFlags="showBehaviorModels showForceFields" />
16+
<DefaultAnimationLoop />
17+
<DefaultVisualManagerLoop />
18+
19+
<Node name="Prism">
20+
<Node name="Beam">
21+
<RegularGridTopology name="grid" n="40 10 10" min="0 6 -2" max="16 10 2" />
22+
</Node>
23+
24+
<Node name="Simulated">
25+
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />
26+
<CGLinearSolver iterations="20" name="linear solver" tolerance="1.0e-12" threshold="1.0e-12" />
27+
28+
<MechanicalObject position="@../Beam/grid.position" name="Volume" template="CudaVec3f"/>
29+
30+
<MeshTopology name="Container" />
31+
<Hexa2PrismTopologicalMapping input="@../Beam/grid" output="@Container" />
32+
33+
<NodalMassDensity property="0.2"/>
34+
<FEMMass template="CudaVec3f,Prism"/>
35+
<BoxROI name="ROI1" box="-0.1 5 -3 0.1 11 3" drawBoxes="1" />
36+
37+
<FixedProjectiveConstraint indices="@ROI1.indices" />
38+
<CudaCorotationalFEMForceField name="FEM" template="CudaVec3f,Prism"
39+
youngModulus="2000" poissonRatio="0.3"/>
40+
</Node>
41+
</Node>
42+
43+
</Node>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" ?>
2+
<Node name="root" gravity="0 -9.81 0" dt="0.01">
3+
<RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/>
4+
<RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/>
5+
<RequiredPlugin pluginName="Sofa.Component.Mass"/>
6+
<RequiredPlugin pluginName="Sofa.Component.ODESolver.Backward"/>
7+
<RequiredPlugin pluginName="Sofa.Component.SolidMechanics.FEM.Elastic"/>
8+
<RequiredPlugin pluginName="Sofa.Component.StateContainer"/>
9+
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Constant"/>
10+
<RequiredPlugin pluginName="Sofa.Component.Visual"/>
11+
<RequiredPlugin pluginName="SofaCUDA"/>
12+
13+
<VisualStyle displayFlags="showBehaviorModels showForceFields" />
14+
<DefaultAnimationLoop />
15+
<DefaultVisualManagerLoop />
16+
17+
<Node name="Pyramid">
18+
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />
19+
<CGLinearSolver iterations="20" name="linear solver" tolerance="1.0e-12" threshold="1.0e-12" />
20+
21+
<!-- A cube made of 6 pyramids -->
22+
<MeshTopology name="Container" pyramids="
23+
0 1 5 4 8
24+
1 5 6 2 8
25+
2 3 7 6 8
26+
0 3 7 4 8
27+
3 2 1 0 8
28+
6 7 4 5 8
29+
"
30+
position="
31+
-1 -1 -1
32+
1 -1 -1
33+
1 1 -1
34+
-1 1 -1
35+
-1 -1 1
36+
1 -1 1
37+
1 1 1
38+
-1 1 1
39+
0 0 0
40+
"/>
41+
<MechanicalObject template="CudaVec3f" name="Volume" />
42+
43+
<NodalMassDensity property="10"/>
44+
<FEMMass template="CudaVec3f,Pyramid"/>
45+
<FixedProjectiveConstraint indices="2 3 7 6"/>
46+
<CudaCorotationalFEMForceField name="FEM" template="CudaVec3f,Pyramid"
47+
youngModulus="500" poissonRatio="0.45"/>
48+
</Node>
49+
50+
</Node>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" ?>
2+
<Node name="root" gravity="0 -9.81 0" dt="0.01">
3+
<RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/>
4+
<RequiredPlugin pluginName="Sofa.Component.Engine.Select"/>
5+
<RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/>
6+
<RequiredPlugin pluginName="Sofa.Component.Mass"/>
7+
<RequiredPlugin pluginName="Sofa.Component.ODESolver.Backward"/>
8+
<RequiredPlugin pluginName="Sofa.Component.SolidMechanics.FEM.Elastic"/>
9+
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Constant"/>
10+
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Grid"/>
11+
<RequiredPlugin pluginName="Sofa.Component.Topology.Mapping"/>
12+
<RequiredPlugin pluginName="Sofa.Component.Visual"/>
13+
<RequiredPlugin pluginName="SofaCUDA"/>
14+
15+
<VisualStyle displayFlags="showBehaviorModels showForceFields" />
16+
<DefaultAnimationLoop />
17+
<DefaultVisualManagerLoop />
18+
19+
<Node name="Prism">
20+
<Node name="Beam">
21+
<RegularGridTopology name="grid" n="40 10 10" min="0 6 -2" max="16 10 2" />
22+
</Node>
23+
24+
<Node name="Simulated">
25+
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />
26+
<CGLinearSolver iterations="20" name="linear solver" tolerance="1.0e-12" threshold="1.0e-12" />
27+
28+
<MechanicalObject position="@../Beam/grid.position" name="Volume" template="CudaVec3f"/>
29+
30+
<MeshTopology name="Container" />
31+
<Hexa2PrismTopologicalMapping input="@../Beam/grid" output="@Container" />
32+
33+
<NodalMassDensity property="0.2"/>
34+
<FEMMass template="CudaVec3f,Prism"/>
35+
<BoxROI name="ROI1" box="-0.1 5 -3 0.1 11 3" drawBoxes="1" />
36+
37+
<FixedProjectiveConstraint indices="@ROI1.indices" />
38+
<CudaLinearSmallStrainFEMForceField name="FEM" template="CudaVec3f,Prism"
39+
youngModulus="2000" poissonRatio="0.3"/>
40+
</Node>
41+
</Node>
42+
43+
</Node>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" ?>
2+
<Node name="root" gravity="0 -9.81 0" dt="0.01">
3+
<RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/>
4+
<RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/>
5+
<RequiredPlugin pluginName="Sofa.Component.Mass"/>
6+
<RequiredPlugin pluginName="Sofa.Component.ODESolver.Backward"/>
7+
<RequiredPlugin pluginName="Sofa.Component.SolidMechanics.FEM.Elastic"/>
8+
<RequiredPlugin pluginName="Sofa.Component.StateContainer"/>
9+
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Constant"/>
10+
<RequiredPlugin pluginName="Sofa.Component.Visual"/>
11+
<RequiredPlugin pluginName="SofaCUDA"/>
12+
13+
<VisualStyle displayFlags="showBehaviorModels showForceFields" />
14+
<DefaultAnimationLoop />
15+
<DefaultVisualManagerLoop />
16+
17+
<Node name="Pyramid">
18+
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />
19+
<CGLinearSolver iterations="20" name="linear solver" tolerance="1.0e-12" threshold="1.0e-12" />
20+
21+
<!-- A cube made of 6 pyramids -->
22+
<MeshTopology name="Container" pyramids="
23+
0 1 5 4 8
24+
1 5 6 2 8
25+
2 3 7 6 8
26+
0 3 7 4 8
27+
3 2 1 0 8
28+
6 7 4 5 8
29+
"
30+
position="
31+
-1 -1 -1
32+
1 -1 -1
33+
1 1 -1
34+
-1 1 -1
35+
-1 -1 1
36+
1 -1 1
37+
1 1 1
38+
-1 1 1
39+
0 0 0
40+
"/>
41+
<MechanicalObject template="CudaVec3f" name="Volume" />
42+
43+
<NodalMassDensity property="10"/>
44+
<FEMMass template="CudaVec3f,Pyramid"/>
45+
<FixedProjectiveConstraint indices="2 3 7 6"/>
46+
<CudaLinearSmallStrainFEMForceField name="FEM" template="CudaVec3f,Pyramid"
47+
youngModulus="500" poissonRatio="0.45"/>
48+
</Node>
49+
50+
</Node>

0 commit comments

Comments
 (0)