Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTyp
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Quad>;
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Tetrahedron>;
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Hexahedron>;
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Prism>;
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Pyramid>;

#ifdef SOFA_GPU_CUDA_DOUBLE
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Edge>;
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Triangle>;
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Quad>;
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Tetrahedron>;
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Hexahedron>;
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Prism>;
template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Pyramid>;
#endif

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

factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA for EdgeCorotationalFEMForceField")
"Supports GPU-side computations using CUDA for CorotationalFEMForceField")
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Edge> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA for TriangleCorotationalFEMForceField")
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Triangle> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA for QuadCorotationalFEMForceField")
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Quad> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA for TetrahedronCorotationalFEMForceField")
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Tetrahedron> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA for HexahedronCorotationalFEMForceField")
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Hexahedron> >()
);

.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Prism> >()
.add< CudaCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Pyramid> >()
#ifdef SOFA_GPU_CUDA_DOUBLE
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA (double) for EdgeCorotationalFEMForceField")
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Edge> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA (double) for TriangleCorotationalFEMForceField")
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Triangle> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA (double) for QuadCorotationalFEMForceField")
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Quad> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA (double) for TetrahedronCorotationalFEMForceField")
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Tetrahedron> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA (double) for HexahedronCorotationalFEMForceField")
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Hexahedron> >()
);
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Prism> >()
.add< CudaCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Pyramid> >()
#endif
);
}

} // namespace sofa::gpu::cuda
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,25 @@ void CorotationalFEMForceFieldCuda_addDForce(
INSTANTIATE_COROTATIONAL(float, 2)
INSTANTIATE_COROTATIONAL(float, 3)
INSTANTIATE_COROTATIONAL(float, 4)
INSTANTIATE_COROTATIONAL(float, 5) // Pyramid
INSTANTIATE_COROTATIONAL(float, 6) // Prism
INSTANTIATE_COROTATIONAL(float, 8)
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(float, 3)
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(float, 4)
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(float, 5) // Pyramid
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(float, 6) // Prism
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(float, 8)

INSTANTIATE_COROTATIONAL(double, 2)
INSTANTIATE_COROTATIONAL(double, 3)
INSTANTIATE_COROTATIONAL(double, 4)
INSTANTIATE_COROTATIONAL(double, 5) // Pyramid
INSTANTIATE_COROTATIONAL(double, 6) // Prism
INSTANTIATE_COROTATIONAL(double, 8)
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(double, 3)
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(double, 4)
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(double, 5) // Pyramid
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(double, 6) // Prism
INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(double, 8)

#undef INSTANTIATE_COROTATIONAL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Quad>;
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Tetrahedron>;
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Hexahedron>;
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Prism>;
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Pyramid>;

#ifdef SOFA_GPU_CUDA_DOUBLE
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Edge>;
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Triangle>;
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Quad>;
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Tetrahedron>;
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Hexahedron>;
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Prism>;
template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Pyramid>;
#endif

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

factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA for EdgeLinearSmallStrainFEMForceField")
"Supports GPU-side computations using CUDA for LinearSmallStrainFEMForceField")
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Edge> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA for TriangleLinearSmallStrainFEMForceField")
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Triangle> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA for QuadLinearSmallStrainFEMForceField")
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Quad> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA for TetrahedronLinearSmallStrainFEMForceField")
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Tetrahedron> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA for HexahedronLinearSmallStrainFEMForceField")
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Hexahedron> >()
);

.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Prism> >()
.add< CudaLinearSmallStrainFEMForceField<CudaVec3fTypes, sofa::geometry::Pyramid> >()
#ifdef SOFA_GPU_CUDA_DOUBLE
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA (double) for EdgeLinearSmallStrainFEMForceField")
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Edge> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA (double) for TriangleLinearSmallStrainFEMForceField")
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Triangle> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA (double) for QuadLinearSmallStrainFEMForceField")
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Quad> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA (double) for TetrahedronLinearSmallStrainFEMForceField")
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Tetrahedron> >()
);
factory->registerObjects(sofa::core::ObjectRegistrationData(
"Supports GPU-side computations using CUDA (double) for HexahedronLinearSmallStrainFEMForceField")
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Hexahedron> >()
);
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Prism> >()
.add< CudaLinearSmallStrainFEMForceField<CudaVec3dTypes, sofa::geometry::Pyramid> >()
#endif
);
}

} // namespace sofa::gpu::cuda
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,15 @@ void LinearSmallStrainFEMForceFieldCuda_addDForce(
INSTANTIATE_LINEAR(float, 2)
INSTANTIATE_LINEAR(float, 3)
INSTANTIATE_LINEAR(float, 4)
INSTANTIATE_LINEAR(float, 5) // Pyramid
INSTANTIATE_LINEAR(float, 6) // Prism
INSTANTIATE_LINEAR(float, 8)

INSTANTIATE_LINEAR(double, 2)
INSTANTIATE_LINEAR(double, 3)
INSTANTIATE_LINEAR(double, 4)
INSTANTIATE_LINEAR(double, 5) // Pyramid
INSTANTIATE_LINEAR(double, 6) // Prism
INSTANTIATE_LINEAR(double, 8)

#undef INSTANTIATE_LINEAR
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" ?>
<Node name="root" gravity="0 -9.81 0" dt="0.01">
<RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/>
<RequiredPlugin pluginName="Sofa.Component.Engine.Select"/>
<RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/>
<RequiredPlugin pluginName="Sofa.Component.Mass"/>
<RequiredPlugin pluginName="Sofa.Component.ODESolver.Backward"/>
<RequiredPlugin pluginName="Sofa.Component.SolidMechanics.FEM.Elastic"/>
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Constant"/>
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Grid"/>
<RequiredPlugin pluginName="Sofa.Component.Topology.Mapping"/>
<RequiredPlugin pluginName="Sofa.Component.Visual"/>
<RequiredPlugin pluginName="SofaCUDA"/>

<VisualStyle displayFlags="showBehaviorModels showForceFields" />
<DefaultAnimationLoop />
<DefaultVisualManagerLoop />

<Node name="Prism">
<Node name="Beam">
<RegularGridTopology name="grid" n="40 10 10" min="0 6 -2" max="16 10 2" />
</Node>

<Node name="Simulated">
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />
<CGLinearSolver iterations="20" name="linear solver" tolerance="1.0e-12" threshold="1.0e-12" />

<MechanicalObject position="@../Beam/grid.position" name="Volume" template="CudaVec3f"/>

<MeshTopology name="Container" />
<Hexa2PrismTopologicalMapping input="@../Beam/grid" output="@Container" />

<NodalMassDensity property="0.2"/>
<FEMMass template="CudaVec3f,Prism"/>
<BoxROI name="ROI1" box="-0.1 5 -3 0.1 11 3" drawBoxes="1" />

<FixedProjectiveConstraint indices="@ROI1.indices" />
<CudaCorotationalFEMForceField name="FEM" template="CudaVec3f,Prism"
youngModulus="2000" poissonRatio="0.3"/>
</Node>
</Node>

</Node>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" ?>
<Node name="root" gravity="0 -9.81 0" dt="0.01">
<RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/>
<RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/>
<RequiredPlugin pluginName="Sofa.Component.Mass"/>
<RequiredPlugin pluginName="Sofa.Component.ODESolver.Backward"/>
<RequiredPlugin pluginName="Sofa.Component.SolidMechanics.FEM.Elastic"/>
<RequiredPlugin pluginName="Sofa.Component.StateContainer"/>
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Constant"/>
<RequiredPlugin pluginName="Sofa.Component.Visual"/>
<RequiredPlugin pluginName="SofaCUDA"/>

<VisualStyle displayFlags="showBehaviorModels showForceFields" />
<DefaultAnimationLoop />
<DefaultVisualManagerLoop />

<Node name="Pyramid">
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />
<CGLinearSolver iterations="20" name="linear solver" tolerance="1.0e-12" threshold="1.0e-12" />

<!-- A cube made of 6 pyramids -->
<MeshTopology name="Container" pyramids="
0 1 5 4 8
1 5 6 2 8
2 3 7 6 8
0 3 7 4 8
3 2 1 0 8
6 7 4 5 8
"
position="
-1 -1 -1
1 -1 -1
1 1 -1
-1 1 -1
-1 -1 1
1 -1 1
1 1 1
-1 1 1
0 0 0
"/>
<MechanicalObject template="CudaVec3f" name="Volume" />

<NodalMassDensity property="10"/>
<FEMMass template="CudaVec3f,Pyramid"/>
<FixedProjectiveConstraint indices="2 3 7 6"/>
<CudaCorotationalFEMForceField name="FEM" template="CudaVec3f,Pyramid"
youngModulus="500" poissonRatio="0.45"/>
</Node>

</Node>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" ?>
<Node name="root" gravity="0 -9.81 0" dt="0.01">
<RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/>
<RequiredPlugin pluginName="Sofa.Component.Engine.Select"/>
<RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/>
<RequiredPlugin pluginName="Sofa.Component.Mass"/>
<RequiredPlugin pluginName="Sofa.Component.ODESolver.Backward"/>
<RequiredPlugin pluginName="Sofa.Component.SolidMechanics.FEM.Elastic"/>
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Constant"/>
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Grid"/>
<RequiredPlugin pluginName="Sofa.Component.Topology.Mapping"/>
<RequiredPlugin pluginName="Sofa.Component.Visual"/>
<RequiredPlugin pluginName="SofaCUDA"/>

<VisualStyle displayFlags="showBehaviorModels showForceFields" />
<DefaultAnimationLoop />
<DefaultVisualManagerLoop />

<Node name="Prism">
<Node name="Beam">
<RegularGridTopology name="grid" n="40 10 10" min="0 6 -2" max="16 10 2" />
</Node>

<Node name="Simulated">
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />
<CGLinearSolver iterations="20" name="linear solver" tolerance="1.0e-12" threshold="1.0e-12" />

<MechanicalObject position="@../Beam/grid.position" name="Volume" template="CudaVec3f"/>

<MeshTopology name="Container" />
<Hexa2PrismTopologicalMapping input="@../Beam/grid" output="@Container" />

<NodalMassDensity property="0.2"/>
<FEMMass template="CudaVec3f,Prism"/>
<BoxROI name="ROI1" box="-0.1 5 -3 0.1 11 3" drawBoxes="1" />

<FixedProjectiveConstraint indices="@ROI1.indices" />
<CudaLinearSmallStrainFEMForceField name="FEM" template="CudaVec3f,Prism"
youngModulus="2000" poissonRatio="0.3"/>
</Node>
</Node>

</Node>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" ?>
<Node name="root" gravity="0 -9.81 0" dt="0.01">
<RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/>
<RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/>
<RequiredPlugin pluginName="Sofa.Component.Mass"/>
<RequiredPlugin pluginName="Sofa.Component.ODESolver.Backward"/>
<RequiredPlugin pluginName="Sofa.Component.SolidMechanics.FEM.Elastic"/>
<RequiredPlugin pluginName="Sofa.Component.StateContainer"/>
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Constant"/>
<RequiredPlugin pluginName="Sofa.Component.Visual"/>
<RequiredPlugin pluginName="SofaCUDA"/>

<VisualStyle displayFlags="showBehaviorModels showForceFields" />
<DefaultAnimationLoop />
<DefaultVisualManagerLoop />

<Node name="Pyramid">
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />
<CGLinearSolver iterations="20" name="linear solver" tolerance="1.0e-12" threshold="1.0e-12" />

<!-- A cube made of 6 pyramids -->
<MeshTopology name="Container" pyramids="
0 1 5 4 8
1 5 6 2 8
2 3 7 6 8
0 3 7 4 8
3 2 1 0 8
6 7 4 5 8
"
position="
-1 -1 -1
1 -1 -1
1 1 -1
-1 1 -1
-1 -1 1
1 -1 1
1 1 1
-1 1 1
0 0 0
"/>
<MechanicalObject template="CudaVec3f" name="Volume" />

<NodalMassDensity property="10"/>
<FEMMass template="CudaVec3f,Pyramid"/>
<FixedProjectiveConstraint indices="2 3 7 6"/>
<CudaLinearSmallStrainFEMForceField name="FEM" template="CudaVec3f,Pyramid"
youngModulus="500" poissonRatio="0.45"/>
</Node>

</Node>
Loading