Skip to content

Commit cdf7516

Browse files
authored
Merge branch 'master' into framework_warnings_as_errors
2 parents 02ee377 + 3dba466 commit cdf7516

30 files changed

Lines changed: 3050 additions & 2 deletions

Sofa/framework/Simulation/Common/src/sofa/simulation/common/xml/ObjectElement.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,26 @@ bool ObjectElement::init()
5656

5757
bool ObjectElement::initNode()
5858
{
59-
core::objectmodel::BaseContext* ctx = getParent()->getObject()->toBaseContext();
59+
core::objectmodel::BaseContext* ctx { nullptr };
60+
if (auto* parent = getParent())
61+
{
62+
if (auto* parentObj = parent->getObject())
63+
{
64+
ctx = parentObj->toBaseContext();
65+
}
66+
else
67+
{
68+
msg_error("XML parser") << "Cannot access to a valid component from parent element \'"
69+
<< parent->getName() << "\' (type:\'" << parent->getAttribute("type")
70+
<< "\') for the object element \'" << this->getName() << "\'";
71+
}
72+
}
73+
else
74+
{
75+
msg_error("XML parser") << "Cannot find a parent for the object element \'" << this->getName() << "\'";
76+
}
77+
if (!ctx)
78+
return false;
6079

6180
for (AttributeMap::iterator it = attributes.begin(), itend = attributes.end(); it != itend; ++it)
6281
{

applications/plugins/SofaCUDA/Component/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ set(HEADER_FILES
3939

4040

4141
### solidmechanics
42+
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementFEMKernelUtils.cuh
43+
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.h
44+
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.inl
45+
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.h
46+
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.inl
4247
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.h
4348
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.inl
4449
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.h
@@ -111,6 +116,8 @@ set(SOURCE_FILES
111116
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.cpp
112117

113118
### Solidmechanics
119+
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cpp
120+
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cpp
114121
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cpp
115122
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cpp
116123
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cpp
@@ -181,6 +188,8 @@ set(CUDA_SOURCES
181188
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.cu
182189

183190
### solidmechanics
191+
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cu
192+
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cu
184193
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cu
185194
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cu
186195
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cu

applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ extern void registerPlaneForceField(sofa::core::ObjectFactory* factory);
9090
extern void registerSphereForceField(sofa::core::ObjectFactory* factory);
9191

9292
// component::solidmechanics::fem::elastic
93+
extern void registerElementCorotationalFEMForceField(sofa::core::ObjectFactory* factory);
94+
extern void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory);
9395
extern void registerHexahedronFEMForceField(sofa::core::ObjectFactory* factory);
9496
extern void registerTetrahedronFEMForceField(sofa::core::ObjectFactory* factory);
9597
extern void registerTriangularFEMForceFieldOptim(sofa::core::ObjectFactory* factory);
@@ -224,6 +226,8 @@ void registerObjects(sofa::core::ObjectFactory* factory)
224226
registerLinearForceField(factory);
225227
registerPlaneForceField(factory);
226228
registerSphereForceField(factory);
229+
registerElementCorotationalFEMForceField(factory);
230+
registerElementLinearSmallStrainFEMForceField(factory);
227231
registerHexahedronFEMForceField(factory);
228232
registerTetrahedronFEMForceField(factory);
229233
registerTriangularFEMForceFieldOptim(factory);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/******************************************************************************
2+
* SOFA, Simulation Open-Framework Architecture *
3+
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
4+
* *
5+
* This program is free software; you can redistribute it and/or modify it *
6+
* under the terms of the GNU Lesser General Public License as published by *
7+
* the Free Software Foundation; either version 2.1 of the License, or (at *
8+
* your option) any later version. *
9+
* *
10+
* This program is distributed in the hope that it will be useful, but WITHOUT *
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
13+
* for more details. *
14+
* *
15+
* You should have received a copy of the GNU Lesser General Public License *
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17+
*******************************************************************************
18+
* Authors: The SOFA Team and external contributors (see Authors.txt) *
19+
* *
20+
* Contact information: contact@sofa-framework.org *
21+
******************************************************************************/
22+
#include <SofaCUDA/component/config.h>
23+
24+
#include <sofa/gpu/cuda/CudaTypes.h>
25+
#include <SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.inl>
26+
#include <sofa/core/ObjectFactory.h>
27+
28+
namespace sofa::component::solidmechanics::fem::elastic
29+
{
30+
31+
using namespace sofa::gpu::cuda;
32+
33+
template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Edge>;
34+
template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Triangle>;
35+
template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Quad>;
36+
template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Tetrahedron>;
37+
template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Hexahedron>;
38+
39+
#ifdef SOFA_GPU_CUDA_DOUBLE
40+
template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Edge>;
41+
template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Triangle>;
42+
template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Quad>;
43+
template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Tetrahedron>;
44+
template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Hexahedron>;
45+
#endif
46+
47+
} // namespace sofa::component::solidmechanics::fem::elastic
48+
49+
namespace sofa::gpu::cuda
50+
{
51+
52+
void registerElementCorotationalFEMForceField(sofa::core::ObjectFactory* factory)
53+
{
54+
using namespace sofa::component::solidmechanics::fem::elastic;
55+
56+
factory->registerObjects(sofa::core::ObjectRegistrationData(
57+
"Supports GPU-side computations using CUDA for EdgeCorotationalFEMForceField")
58+
.add< CudaElementCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Edge> >()
59+
);
60+
factory->registerObjects(sofa::core::ObjectRegistrationData(
61+
"Supports GPU-side computations using CUDA for TriangleCorotationalFEMForceField")
62+
.add< CudaElementCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Triangle> >()
63+
);
64+
factory->registerObjects(sofa::core::ObjectRegistrationData(
65+
"Supports GPU-side computations using CUDA for QuadCorotationalFEMForceField")
66+
.add< CudaElementCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Quad> >()
67+
);
68+
factory->registerObjects(sofa::core::ObjectRegistrationData(
69+
"Supports GPU-side computations using CUDA for TetrahedronCorotationalFEMForceField")
70+
.add< CudaElementCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Tetrahedron> >()
71+
);
72+
factory->registerObjects(sofa::core::ObjectRegistrationData(
73+
"Supports GPU-side computations using CUDA for HexahedronCorotationalFEMForceField")
74+
.add< CudaElementCorotationalFEMForceField<CudaVec3fTypes, sofa::geometry::Hexahedron> >()
75+
);
76+
77+
#ifdef SOFA_GPU_CUDA_DOUBLE
78+
factory->registerObjects(sofa::core::ObjectRegistrationData(
79+
"Supports GPU-side computations using CUDA (double) for EdgeCorotationalFEMForceField")
80+
.add< CudaElementCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Edge> >()
81+
);
82+
factory->registerObjects(sofa::core::ObjectRegistrationData(
83+
"Supports GPU-side computations using CUDA (double) for TriangleCorotationalFEMForceField")
84+
.add< CudaElementCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Triangle> >()
85+
);
86+
factory->registerObjects(sofa::core::ObjectRegistrationData(
87+
"Supports GPU-side computations using CUDA (double) for QuadCorotationalFEMForceField")
88+
.add< CudaElementCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Quad> >()
89+
);
90+
factory->registerObjects(sofa::core::ObjectRegistrationData(
91+
"Supports GPU-side computations using CUDA (double) for TetrahedronCorotationalFEMForceField")
92+
.add< CudaElementCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Tetrahedron> >()
93+
);
94+
factory->registerObjects(sofa::core::ObjectRegistrationData(
95+
"Supports GPU-side computations using CUDA (double) for HexahedronCorotationalFEMForceField")
96+
.add< CudaElementCorotationalFEMForceField<CudaVec3dTypes, sofa::geometry::Hexahedron> >()
97+
);
98+
#endif
99+
}
100+
101+
} // namespace sofa::gpu::cuda

0 commit comments

Comments
 (0)