Skip to content
Open
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 @@ -25,12 +25,14 @@
namespace sofa::component::mass
{

template class SOFA_COMPONENT_MASS_API NodalMassDensity<SReal>;
template class SOFA_COMPONENT_MASS_API NodalMassDensity<double>;
template class SOFA_COMPONENT_MASS_API NodalMassDensity<float>;

void registerNodalMassDensity(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Definition of a nodal mass density (one value per dof).")
.add< NodalMassDensity<SReal> >()
.add< NodalMassDensity<double> >()
.add< NodalMassDensity<float> >()
);
}

Expand Down
4 changes: 3 additions & 1 deletion applications/plugins/SofaCUDA/Component/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ set(HEADER_FILES
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaMeshMatrixMass.inl
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.h
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.inl

${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaFEMMass.h


### solidmechanics
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaFEMKernelUtils.cuh
Expand Down Expand Up @@ -114,6 +115,7 @@ set(SOURCE_FILES
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaDiagonalMass.cpp
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaMeshMatrixMass.cpp
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.cpp
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaFEMMass.cpp

### Solidmechanics
${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ extern void registerRigidMapping(sofa::core::ObjectFactory* factory);
extern void registerDiagonalMass(sofa::core::ObjectFactory* factory);
extern void registerMeshMatrixMass(sofa::core::ObjectFactory* factory);
extern void registerUniformMass(sofa::core::ObjectFactory* factory);
extern void registerFEMMass(sofa::core::ObjectFactory* factory);

// component::mechanicalload
extern void registerConstantForceField(sofa::core::ObjectFactory* factory);
Expand Down Expand Up @@ -221,6 +222,7 @@ void registerObjects(sofa::core::ObjectFactory* factory)
registerDiagonalMass(factory);
registerMeshMatrixMass(factory);
registerUniformMass(factory);
registerFEMMass(factory);
registerConstantForceField(factory);
registerEllipsoidForceField(factory);
registerLinearForceField(factory);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture *
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt) *
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#define SOFA_GPU_CUDA_CUDAFEMMASS_CPP

#include <SofaCUDA/component/config.h>

#include <sofa/gpu/cuda/CudaTypes.h>
#include <SofaCUDA/component/mass/CudaFEMMass.h>
#include <sofa/component/mass/FEMMass.inl>
#include <sofa/core/behavior/Mass.inl>
#include <sofa/core/ObjectFactory.h>
#include <sofa/fem/FiniteElement[all].h>

namespace sofa::component::mass
{

using namespace sofa::gpu::cuda;

template class SOFACUDA_COMPONENT_API FEMMass<CudaVec3fTypes, sofa::geometry::Edge>;
template class SOFACUDA_COMPONENT_API FEMMass<CudaVec3fTypes, sofa::geometry::Triangle>;
template class SOFACUDA_COMPONENT_API FEMMass<CudaVec3fTypes, sofa::geometry::Quad>;
template class SOFACUDA_COMPONENT_API FEMMass<CudaVec3fTypes, sofa::geometry::Tetrahedron>;
template class SOFACUDA_COMPONENT_API FEMMass<CudaVec3fTypes, sofa::geometry::Hexahedron>;
template class SOFACUDA_COMPONENT_API FEMMass<CudaVec3fTypes, sofa::geometry::Prism>;
template class SOFACUDA_COMPONENT_API FEMMass<CudaVec3fTypes, sofa::geometry::Pyramid>;

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

} // namespace sofa::component::mass

namespace sofa::gpu::cuda
{

void registerFEMMass(sofa::core::ObjectFactory* factory)
{
using namespace sofa::component::mass;

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

} // namespace sofa::gpu::cuda
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture *
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt) *
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#pragma once

#include <SofaCUDA/component/config.h>

#include <sofa/gpu/cuda/CudaTypes.h>
#include <sofa/component/mass/FEMMass.h>

namespace sofa::component::mass
{

#ifndef SOFA_GPU_CUDA_CUDAFEMMASS_CPP
extern template class SOFACUDA_COMPONENT_API FEMMass<sofa::gpu::cuda::CudaVec3fTypes, sofa::geometry::Edge>;
extern template class SOFACUDA_COMPONENT_API FEMMass<sofa::gpu::cuda::CudaVec3fTypes, sofa::geometry::Triangle>;
extern template class SOFACUDA_COMPONENT_API FEMMass<sofa::gpu::cuda::CudaVec3fTypes, sofa::geometry::Quad>;
extern template class SOFACUDA_COMPONENT_API FEMMass<sofa::gpu::cuda::CudaVec3fTypes, sofa::geometry::Tetrahedron>;
extern template class SOFACUDA_COMPONENT_API FEMMass<sofa::gpu::cuda::CudaVec3fTypes, sofa::geometry::Hexahedron>;
extern template class SOFACUDA_COMPONENT_API FEMMass<sofa::gpu::cuda::CudaVec3fTypes, sofa::geometry::Prism>;
extern template class SOFACUDA_COMPONENT_API FEMMass<sofa::gpu::cuda::CudaVec3fTypes, sofa::geometry::Pyramid>;

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

} // namespace sofa::component::mass
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
Loading
Loading