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
381 changes: 14 additions & 367 deletions applications/plugins/SofaCUDA/CMakeLists.txt

Large diffs are not rendered by default.

262 changes: 262 additions & 0 deletions applications/plugins/SofaCUDA/Component/CMakeLists.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CMake package configuration file for the SofaCUDA.Component plugin

@PACKAGE_GUARD@
@PACKAGE_INIT@

find_package(Sofa.Config QUIET REQUIRED)

sofa_find_package(SofaCUDA.Core QUIET REQUIRED)

sofa_find_package(Sofa.Component.Mass QUIET REQUIRED)
sofa_find_package(Sofa.Component.SolidMechanics.FEM.Elastic QUIET REQUIRED)
sofa_find_package(Sofa.Component.SolidMechanics.FEM.HyperElastic QUIET REQUIRED)
sofa_find_package(Sofa.Component.SolidMechanics.TensorMass QUIET REQUIRED)
sofa_find_package(Sofa.Component.Collision.Response.Contact QUIET REQUIRED)
sofa_find_package(Sofa.Component.Collision.Detection.Intersection QUIET REQUIRED)
sofa_find_package(Sofa.Component.StateContainer QUIET REQUIRED)
sofa_find_package(Sofa.Component.Constraint.Projective QUIET REQUIRED)
sofa_find_package(Sofa.Component.Mapping.Linear QUIET REQUIRED)
sofa_find_package(Sofa.Component.Mapping.NonLinear QUIET REQUIRED)
sofa_find_package(Sofa.Component.Engine.Select QUIET REQUIRED)
sofa_find_package(Sofa.Component.Engine.Transform QUIET REQUIRED)
sofa_find_package(Sofa.Component.MechanicalLoad QUIET REQUIRED)

if(NOT TARGET SofaCUDA.Component)
include("${CMAKE_CURRENT_LIST_DIR}/SofaCUDA.ComponentTargets.cmake")
endif()

check_required_components(SofaCUDA.Component)

Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#include <sofa/gpu/cuda/CudaTypes.h>
#include <SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.inl>
#include <SofaCUDA/component/statecontainer/CudaMechanicalObject.inl>
#include <SofaCUDA/component/mapping/linear/CudaIdentityMapping.inl>
#include "CudaContactMapper.h"
#include <SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.h>
#include <SofaCUDA/component/collision/response/mapper/CudaContactMapper.h>
#include <SofaCUDA/component/collision/geometry/CudaSphereModel.h>
#include <SofaCUDA/component/collision/geometry/CudaPointModel.h>

Expand All @@ -33,23 +29,11 @@
#include <sofa/component/collision/detection/intersection/NewProximityIntersection.inl>
#include <sofa/component/collision/detection/intersection/MeshNewProximityIntersection.inl>
#include <sofa/component/collision/detection/intersection/RayDiscreteIntersection.inl>
#include <sofa/component/collision/detection/intersection/NewProximityIntersection.inl>
#include <sofa/component/collision/detection/intersection/DiscreteIntersection.h>

#include <sofa/component/collision/response/contact/RayContact.h>
#include <sofa/component/collision/response/contact/BarycentricPenalityContact.inl>
#include <sofa/component/collision/response/contact/PenalityContactForceField.h>
#include <sofa/component/collision/response/mapper/BarycentricContactMapper.inl>

#include <sofa/component/solidmechanics/spring/VectorSpringForceField.h>

#include <sofa/gl/gl.h>
#include <sofa/helper/Factory.inl>
#include <sofa/core/Mapping.inl>
#include <fstream>




namespace sofa::gpu::cuda
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#define SOFA_GPU_CUDA_CUDALINEMODEL_CPP
#include <SofaCUDA/component/config.h>

#include <SofaCUDA/component/collision/geometry/CudaLineModel.h>
#include <sofa/component/collision/geometry/LineModel.inl>
#include <sofa/core/ObjectFactory.h>

namespace sofa::component::collision::geometry
{
template class SOFA_GPU_CUDA_API LineCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
template class SOFA_GPU_CUDA_API LineCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;
template class SOFACUDA_COMPONENT_API LineCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
template class SOFACUDA_COMPONENT_API LineCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;

#ifdef SOFA_GPU_CUDA_DOUBLE
template class SOFA_GPU_CUDA_API LineCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
template class SOFA_GPU_CUDA_API LineCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
template class SOFACUDA_COMPONENT_API LineCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
template class SOFACUDA_COMPONENT_API LineCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
#endif // SOFA_GPU_CUDA_DOUBLE

} // namespace sofa::component::collision::geometry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ using CudaLine = sofa::component::collision::geometry::TLine<CudaVec3fTypes>;
namespace sofa::component::collision::geometry
{
#if !defined(SOFA_GPU_CUDA_CUDALINEMODEL_CPP)
extern template class SOFA_GPU_CUDA_API LineCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
extern template class SOFA_GPU_CUDA_API LineCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;
extern template class SOFACUDA_COMPONENT_API LineCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
extern template class SOFACUDA_COMPONENT_API LineCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;
#ifdef SOFA_GPU_CUDA_DOUBLE
extern template class SOFA_GPU_CUDA_API LineCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
extern template class SOFA_GPU_CUDA_API LineCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
extern template class SOFACUDA_COMPONENT_API LineCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
extern template class SOFACUDA_COMPONENT_API LineCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
#endif // SOFA_GPU_CUDA_DOUBLE
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
******************************************************************************/
#pragma once

#include <SofaCUDA/component/config.h>

#include <sofa/gpu/cuda/CudaTypes.h>
#include <sofa/core/CollisionModel.h>
#include <sofa/component/statecontainer/MechanicalObject.h>
Expand All @@ -36,7 +38,7 @@ using namespace sofa::defaulttype;

class CudaPointCollisionModel;

class SOFA_GPU_CUDA_API CudaPoint : public core::TCollisionElementIterator<CudaPointCollisionModel>
class SOFACUDA_COMPONENT_API CudaPoint : public core::TCollisionElementIterator<CudaPointCollisionModel>
{
public:
CudaPoint(CudaPointCollisionModel* model, Index index);
Expand All @@ -47,7 +49,7 @@ class SOFA_GPU_CUDA_API CudaPoint : public core::TCollisionElementIterator<CudaP
explicit CudaPoint(const core::CollisionElementIterator& i);
};

class SOFA_GPU_CUDA_API CudaPointCollisionModel : public core::CollisionModel
class SOFACUDA_COMPONENT_API CudaPointCollisionModel : public core::CollisionModel
{
public:
SOFA_CLASS(CudaPointCollisionModel,core::CollisionModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#define SOFA_GPU_CUDA_CUDASPHEREMODEL_CPP
#include <SofaCUDA/component/config.h>

#include <SofaCUDA/component/collision/geometry/CudaSphereModel.h>
#include <sofa/component/collision/geometry/SphereModel.inl>
Expand All @@ -28,11 +29,11 @@
namespace sofa::component::collision::geometry
{

template class SOFA_GPU_CUDA_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
template class SOFA_GPU_CUDA_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;
template class SOFACUDA_COMPONENT_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
template class SOFACUDA_COMPONENT_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;
#ifdef SOFA_GPU_CUDA_DOUBLE
template class SOFA_GPU_CUDA_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
template class SOFA_GPU_CUDA_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
template class SOFACUDA_COMPONENT_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
template class SOFACUDA_COMPONENT_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
#endif // SOFA_GPU_CUDA_DOUBLE

} // namespace sofa::component::collision::geometry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#pragma once
#include <SofaCUDA/component/config.h>

#include <sofa/gpu/cuda/CudaTypes.h>
#include <sofa/component/collision/geometry/SphereModel.h>
Expand All @@ -39,11 +40,11 @@ namespace sofa::component::collision::geometry
{

#if !defined(SOFA_GPU_CUDA_CUDASPHEREMODEL_CPP)
extern template class SOFA_GPU_CUDA_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
extern template class SOFA_GPU_CUDA_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;
extern template class SOFACUDA_COMPONENT_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
extern template class SOFACUDA_COMPONENT_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;
#ifdef SOFA_GPU_CUDA_DOUBLE
extern template class SOFA_GPU_CUDA_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
extern template class SOFA_GPU_CUDA_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
extern template class SOFACUDA_COMPONENT_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
extern template class SOFACUDA_COMPONENT_API SphereCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
#endif // SOFA_GPU_CUDA_DOUBLE
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#define SOFA_GPU_CUDA_CUDATRIANGLEMODEL_CPP
#include <SofaCUDA/component/config.h>

#include <SofaCUDA/component/collision/geometry/CudaTriangleModel.h>
#include <sofa/component/collision/geometry/TriangleModel.inl>
Expand All @@ -28,11 +29,11 @@
namespace sofa::component::collision::geometry
{

template class SOFA_GPU_CUDA_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
template class SOFA_GPU_CUDA_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;
template class SOFACUDA_COMPONENT_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
template class SOFACUDA_COMPONENT_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;
#ifdef SOFA_GPU_CUDA_DOUBLE
template class SOFA_GPU_CUDA_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
template class SOFA_GPU_CUDA_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
template class SOFACUDA_COMPONENT_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
template class SOFACUDA_COMPONENT_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
#endif // SOFA_GPU_CUDA_DOUBLE

} // namespace sofa::component::collision::geometry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ using CudaTriangle = sofa::component::collision::geometry::TTriangle<CudaVec3fTy
namespace sofa::component::collision::geometry
{
#if !defined(SOFA_GPU_CUDA_CUDATRIANGLEMODEL_CPP)
extern template class SOFA_GPU_CUDA_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
extern template class SOFA_GPU_CUDA_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;
extern template class SOFACUDA_COMPONENT_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3fTypes>;
extern template class SOFACUDA_COMPONENT_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3f1Types>;
#ifdef SOFA_GPU_CUDA_DOUBLE
extern template class SOFA_GPU_CUDA_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
extern template class SOFA_GPU_CUDA_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
extern template class SOFACUDA_COMPONENT_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3dTypes>;
extern template class SOFACUDA_COMPONENT_API TriangleCollisionModel<sofa::gpu::cuda::CudaVec3d1Types>;
#endif // SOFA_GPU_CUDA_DOUBLE
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,21 @@
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#include <SofaCUDA/component/config.h>

#include <sofa/gpu/cuda/CudaTypes.h>
#include <SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.inl>
#include <sofa/core/ObjectFactory.h>

namespace sofa::component::collision::response::contact
{
using namespace sofa::gpu::cuda;
template class SOFA_GPU_CUDA_API PenalityContactForceField< CudaVec3fTypes>;
template class SOFA_GPU_CUDA_API PenalityContactForceField< CudaVec3f1Types>;
template class SOFACUDA_COMPONENT_API PenalityContactForceField< CudaVec3fTypes>;
template class SOFACUDA_COMPONENT_API PenalityContactForceField< CudaVec3f1Types>;

#ifdef SOFA_GPU_CUDA_DOUBLE
template class SOFA_GPU_CUDA_API PenalityContactForceField< CudaVec3dTypes>;
template class SOFA_GPU_CUDA_API PenalityContactForceField< CudaVec3d1Types>;
template class SOFACUDA_COMPONENT_API PenalityContactForceField< CudaVec3dTypes>;
template class SOFACUDA_COMPONENT_API PenalityContactForceField< CudaVec3d1Types>;
#endif

} // sofa::component::collision::response::contact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
******************************************************************************/
#define SOFACUDA_CUDACONTACTMAPPER_CPP

#include <sofa/gpu/cuda/CudaContactMapper.h>
#include <SofaCUDA/component/collision/response/mapper/CudaContactMapper.h>

namespace sofa::component::collision
{

template class SOFA_GPU_CUDA_API response::mapper::ContactMapper<sofa::gpu::cuda::CudaPointCollisionModel, CudaVec3fTypes>;
template class SOFA_GPU_CUDA_API response::mapper::ContactMapper<sofa::gpu::cuda::CudaSphereCollisionModel, CudaVec3fTypes>;
template class SOFACUDA_COMPONENT_API response::mapper::ContactMapper<sofa::gpu::cuda::CudaPointCollisionModel, CudaVec3fTypes>;
template class SOFACUDA_COMPONENT_API response::mapper::ContactMapper<sofa::gpu::cuda::CudaSphereCollisionModel, CudaVec3fTypes>;

}
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ class response::mapper::ContactMapper<CudaSphereCollisionModel, DataTypes> : pub
};

#if !defined(SOFACUDA_CUDACONTACTMAPPER_CPP)
extern template class SOFA_GPU_CUDA_API response::mapper::ContactMapper<sofa::gpu::cuda::CudaPointCollisionModel, sofa::gpu::cuda::CudaVec3fTypes>;
extern template class SOFA_GPU_CUDA_API response::mapper::ContactMapper<sofa::gpu::cuda::CudaSphereCollisionModel, sofa::gpu::cuda::CudaVec3fTypes>;
extern template class SOFACUDA_COMPONENT_API response::mapper::ContactMapper<sofa::gpu::cuda::CudaPointCollisionModel, sofa::gpu::cuda::CudaVec3fTypes>;
extern template class SOFACUDA_COMPONENT_API response::mapper::ContactMapper<sofa::gpu::cuda::CudaSphereCollisionModel, sofa::gpu::cuda::CudaVec3fTypes>;
#endif

} // namespace sofa::component::collision
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/******************************************************************************
* 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 <sofa/config.h>

#ifdef SOFA_BUILD_SOFACUDA_COMPONENT
# define SOFACUDA_COMPONENT_API SOFA_EXPORT_DYNAMIC_LIBRARY
#else
# define SOFACUDA_COMPONENT_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

namespace sofacuda::component
{
constexpr const char* MODULE_NAME = "@PROJECT_NAME@";
constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@";
} // namespace sofacuda::component
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#include <SofaCUDA/component/config.h>

#include <sofa/gpu/cuda/CudaTypes.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/core/behavior/ConstraintCorrection.inl>
Expand All @@ -28,12 +30,12 @@ namespace sofa::component::constraint::lagrangian::correction
{
using namespace sofa::gpu::cuda;

template class SOFA_GPU_CUDA_API LinearSolverConstraintCorrection< CudaVec3fTypes >;
template class SOFA_GPU_CUDA_API LinearSolverConstraintCorrection< CudaVec3f1Types >;
template class SOFACUDA_COMPONENT_API LinearSolverConstraintCorrection< CudaVec3fTypes >;
template class SOFACUDA_COMPONENT_API LinearSolverConstraintCorrection< CudaVec3f1Types >;

#ifdef SOFA_GPU_CUDA_DOUBLE
template class SOFA_GPU_CUDA_API LinearSolverConstraintCorrection< CudaVec3dTypes >;
template class SOFA_GPU_CUDA_API LinearSolverConstraintCorrection< CudaVec3d1Types >;
template class SOFACUDA_COMPONENT_API LinearSolverConstraintCorrection< CudaVec3dTypes >;
template class SOFACUDA_COMPONENT_API LinearSolverConstraintCorrection< CudaVec3d1Types >;
#endif

} // namespace sofa::component::constraint::lagrangian::correction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#include <SofaCUDA/component/config.h>

#include <sofa/gpu/cuda/CudaTypes.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/core/behavior/ConstraintCorrection.inl>
Expand All @@ -28,12 +30,12 @@ namespace sofa::component::constraint::lagrangian::correction
{
using namespace sofa::gpu::cuda;

template class SOFA_GPU_CUDA_API PrecomputedConstraintCorrection< CudaVec3fTypes >;
template class SOFA_GPU_CUDA_API PrecomputedConstraintCorrection< CudaVec3f1Types >;
template class SOFACUDA_COMPONENT_API PrecomputedConstraintCorrection< CudaVec3fTypes >;
template class SOFACUDA_COMPONENT_API PrecomputedConstraintCorrection< CudaVec3f1Types >;

#ifdef SOFA_GPU_CUDA_DOUBLE
template class SOFA_GPU_CUDA_API PrecomputedConstraintCorrection< CudaVec3dTypes >;
template class SOFA_GPU_CUDA_API PrecomputedConstraintCorrection< CudaVec3d1Types >;
template class SOFACUDA_COMPONENT_API PrecomputedConstraintCorrection< CudaVec3dTypes >;
template class SOFACUDA_COMPONENT_API PrecomputedConstraintCorrection< CudaVec3d1Types >;
#endif

} // namespace sofa::component::constraint::lagrangian::correction
Expand Down
Loading
Loading