From db59e9fd955c6cd66f3ab2e8f76033e545e0163d Mon Sep 17 00:00:00 2001 From: Jeremie Allard Date: Thu, 28 Jun 2012 18:13:17 +0000 Subject: [PATCH 01/47] r12541/sofa-dev : WARNING: move cuda library into a plugin. cuda_dev is currently disabled, until it is also moved into a plugin. //partial sync (239/371 changes)// Former-commit-id: 76938e8326b59943494ec613633530609a03c340 --- .../sofa/gpu/cuda/CudaParticleSource.cpp | 65 ++++ .../sofa/gpu/cuda/CudaParticleSource.cu | 135 +++++++ .../sofa/gpu/cuda/CudaParticleSource.h | 69 ++++ .../sofa/gpu/cuda/CudaParticleSource.inl | 153 ++++++++ .../sofa/gpu/cuda/CudaSpatialGridContainer.h | 139 +++++++ .../gpu/cuda/CudaSpatialGridContainer.inl | 349 ++++++++++++++++++ 6 files changed, 910 insertions(+) create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp new file mode 100644 index 0000000..774edd6 --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp @@ -0,0 +1,65 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include "CudaTypes.h" +#include "CudaParticleSource.inl" +#include + + +namespace sofa +{ + +namespace core +{ +namespace behavior +{ +template class ProjectiveConstraintSet; +#ifdef SOFA_GPU_CUDA_DOUBLE +template class ProjectiveConstraintSet; +#endif +} // namespace behavior +} // namespace core + +namespace gpu +{ + +namespace cuda +{ + + + +SOFA_DECL_CLASS(CudaParticleSource) + +int ParticleSourceCudaClass = core::RegisterObject("Supports GPU-side computations using CUDA") + .add< component::misc::ParticleSource >() +#ifdef SOFA_GPU_CUDA_DOUBLE + .add< component::misc::ParticleSource >() +#endif // SOFA_GPU_CUDA_DOUBLE + ; + +} // namespace cuda + +} // namespace gpu + +} // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu new file mode 100644 index 0000000..03f1761 --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu @@ -0,0 +1,135 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include "CudaCommon.h" +#include "CudaMath.h" +#include "cuda.h" + +#if defined(__cplusplus) && CUDA_VERSION < 2000 +namespace sofa +{ +namespace gpu +{ +namespace cuda +{ +#endif + +extern "C" +{ + + void ParticleSourceCuda3f_fillValues(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, float fx, float fy, float fz); + void ParticleSourceCuda3f_copyValuesWithOffset(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, const void* src, float fx, float fy, float fz); + +#ifdef SOFA_GPU_CUDA_DOUBLE + + void ParticleSourceCuda3d_fillValues(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, double fx, double fy, double fz); + void ParticleSourceCuda3d_copyValuesWithOffset(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, const void* src, double fx, double fy, double fz); + +#endif // SOFA_GPU_CUDA_DOUBLE +} + +////////////////////// +// GPU-side methods // +////////////////////// + + +template +__global__ void ParticleSourceCuda3t_fillValues_kernel(unsigned int totalsize, unsigned int subsetsize, real* dest, const unsigned int* indices, real fx, real fy, real fz) +{ + unsigned int index0 = umul24(blockIdx.x,BSIZE); + unsigned int index = index0+threadIdx.x; + if (index < subsetsize) + { + unsigned int dindex = indices[index]; + if (dindex < totalsize) + { + unsigned int dindex3 = umul24(dindex,3); + dest[dindex3+0] = fx; + dest[dindex3+1] = fy; + dest[dindex3+2] = fz; + } + } +} + +template +__global__ void ParticleSourceCuda3t_copyValuesWithOffset_kernel(unsigned int totalsize, unsigned int subsetsize, real* dest, const unsigned int* indices, const real* src, real fx, real fy, real fz) +{ + unsigned int index0 = umul24(blockIdx.x,BSIZE); + unsigned int index = index0+threadIdx.x; + if (index < subsetsize) + { + unsigned int dindex = indices[index]; + if (dindex < totalsize) + { + unsigned int dindex3 = umul24(dindex,3); + unsigned int index3 = umul24(index,3); + dest[dindex3+0] = src[index3+0]+fx; + dest[dindex3+1] = src[index3+1]+fy; + dest[dindex3+2] = src[index3+2]+fz; + } + } +} + +////////////////////// +// CPU-side methods // +////////////////////// + + +void ParticleSourceCuda3f_fillValues(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, float fx, float fy, float fz) +{ + dim3 threads(BSIZE,1); + dim3 grid((subsetsize+BSIZE-1)/BSIZE,1); + {ParticleSourceCuda3t_fillValues_kernel<<< grid, threads >>>(totalsize, subsetsize, (float*)dest, (const unsigned int*)indices, fx, fy, fz); mycudaDebugError("ParticleSourceCuda3t_fillValues_kernel");} +} + +void ParticleSourceCuda3f_copyValuesWithOffset(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, const void* src, float fx, float fy, float fz) +{ + dim3 threads(BSIZE,1); + dim3 grid((subsetsize+BSIZE-1)/BSIZE,1); + {ParticleSourceCuda3t_copyValuesWithOffset_kernel<<< grid, threads >>>(totalsize, subsetsize, (float*)dest, (const unsigned int*)indices, (const float*)src, fx, fy, fz); mycudaDebugError("ParticleSourceCuda3t_copyValuesWithOffset_kernel");} +} + +#ifdef SOFA_GPU_CUDA_DOUBLE + +void ParticleSourceCuda3d_fillValues(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, double fx, double fy, double fz) +{ + dim3 threads(BSIZE,1); + dim3 grid((subsetsize+BSIZE-1)/BSIZE,1); + {ParticleSourceCuda3t_fillValues_kernel<<< grid, threads >>>(totalsize, subsetsize, (double*)dest, (const unsigned int*)indices, fx, fy, fz); mycudaDebugError("ParticleSourceCuda3t_fillValues_kernel");} +} + +void ParticleSourceCuda3d_copyValuesWithOffset(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, const void* src, double fx, double fy, double fz) +{ + dim3 threads(BSIZE,1); + dim3 grid((subsetsize+BSIZE-1)/BSIZE,1); + {ParticleSourceCuda3t_copyValuesWithOffset_kernel<<< grid, threads >>>(totalsize, subsetsize, (double*)dest, (const unsigned int*)indices, (const double*)src, fx, fy, fz); mycudaDebugError("ParticleSourceCuda3t_copyValuesWithOffset_kernel");} +} + +#endif // SOFA_GPU_CUDA_DOUBLE + +#if defined(__cplusplus) && CUDA_VERSION < 2000 +} // namespace cuda +} // namespace gpu +} // namespace sofa +#endif diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h new file mode 100644 index 0000000..456bedb --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -0,0 +1,69 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#ifndef SOFA_GPU_CUDA_CUDAPARTICLESOURCE_H +#define SOFA_GPU_CUDA_CUDAPARTICLESOURCE_H + +#include "CudaTypes.h" +#include +#include + +namespace sofa +{ + +namespace component +{ + +namespace misc +{ + +template <> +void ParticleSource::projectResponse(VecDeriv& res); + +template <> +void ParticleSource::projectVelocity(VecDeriv& res); + +template <> +void ParticleSource::projectPosition(VecCoord& res); + +#ifdef SOFA_GPU_CUDA_DOUBLE + +template <> +void ParticleSource::projectResponse(VecDeriv& res); + +template <> +void ParticleSource::projectVelocity(VecDeriv& res); + +template <> +void ParticleSource::projectPosition(VecCoord& res); + +#endif // SOFA_GPU_CUDA_DOUBLE + +} // namespace misc + +} // namespace component + +} // namespace sofa + +#endif diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl new file mode 100644 index 0000000..0f89a33 --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -0,0 +1,153 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#ifndef SOFA_GPU_CUDA_CUDAPARTICLESOURCE_INL +#define SOFA_GPU_CUDA_CUDAPARTICLESOURCE_INL + +#include "CudaParticleSource.h" +//#include +#include + +namespace sofa +{ + +namespace gpu +{ + +namespace cuda +{ + +extern "C" +{ + + void ParticleSourceCuda3f_fillValues(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, float fx, float fy, float fz); + void ParticleSourceCuda3f_copyValuesWithOffset(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, const void* src, float fx, float fy, float fz); + + +#ifdef SOFA_GPU_CUDA_DOUBLE + + void ParticleSourceCuda3d_fillValues(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, double fx, double fy, double fz); + void ParticleSourceCuda3d_copyValuesWithOffset(unsigned int totalsize, unsigned int subsetsize, void* dest, const void* indices, const void* src, double fx, double fy, double fz); + +#endif // SOFA_GPU_CUDA_DOUBLE +} + +} // namespace cuda + +} // namespace gpu + +namespace component +{ + +namespace misc +{ + +using namespace gpu::cuda; + +template <> +void ParticleSource::projectResponse(VecDeriv& res) +{ + if (!this->mstate) return; + const VecIndex& lastparticles = this->lastparticles.getValue(); + if (lastparticles.empty()) return; + //sout << "ParticleSource: projectResponse of last particles ("<getTime(); + if (time < f_start.getValue() || time > f_stop.getValue()) return; + // constraint the last values + //mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Deriv)); + ParticleSourceCuda3f_fillValues(res.size(), lastparticles.size(), res.deviceWrite(), lastparticles.deviceRead(), 0, 0, 0); +} + +template <> +void ParticleSource::projectVelocity(VecDeriv& res) +{ + if (!this->mstate) return; + const VecIndex& lastparticles = this->lastparticles.getValue(); + if (lastparticles.empty()) return; + //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); + if (time < f_start.getValue() || time > f_stop.getValue()) return; + // constraint the last values + Deriv vel = f_velocity.getValue(); +#if 1 + //mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Coord)); + ParticleSourceCuda3f_fillValues(res.size(), lastparticles.size(), res.deviceWrite(), lastparticles.deviceRead(), vel[0], vel[1], vel[2]); +#else + for (unsigned int s=0; s +void ParticleSource::projectPosition(VecCoord& res) +{ + if (!this->mstate) return; + const VecIndex& lastparticles = this->lastparticles.getValue(); + if (lastparticles.empty()) return; + //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); + if (time < f_start.getValue() || time > f_stop.getValue()) return; + // constraint the last values + Deriv vel = f_velocity.getValue(); + vel *= (time-lasttime); + //mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Coord)); + ParticleSourceCuda3f_copyValuesWithOffset(res.size(), lastparticles.size(), res.deviceWrite(), lastparticles.deviceRead(), lastpos.deviceRead(), vel[0], vel[1], vel[2]); +} + + +#ifdef SOFA_GPU_CUDA_DOUBLE + +template <> +void ParticleSource::projectResponse(VecDeriv& res) +{ + if (!this->mstate) return; + const VecIndex& lastparticles = this->lastparticles.getValue(); + if (lastparticles.empty()) return; + //sout << "ParticleSource: projectResponse of last particle ("<getTime(); + if (time < f_start.getValue() || time > f_stop.getValue()) return; + // constraint the last values + mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Coord)); +} + +template <> +void ParticleSource::projectVelocity(VecDeriv& /*res*/) +{ +} + +template <> +void ParticleSource::projectPosition(VecDeriv& /*res*/) +{ +} + +#endif // SOFA_GPU_CUDA_DOUBLE + +} // namespace misc + +} // namespace component + +} // namespace sofa + +#endif diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h new file mode 100644 index 0000000..c77b51f --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -0,0 +1,139 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +// +// C++ Interface: SpatialGridContainer +// +// Description: +// +// +// Author: The SOFA team , (C) 2006 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#ifndef SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_H +#define SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_H + +#include +#include +#include + +namespace sofa +{ + +namespace component +{ + +namespace container +{ + +using namespace sofa::defaulttype; + +template +class SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > > +{ +public: + typedef SpatialGridTypes < gpu::cuda::CudaVectorTypes > DataTypes; + typedef typename DataTypes::Real Real; + typedef typename DataTypes::Coord Coord; + typedef typename DataTypes::VecCoord VecCoord; + typedef typename DataTypes::CellData CellData; + typedef typename DataTypes::GridData GridData; + //typedef typename DataTypes::NeighborListener NeighborListener; + typedef typename DataTypes::ParticleField ParticleField; + + enum + { + HASH_PX = 73856093, + HASH_PY = 19349663, + HASH_PZ = 83492791, + }; + +public: + SpatialGrid(Real cellWidth); + + ~SpatialGrid(); + + void update(const VecCoord& x); + + void draw(const core::visual::VisualParams*); + + template + void findNeighbors(NeighborListener* dest, Real dist); + + void computeField(ParticleField* field, Real dist); + + /// Change particles ordering inside a given cell have contiguous indices + /// + /// Fill the old2new and new2old arrays giving the permutation to apply + void reorderIndices(helper::vector* old2new, helper::vector* new2old); + GridData data; + + Real getCellWidth() const { return cellWidth; } + Real getInvCellWidth() const { return invCellWidth; } + + int getCellBits() const { return cellBits; } + int getNbCells() const { return nbCells; } + + int getCell(const Coord& c) const + { + return ( (helper::rfloor(c[0]*invCellWidth*0.5f) * HASH_PX) ^ + (helper::rfloor(c[1]*invCellWidth*0.5f) * HASH_PY) ^ + (helper::rfloor(c[2]*invCellWidth*0.5f) * HASH_PZ) ) & ((1 << cellBits)-1); + } + + //const sofa::gpu::cuda::CudaVector< unsigned int >& getParticleIndexVector() const { return particleIndex; } + const sofa::gpu::cuda::CudaVector< int >& getCellsVector() const { return cells; } + const sofa::gpu::cuda::CudaVector< int >& getCellGhostVector() const { return cellGhost; } + +protected: + const Real cellWidth; + const Real invCellWidth; + int cellBits, nbCells; + sofa::gpu::cuda::CudaVector< unsigned int > /*particleIndex,*/ particleHash; + //sofa::gpu::cuda::CudaVector< int > cellRange; + sofa::gpu::cuda::CudaVector< int > cells; + sofa::gpu::cuda::CudaVector< int > cellGhost; + sofa::gpu::cuda::CudaVector< sofa::gpu::cuda::Vec3f1 > sortedPos; + const VecCoord* lastX; + + void kernel_computeHash( + int cellBits, Real cellWidth, int nbPoints, void* particleIndex, void* particleHash, const void* x); + + void kernel_updateGrid( + int cellBits, int index0, Real cellWidth, int nbPoints, const void* particleHash, + void* cells, void* cellGhost); + //void kernel_reorderData(int nbPoints, const void* particleIndex, const void* particleHash, void* sorted, const void* x); + +}; + +} // namespace container + +} // namespace component + +} // namespace sofa + +#endif diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl new file mode 100644 index 0000000..5626ff9 --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -0,0 +1,349 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +// +// C++ Interface: SpatialGridContainer +// +// Description: +// +// +// Author: The SOFA team , (C) 2006 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#ifndef SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_INL +#define SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_INL + +#include +#include +#include +#include + +namespace sofa +{ + +namespace gpu +{ + +namespace cuda +{ + +extern "C" +{ + void SpatialGridContainer3f_computeHash(int cellBits, float cellWidth, int nbPoints, void* particleIndex8, void* particleHash8, const void* x); + void SpatialGridContainer3f1_computeHash(int cellBits, float cellWidth, int nbPoints, void* particleIndex8, void* particleHash8, const void* x); + void SpatialGridContainer_findCellRange(int cellBits, int index0, float cellWidth, int nbPoints, const void* particleHash8, void* cellRange, void* cellGhost); +//void SpatialGridContainer3f_reorderData(int nbPoints, const void* particleHash, void* sorted, const void* x); +//void SpatialGridContainer3f1_reorderData(int nbPoints, const void* particleHash, void* sorted, const void* x); +} + +} // namespace cuda + +} // namespace gpu + +namespace component +{ + +namespace container +{ + +using namespace sofa::helper; + +// template +// typename SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::Grid SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::emptyGrid; + +template +SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::SpatialGrid(Real cellWidth) + : cellWidth(cellWidth), invCellWidth(1/cellWidth), lastX(NULL) +{ + cellBits = 15; + nbCells = 1< +SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::~SpatialGrid() +{ +} + +template template +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::findNeighbors(NeighborListener* /*dest*/, Real /*dist*/) +{ + std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::findNeighbors(NeighborListener* dest, Real dist)"< +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::computeField(ParticleField* /*field*/, Real /*dist*/) +{ + std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::computeField(ParticleField* field, Real dist)"< +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(helper::vector* /*old2new*/, helper::vector* /*new2old*/) +{ + std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(helper::vector* old2new, helper::vector* new2old)"< +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3fTypes > >::kernel_computeHash( + int cellBits, Real cellWidth, int nbPoints, void* particleIndex, void* particleHash, + const void* x) +{ + /* + { + helper::ReadAccessor< sofa::gpu::cuda::CudaVector< unsigned int > > pparticleHash = this->particleHash; + for (int i=0;iparticleHash.deviceWrite(); + { + helper::ReadAccessor< sofa::gpu::cuda::CudaVector< unsigned int > > pparticleHash = this->particleHash; + for (int i=0;i +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3fTypes > >::kernel_updateGrid( + int cellBits, int index0, Real cellWidth, int nbPoints, const void* particleHash, + void* cells, void* cellGhost) +{ + //int nbbits = 8; + //while (nbbits < cellBits + 1) nbbits+=8; + //CudaSort(particleHash,particleIndex,nbbits,nbPoints*8); + gpu::cuda::SpatialGridContainer_findCellRange(cellBits, index0, cellWidth, nbPoints, particleHash, cells, cellGhost); +} + +template<> +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3f1Types > >::kernel_computeHash( + int cellBits, Real cellWidth, int nbPoints, void* particleIndex, void* particleHash, + const void* x) +{ + gpu::cuda::SpatialGridContainer3f1_computeHash(cellBits, cellWidth, nbPoints, particleIndex, particleHash, x); +} + +template<> +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3f1Types > >::kernel_updateGrid( + int cellBits, int index0, Real cellWidth, int nbPoints, const void* particleHash, + void* cells, void* cellGhost) +{ + gpu::cuda::SpatialGridContainer_findCellRange(cellBits, index0, cellWidth, nbPoints, particleHash, cells, cellGhost); +} + +#ifdef SOFA_GPU_CUDA_DOUBLE + +template<> +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_computeHash( + int /*cellBits*/, Real /*cellWidth*/, int /*nbPoints*/, void* /*particleIndex*/, void* /*particleHash*/, + const void* /*x*/) +{ + std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_computeHash()"< +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_updateGrid( + int /*cellBits*/, int /*index0*/, Real /*cellWidth*/, int /*nbPoints*/, const void* /*particleHash*/, + void* /*cells*/, void* /*cellGhost*/) +{ + std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_updateGrid()"< +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3fTypes > >::kernel_reorderData(int nbPoints, const void* particleHash, void* sorted, const void* x) +{ + gpu::cuda::SpatialGridContainer3f_reorderData(nbPoints, particleHash, sorted, x); +} + +template<> +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3f1Types > >::kernel_reorderData(int nbPoints, const void* particleHash, void* sorted, const void* x) +{ + gpu::cuda::SpatialGridContainer3f1_reorderData(nbPoints, particleHash, sorted, x); +} +*/ + +template +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::update(const VecCoord& x) +{ + lastX = &x; + data.clear(); + int nbPoints = x.size(); + int index0 = nbCells+BSIZE; + /*particleIndex*/ cells.recreate(index0+nbPoints*8,8*BSIZE); + particleHash.recreate(nbPoints*8,8*BSIZE); + + { + unsigned int numElements = (unsigned int)nbPoints*8; + sofa::gpu::cuda::CudaSortPrepare(numElements); + } + +#ifdef SOFA_DEV + //sortTmp.recreate(radixSortTempStorage(nbPoints*8)); + //sortTmp.deviceWrite(); +#endif + + //cells.recreate(nbCells+1); + cellGhost.recreate(nbCells); + //sortedPos.recreate(nbPoints); +#if 0 + { + helper::WriteAccessor< sofa::gpu::cuda::CudaVector< int > > pcells = cells; + helper::WriteAccessor< sofa::gpu::cuda::CudaVector< unsigned int > > pparticleHash = particleHash; + helper::ReadAccessor< VecCoord > px = x; + const Real pcellWidth = cellWidth*2.0f; + //const Real pinvCellWidth = 1.0f/pcellWidth; + const int pcellMask = (1<> 1; + hgpos_y = (hgpos_y-1) >> 1; + hgpos_z = (hgpos_z-1) >> 1; + unsigned int hx = (HASH_PX*hgpos_x); + unsigned int hy = (HASH_PY*hgpos_y); + unsigned int hz = (HASH_PZ*hgpos_z); + for (int x=0; x<8; ++x) + { + unsigned int h_x = hx; if (x&1) h_x += HASH_PX; + unsigned int h_y = hy; if (x&2) h_y += HASH_PY; + unsigned int h_z = hz; if (x&4) h_z += HASH_PZ; + unsigned int hash = ((h_x ^ h_y ^ h_z) & pcellMask)<<1; + if (halfcell != x) ++hash; + pcells[index0 + i*8 + x] = i; + pparticleHash[i*8 + x] = hash; + } + } + } +#endif +#if 0 + helper::vector< std::pair > cpusort; + cpusort.resize(8*nbPoints); + for (int i=0; i<8*nbPoints; ++i) + cpusort[i] = std::make_pair(pparticleHash[i],pcells[index0+i]); + std::sort(cpusort.begin(),cpusort.end(),compare_pair_first); + + for (int i=0; i<8*nbPoints; ++i) + { + pparticleHash[i] = cpusort[i].first; + pcells[index0+i] = cpusort[i].second; + } +#endif + + kernel_computeHash( + cellBits, cellWidth*2, nbPoints, cells.deviceWriteAt(index0), particleHash.deviceWrite(), + x.deviceRead()); + + { + int nbbits = 8; + while (nbbits < cellBits + 1) nbbits+=8; + sofa::gpu::cuda::CudaSort(&particleHash,0, &cells,index0, nbPoints*8, nbbits); + } + + kernel_updateGrid( + cellBits, index0, cellWidth*2, nbPoints, particleHash.deviceRead(), + cells.deviceWrite(), cellGhost.deviceWrite()); +#if 0 + std::cout << nbPoints*8 << " entries in " << nbCells << " cells." << std::endl; + int nfill = 0; + for (int c=0; c cellBegin + nbPoints/2) // || nfill >= 100 && nfill < 110) + std::cout << "Cell " << c << ": range = " << cellBegin-index0 << " - " << cellEnd-index0 << " ghost = " << cellGhost[c]-index0 << std::endl; + ++nfill; + } + std::cout << ((1000*nfill)/nbCells) * 0.1 << " % cells with particles." << std::endl; +#endif + + //kernel_reorderData(nbPoints, particleHash.deviceRead(), sortedPos.deviceWrite(), x.deviceRead()); +} + +template +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::draw(const core::visual::VisualParams* ) +{ + if (!lastX) return; + int nbPoints = particleHash.size(); + int index0 = nbCells+BSIZE; + glDisable(GL_LIGHTING); + glColor4f(1,1,1,1); + glPointSize(3); + glBegin(GL_POINTS); + unsigned int last = 0; + for (int i=0; i>=1; + //if (cell != 0 && cell != 65535) + // std::cout << i << ": "< "< "<>2)&3; + int b = (cell>>4)&3; + glColor4ub(63+r*64,63+g*64,63+b*64,255); + //glVertex3fv(sortedPos[i].ptr()); + helper::gl::glVertexT((*lastX)[p]); + } + glEnd(); + glPointSize(1); +} + +} // namespace container + +} // namespace component + +} // namespace sofa + +#endif From 60d7c80b5fdeac467be806abc60d8774f77e1207 Mon Sep 17 00:00:00 2001 From: Jeremie Allard Date: Mon, 6 Aug 2012 18:05:07 +0000 Subject: [PATCH 02/47] r12640/sofa-dev : Move GPU SPH code to SofaCUDA plugin Former-commit-id: 8b8803f859d5c713990114c543ebb8707ed22edd --- .../cuda/CudaParticlesRepulsionForceField.cpp | 51 + .../cuda/CudaParticlesRepulsionForceField.cu | 323 +++++ .../cuda/CudaParticlesRepulsionForceField.h | 85 ++ .../cuda/CudaParticlesRepulsionForceField.inl | 178 +++ .../sofa/gpu/cuda/CudaSPHFluidForceField.cpp | 51 + .../sofa/gpu/cuda/CudaSPHFluidForceField.cu | 1249 +++++++++++++++++ .../sofa/gpu/cuda/CudaSPHFluidForceField.h | 145 ++ .../sofa/gpu/cuda/CudaSPHFluidForceField.inl | 284 ++++ .../gpu/cuda/CudaSpatialGridContainer.cpp | 63 + .../sofa/gpu/cuda/CudaSpatialGridContainer.cu | 380 +++++ 10 files changed, 2809 insertions(+) create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp create mode 100644 applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp new file mode 100644 index 0000000..e25e973 --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp @@ -0,0 +1,51 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include +#include "CudaParticlesRepulsionForceField.inl" +#include + +namespace sofa +{ + +namespace gpu +{ + +namespace cuda +{ + +SOFA_DECL_CLASS(CudaParticlesRepulsionForceField) + +int ParticlesRepulsionForceFieldCudaClass = core::RegisterObject("Supports GPU-side computations using CUDA") + .add< component::forcefield::ParticlesRepulsionForceField >() +#ifdef SOFA_GPU_CUDA_DOUBLE + .add< component::forcefield::ParticlesRepulsionForceField >() +#endif // SOFA_GPU_CUDA_DOUBLE + ; + +} // namespace cuda + +} // namespace gpu + +} // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu new file mode 100644 index 0000000..984a6c3 --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu @@ -0,0 +1,323 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include +#include +#include "cuda.h" + +#if defined(__cplusplus) && CUDA_VERSION < 2000 +namespace sofa +{ +namespace gpu +{ +namespace cuda +{ +#endif + +template +class GPURepulsion +{ +public: + real d; + real d2; + real stiffness; + real damping; +}; + +typedef GPURepulsion GPURepulsion3f; +typedef GPURepulsion GPURepulsion3d; + +extern "C" +{ + void ParticlesRepulsionForceFieldCuda3f_addForce (unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3f* repulsion, void* f, const void* x, const void* v ); + void ParticlesRepulsionForceFieldCuda3f_addDForce(unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3f* repulsion, void* f, const void* x, const void* dx); + +#ifdef SOFA_GPU_CUDA_DOUBLE + + void ParticlesRepulsionForceFieldCuda3d_addForce (unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3d* repulsion, void* f, const void* x, const void* v ); + void ParticlesRepulsionForceFieldCuda3d_addDForce(unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3d* repulsion, void* f, const void* x, const void* dx); + +#endif // SOFA_GPU_CUDA_DOUBLE +} + +////////////////////// +// GPU-side methods // +////////////////////// + +template +__device__ void ParticlesRepulsionCalcForce(CudaVec3 x1, CudaVec3 v1, CudaVec3 x2, CudaVec3 v2, CudaVec3& force, GPURepulsion& rep) +{ + CudaVec3 n = x2-x1; + real d2 = norm2(n); + if (d2 < rep.d2) + { + CudaVec3 vi = v2-v1; + real inv_d = rsqrtf(d2); + n *= inv_d; + real d = d2*inv_d - rep.d; + real forceIntensity = rep.stiffness*d; + real dampingIntensity = rep.damping*d; + force += n*forceIntensity - vi*dampingIntensity; + } +} + +template +__device__ void ParticlesRepulsionCalcDForce(CudaVec3 x1, CudaVec3 dx1, CudaVec3 x2, CudaVec3 dx2, CudaVec3& dforce, GPURepulsion& rep) +{ + CudaVec3 n = x2-x1; + real d2 = norm2(n); + if (d2 < rep.d2) + { + CudaVec3 dxi = dx2-dx1; + //real inv_d = rsqrtf(d2); + //n *= inv_d; + //dforce = n * (rep.stiffness * dot(dxi, n)); + + //dforce = (n * (rep.stiffness * dot(dxi, n)))/d2; + + dforce += n * (real)__fdividef((rep.stiffness * dot(dxi, n)),d2); + } +} + +template +__global__ void ParticlesRepulsionForceFieldCuda3t_addForce_kernel(int size, const int *cells, const int *cellGhost, GPURepulsion repulsion, real* f, const real* x, const real* v) +{ + __shared__ int2 range; + __shared__ int ghost; + __shared__ real temp_x[BSIZE*3]; + __shared__ real temp_v[BSIZE*3]; + int tx3 = __umul24(threadIdx.x,3); + for (int cell = blockIdx.x; cell < size; cell += gridDim.x) + { + if (!threadIdx.x) + { + //range = *(const int2*)(cells+cell); + range.x = cells[cell]; + range.y = cells[cell+1]; + range.y &= ~(1U<<31); + ghost = cellGhost[cell]; + } + __syncthreads(); + if (range.x <= 0) continue; // no actual particle in this cell + for (int px0 = range.x; px0 < ghost; px0 += BSIZE) + { + int px = px0 + threadIdx.x; + CudaVec3 xi; + CudaVec3 vi; + CudaVec3 force; + int index; + if (px < range.y) + { + index = cells[px]; + xi = ((const CudaVec3*)x)[index]; + temp_x[tx3 ] = xi.x; + temp_x[tx3+1] = xi.y; + temp_x[tx3+2] = xi.z; + vi = ((const CudaVec3*)v)[index]; + temp_v[tx3 ] = vi.x; + temp_v[tx3+1] = vi.y; + temp_v[tx3+2] = vi.z; + } + __syncthreads(); + if (px < ghost) + { + // actual particle -> compute interactions + force = CudaVec3::make(0,0,0); + int np = min(range.y-px0,BSIZE); + for (int i=0; i < np; ++i) + { + if (i != threadIdx.x) + ParticlesRepulsionCalcForce(xi, vi, ((const CudaVec3*)temp_x)[i], ((const CudaVec3*)temp_v)[i], force, repulsion); + } + } + __syncthreads(); + // loop through other groups of particles + for (int py0 = range.x; py0 < range.y; py0 += BSIZE) + { + if (py0 == px0) continue; + int py = py0 + threadIdx.x; + if (py < range.y) + { + int index2 = cells[py]; + CudaVec3 xj = ((const CudaVec3*)x)[index2]; + temp_x[tx3 ] = xj.x; + temp_x[tx3+1] = xj.y; + temp_x[tx3+2] = xj.z; + CudaVec3 vj = ((const CudaVec3*)v)[index2]; + temp_v[tx3 ] = vj.x; + temp_v[tx3+1] = vj.y; + temp_v[tx3+2] = vj.z; + } + __syncthreads(); + if (px < ghost) + { + // actual particle -> compute interactions + int np = min(range.y-py0,BSIZE); + for (int i=0; i < np; ++i) + { + ParticlesRepulsionCalcForce(xi, vi, ((const CudaVec3*)temp_x)[i], ((const CudaVec3*)temp_v)[i], force, repulsion); + } + } + __syncthreads(); + } + if (px < ghost) + { + // actual particle -> write computed force + ((CudaVec3*)f)[index] += force; + } + } + } +} + +template +__global__ void ParticlesRepulsionForceFieldCuda3t_addDForce_kernel(int size, const int *cells, const int *cellGhost, GPURepulsion repulsion, real* df, const real* x, const real* dx) +{ + __shared__ int2 range; + __shared__ int ghost; + __shared__ real temp_x[BSIZE*3]; + __shared__ real temp_dx[BSIZE*3]; + int tx3 = __umul24(threadIdx.x,3); + for (int cell = blockIdx.x; cell < size; cell += gridDim.x) + { + if (!threadIdx.x) + { + //range = *(const int2*)(cells+cell); + range.x = cells[cell]; + range.y = cells[cell+1]; + range.y &= ~(1U<<31); + ghost = cellGhost[cell]; + } + __syncthreads(); + if (range.x <= 0) continue; // no actual particle in this cell + for (int px0 = range.x; px0 < ghost; px0 += BSIZE) + { + int px = px0 + threadIdx.x; + CudaVec3 xi; + CudaVec3 dxi; + CudaVec3 dforce; + int index; + if (px < range.y) + { + index = cells[px]; + xi = ((const CudaVec3*)x)[index]; + temp_x[tx3 ] = xi.x; + temp_x[tx3+1] = xi.y; + temp_x[tx3+2] = xi.z; + dxi = ((const CudaVec3*)dx)[index]; + temp_dx[tx3 ] = dxi.x; + temp_dx[tx3+1] = dxi.y; + temp_dx[tx3+2] = dxi.z; + } + __syncthreads(); + if (px < ghost) + { + // actual particle -> compute interactions + dforce = CudaVec3::make(0,0,0); + int np = min(range.y-px0,BSIZE); + for (int i=0; i < np; ++i) + { + if (i != threadIdx.x) + ParticlesRepulsionCalcDForce(xi, dxi, ((const CudaVec3*)temp_x)[i], ((const CudaVec3*)temp_dx)[i], dforce, repulsion); + } + } + __syncthreads(); + // loop through other groups of particles + for (int py0 = range.x; py0 < range.y; py0 += BSIZE) + { + if (py0 == px0) continue; + int py = py0 + threadIdx.x; + if (py < range.y) + { + int index2 = cells[py]; + CudaVec3 xj = ((const CudaVec3*)x)[index2]; + temp_x[tx3 ] = xj.x; + temp_x[tx3+1] = xj.y; + temp_x[tx3+2] = xj.z; + CudaVec3 dxj = ((const CudaVec3*)dx)[index2]; + temp_dx[tx3 ] = dxj.x; + temp_dx[tx3+1] = dxj.y; + temp_dx[tx3+2] = dxj.z; + } + __syncthreads(); + if (px < ghost) + { + // actual particle -> compute interactions + int np = min(range.y-py0,BSIZE); + for (int i=0; i < np; ++i) + { + ParticlesRepulsionCalcDForce(xi, dxi, ((const CudaVec3*)temp_x)[i], ((const CudaVec3*)temp_dx)[i], dforce, repulsion); + } + } + __syncthreads(); + } + if (px < ghost) + { + // actual particle -> write computed force + ((CudaVec3*)df)[index] += dforce; + } + } + } +} + +////////////////////// +// CPU-side methods // +////////////////////// + +void ParticlesRepulsionForceFieldCuda3f_addForce(unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3f* repulsion, void* f, const void* x, const void* v) +{ + dim3 threads(BSIZE,1); + dim3 grid(60,1); + {ParticlesRepulsionForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *repulsion, (float*)f, (const float*)x, (const float*)v); mycudaDebugError("ParticlesRepulsionForceFieldCuda3t_addForce_kernel");} +} + +void ParticlesRepulsionForceFieldCuda3f_addDForce(unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3f* repulsion, void* df, const void* x, const void* dx) +{ + dim3 threads(BSIZE,1); + dim3 grid(60/BSIZE,1); + {ParticlesRepulsionForceFieldCuda3t_addDForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *repulsion, (float*)df, (const float*)x, (const float*)dx); mycudaDebugError("ParticlesRepulsionForceFieldCuda3t_addDForce_kernel");} +} + +#ifdef SOFA_GPU_CUDA_DOUBLE + +void ParticlesRepulsionForceFieldCuda3d_addForce(unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3d* repulsion, void* f, const void* x, const void* v) +{ + dim3 threads(BSIZE,1); + dim3 grid(60/BSIZE,1); + {ParticlesRepulsionForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *repulsion, (double*)f, (const double*)x, (const double*)v); mycudaDebugError("ParticlesRepulsionForceFieldCuda3t_addForce_kernel");} +} + +void ParticlesRepulsionForceFieldCuda3d_addDForce(unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3d* repulsion, void* df, const void* x, const void* dx) +{ + dim3 threads(BSIZE,1); + dim3 grid(60/BSIZE,1); + {ParticlesRepulsionForceFieldCuda3t_addDForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *repulsion, (double*)df, (const double*)x, (const double*)dx); mycudaDebugError("ParticlesRepulsionForceFieldCuda3t_addDForce_kernel");} +} + +#endif // SOFA_GPU_CUDA_DOUBLE + +#if defined(__cplusplus) && CUDA_VERSION < 2000 +} // namespace cuda +} // namespace gpu +} // namespace sofa +#endif diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h new file mode 100644 index 0000000..f5a7aa3 --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -0,0 +1,85 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#ifndef SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_H +#define SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_H + +#include +#include +#include + +namespace sofa +{ + +namespace gpu +{ + +namespace cuda +{ + +template +struct GPURepulsion +{ + real d; + real d2; + real stiffness; + real damping; +}; + +typedef GPURepulsion GPURepulsion3f; +typedef GPURepulsion GPURepulsion3d; + +} // namespace cuda + +} // namespace gpu + +namespace component +{ + +namespace forcefield +{ + +template <> +void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); + +template <> +void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx); + +#ifdef SOFA_GPU_CUDA_DOUBLE + +template <> +void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); + +template <> +void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx); + +#endif // SOFA_GPU_CUDA_DOUBLE + +} // namespace forcefield + +} // namespace component + +} // namespace sofa + +#endif diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl new file mode 100644 index 0000000..85eb640 --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -0,0 +1,178 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#ifndef SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_INL +#define SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_INL + +#include "CudaParticlesRepulsionForceField.h" +#include +//#include + +namespace sofa +{ + +namespace gpu +{ + +namespace cuda +{ + +extern "C" +{ + + void ParticlesRepulsionForceFieldCuda3f_addForce (unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3f* repulsion, void* f, const void* x, const void* v ); + void ParticlesRepulsionForceFieldCuda3f_addDForce(unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3f* repulsion, void* f, const void* x, const void* dx); + +#ifdef SOFA_GPU_CUDA_DOUBLE + + void ParticlesRepulsionForceFieldCuda3d_addForce (unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3d* repulsion, void* f, const void* x, const void* v ); + void ParticlesRepulsionForceFieldCuda3d_addDForce(unsigned int size, const void* cells, const void* cellGhost, GPURepulsion3d* repulsion, void* f, const void* x, const void* dx); + +#endif // SOFA_GPU_CUDA_DOUBLE +} + +} // namespace cuda + +} // namespace gpu + +namespace component +{ + +namespace forcefield +{ + +using namespace gpu::cuda; + + +template <> +void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* /*mparams*/ /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) +{ + if (grid == NULL) return; + + VecDeriv& f = *d_f.beginEdit(); + const VecCoord& x = d_x.getValue(); + const VecDeriv& v = d_v.getValue(); + + grid->updateGrid(x); + GPURepulsion3f repulsion; + repulsion.d = distance.getValue(); + repulsion.d2 = repulsion.d*repulsion.d; + repulsion.stiffness = stiffness.getValue(); + repulsion.damping = damping.getValue(); + f.resize(x.size()); + Grid::Grid* g = grid->getGrid(); + ParticlesRepulsionForceFieldCuda3f_addForce( + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + &repulsion, f.deviceWrite(), x.deviceRead(), v.deviceRead()); + + d_f.endEdit(); +} + +template <> +void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx) +{ + if (grid == NULL) return; + + VecDeriv& df = *d_df.beginEdit(); + const VecDeriv& dx = d_dx.getValue(); + double kFactor = mparams->kFactor(); + double bFactor = mparams->bFactor(); + + const VecCoord& x = *this->mstate->getX(); + GPURepulsion3f repulsion; + repulsion.d = distance.getValue(); + repulsion.d2 = repulsion.d*repulsion.d; + repulsion.stiffness = (float)(stiffness.getValue()*kFactor); + repulsion.damping = (float)(damping.getValue()*bFactor); + df.resize(dx.size()); + Grid::Grid* g = grid->getGrid(); + ParticlesRepulsionForceFieldCuda3f_addDForce( + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + &repulsion, df.deviceWrite(), x.deviceRead(), dx.deviceRead()); + + d_df.endEdit(); +} + + +#ifdef SOFA_GPU_CUDA_DOUBLE + +template <> +void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* /*mparams*/ /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) +{ + if (grid == NULL) return; + + VecDeriv& f = *d_f.beginEdit(); + const VecCoord& x = d_x.getValue(); + const VecDeriv& v = d_v.getValue(); + + grid->updateGrid(x); + GPURepulsion3d repulsion; + repulsion.d = distance.getValue(); + repulsion.d2 = repulsion.d*repulsion.d; + repulsion.stiffness = stiffness.getValue(); + repulsion.damping = damping.getValue(); + f.resize(x.size()); + Grid::Grid* g = grid->getGrid(); + ParticlesRepulsionForceFieldCuda3d_addForce( + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + &repulsion, f.deviceWrite(), x.deviceRead(), v.deviceRead()); + + d_f.endEdit(); +} + +template <> +void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx) +{ + if (grid == NULL) return; + + VecDeriv& df = *d_df.beginEdit(); + const VecDeriv& dx = d_dx.getValue(); + double kFactor = mparams->kFactor(); + double bFactor = mparams->bFactor(); + + const VecCoord& x = *this->mstate->getX(); + GPURepulsion3d repulsion; + repulsion.d = distance.getValue(); + repulsion.d2 = repulsion.d*repulsion.d; + repulsion.stiffness = stiffness.getValue()*kFactor; + repulsion.damping = damping.getValue()*bFactor; + df.resize(dx.size()); + Grid::Grid* g = grid->getGrid(); + ParticlesRepulsionForceFieldCuda3d_addDForce( + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + &repulsion, df.deviceWrite(), x.deviceRead(), dx.deviceRead()); + + d_df.endEdit(); +} + +#endif // SOFA_GPU_CUDA_DOUBLE + + +} // namespace forcefield + +} // namespace component + +} // namespace sofa + +#endif diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp new file mode 100644 index 0000000..79464a3 --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp @@ -0,0 +1,51 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include +#include "CudaSPHFluidForceField.inl" +#include + +namespace sofa +{ + +namespace gpu +{ + +namespace cuda +{ + +SOFA_DECL_CLASS(CudaSPHFluidForceField) + +int SPHFluidForceFieldCudaClass = core::RegisterObject("Supports GPU-side computations using CUDA") + .add< component::forcefield::SPHFluidForceField >() +#ifdef SOFA_GPU_CUDA_DOUBLE + .add< component::forcefield::SPHFluidForceField >() +#endif // SOFA_GPU_CUDA_DOUBLE + ; + +} // namespace cuda + +} // namespace gpu + +} // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu new file mode 100644 index 0000000..a69c19e --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu @@ -0,0 +1,1249 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include +#include +#include "cuda.h" + +#if defined(__cplusplus) && CUDA_VERSION < 2000 +namespace sofa +{ +namespace gpu +{ +namespace cuda +{ +#endif + +template +class GPUSPHFluid +{ +public: + real h; ///< particles radius + real h2; ///< particles radius squared + real inv_h2; ///< particles radius squared inverse + real stiffness; ///< pressure stiffness + real mass; ///< particles mass + real mass2; ///< particles mass squared + real density0; ///< 1000 kg/m3 for water + real viscosity; + real surfaceTension; + + // Precomputed constants for smoothing kernels + real CWd; ///< = constWd(h) + //real CgradWd; ///< = constGradWd(h) + real CgradWp; ///< = constGradWp(h) + real ClaplacianWv; ///< = constLaplacianWv(h) +}; + +typedef GPUSPHFluid GPUSPHFluid3f; +typedef GPUSPHFluid GPUSPHFluid3d; + +extern "C" +{ + + void SPHFluidForceFieldCuda3f_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* pos4, const void* x); + void SPHFluidForceFieldCuda3f_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v); +//void SPHFluidForceFieldCuda3f_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v, const void* dx); + +#ifdef SOFA_GPU_CUDA_DOUBLE + + void SPHFluidForceFieldCuda3d_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* pos4, const void* x); + void SPHFluidForceFieldCuda3d_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v); +//void SPHFluidForceFieldCuda3d_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v, const void* dx); + +#endif // SOFA_GPU_CUDA_DOUBLE + +} + +////////////////////// +// GPU-side methods // +////////////////////// + +#ifndef R_PI +#ifdef M_PI +#define R_PI M_PI +#else +#define R_PI 3.141592653589793238462 +#endif +#endif + +template +class SPH; + +template +class SPH +{ +public: + typedef real Real; + typedef CudaVec3 Deriv; + static Real constW(Real h) + { + return (Real) (48/R_PI)/(h*h*h); + } + + static __device__ Real W0(Real C) + { + return C*((Real)(1.0/6.0)); + } + static __device__ Real W0() + { + return ((Real)(1.0/6.0)); + } + static __device__ Real W(Real r_h, Real C) + { + Real s = 1-r_h; + if (r_h < (Real)0.5) return C*((Real)(1.0/6.0) - r_h*r_h*s); + else return C*((Real)(1.0/3.0) * (s*s*s)); + } + static __device__ Real W2(Real r2_h2, Real C) + { + Real r_h = sqrtf(r2_h2); + Real s = 1-r_h; + if (r2_h2 < (Real)0.25) return C*((Real)(1.0/6.0) - r2_h2*s); + else return C*((Real)(1.0/3.0) * (s*s*s)); + } + static __device__ Real W2(Real r2_h2) + { + Real r_h = sqrtf(r2_h2); + Real s = 1-r_h; + if (r2_h2 < (Real)0.25) return ((Real)(1.0/6.0) - r2_h2*s); + else return ((Real)(1.0/3.0) * (s*s*s)); + } + static Real constGradW(Real h) + { + return constW(h)/(h*h); + } + static __device__ Deriv gradW(const Deriv& d, Real r_h, Real C) + { + Real g; + if (r_h < (Real)0.5) g = 3*r_h - 2; + else { Real s = 1-r_h; g = -s*s/r_h; } + return d*(C*g); + } + static Real constLaplacianW(Real h) + { + return constW(h)/(h*h); + } + static __device__ Real laplacianW(Real r_h, Real C) + { + if (r_h < (Real)0.5) return C*(12*r_h-6); + else if (r_h < (Real)1) return C*(6-4*r_h-2/r_h); + else return 0; + } + /// Density Smoothing Kernel + static Real constWd(Real h) + { + return constW(h); + } + static __device__ Real Wd(Real r_h, Real C) + { + return W(r_h,C); + } + static __device__ Real Wd2(Real r2_h2, Real C) + { + return W2(r2_h2,C); + } + static __device__ Real Wd2(Real r2_h2) + { + return W2(r2_h2); + } + static __device__ Real Wd0() + { + return W0(); + } + static Real constGradWd(Real h) + { + return constGradW(h); + } + static __device__ Deriv gradWd(const Deriv& d, Real r_h, Real C) + { + return gradW(d,r_h,C); + } + static __device__ Deriv gradWd2(const Deriv& d, Real r2_h2, Real C) + { + return gradW(d,sqrtf(r2_h2),C); + } + static Real constLaplacianWd(Real h) + { + return constLaplacianW(h); + } + static __device__ Real laplacianWd(Real r_h, Real C) + { + return laplacianW(r_h,C); + } + static __device__ Real laplacianWd2(Real r2_h2, Real C) + { + return laplacianW(sqrtf(r2_h2),C); + } + + /// Pressure Smoothing Kernel + static Real constWp(Real h) + { + return constW(h); + } + static __device__ Real Wp(Real r_h, Real C) + { + return W(r_h,C); + } + static Real constGradWp(Real h) + { + return constGradW(h); + } + static __device__ Deriv gradWp(const Deriv& d, Real r_h, Real C) + { + return gradW(d,r_h,C); + } + + /// Viscosity Smoothing Kernel + static Real constWv(Real h) + { + return constW(h); + } + static __device__ Real Wv(Real r_h, Real C) + { + return W(r_h,C); + } + static __device__ Real Wv2(Real r2_h2, Real r_h, Real C) + { + return W2(r2_h2,r_h,C); + } + static Real constGradWv(Real h) + { + return constGradW(h); + } + static __device__ Deriv gradWv(const Deriv& d, Real r_h, Real C) + { + return gradW(d,r_h,C); + } + static __device__ Deriv gradWv2(const Deriv& d, Real r2_h2, Real r_h, Real C) + { + return gradW(d,r_h,C); + } + static Real constLaplacianWv(Real h) + { + return constLaplacianW(h); + } + + static __device__ Real laplacianWv(Real r_h, Real C) + { + return laplacianW(r_h,C); + } +}; + +template +class SPH +{ +public: + typedef real Real; + typedef CudaVec3 Deriv; + /// Density Smoothing Kernel: W = 315 / 64pih9 * (h2 - r2)3 = 315 / 64pih3 * (1 - (r/h)2)3 + static Real constWd(Real h) + { + return (Real)(315 / (64*R_PI*h*h*h)); + } + static __device__ Real Wd(Real r_h, Real C) + { + Real a = (1-r_h*r_h); + return C*a*a*a; + } + static __device__ Real Wd2(Real r2_h2, Real C) + { + Real a = (1-r2_h2); + return C*a*a*a; + } + static __device__ Real Wd2(Real r2_h2) + { + Real a = (1-r2_h2); + return a*a*a; + } + static __device__ Real Wd0(Real C) + { + return C; + } + static __device__ Real Wd0() + { + return 1; + } + static Real constGradWd(Real h) + { + return -6*constWd(h)/(h*h); + } + static __device__ Deriv gradWd(const Deriv& d, Real r_h, Real C) + { + Real a = (1-r_h*r_h); + return d*(C*a*a); + } + static __device__ Deriv gradWd2(const Deriv& d, Real r2_h2, Real C) + { + Real a = (1-r2_h2); + return d*(C*a*a); + } + static Real constLaplacianWd(Real h) + { + return -6*constWd(h)/(h*h); + } + static __device__ Real laplacianWd(Real r_h, Real C) + { + Real r2_h2 = r_h*r_h; + return C*((1-r2_h2)*(3-7*r2_h2)); + } + static __device__ Real laplacianWd2(Real r2_h2, Real C) + { + return C*((1-r2_h2)*(3-7*r2_h2)); + } + + /// Pressure Smoothing Kernel: W = 15 / pih6 (h - r)3 = 15 / pih3 (1 - r/h)3 + static Real constWp(Real h) + { + return (Real)(15 / (R_PI*h*h*h)); + } + static __device__ Real Wp(Real r_h, Real C) + { + Real a = (1-r_h); + return C*a*a*a; + } + static Real constGradWp(Real h) + { + return (-3*constWp(h)) / (h*h); + } + static __device__ Deriv gradWp(const Deriv& d, Real r_h, Real C) + { + Real a = (1-r_h); + return d * (C*a*a/r_h); + } + + /// Viscosity Smoothing Kernel: W = 15/(2pih3) (-r3/2h3 + r2/h2 + h/2r - 1) + static Real constWv(Real h) + { + return (Real)(15/(2*R_PI*h*h*h)); + } + static __device__ Real Wv(Real r_h, Real C) + { + Real r2_h2 = r_h*r_h; + Real r3_h3 = r2_h2*r_h; + return C*(-0.5f*r3_h3 + r2_h2 + 0.5f/r_h - 1); + } + static __device__ Real Wv2(Real r2_h2, Real r_h, Real C) + { + Real r3_h3 = r2_h2*r_h; + return C*(-0.5f*r3_h3 + r2_h2 + 0.5f/r_h - 1); + } + static Real constGradWv(Real h) + { + return constWv(h)/(h*h); + } + static __device__ Deriv gradWv(const Deriv& d, Real r_h, Real C) + { + Real r3_h3 = r_h*r_h*r_h; + return d * (C*(2.0f -3.0f*r_h - 0.5f/r3_h3)); + } + static __device__ Deriv gradWv2(const Deriv& d, Real r2_h2, Real r_h, Real C) + { + Real r3_h3 = r2_h2*r_h; + return d * (C*(-3*r_h + 4 - 1/r3_h3)); + } + static Real constLaplacianWv(Real h) + { + return 6*constWv(h)/(h*h); + } + + static __device__ Real laplacianWv(Real r_h, Real C) + { + return C*(1-r_h); + } +}; + +template +__device__ void SPHFluidInitDensity(CudaVec3 /*x1*/, real& density, GPUSPHFluid& params) +{ + density = 0; //params.mass * params.CWd; //SPH::Wd(0,params.CWd); +} + +template +__device__ void SPHFluidCalcDensity(CudaVec3 x1, CudaVec3 x2, real& density, GPUSPHFluid& params) +{ + CudaVec3 n = x2-x1; + real d2 = norm2(n); + if (sqrtf(d2) < params.h) + //if (d2 < params.h2) + { + //real r_h = rsqrtf(params.h2/d2); + //real r_h = sqrtf(d2/params.h2); + real r2_h2 = (d2/params.h2); + real d = SPH::Wd2(r2_h2); + density += d; + } +} + +template +__device__ void SPHFluidFinalDensity(CudaVec3 /*x1*/, real& density, GPUSPHFluid& params) +{ + density = (SPH::Wd0()+density) * params.CWd * params.mass; //SPH::Wd(0,params.CWd); +} + +template +__device__ void SPHFluidCalcForce(CudaVec4 x1, CudaVec3 v1, CudaVec4 x2, CudaVec3 v2, CudaVec3& force, GPUSPHFluid& params) +{ + CudaVec3 n = CudaVec3::make(x2.x-x1.x,x2.y-x1.y,x2.z-x1.z); + real d2 = norm2(n); + if (d2 < params.h2) + { + //real r_h = rsqrtf(params.h2/d2); + //real r_h = sqrtf(d2/params.h2); + real r2_h2 = (d2/params.h2); + real r_h = sqrtf(r2_h2); + real density1 = x1.w; + real density2 = x2.w; + + // Pressure + real pressure1 = params.stiffness * (density1 - params.density0); + real pressure2 = params.stiffness * (density2 - params.density0); + real pressureFV = params.mass2 * (pressure1 / (density1*density1) + pressure2 / (density2*density2) ); + + // Viscosity + if (viscosityType == 1) + { + force += ( v2 - v1 ) * ( params.mass2 * params.viscosity * SPH::laplacianWv(r_h,params.ClaplacianWv) / (density1 * density2) ); + } + else if (viscosityType == 2) + { + real vx = dot(n,v2-v1); + if (vx < 0) + pressureFV += - (vx * params.viscosity * params.h * params.mass / ((r2_h2 + 0.01f*params.h2)*(density1+density2)*0.5f)); + } + + force += SPH::gradWp(n, r_h, params.CgradWp) * pressureFV; + } +} +/* +template +__device__ void SPHFluidCalcDForce(CudaVec4 x1, CudaVec3 v1, CudaVec3 dx1, CudaVec4 x2, CudaVec3 v2, CudaVec3 dx2, CudaVec3& dforce, GPUSPHFluid& params) +{ + CudaVec3 n = CudaVec3::make(x2.x-x1.x,x2.y-x1.y,x2.z-x1.z); + real d2 = norm2(n); + if (d2 < params.h2) + { + CudaVec3 dxi = dx2-dx1; + + real inv_d = rsqrtf(d2); + + real r2_h2 = (d2/params.h2); + real r_h = sqrtf(r2_h2); + + real density1 = x1.w; + real density2 = x2.w; + + // Pressure + real pressure1 = params.stiffness * (density1 - params.density0); + real pressure2 = params.stiffness * (density2 - params.density0); + + real fpressure = params.mass2 * (pressure1 / (density1*density1) + pressure2 / (density2*density2) ); + + // Derivatives + + CudaVec3 dn = dxi * inv_d; + + real dr_h = dot(dn,n)/params.h; + //real dr2_h2 = 2*r_h*dr_h; + + real ddensity = dot(dxi,SPH::gradWd2(n, r2_h2, params.CgradWd)); + real dpressure = params.stiffness*ddensity; + // d(a/b^2) = (d(a)*b-2*a*d(b))/b^3 + real dfpressure = params.mass2 * ( (dpressure*density1-2*pressure1*ddensity)/(density1*density1*density1) + +(dpressure*density2-2*pressure2*ddensity)/(density2*density2*density2) ); + real a = (1-r_h); + real dWp = params.CgradWp*a*a; + real ddWp = -2*params.CgradWp*a*dr_h; + + // f = n * dWp * fpressure + // df = dn * (dWp * fpressure) + n * (ddWp * fpressure + dWp * dfpressure); + + dforce += dn * (dWp * fpressure) + n * (ddWp * fpressure + dWp * dfpressure); + + // Viscosity + // force += ( v2 - v1 ) * ( params.mass2 * params.viscosity * params.ClaplacianWv * (1-r_h) / (density1 * density2) ); + real d1d2 = density1*density2; + dforce += dxi * ( params.mass2 * params.viscosity * params.ClaplacianWv * (1-r_h) / (density1 * density2) ) + + (v2-v1) * ( params.mass2 * params.viscosity * params.ClaplacianWv * (-dr_h*d1d2 - (1-r_h)*ddensity*(density1+density2))/(d1d2*d1d2)); + + } +} +*/ +template +__global__ void SPHFluidForceFieldCuda3t_computeDensity_kernel(int size, const int *cells, const int *cellGhost, GPUSPHFluid params, real* pos4, const real* x) +{ + __shared__ int2 range; + __shared__ int ghost; + __shared__ real temp_x[BSIZE*3]; + int tx3 = __umul24(threadIdx.x,3); + for (int cell = blockIdx.x; cell < size; cell += gridDim.x) + { + __syncthreads(); + if (!threadIdx.x) + { + //range = *(const int2*)(cells+cell); + range.x = cells[cell]; + range.y = cells[cell+1]; + range.y &= ~(1U<<31); + ghost = cellGhost[cell]; + } + __syncthreads(); + if (range.x <= 0) continue; // no actual particle in this cell + for (int px0 = range.x; px0 < ghost; px0 += BSIZE) + { + int px = px0 + threadIdx.x; + CudaVec3 xi; + real density; + int index; + if (px < range.y) + { + index = cells[px]; + xi = ((const CudaVec3*)x)[index]; + temp_x[tx3 ] = xi.x; + temp_x[tx3+1] = xi.y; + temp_x[tx3+2] = xi.z; + } + __syncthreads(); + if (px < ghost) + { + // actual particle -> compute interactions + SPHFluidInitDensity(xi, density, params); + + int np = min(range.y-px0,BSIZE); + for (int i=0; i < np; ++i) + { + if (i != threadIdx.x) + SPHFluidCalcDensity(xi, ((const CudaVec3*)temp_x)[i], density, params); + } + } + __syncthreads(); + // loop through other groups of particles + for (int py0 = range.x; py0 < range.y; py0 += BSIZE) + { + if (py0 == px0) continue; + int py = py0 + threadIdx.x; + if (py < range.y) + { + int index2 = cells[py]; + CudaVec3 xj = ((const CudaVec3*)x)[index2]; + temp_x[tx3 ] = xj.x; + temp_x[tx3+1] = xj.y; + temp_x[tx3+2] = xj.z; + } + __syncthreads(); + if (px < ghost) + { + // actual particle -> compute interactions + int np = min(range.y-py0,BSIZE); + for (int i=0; i < np; ++i) + { + SPHFluidCalcDensity(xi, ((const CudaVec3*)temp_x)[i], density, params); + } + } + __syncthreads(); + } + if (px < ghost) + { + // actual particle -> write computed density + SPHFluidFinalDensity(xi, density, params); + CudaVec4 res = CudaVec4::make(xi.x,xi.y,xi.z,density); + ((CudaVec4*)pos4)[index] = res; + } + } + } +} + +template +__global__ void SPHFluidForceFieldCuda3t_addForce_kernel(int size, const int *cells, const int *cellGhost, GPUSPHFluid params, real* f, const real* pos4, const real* v) +{ + __shared__ int2 range; + __shared__ int ghost; + __shared__ real temp_x[BSIZE*4]; + __shared__ real temp_v[BSIZE*3]; + int tx3 = __umul24(threadIdx.x,3); + int tx4 = threadIdx.x << 2; + for (int cell = blockIdx.x; cell < size; cell += gridDim.x) + { + if (!threadIdx.x) + { + //range = *(const int2*)(cells+cell); + range.x = cells[cell]; + range.y = cells[cell+1]; + range.y &= ~(1U<<31); + ghost = cellGhost[cell]; + } + __syncthreads(); + if (range.x <= 0) continue; // no actual particle in this cell + for (int px0 = range.x; px0 < ghost; px0 += BSIZE) + { + int px = px0 + threadIdx.x; + CudaVec4 xi; + CudaVec3 vi; + CudaVec3 force; + int index; + if (px < range.y) + { + index = cells[px]; + xi = ((const CudaVec4*)pos4)[index]; + temp_x[tx4 ] = xi.x; + temp_x[tx4+1] = xi.y; + temp_x[tx4+2] = xi.z; + temp_x[tx4+3] = xi.w; + vi = ((const CudaVec3*)v)[index]; + temp_v[tx3 ] = vi.x; + temp_v[tx3+1] = vi.y; + temp_v[tx3+2] = vi.z; + } + __syncthreads(); + if (px < ghost) + { + // actual particle -> compute interactions + force = CudaVec3::make(0,0,0); + int np = min(range.y-px0,BSIZE); + for (int i=0; i < np; ++i) + { + if (i != threadIdx.x) + SPHFluidCalcForce(xi, vi, ((const CudaVec4*)temp_x)[i], ((const CudaVec3*)temp_v)[i], force, params); + } + } + __syncthreads(); + // loop through other groups of particles + for (int py0 = range.x; py0 < range.y; py0 += BSIZE) + { + if (py0 == px0) continue; + int py = py0 + threadIdx.x; + if (py < range.y) + { + int index2 = cells[py]; + CudaVec4 xj = ((const CudaVec4*)pos4)[index2]; + temp_x[tx4 ] = xj.x; + temp_x[tx4+1] = xj.y; + temp_x[tx4+2] = xj.z; + temp_x[tx4+3] = xj.w; + CudaVec3 vj = ((const CudaVec3*)v)[index2]; + temp_v[tx3 ] = vj.x; + temp_v[tx3+1] = vj.y; + temp_v[tx3+2] = vj.z; + } + __syncthreads(); + if (px < ghost) + { + // actual particle -> compute interactions + int np = min(range.y-py0,BSIZE); + for (int i=0; i < np; ++i) + { + SPHFluidCalcForce(xi, vi, ((const CudaVec4*)temp_x)[i], ((const CudaVec3*)temp_v)[i], force, params); + } + } + __syncthreads(); + } + if (px < ghost) + { + // actual particle -> write computed force + ((CudaVec3*)f)[index] += force; + } + } + } +} +/* +template +__global__ void SPHFluidForceFieldCuda3t_addDForce_kernel(int size, const int *cells, const int *cellGhost, GPUSPHFluid params, real* df, const real* pos4, const real* v, const real* dx) +{ + __shared__ int2 range; + __shared__ int ghost; + __shared__ real temp_x[BSIZE*4]; + __shared__ real temp_v[BSIZE*3]; + __shared__ real temp_dx[BSIZE*3]; + int tx3 = __umul24(threadIdx.x,3); + int tx4 = threadIdx.x << 2; + for (int cell = blockIdx.x; cell < size; cell += gridDim.x) + { + if (!threadIdx.x) + { + //range = *(const int2*)(cells+cell); + range.x = cells[cell]; + range.y = cells[cell+1]; + range.y &= ~(1U<<31); + ghost = cellGhost[cell]; + } + __syncthreads(); + if (range.x <= 0) continue; // no actual particle in this cell + for (int px0 = range.x; px0 < ghost; px0 += BSIZE) + { + int px = px0 + threadIdx.x; + CudaVec4 xi; + CudaVec3 vi; + CudaVec3 dxi; + CudaVec3 dforce; + int index; + if (px < range.y) + { + index = cells[px]; + xi = ((const CudaVec4*)pos4)[index]; + temp_x[tx4 ] = xi.x; + temp_x[tx4+1] = xi.y; + temp_x[tx4+2] = xi.z; + temp_x[tx4+3] = xi.w; + vi = ((const CudaVec3*)v)[index]; + temp_v[tx3 ] = vi.x; + temp_v[tx3+1] = vi.y; + temp_v[tx3+2] = vi.z; + dxi = ((const CudaVec3*)dx)[index]; + temp_dx[tx3 ] = dxi.x; + temp_dx[tx3+1] = dxi.y; + temp_dx[tx3+2] = dxi.z; + } + __syncthreads(); + if (px < ghost) + { // actual particle -> compute interactions + dforce = CudaVec3::make(0,0,0); + int np = min(range.y-px0,BSIZE); + for (int i=0; i < np; ++i) + { + if (i != threadIdx.x) + SPHFluidCalcDForce(xi, vi, dxi, ((const CudaVec4*)temp_x)[i], ((const CudaVec3*)temp_v)[i], ((const CudaVec3*)temp_dx)[i], dforce, params); + } + } + __syncthreads(); + // loop through other groups of particles + for (int py0 = range.x; py0 < range.y; py0 += BSIZE) + { + if (py0 == px0) continue; + int py = py0 + threadIdx.x; + if (py < range.y) + { + int index2 = cells[py]; + CudaVec4 xj = ((const CudaVec4*)pos4)[index2]; + temp_x[tx4 ] = xj.x; + temp_x[tx4+1] = xj.y; + temp_x[tx4+2] = xj.z; + temp_x[tx4+3] = xj.w; + CudaVec3 vj = ((const CudaVec3*)v)[index2]; + temp_v[tx3 ] = vj.x; + temp_v[tx3+1] = vj.y; + temp_v[tx3+2] = vj.z; + CudaVec3 dxj = ((const CudaVec3*)dx)[index2]; + temp_dx[tx3 ] = dxj.x; + temp_dx[tx3+1] = dxj.y; + temp_dx[tx3+2] = dxj.z; + } + __syncthreads(); + if (px < ghost) + { // actual particle -> compute interactions + int np = min(range.y-py0,BSIZE); + for (int i=0; i < np; ++i) + { + SPHFluidCalcDForce(xi, vi, dxi, ((const CudaVec4*)temp_x)[i], ((const CudaVec3*)temp_v)[i], ((const CudaVec3*)temp_dx)[i], dforce, params); + } + } + __syncthreads(); + } + if (px < ghost) + { // actual particle -> write computed force + ((CudaVec3*)df)[index] += dforce; + } + } + } +} +*/ +////////////////////// +// CPU-side methods // +////////////////////// + +void SPHFluidForceFieldCuda3f_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* pos4, const void* x) +{ + dim3 threads(BSIZE,1); + dim3 grid(60,1); + switch(kernelType) + { + case 0: + switch(pressureType) + { + case 0: //SPHFluidForceFieldCuda3t_computeDensity_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)pos4, (const float*)x); + break; + case 1: SPHFluidForceFieldCuda3t_computeDensity_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)pos4, (const float*)x); + break; + default: break; + } + break; + case 1: + switch(pressureType) + { + case 0: //SPHFluidForceFieldCuda3t_computeDensity_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)pos4, (const float*)x); + break; + case 1: SPHFluidForceFieldCuda3t_computeDensity_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)pos4, (const float*)x); + break; + default: break; + } + break; + default: break; + } + mycudaDebugError("SPHFluidForceFieldCuda3t_computeDensity_kernel"); +} + +void SPHFluidForceFieldCuda3f_addForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* x, const void* v) +{ + dim3 threads(BSIZE,1); + dim3 grid(60,1); + switch(kernelType) + { + case 0: + switch(pressureType) + { + case 0: + switch(viscosityType) + { + case 0: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + case 1: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + case 2: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + default: break; + } + break; + case 1: + switch(viscosityType) + { + case 0: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + case 1: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + case 2: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + default: break; + } + break; + default: break; + } + break; + case 1: + switch(pressureType) + { + case 0: + switch(viscosityType) + { + case 0: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + case 1: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + case 2: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + default: break; + } + break; + case 1: + switch(viscosityType) + { + case 0: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + case 1: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + case 2: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)f, (const float*)x, (const float*)v); + break; + default: break; + } + break; + default: break; + } + break; + default: break; + } + break; + default: break; + } + mycudaDebugError("SPHFluidForceFieldCuda3t_addForce_kernel"); +} +/* +void SPHFluidForceFieldCuda3f_addDForce(unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* df, const void* x, const void* v, const void* dx) +{ + dim3 threads(BSIZE,1); + dim3 grid(60/BSIZE,1); + {SPHFluidForceFieldCuda3t_addDForce_kernel<<< grid, threads, BSIZE*3*sizeof(float) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (float*)df, (const float*)x, (const float*)v, (const float*)dx); mycudaDebugError("SPHFluidForceFieldCuda3t_addDForce_kernel");} +} +*/ +#ifdef SOFA_GPU_CUDA_DOUBLE + +void SPHFluidForceFieldCuda3d_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* pos4, const void* x) +{ + dim3 threads(BSIZE,1); + dim3 grid(60,1); + switch(kernelType) + { + case 0: + switch(pressureType) + { + case 0: //SPHFluidForceFieldCuda3t_computeDensity_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)pos4, (const double*)x); + break; + case 1: SPHFluidForceFieldCuda3t_computeDensity_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)pos4, (const double*)x); + break; + default: break; + } + break; + case 1: + switch(pressureType) + { + case 0: //SPHFluidForceFieldCuda3t_computeDensity_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)pos4, (const double*)x); + break; + case 1: SPHFluidForceFieldCuda3t_computeDensity_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)pos4, (const double*)x); + break; + default: break; + } + break; + default: break; + } + mycudaDebugError("SPHFluidForceFieldCuda3t_computeDensity_kernel"); + +} + +void SPHFluidForceFieldCuda3d_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* x, const void* v) +{ + dim3 threads(BSIZE,1); + dim3 grid(60,1); + switch(kernelType) + { + case 0: + switch(pressureType) + { + case 0: + switch(viscosityType) + { + case 0: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + case 1: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + case 2: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + default: break; + } + break; + case 1: + switch(viscosityType) + { + case 0: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + case 1: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + case 2: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + default: break; + } + break; + default: break; + } + break; + case 1: + switch(pressureType) + { + case 0: + switch(viscosityType) + { + case 0: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + case 1: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + case 2: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + default: break; + } + break; + case 1: + switch(viscosityType) + { + case 0: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + case 1: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + case 2: + switch(surfaceTensionType) + { + case 0: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 1: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + case 2: SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); + break; + default: break; + } + break; + default: break; + } + break; + default: break; + } + break; + default: break; + } + mycudaDebugError("SPHFluidForceFieldCuda3t_addForce_kernel"); + /* + dim3 threads(BSIZE,1); + dim3 grid(60/BSIZE,1); + if (params->surfaceTension > 0) + {SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); mycudaDebugError("SPHFluidForceFieldCuda3t_addForce_kernel");} + else + {SPHFluidForceFieldCuda3t_addForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)f, (const double*)x, (const double*)v); mycudaDebugError("SPHFluidForceFieldCuda3t_addForce_kernel");} + */ +} +/* +void SPHFluidForceFieldCuda3d_addDForce(unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* df, const void* x, const void* v, const void* dx) +{ + dim3 threads(BSIZE,1); + dim3 grid(60/BSIZE,1); + {SPHFluidForceFieldCuda3t_addDForce_kernel<<< grid, threads, BSIZE*3*sizeof(double) >>>(size, (const int*) cells, (const int*) cellGhost, *params, (double*)df, (const double*)x, (const double*)v, (const double*)dx); mycudaDebugError("SPHFluidForceFieldCuda3t_addDForce_kernel");} +} +*/ +#endif // SOFA_GPU_CUDA_DOUBLE + +#if defined(__cplusplus) && CUDA_VERSION < 2000 +} // namespace cuda +} // namespace gpu +} // namespace sofa +#endif diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h new file mode 100644 index 0000000..532dff1 --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -0,0 +1,145 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#ifndef SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_H +#define SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_H + +#include +#include +#include + +namespace sofa +{ + +namespace gpu +{ + +namespace cuda +{ + +template +struct GPUSPHFluid +{ + real h; ///< particles radius + real h2; ///< particles radius squared + real inv_h2; ///< particles radius squared inverse + real stiffness; ///< pressure stiffness + real mass; ///< particles mass + real mass2; ///< particles mass squared + real density0; ///< 1000 kg/m3 for water + real viscosity; + real surfaceTension; + + // Precomputed constants for smoothing kernels + real CWd; ///< = constWd(h) + //real CgradWd; ///< = constGradWd(h) + real CgradWp; ///< = constGradWp(h) + real ClaplacianWv; ///< = constLaplacianWv(h) +}; + +typedef GPUSPHFluid GPUSPHFluid3f; +typedef GPUSPHFluid GPUSPHFluid3d; + +} // namespace cuda + +} // namespace gpu + +namespace component +{ + +namespace forcefield +{ + +template +class SPHFluidForceFieldInternalData< gpu::cuda::CudaVectorTypes > +{ +public: + typedef gpu::cuda::CudaVectorTypes DataTypes; + typedef SPHFluidForceFieldInternalData Data; + typedef SPHFluidForceField Main; + typedef typename DataTypes::Coord Coord; + typedef typename DataTypes::Real Real; + gpu::cuda::GPUSPHFluid params; + gpu::cuda::CudaVector pos4; + + void fillParams(Main* m, int kernelType, double kFactor=1.0, double bFactor=1.0) + { + Real h = m->particleRadius.getValue(); + params.h = h; + params.h2 = h*h; + params.inv_h2 = 1/(h*h); + params.stiffness = (Real)(kFactor*m->pressureStiffness.getValue()); + params.mass = m->particleMass.getValue(); + params.mass2 = params.mass*params.mass; + params.density0 = m->density0.getValue(); + params.viscosity = (Real)(bFactor*m->viscosity.getValue()); + params.surfaceTension = (Real)(kFactor*m->surfaceTension.getValue()); + if (kernelType == 1) + { + params.CWd = SPHKernel::constW(h); + //params.CgradWd = SPHKernel::constGradW(h); + params.CgradWp = SPHKernel::constGradW(h); + params.ClaplacianWv = SPHKernel::constLaplacianW(h); + } + else + { + params.CWd = SPHKernel::constW(h); + //params.CgradWd = SPHKernel::constGradW(h); + params.CgradWp = SPHKernel::constGradW(h); + params.ClaplacianWv = SPHKernel::constLaplacianW(h); + } + } + + void Kernels_computeDensity(int kernelType, int pressureType, int gsize, const void* cells, const void* cellGhost, void* pos4, const void* x); + void Kernels_addForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, int gsize, const void* cells, const void* cellGhost, void* f, const void* pos4, const void* vel); + //void Kernels_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, int gsize, const void* cells, const void* cellGhost, void* f, const void* pos4, const void* dx, const void* vel); +}; + + +template <> +void SPHFluidForceField::addForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); + +template <> +void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx); + +template <> +void SPHFluidForceField::draw(const core::visual::VisualParams* vparams); + +#ifdef SOFA_GPU_CUDA_DOUBLE + +template <> +void SPHFluidForceField::addForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); + +template <> +void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx); + +#endif // SOFA_GPU_CUDA_DOUBLE + +} // namespace forcefield + +} // namespace component + +} // namespace sofa + +#endif diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl new file mode 100644 index 0000000..f506dfc --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -0,0 +1,284 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#ifndef SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_INL +#define SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_INL + +#include "CudaSPHFluidForceField.h" +#include +//#include + +namespace sofa +{ + +namespace gpu +{ + +namespace cuda +{ + +extern "C" +{ + + void SPHFluidForceFieldCuda3f_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* pos4, const void* x); + void SPHFluidForceFieldCuda3f_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v); +//void SPHFluidForceFieldCuda3f_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v, const void* dx); + +#ifdef SOFA_GPU_CUDA_DOUBLE + + void SPHFluidForceFieldCuda3d_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* pos4, const void* x); + void SPHFluidForceFieldCuda3d_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v); +//void SPHFluidForceFieldCuda3d_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v, const void* dx); + +#endif // SOFA_GPU_CUDA_DOUBLE +} + +} // namespace cuda + +} // namespace gpu + +namespace component +{ + +namespace forcefield +{ + +using namespace gpu::cuda; + +template<> +void SPHFluidForceFieldInternalData::Kernels_computeDensity(int kernelType, int pressureType, int gsize, const void* cells, const void* cellGhost, void* pos4, const void* x) +{ + SPHFluidForceFieldCuda3f_computeDensity(kernelType, pressureType, gsize, cells, cellGhost, ¶ms, pos4, x); +} + +template<> +void SPHFluidForceFieldInternalData::Kernels_addForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, int gsize, const void* cells, const void* cellGhost, void* f, const void* pos4, const void* v) +{ + SPHFluidForceFieldCuda3f_addForce (kernelType, pressureType, viscosityType, surfaceTensionType, gsize, cells, cellGhost, ¶ms, f, pos4, v); +} +/* +template<> +void SPHFluidForceFieldInternalData::Kernels_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, int gsize, const void* cells, const void* cellGhost, void* f, const void* pos4, const void* v, const void* dx) +{ + SPHFluidForceFieldCuda3f_addDForce(kernelType, pressureType, viscosityType, surfaceTensionType, gsize, cells, cellGhost, ¶ms, f, pos4, v, dx); +} +*/ +template <> +void SPHFluidForceField::addForce(const core::MechanicalParams* /*mparams*/ /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) +{ + if (grid == NULL) return; + + const int kernelT = kernelType.getValue(); + const int pressureT = pressureType.getValue(); + const Real viscosity = this->viscosity.getValue(); + const int viscosityT = (viscosity == 0) ? 0 : viscosityType.getValue(); + const Real surfaceTension = this->surfaceTension.getValue(); + const int surfaceTensionT = (surfaceTension <= 0) ? 0 : surfaceTensionType.getValue(); + + VecDeriv& f = *d_f.beginEdit(); + const VecCoord& x = d_x.getValue(); + const VecDeriv& v = d_v.getValue(); + + grid->updateGrid(x); + data.fillParams(this, kernelT); + f.resize(x.size()); + Grid::Grid* g = grid->getGrid(); + data.pos4.recreate(x.size()); + data.Kernels_computeDensity( kernelT, pressureT, + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + data.pos4.deviceWrite(), x.deviceRead()); + if (this->f_printLog.getValue()) + { + sout << "density[" << 0 << "] = " << data.pos4[0][3] << sendl; + sout << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3] << sendl; + } + data.Kernels_addForce( kernelT, pressureT, viscosityT, surfaceTensionT, + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); + + d_f.endEdit(); +} + +template <> +void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& /*d_df*/, const DataVecDeriv& /*d_dx*/) +{ + mparams->kFactor(); +#if 0 + if (grid == NULL) return; + + const int kernelT = kernelType.getValue(); + const int pressureT = pressureType.getValue(); + const Real viscosity = this->viscosity.getValue(); + const int viscosityT = (viscosity == 0) ? 0 : viscosityType.getValue(); + const Real surfaceTension = this->surfaceTension.getValue(); + const int surfaceTensionT = (surfaceTension <= 0) ? 0 : surfaceTensionType.getValue(); + + VecDeriv& df = *d_df.beginEdit(); + const VecDeriv& dx = d_dx.getValue(); + + //sout << "addDForce(" << mparams->kFactor() << "," << mparams->bFactor() << ")" << sendl; + //const VecCoord& x = *this->mstate->getX(); + const VecDeriv& v = *this->mstate->getV(); + data.fillParams(this, kernelT, mparams->kFactor(), mparams->bFactor()); + df.resize(dx.size()); + Grid::Grid* g = grid->getGrid(); + data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); + + d_df.endEdit(); +#endif +} + + +#ifdef SOFA_GPU_CUDA_DOUBLE + + +template<> +void SPHFluidForceFieldInternalData::Kernels_computeDensity(int kernelType, int pressureType, int gsize, const void* cells, const void* cellGhost, void* pos4, const void* x) +{ + SPHFluidForceFieldCuda3d_computeDensity(kernelType, pressureType, gsize, cells, cellGhost, ¶ms, pos4, x); +} + +template<> +void SPHFluidForceFieldInternalData::Kernels_addForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, int gsize, const void* cells, const void* cellGhost, void* f, const void* pos4, const void* v) +{ + SPHFluidForceFieldCuda3d_addForce (kernelType, pressureType, viscosityType, surfaceTensionType, gsize, cells, cellGhost, ¶ms, f, pos4, v); +} +/* +template<> +void SPHFluidForceFieldInternalData::Kernels_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, int gsize, const void* cells, const void* cellGhost, void* f, const void* pos4, const void* v, const void* dx) +{ + SPHFluidForceFieldCuda3d_addDForce(kernelType, pressureType, viscosityType, surfaceTensionType, gsize, cells, cellGhost, ¶ms, f, pos4, v, dx); +} +*/ +template <> +void SPHFluidForceField::addForce(const core::MechanicalParams* /*mparams*/ /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) +{ + if (grid == NULL) return; + + const int kernelT = kernelType.getValue(); + const int pressureT = pressureType.getValue(); + const Real viscosity = this->viscosity.getValue(); + const int viscosityT = (viscosity == 0) ? 0 : viscosityType.getValue(); + const Real surfaceTension = this->surfaceTension.getValue(); + const int surfaceTensionT = (surfaceTension <= 0) ? 0 : surfaceTensionType.getValue(); + + VecDeriv& f = *d_f.beginEdit(); + const VecCoord& x = d_x.getValue(); + const VecDeriv& v = d_v.getValue(); + + grid->updateGrid(x); + data.fillParams(this, kernelT); + f.resize(x.size()); + Grid::Grid* g = grid->getGrid(); + data.pos4.recreate(x.size()); + data.Kernels_computeDensity( kernelT, pressureT, + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + data.pos4.deviceWrite(), x.deviceRead()); + if (this->f_printLog.getValue()) + { + sout << "density[" << 0 << "] = " << data.pos4[0][3] << sendl; + sout << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3] << sendl; + } + data.Kernels_addForce( kernelT, pressureT, viscosityT, surfaceTensionT, + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); + + d_f.endEdit(); +} + +template <> +void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& /*d_df*/, const DataVecDeriv& /*d_dx*/) +{ + mparams->kFactor(); +#if 0 + if (grid == NULL) return; + + const int kernelT = kernelType.getValue(); + const int pressureT = pressureType.getValue(); + const Real viscosity = this->viscosity.getValue(); + const int viscosityT = (viscosity == 0) ? 0 : viscosityType.getValue(); + const Real surfaceTension = this->surfaceTension.getValue(); + const int surfaceTensionT = (surfaceTension <= 0) ? 0 : surfaceTensionType.getValue(); + + VecDeriv& df = *d_df.beginEdit(); + const VecDeriv& dx = d_dx.getValue(); + //const VecCoord& x = *this->mstate->getX(); + const VecDeriv& v = *this->mstate->getV(); + data.fillParams(this, mparams->kFactor(), mparams->bFactor()); + df.resize(dx.size()); + Grid::Grid* g = grid->getGrid(); + data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); + d_df.endEdit(); +#endif +} + +#endif // SOFA_GPU_CUDA_DOUBLE + + + +template <> +void SPHFluidForceField::draw(const core::visual::VisualParams* vparams) +{ + if (!vparams->displayFlags().getShowForceFields()) return; + //if (grid != NULL) + // grid->draw(vparams); + helper::ReadAccessor x = *this->mstate->getX(); + helper::ReadAccessor > pos4 = this->data.pos4; + if (pos4.empty()) return; + glDisable(GL_LIGHTING); + glColor3f(0,1,1); + glDisable(GL_BLEND); + glDepthMask(1); + glPointSize(5); + glBegin(GL_POINTS); + for (unsigned int i=0; i +#include +#include + +namespace sofa +{ + +namespace component +{ + +namespace container +{ + +using namespace sofa::defaulttype; +using namespace sofa::gpu::cuda; +using namespace core::behavior; + + +SOFA_DECL_CLASS(CudaSpatialGridContainer) + +int SpatialGridContainerCudaClass = core::RegisterObject("GPU support using CUDA.") + .add< SpatialGridContainer >() + ; + +template class SpatialGridContainer< CudaVec3fTypes >; +template class SpatialGrid< SpatialGridTypes< CudaVec3fTypes > >; + +#ifdef SOFA_GPU_CUDA_DOUBLE + +template class SpatialGridContainer< CudaVec3dTypes >; +template class SpatialGrid< SpatialGridTypes< CudaVec3dTypes > >; + +#endif // SOFA_GPU_CUDA_DOUBLE + +} // namespace container + +} // namespace component + +} // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu new file mode 100644 index 0000000..7ebb8e8 --- /dev/null +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu @@ -0,0 +1,380 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * +* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* * +* This library 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 library 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 library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +******************************************************************************* +* SOFA :: Modules * +* * +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +/* PART OF THIS FILE IS FROM NVIDIA CUDA SDK particles demo: + * + * Copyright 1993-2006 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO USER: + * + * This source code is subject to NVIDIA ownership rights under U.S. and + * international Copyright laws. + * + * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE + * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR + * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE + * OR PERFORMANCE OF THIS SOURCE CODE. + * + * U.S. Government End Users. This source code is a "commercial item" as + * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of + * "commercial computer software" and "commercial computer software + * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) + * and is provided to the U.S. Government only as a commercial end item. + * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through + * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the + * source code with only those rights set forth herein. + */ + + +#include +#include +#include +#include + +#if defined(__cplusplus) && CUDA_VERSION < 2000 +namespace sofa +{ +namespace gpu +{ +namespace cuda +{ +#endif + +extern "C" +{ + void SpatialGridContainer3f_computeHash(int cellBits, float cellWidth, int nbPoints, void* particleIndex8, void* particleHash8, const void* x); + void SpatialGridContainer3f1_computeHash(int cellBits, float cellWidth, int nbPoints, void* particleIndex8, void* particleHash8, const void* x); + void SpatialGridContainer_findCellRange(int cellBits, int index0, float cellWidth, int nbPoints, const void* particleHash8, void* cellRange, void* cellGhost); +//void SpatialGridContainer3f_reorderData(int nbPoints, const void* particleHash, void* sorted, const void* x); +//void SpatialGridContainer3f1_reorderData(int nbPoints, const void* particleHash, void* sorted, const void* x); +} + +#define USE_TEX 0 + +struct GridParams +{ + float cellWidth; + float invCellWidth; + int cellMask; + float halfCellWidth; + float invHalfCellWidth; +}; + +// large prime numbers +#define HASH_PX 73856093 +#define HASH_PY 19349663 +#define HASH_PZ 83492791 + +////////////////////// +// GPU-side methods // +////////////////////// + +#if USE_TEX +texture cellRangeTex; +#endif + +__constant__ GridParams gridParams; + +// calculate cell in grid from position +template +__device__ int3 calcGridPos(T p) +{ + int3 i; + i.x = __float2int_rd(p.x * gridParams.invCellWidth); + i.y = __float2int_rd(p.y * gridParams.invCellWidth); + i.z = __float2int_rd(p.z * gridParams.invCellWidth); + return i; +} + +// calculate address in grid from position +__device__ unsigned int calcGridHashI(int3 p) +{ + //return ((p.x<<10)^(p.y<<5)^(p.z)) & gridParams.cellMask; + //return ((p.x)^(p.y)^(p.z)) & gridParams.cellMask; + return (__mul24(HASH_PX,p.x)^__mul24(HASH_PY,p.y)^__mul24(HASH_PZ,p.z)) & gridParams.cellMask; + //return (p.x) & gridParams.cellMask; +} + +// calculate address in grid from position +template +__device__ unsigned int calcGridHash(T p) +{ + return calcGridHashI(calcGridPos(p)); +} + + +__device__ __inline__ float3 getPos3(const float4* pos, int index0, int index) +{ + float4 p = pos[index]; + return make_float3(p.x,p.y,p.z); +} + +__shared__ float ftemp[BSIZE*3]; + +__device__ __inline__ float3 getPos3(const float3* pos, int index0, int index) +{ + //return pos[index]; + + int index03 = __umul24(index0,3); + int index3 = __umul24(threadIdx.x,3); + ftemp[threadIdx.x] = ((const float*)pos)[index03+threadIdx.x]; + ftemp[threadIdx.x+BSIZE] = ((const float*)pos)[index03+threadIdx.x+BSIZE]; + ftemp[threadIdx.x+2*BSIZE] = ((const float*)pos)[index03+threadIdx.x+2*BSIZE]; + __syncthreads(); + return make_float3(ftemp[index3],ftemp[index3+1],ftemp[index3+2]); +} + +__device__ __inline__ float4 getPos4(const float4* pos, int index0, int index) +{ + return pos[index]; +} + +__device__ __inline__ float4 getPos4(const float3* pos, int index0, int index) +{ + int index3 = __umul24(threadIdx.x,3); + pos += index0; + ftemp[threadIdx.x] = ((const float*)pos)[threadIdx.x]; + ftemp[threadIdx.x+BSIZE] = ((const float*)pos)[threadIdx.x+BSIZE]; + ftemp[threadIdx.x+2*BSIZE] = ((const float*)pos)[threadIdx.x+2*BSIZE]; + __syncthreads(); + return make_float4(ftemp[index3],ftemp[index3+1],ftemp[index3+2],0.0f); +} + +__device__ __inline__ float4 getPos4(const float4* pos, int index) +{ + return pos[index]; +} + +__device__ __inline__ float4 getPos4(const float3* pos, int index) +{ + float3 p = pos[index]; + return make_float4(p.x,p.y,p.z,1.0f); +} + +// calculate grid hash value for each particle +template +__global__ void +computeHashD(const TIn* pos, + unsigned int* particleIndex8, unsigned int* particleHash8, int n) +{ + int index0 = (blockIdx.x*BSIZE); + int index = index0 + threadIdx.x; + int nt = n - index0; if (nt > BSIZE) nt = BSIZE; + float3 p = getPos3(pos,index0,index); + + int3 hgpos; + hgpos.x = __float2int_rd(p.x * gridParams.invHalfCellWidth); + hgpos.y = __float2int_rd(p.y * gridParams.invHalfCellWidth); + hgpos.z = __float2int_rd(p.z * gridParams.invHalfCellWidth); + int halfcell = ((hgpos.x&1) + ((hgpos.y&1)<<1) + ((hgpos.z&1)<<2))^7; + // compute the first cell to be influenced by the particle + hgpos.x = (hgpos.x-1) >> 1; + hgpos.y = (hgpos.y-1) >> 1; + hgpos.z = (hgpos.z-1) >> 1; + + __syncthreads(); + + __shared__ int hx[3*BSIZE]; + int x = threadIdx.x; + +// hx[x] = (__mul24(HASH_PX,hgpos.x) << 3)+halfcell; +// hy[x] = __mul24(HASH_PY,hgpos.y); +// hz[x] = __mul24(HASH_PZ,hgpos.z); + hx[x] = ((HASH_PX*hgpos.x) << 3)+halfcell; + hx[BSIZE+x] = (HASH_PY*hgpos.y); + hx[2*BSIZE+x] = (HASH_PZ*hgpos.z); + __syncthreads(); + int3 dH; + dH.x = (x&1 ? HASH_PX : 0); + dH.y = (x&2 ? HASH_PY : 0); + dH.z = (x&4 ? HASH_PZ : 0); + int x_7 = x&7; + int index0_8_x_7 = (index0 << 3) + x_7; + for (unsigned int lx = x>>3; lx < nt; lx+=(BSIZE>>3)) + { + particleIndex8[index0_8_x_7 + (lx<<3)] = index0 + lx; + int3 h; + h.x = hx[lx]; + h.y = hx[BSIZE+lx]; + h.z = hx[2*BSIZE+lx]; + int hc = h.x & 7; + h.x = (h.x>>3) + dH.x; + h.y += dH.y; + h.z += dH.z; + unsigned int hash = ((h.x ^ h.y ^ h.z) & gridParams.cellMask)<<1; + if (hc != x_7) ++hash; + particleHash8[index0_8_x_7 + (lx<<3)] = hash; + } +} + +// find start of each cell in sorted particle list by comparing with previous hash value +// one thread per particle +__global__ void +findCellRangeD(int index0, const unsigned int* particleHash, + int * cellRange, int* cellGhost, int n) +{ + unsigned int i = __mul24(blockIdx.x, blockDim.x) + threadIdx.x; + __shared__ unsigned int hash[BSIZE]; + if (i < n) + hash[threadIdx.x] = particleHash[i]; + + __syncthreads(); + + if (i < n) + { + bool firstInCell; + bool firstGhost; + unsigned int cur = hash[threadIdx.x]; + if (i == 0) + { + firstInCell = true; + firstGhost = cur&1; + } + else + { + unsigned int prev; + if (threadIdx.x > 0) + prev = hash[threadIdx.x-1]; + else + prev = particleHash[i-1]; + firstInCell = ((prev>>1) != (cur>>1)); + firstGhost = ((prev != cur) && (cur&1)); + if (firstInCell) + { + if ((prev>>1) < (cur>>1)-1) + cellRange[ (prev>>1)+1 ] = (index0+i) | (1U<<31); + if (!(prev&1)) // no ghost particles in previous cell + cellGhost[ prev>>1 ] = index0+i; + } + } + if (firstInCell) + cellRange[ cur>>1 ] = index0+i; + if (firstGhost) + cellGhost[ cur>>1 ] = index0+i; + if (i == n-1) + { + cellRange[ (cur>>1)+1 ] = (index0+n) | (1U<<31); + if (!(cur&1)) + cellGhost[ cur>>1 ] = index0+n; + } + } +} + +// rearrange particle data into sorted order +template +__global__ void +reorderDataD(const uint2* particleHash, // particle id sorted by hash + const TIn* oldPos, + float4* sortedPos, int n + ) +{ + int index0 = __mul24(blockIdx.x, blockDim.x); + int index = index0 + threadIdx.x; + if (index < n) + { + volatile uint2 sortedData = particleHash[index]; + //float4 pos = getPos4(oldPos,index0,index); + float4 pos = getPos4(oldPos,sortedData.y); + sortedPos[index] = pos; + } +} + + +////////////////////// +// CPU-side methods // +////////////////////// + +void SpatialGridContainer3f_computeHash(int cellBits, float cellWidth, int nbPoints, void* particleIndex8, void* particleHash8, const void* x) +{ + GridParams p; + p.cellWidth = cellWidth; + p.invCellWidth = 1.0f/cellWidth; + p.cellMask = (1<<<< grid, threads >>>((const float3*)x, (unsigned int*)particleIndex8, (unsigned int*)particleHash8, nbPoints); mycudaDebugError("computeHashD");} + } +} + +void SpatialGridContainer3f1_computeHash(int cellBits, float cellWidth, int nbPoints, void* particleIndex8, void* particleHash8, const void* x) +{ + GridParams p; + p.cellWidth = cellWidth; + p.invCellWidth = 1.0f/cellWidth; + p.cellMask = (1<<<< grid, threads >>>((const float4*)x, (unsigned int*)particleIndex8, (unsigned int*)particleHash8, nbPoints); mycudaDebugError("computeHashD");} + } +} + +void SpatialGridContainer_findCellRange(int cellBits, int index0, float cellWidth, int nbPoints, const void* particleHash8, void* cellRange, void* cellGhost) +{ + cudaMemset(cellRange, 0, ((1<>>(index0, (const unsigned int*)particleHash8, (int*)cellRange, (int*)cellGhost, 8*nbPoints); mycudaDebugError("findCellRangeD");} + } +} +/* +void SpatialGridContainer3f_reorderData(int nbPoints, const void* particleHash, void* sorted, const void* x) +{ + dim3 threads(BSIZE,1); + dim3 grid((nbPoints+BSIZE-1)/BSIZE,1); + {reorderDataD<<< grid, threads >>>((const uint2*)particleHash, (const float3*)x, (float4*)sorted, nbPoints); mycudaDebugError("reorderDataD");} +} + +void SpatialGridContainer3f1_reorderData(int nbPoints, const void* particleHash, void* sorted, const void* x) +{ + dim3 threads(BSIZE,1); + dim3 grid((nbPoints+BSIZE-1)/BSIZE,1); + {reorderDataD<<< grid, threads >>>((const uint2*)particleHash, (const float4*)x, (float4*)sorted, nbPoints); mycudaDebugError("reorderDataD");} +} +*/ +#if defined(__cplusplus) && CUDA_VERSION < 2000 +} // namespace cuda +} // namespace gpu +} // namespace sofa +#endif From 0c9e5aaeea008f5636f3a34d5ae9f23f059501cc Mon Sep 17 00:00:00 2001 From: Federico Spadoni Date: Tue, 11 Sep 2012 14:34:31 +0000 Subject: [PATCH 03/47] r12738/sofa-dev : FIX: for win32 Cuda configuration: windows needs the export/import declaration Former-commit-id: 1bbcab170cc46708f160bc89f1d0bc3421ac704b --- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index 24a5b4a..267229e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -41,13 +41,14 @@ using namespace core::behavior; SOFA_DECL_CLASS(CudaSpatialGridContainer) +SOFA_DECL_CLASS(CudaSpatialGrid) int SpatialGridContainerCudaClass = core::RegisterObject("GPU support using CUDA.") .add< SpatialGridContainer >() ; -template class SpatialGridContainer< CudaVec3fTypes >; -template class SpatialGrid< SpatialGridTypes< CudaVec3fTypes > >; +template class SOFA_GPU_CUDA_API SpatialGridContainer< CudaVec3fTypes >; +template class SOFA_GPU_CUDA_API SpatialGrid< SpatialGridTypes< CudaVec3fTypes > >; #ifdef SOFA_GPU_CUDA_DOUBLE From 8e37c21915cd558739f571bbd74dcb6771b3063b Mon Sep 17 00:00:00 2001 From: Matthieu Nesme Date: Thu, 24 Oct 2013 12:40:32 +0000 Subject: [PATCH 04/47] r10105/sofa : Completing Rayleigh damping directly in Mass & ForceField Components. For now, geometric stiffnesses are neglicted. Former-commit-id: db6c2747788da8432dd0135ba4e71899998492e2 --- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 8 ++++---- .../SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 85eb640..1fd9cd0 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -96,8 +96,8 @@ void ParticlesRepulsionForceField::addDForce(const co VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); - double kFactor = mparams->kFactor(); - double bFactor = mparams->bFactor(); + Real kFactor = (Real)mparams->kFactorIncludingRayleighDamping(this->rayleighStiffness.getValue()); + Real bFactor = (Real)mparams->bFactor(); const VecCoord& x = *this->mstate->getX(); GPURepulsion3f repulsion; @@ -148,8 +148,8 @@ void ParticlesRepulsionForceField::addDForce(const co VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); - double kFactor = mparams->kFactor(); - double bFactor = mparams->bFactor(); + Real kFactor = (Real)mparams->kFactorIncludingRayleighDamping(this->rayleighStiffness.getValue()); + Real bFactor = (Real)mparams->bFactor(); const VecCoord& x = *this->mstate->getX(); GPURepulsion3d repulsion; diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index f506dfc..3eb6ae8 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -123,7 +123,7 @@ void SPHFluidForceField::addForce(const core::Mechani template <> void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& /*d_df*/, const DataVecDeriv& /*d_dx*/) { - mparams->kFactor(); + mparams->setKFactorUsed(true); #if 0 if (grid == NULL) return; @@ -212,7 +212,7 @@ void SPHFluidForceField::addForce(const core::Mechani template <> void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& /*d_df*/, const DataVecDeriv& /*d_dx*/) { - mparams->kFactor(); + mparams->setKFactorUsed(true); #if 0 if (grid == NULL) return; From 0d825c33f5b77523c4b961d87ea1c46a5700d39d Mon Sep 17 00:00:00 2001 From: Marc Legendre Date: Tue, 4 Mar 2014 02:17:19 +0000 Subject: [PATCH 05/47] r10771/sofa : Reorganize modules/ by project (BIG CHANGE WARNING) Files in modules/sofa/component/ were organised only according to the namespace hierarchy, this commit reorganizes files by project (in the cmake sense, like, checkboxes in cmake-gui). E.g. files in modules/sofa/component/SofaBaseAnimation/ are moved to modules/BaseAnimation/ Moreover, the "Sofa" prefix is dropped, and the directory structure in each module is completely flattened, unless a module contains many files. On the pragmatic side, this changes what you put in: - include directives: -> - linker dependencies: SofaBaseCollision -> BaseCollision But fear not, this commit also provides a script to fix those: $ ./scripts/fix-modules-includes.sh path/to/your/plugin This should take care of most changes. Obviously, this will modify your files, so needless to say, you should save your work beforehand. It Works on My Machine. Hopefully, it will not wreak havoc on yours. Oh, also, you should completely rebuild SOFA, because there is no way on Earth the cmake scripts can handle this. Former-commit-id: 8b197a3551423ab681a0cdc74b70c1c1d639f2da --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index 456bedb..694f31e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESOURCE_H #include "CudaTypes.h" -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h index f5a7aa3..a53ca66 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_H #include -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 1fd9cd0..9b62a9f 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_INL #include "CudaParticlesRepulsionForceField.h" -#include +#include //#include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index 532dff1..92fad55 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_H #include -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 3eb6ae8..fff1298 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_INL #include "CudaSPHFluidForceField.h" -#include +#include //#include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index 267229e..ed0ba8a 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -23,7 +23,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #include -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index c77b51f..682b66d 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -37,7 +37,7 @@ #ifndef SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_H #define SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_H -#include +#include #include #include diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index 5626ff9..29a5db0 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -39,7 +39,7 @@ #include #include -#include +#include #include namespace sofa From aa5911f8f03164f28ac5e22213712004d9fd4219 Mon Sep 17 00:00:00 2001 From: Marc Legendre Date: Wed, 5 Mar 2014 13:33:42 +0000 Subject: [PATCH 06/47] r10777/sofa : Roll back to revision 10770 Moving files around in modules/ might have been premature, I prefer not to take any more risks and roll back for now. I will commit again any other modifications that are reverted by this commit. Former-commit-id: da094ca425052ca336158ecc49ddc1426aa03e6f --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index 694f31e..456bedb 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESOURCE_H #include "CudaTypes.h" -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h index a53ca66..f5a7aa3 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_H #include -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 9b62a9f..1fd9cd0 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_INL #include "CudaParticlesRepulsionForceField.h" -#include +#include //#include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index 92fad55..532dff1 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_H #include -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index fff1298..3eb6ae8 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_INL #include "CudaSPHFluidForceField.h" -#include +#include //#include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index ed0ba8a..267229e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -23,7 +23,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #include -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index 682b66d..c77b51f 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -37,7 +37,7 @@ #ifndef SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_H #define SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_H -#include +#include #include #include diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index 29a5db0..5626ff9 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -39,7 +39,7 @@ #include #include -#include +#include #include namespace sofa From 5e7e99d13d2c64282cc783ed620ac4a3b8c08002 Mon Sep 17 00:00:00 2001 From: Marc Legendre Date: Tue, 24 Jun 2014 10:06:28 +0200 Subject: [PATCH 07/47] Fix modules includes for the whole repository Former-commit-id: 590be91bbd1c142bc1f03957517f44a6fff1b7a3 --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index 456bedb..c49d241 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESOURCE_H #include "CudaTypes.h" -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h index f5a7aa3..cb47b90 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_H #include -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 1fd9cd0..56608c1 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_INL #include "CudaParticlesRepulsionForceField.h" -#include +#include //#include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index 532dff1..0dbc848 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_H #include -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 3eb6ae8..2417d43 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -26,7 +26,7 @@ #define SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_INL #include "CudaSPHFluidForceField.h" -#include +#include //#include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index 267229e..440c231 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -23,7 +23,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #include -#include +#include #include namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index c77b51f..09cc317 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -37,7 +37,7 @@ #ifndef SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_H #define SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_H -#include +#include #include #include diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index 5626ff9..0506416 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -39,7 +39,7 @@ #include #include -#include +#include #include namespace sofa From 564369e1c741842b4facd6c55d63d76789753e20 Mon Sep 17 00:00:00 2001 From: Marc Legendre Date: Thu, 17 Jul 2014 14:52:22 +0200 Subject: [PATCH 08/47] plugins: replace getX() calls with read() (and getV(), getX0(), etc) Former-commit-id: 979c9c168e3faa1bf68816fce2be4b8cb429ffbe --- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 56608c1..6c178d9 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -99,7 +99,7 @@ void ParticlesRepulsionForceField::addDForce(const co Real kFactor = (Real)mparams->kFactorIncludingRayleighDamping(this->rayleighStiffness.getValue()); Real bFactor = (Real)mparams->bFactor(); - const VecCoord& x = *this->mstate->getX(); + const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); GPURepulsion3f repulsion; repulsion.d = distance.getValue(); repulsion.d2 = repulsion.d*repulsion.d; @@ -151,7 +151,7 @@ void ParticlesRepulsionForceField::addDForce(const co Real kFactor = (Real)mparams->kFactorIncludingRayleighDamping(this->rayleighStiffness.getValue()); Real bFactor = (Real)mparams->bFactor(); - const VecCoord& x = *this->mstate->getX(); + const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); GPURepulsion3d repulsion; repulsion.d = distance.getValue(); repulsion.d2 = repulsion.d*repulsion.d; diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 2417d43..ea08c78 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -138,8 +138,8 @@ void SPHFluidForceField::addDForce(const core::Mechan const VecDeriv& dx = d_dx.getValue(); //sout << "addDForce(" << mparams->kFactor() << "," << mparams->bFactor() << ")" << sendl; - //const VecCoord& x = *this->mstate->getX(); - const VecDeriv& v = *this->mstate->getV(); + //const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); + const VecDeriv& v = this->mstate->read(core::ConstVecDerivId::velocity())->getValue(); data.fillParams(this, kernelT, mparams->kFactor(), mparams->bFactor()); df.resize(dx.size()); Grid::Grid* g = grid->getGrid(); @@ -225,8 +225,8 @@ void SPHFluidForceField::addDForce(const core::Mechan VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); - //const VecCoord& x = *this->mstate->getX(); - const VecDeriv& v = *this->mstate->getV(); + //const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); + const VecDeriv& v = this->mstate->read(core::ConstVecDerivId::velocity())->getValue(); data.fillParams(this, mparams->kFactor(), mparams->bFactor()); df.resize(dx.size()); Grid::Grid* g = grid->getGrid(); @@ -247,7 +247,7 @@ void SPHFluidForceField::draw(const core::visual::Vis if (!vparams->displayFlags().getShowForceFields()) return; //if (grid != NULL) // grid->draw(vparams); - helper::ReadAccessor x = *this->mstate->getX(); + helper::ReadAccessor x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); helper::ReadAccessor > pos4 = this->data.pos4; if (pos4.empty()) return; glDisable(GL_LIGHTING); From a894897ded51d1e038f93687d2137472258a841b Mon Sep 17 00:00:00 2001 From: Marc Legendre Date: Wed, 29 Oct 2014 19:30:16 +0100 Subject: [PATCH 09/47] SofaCUDA: fix compilation Fix minor issues. Also, I commented some method specialisations in CudaParticleSource, because those methods were removed from ParticleSource (they were deprecated), and I have no idea how to translate them into the non-deprecated versions. Former-commit-id: 16734159e3a0d9df2dc02e3845eb7bc81c24468c --- .../sofa/gpu/cuda/CudaParticleSource.h | 28 ++-- .../sofa/gpu/cuda/CudaParticleSource.inl | 156 +++++++++--------- 2 files changed, 92 insertions(+), 92 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index c49d241..e833adf 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -38,27 +38,27 @@ namespace component namespace misc { -template <> -void ParticleSource::projectResponse(VecDeriv& res); +// template <> +// void ParticleSource::projectResponse(VecDeriv& res); -template <> -void ParticleSource::projectVelocity(VecDeriv& res); +// template <> +// void ParticleSource::projectVelocity(VecDeriv& res); -template <> -void ParticleSource::projectPosition(VecCoord& res); +// template <> +// void ParticleSource::projectPosition(VecCoord& res); -#ifdef SOFA_GPU_CUDA_DOUBLE +// #ifdef SOFA_GPU_CUDA_DOUBLE -template <> -void ParticleSource::projectResponse(VecDeriv& res); +// template <> +// void ParticleSource::projectResponse(VecDeriv& res); -template <> -void ParticleSource::projectVelocity(VecDeriv& res); +// template <> +// void ParticleSource::projectVelocity(VecDeriv& res); -template <> -void ParticleSource::projectPosition(VecCoord& res); +// template <> +// void ParticleSource::projectPosition(VecCoord& res); -#endif // SOFA_GPU_CUDA_DOUBLE +// #endif // SOFA_GPU_CUDA_DOUBLE } // namespace misc diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index 0f89a33..f11871e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -65,84 +65,84 @@ namespace misc using namespace gpu::cuda; -template <> -void ParticleSource::projectResponse(VecDeriv& res) -{ - if (!this->mstate) return; - const VecIndex& lastparticles = this->lastparticles.getValue(); - if (lastparticles.empty()) return; - //sout << "ParticleSource: projectResponse of last particles ("<getTime(); - if (time < f_start.getValue() || time > f_stop.getValue()) return; - // constraint the last values - //mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Deriv)); - ParticleSourceCuda3f_fillValues(res.size(), lastparticles.size(), res.deviceWrite(), lastparticles.deviceRead(), 0, 0, 0); -} - -template <> -void ParticleSource::projectVelocity(VecDeriv& res) -{ - if (!this->mstate) return; - const VecIndex& lastparticles = this->lastparticles.getValue(); - if (lastparticles.empty()) return; - //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); - if (time < f_start.getValue() || time > f_stop.getValue()) return; - // constraint the last values - Deriv vel = f_velocity.getValue(); -#if 1 - //mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Coord)); - ParticleSourceCuda3f_fillValues(res.size(), lastparticles.size(), res.deviceWrite(), lastparticles.deviceRead(), vel[0], vel[1], vel[2]); -#else - for (unsigned int s=0; s -void ParticleSource::projectPosition(VecCoord& res) -{ - if (!this->mstate) return; - const VecIndex& lastparticles = this->lastparticles.getValue(); - if (lastparticles.empty()) return; - //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); - if (time < f_start.getValue() || time > f_stop.getValue()) return; - // constraint the last values - Deriv vel = f_velocity.getValue(); - vel *= (time-lasttime); - //mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Coord)); - ParticleSourceCuda3f_copyValuesWithOffset(res.size(), lastparticles.size(), res.deviceWrite(), lastparticles.deviceRead(), lastpos.deviceRead(), vel[0], vel[1], vel[2]); -} - - -#ifdef SOFA_GPU_CUDA_DOUBLE - -template <> -void ParticleSource::projectResponse(VecDeriv& res) -{ - if (!this->mstate) return; - const VecIndex& lastparticles = this->lastparticles.getValue(); - if (lastparticles.empty()) return; - //sout << "ParticleSource: projectResponse of last particle ("<getTime(); - if (time < f_start.getValue() || time > f_stop.getValue()) return; - // constraint the last values - mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Coord)); -} - -template <> -void ParticleSource::projectVelocity(VecDeriv& /*res*/) -{ -} - -template <> -void ParticleSource::projectPosition(VecDeriv& /*res*/) -{ -} - -#endif // SOFA_GPU_CUDA_DOUBLE +// template <> +// void ParticleSource::projectResponse(VecDeriv& res) +// { +// if (!this->mstate) return; +// const VecIndex& lastparticles = this->lastparticles.getValue(); +// if (lastparticles.empty()) return; +// //sout << "ParticleSource: projectResponse of last particles ("<getTime(); +// if (time < f_start.getValue() || time > f_stop.getValue()) return; +// // constraint the last values +// //mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Deriv)); +// ParticleSourceCuda3f_fillValues(res.size(), lastparticles.size(), res.deviceWrite(), lastparticles.deviceRead(), 0, 0, 0); +// } + +// template <> +// void ParticleSource::projectVelocity(VecDeriv& res) +// { +// if (!this->mstate) return; +// const VecIndex& lastparticles = this->lastparticles.getValue(); +// if (lastparticles.empty()) return; +// //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); +// if (time < f_start.getValue() || time > f_stop.getValue()) return; +// // constraint the last values +// Deriv vel = f_velocity.getValue(); +// #if 1 +// //mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Coord)); +// ParticleSourceCuda3f_fillValues(res.size(), lastparticles.size(), res.deviceWrite(), lastparticles.deviceRead(), vel[0], vel[1], vel[2]); +// #else +// for (unsigned int s=0; s +// void ParticleSource::projectPosition(VecCoord& res) +// { +// if (!this->mstate) return; +// const VecIndex& lastparticles = this->lastparticles.getValue(); +// if (lastparticles.empty()) return; +// //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); +// if (time < f_start.getValue() || time > f_stop.getValue()) return; +// // constraint the last values +// Deriv vel = f_velocity.getValue(); +// vel *= (time-lasttime); +// //mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Coord)); +// ParticleSourceCuda3f_copyValuesWithOffset(res.size(), lastparticles.size(), res.deviceWrite(), lastparticles.deviceRead(), lastpos.deviceRead(), vel[0], vel[1], vel[2]); +// } + + +// #ifdef SOFA_GPU_CUDA_DOUBLE + +// template <> +// void ParticleSource::projectResponse(VecDeriv& res) +// { +// if (!this->mstate) return; +// const VecIndex& lastparticles = this->lastparticles.getValue(); +// if (lastparticles.empty()) return; +// //sout << "ParticleSource: projectResponse of last particle ("<getTime(); +// if (time < f_start.getValue() || time > f_stop.getValue()) return; +// // constraint the last values +// mycudaMemset(((Deriv*)res.deviceWrite())+lastparticles[0], 0, lastparticles.size()*sizeof(Coord)); +// } + +// template <> +// void ParticleSource::projectVelocity(VecDeriv& /*res*/) +// { +// } + +// template <> +// void ParticleSource::projectPosition(VecDeriv& /*res*/) +// { +// } + +// #endif // SOFA_GPU_CUDA_DOUBLE } // namespace misc From 813ac9ea7a7f8da0dbfbc819dce21cfa7b0f8b9e Mon Sep 17 00:00:00 2001 From: nesme Date: Wed, 4 Mar 2015 16:29:46 +0100 Subject: [PATCH 10/47] removing all /* PARAMS FIRST */ comments, I cannot see them any longer Former-commit-id: 723c140367e421db8cf8f91fb38b8b48305d85ad --- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.h | 8 ++++---- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 8 ++++---- .../SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h | 8 ++++---- .../SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h index cb47b90..2fee8cd 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -61,18 +61,18 @@ namespace forcefield { template <> -void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); +void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* mparams, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); template <> -void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx); +void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams, DataVecDeriv& d_df, const DataVecDeriv& d_dx); #ifdef SOFA_GPU_CUDA_DOUBLE template <> -void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); +void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* mparams, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); template <> -void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx); +void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams, DataVecDeriv& d_df, const DataVecDeriv& d_dx); #endif // SOFA_GPU_CUDA_DOUBLE diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 6c178d9..edefe35 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -66,7 +66,7 @@ using namespace gpu::cuda; template <> -void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* /*mparams*/ /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) +void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* /*mparams*/, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) { if (grid == NULL) return; @@ -90,7 +90,7 @@ void ParticlesRepulsionForceField::addForce(const cor } template <> -void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx) +void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams, DataVecDeriv& d_df, const DataVecDeriv& d_dx) { if (grid == NULL) return; @@ -118,7 +118,7 @@ void ParticlesRepulsionForceField::addDForce(const co #ifdef SOFA_GPU_CUDA_DOUBLE template <> -void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* /*mparams*/ /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) +void ParticlesRepulsionForceField::addForce(const core::MechanicalParams* /*mparams*/, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) { if (grid == NULL) return; @@ -142,7 +142,7 @@ void ParticlesRepulsionForceField::addForce(const cor } template <> -void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx) +void ParticlesRepulsionForceField::addDForce(const core::MechanicalParams* mparams, DataVecDeriv& d_df, const DataVecDeriv& d_dx) { if (grid == NULL) return; diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index 0dbc848..0586a31 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -118,10 +118,10 @@ class SPHFluidForceFieldInternalData< gpu::cuda::CudaVectorTypes -void SPHFluidForceField::addForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); +void SPHFluidForceField::addForce(const core::MechanicalParams* mparams, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); template <> -void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx); +void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams, DataVecDeriv& d_df, const DataVecDeriv& d_dx); template <> void SPHFluidForceField::draw(const core::visual::VisualParams* vparams); @@ -129,10 +129,10 @@ void SPHFluidForceField::draw(const core::visual::Vis #ifdef SOFA_GPU_CUDA_DOUBLE template <> -void SPHFluidForceField::addForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); +void SPHFluidForceField::addForce(const core::MechanicalParams* mparams, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v); template <> -void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& d_df, const DataVecDeriv& d_dx); +void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams, DataVecDeriv& d_df, const DataVecDeriv& d_dx); #endif // SOFA_GPU_CUDA_DOUBLE diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index ea08c78..5ed8f6a 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -85,7 +85,7 @@ void SPHFluidForceFieldInternalData::Kernels_addDForc } */ template <> -void SPHFluidForceField::addForce(const core::MechanicalParams* /*mparams*/ /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) +void SPHFluidForceField::addForce(const core::MechanicalParams* /*mparams*/, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) { if (grid == NULL) return; @@ -121,7 +121,7 @@ void SPHFluidForceField::addForce(const core::Mechani } template <> -void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& /*d_df*/, const DataVecDeriv& /*d_dx*/) +void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams, DataVecDeriv& /*d_df*/, const DataVecDeriv& /*d_dx*/) { mparams->setKFactorUsed(true); #if 0 @@ -174,7 +174,7 @@ void SPHFluidForceFieldInternalData::Kernels_addDForc } */ template <> -void SPHFluidForceField::addForce(const core::MechanicalParams* /*mparams*/ /* PARAMS FIRST */, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) +void SPHFluidForceField::addForce(const core::MechanicalParams* /*mparams*/, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) { if (grid == NULL) return; @@ -210,7 +210,7 @@ void SPHFluidForceField::addForce(const core::Mechani } template <> -void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams /* PARAMS FIRST */, DataVecDeriv& /*d_df*/, const DataVecDeriv& /*d_dx*/) +void SPHFluidForceField::addDForce(const core::MechanicalParams* mparams, DataVecDeriv& /*d_df*/, const DataVecDeriv& /*d_dx*/) { mparams->setKFactorUsed(true); #if 0 From 4f639dd8206b3b531254db50bfe6d8184b17b692 Mon Sep 17 00:00:00 2001 From: Benjamin GILLES Date: Mon, 20 Apr 2015 16:12:59 +0200 Subject: [PATCH 11/47] [SofaCUDA] fix compilation on mac (clang 3.7, CUDA 7.0) Former-commit-id: a2f46566ffa73843be5fa1f6ae5320962c65e1c1 --- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp | 2 ++ .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp index e25e973..5b6fd02 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp @@ -25,6 +25,8 @@ #include #include "CudaParticlesRepulsionForceField.inl" #include +#include +#include namespace sofa { diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp index 79464a3..2e5cc04 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp @@ -25,6 +25,8 @@ #include #include "CudaSPHFluidForceField.inl" #include +#include +#include namespace sofa { From 6b96a09bf7099a398dd4a98ef0d81d1d2b6103da Mon Sep 17 00:00:00 2001 From: Benjamin GILLES Date: Mon, 20 Apr 2015 16:12:59 +0200 Subject: [PATCH 12/47] [SofaCUDA] fix compilation on mac (clang 3.7, CUDA 7.0) Former-commit-id: ce86fd7f466eb071eaa73e216960cd6bf583d591 --- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp | 2 ++ .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp index e25e973..5b6fd02 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp @@ -25,6 +25,8 @@ #include #include "CudaParticlesRepulsionForceField.inl" #include +#include +#include namespace sofa { diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp index 79464a3..2e5cc04 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp @@ -25,6 +25,8 @@ #include #include "CudaSPHFluidForceField.inl" #include +#include +#include namespace sofa { From 79e616099a5ba5c9351bf1d66d8fb401ef24062a Mon Sep 17 00:00:00 2001 From: Marc Legendre Date: Mon, 29 Jun 2015 17:21:10 +0200 Subject: [PATCH 13/47] applications: clean up some includes Former-commit-id: de8d090329fdadbc6aa0e35270098c7972114e74 --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl | 1 - 1 file changed, 1 deletion(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index f11871e..9e8a391 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -26,7 +26,6 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESOURCE_INL #include "CudaParticleSource.h" -//#include #include namespace sofa From 5a2bd7a3dd42667ac9289bca53a1adf9d468ef90 Mon Sep 17 00:00:00 2001 From: Etienne Schmitt Date: Sun, 1 Nov 2015 16:21:33 +0100 Subject: [PATCH 14/47] updated the license. Signed-off-by: Etienne Schmitt Former-commit-id: 1d0c2181ba363fdf8c90534ce61d2829b154d74f --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl | 4 ++-- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp | 4 ++-- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h | 4 ++-- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 4 ++-- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp index 774edd6..96454c3 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu index 03f1761..1e962c1 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index e833adf..c784d10 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index 9e8a391..8cfc08d 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp index 5b6fd02..912f76a 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu index 984a6c3..43825a2 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h index 2fee8cd..42d1b02 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index edefe35..307a8de 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp index 2e5cc04..625b7b6 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu index a69c19e..e75f0e2 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index 0586a31..2835a95 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 5ed8f6a..20c1a74 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index 440c231..52c15d8 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu index 7ebb8e8..68bf698 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index 09cc317..3ed75dc 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index 0506416..b2ae360 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, version 1.0 RC 1 * -* (c) 2006-2011 MGH, INRIA, USTL, UJF, CNRS * +* SOFA, Simulation Open-Framework Architecture, development version * +* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * From f09355893aad8679c6e7d6aad396fba7eb8272de Mon Sep 17 00:00:00 2001 From: Etienne Schmitt Date: Sat, 13 Feb 2016 14:23:41 +0100 Subject: [PATCH 15/47] updating licenses. Signed-off-by: Etienne Schmitt Former-commit-id: 4b6a6d51ae2391fa2a861c26575be03baf3522da --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp index 96454c3..53b0066 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu index 1e962c1..44287a1 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index c784d10..abdb18d 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index 8cfc08d..0e892c1 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp index 912f76a..940a3cf 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu index 43825a2..6f2813a 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h index 42d1b02..3d14d98 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 307a8de..1d39351 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp index 625b7b6..78ade5f 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu index e75f0e2..e090de3 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index 2835a95..041452d 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 20c1a74..73018b5 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index 52c15d8..0bd4f6b 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu index 68bf698..3bff00a 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index 3ed75dc..164d7dd 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index b2ae360..1f79ce7 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2015 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * From 1a8b87a58ed3ae936655a749fec3df721edd08ff Mon Sep 17 00:00:00 2001 From: htalbot Date: Mon, 9 Jan 2017 17:53:37 +0100 Subject: [PATCH 16/47] [SOFA] Update the year 2017 in all file headers --- .../SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp | 11 ++++------- .../SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu | 11 ++++------- .../SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h | 11 ++++------- .../SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl | 11 ++++------- .../gpu/cuda/CudaParticlesRepulsionForceField.cpp | 11 ++++------- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu | 11 ++++------- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.h | 11 ++++------- .../gpu/cuda/CudaParticlesRepulsionForceField.inl | 11 ++++------- .../SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp | 11 ++++------- .../SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu | 11 ++++------- .../SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h | 11 ++++------- .../SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 11 ++++------- .../sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 11 ++++------- .../sofa/gpu/cuda/CudaSpatialGridContainer.cu | 11 ++++------- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 11 ++++------- .../sofa/gpu/cuda/CudaSpatialGridContainer.inl | 11 ++++------- 16 files changed, 64 insertions(+), 112 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp index 53b0066..5acb30c 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu index 44287a1..f5aefa0 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index abdb18d..1609dee 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index 0e892c1..f058569 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp index 940a3cf..d77a555 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu index 6f2813a..e04754e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h index 3d14d98..9cb240e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 1d39351..2c2a7d0 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp index 78ade5f..a4c3c07 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu index e090de3..8b5921d 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index 041452d..e8fa47a 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 73018b5..4a1c1a2 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index 0bd4f6b..259e2f8 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu index 3bff00a..d010d93 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index 164d7dd..eb43c8b 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index 1f79ce7..a38969f 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -1,23 +1,20 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2016 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * -* This library is free software; you can redistribute it and/or modify it * +* 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 library is distributed in the hope that it will be useful, but WITHOUT * +* 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 library; if not, write to the Free Software Foundation, * -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* along with this program. If not, see . * ******************************************************************************* -* SOFA :: Modules * -* * * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * From db9968cea9f3a56d7a0a7c55bc03fe65a93eca7f Mon Sep 17 00:00:00 2001 From: Damien Marchal Date: Mon, 18 Sep 2017 10:48:45 +0200 Subject: [PATCH 17/47] [SofaCUDA] Update to properly handle the dependency with plugin/SofaSphFluid --- .../sofa/gpu/cuda/CudaParticleSource.cpp | 3 +- .../sofa/gpu/cuda/CudaParticleSource.h | 39 ------------------- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp index 5acb30c..5e7ab1d 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp @@ -22,7 +22,8 @@ #include "CudaTypes.h" #include "CudaParticleSource.inl" #include - +#include +#include namespace sofa { diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index 1609dee..ed78d48 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -23,44 +23,5 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESOURCE_H #include "CudaTypes.h" -#include -#include - -namespace sofa -{ - -namespace component -{ - -namespace misc -{ - -// template <> -// void ParticleSource::projectResponse(VecDeriv& res); - -// template <> -// void ParticleSource::projectVelocity(VecDeriv& res); - -// template <> -// void ParticleSource::projectPosition(VecCoord& res); - -// #ifdef SOFA_GPU_CUDA_DOUBLE - -// template <> -// void ParticleSource::projectResponse(VecDeriv& res); - -// template <> -// void ParticleSource::projectVelocity(VecDeriv& res); - -// template <> -// void ParticleSource::projectPosition(VecCoord& res); - -// #endif // SOFA_GPU_CUDA_DOUBLE - -} // namespace misc - -} // namespace component - -} // namespace sofa #endif From 6b6e1e9df80339478cee77436f87fda75adc0ab7 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Fri, 29 Sep 2017 15:06:31 +0200 Subject: [PATCH 18/47] [SofaCUDA] fix compilation --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 1 + 1 file changed, 1 insertion(+) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 4a1c1a2..b33c543 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -24,6 +24,7 @@ #include "CudaSPHFluidForceField.h" #include +#include //#include namespace sofa From 697c95d2f4a445d6bf9c840c7026d18aa6af956d Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Wed, 7 Feb 2018 09:40:51 +0100 Subject: [PATCH 19/47] [All] Update license headers 2018 --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp index 5e7ab1d..d8e3c20 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu index f5aefa0..8dc216e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index ed78d48..4da6099 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index f058569..11117e2 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp index d77a555..85b5bc4 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu index e04754e..3af3f83 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h index 9cb240e..7efc1ea 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 2c2a7d0..540b942 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp index a4c3c07..15aa81c 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu index 8b5921d..98682c6 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index e8fa47a..efbe4eb 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index b33c543..5162a4e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index 259e2f8..d8627f0 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu index d010d93..6579bf2 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index eb43c8b..daddb92 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index a38969f..e2b7f3c 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2018 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 * From 5124a220c3f3444e5d21fd3a49eee974938ec908 Mon Sep 17 00:00:00 2001 From: Damien Marchal Date: Tue, 20 Nov 2018 17:16:03 +0100 Subject: [PATCH 20/47] [all] Remove all #ifdef SOFA_DEV In case these SOFA_DEV were usefull to you please make PR in which the removed code is properly engineered (i.e no #ifdef). If you don't think using #ifdef is bad don't hesitate to tell it to sofa-dev. --- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 5 ----- 1 file changed, 5 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index e2b7f3c..958cabb 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -211,11 +211,6 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes Date: Mon, 26 Nov 2018 16:54:54 +0100 Subject: [PATCH 21/47] [All] Remove SOFA_DECL_CLASS and SOFA_LINK_CLASS (#837) * Minor changes to ease automatic removal of SOFA_FLOAT. * [all] remove all SOFA_DECL_CLASS & SOFA_LINK_CLASS * [SofaCUDA] Remove comments that fails. * [All] Clean blank lines + forgotten macros --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp | 2 -- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp | 2 -- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp | 2 -- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 3 --- 4 files changed, 9 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp index d8e3c20..123d022 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp @@ -47,8 +47,6 @@ namespace cuda -SOFA_DECL_CLASS(CudaParticleSource) - int ParticleSourceCudaClass = core::RegisterObject("Supports GPU-side computations using CUDA") .add< component::misc::ParticleSource >() #ifdef SOFA_GPU_CUDA_DOUBLE diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp index 85b5bc4..d26764e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp @@ -34,8 +34,6 @@ namespace gpu namespace cuda { -SOFA_DECL_CLASS(CudaParticlesRepulsionForceField) - int ParticlesRepulsionForceFieldCudaClass = core::RegisterObject("Supports GPU-side computations using CUDA") .add< component::forcefield::ParticlesRepulsionForceField >() #ifdef SOFA_GPU_CUDA_DOUBLE diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp index 15aa81c..6b57b53 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp @@ -34,8 +34,6 @@ namespace gpu namespace cuda { -SOFA_DECL_CLASS(CudaSPHFluidForceField) - int SPHFluidForceFieldCudaClass = core::RegisterObject("Supports GPU-side computations using CUDA") .add< component::forcefield::SPHFluidForceField >() #ifdef SOFA_GPU_CUDA_DOUBLE diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index d8627f0..ce4f2bd 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -37,9 +37,6 @@ using namespace sofa::gpu::cuda; using namespace core::behavior; -SOFA_DECL_CLASS(CudaSpatialGridContainer) -SOFA_DECL_CLASS(CudaSpatialGrid) - int SpatialGridContainerCudaClass = core::RegisterObject("GPU support using CUDA.") .add< SpatialGridContainer >() ; From b04ca4fc405b026dfb2e4cbca54e9bba4dbdb6e7 Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Fri, 1 Mar 2019 15:30:38 +0100 Subject: [PATCH 22/47] [All] Update license headers 2019 --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 2 +- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp index 123d022..1ef91b4 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu index 8dc216e..25efee7 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index 4da6099..7fc91d1 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index 11117e2..4501d01 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp index d26764e..3bfbb93 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu index 3af3f83..8282824 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h index 7efc1ea..1fa3a9e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 540b942..1121cd8 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp index 6b57b53..f11e100 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu index 98682c6..a6e072d 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index efbe4eb..256accb 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 5162a4e..e3d9c75 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index ce4f2bd..1ee5cf6 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu index 6579bf2..8a55f0c 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index daddb92..78fa704 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index 958cabb..e3e4f76 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -1,6 +1,6 @@ /****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH * +* (c) 2006-2019 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 * From 4d1c5e217d2da21b33095aa0e777d5475292986f Mon Sep 17 00:00:00 2001 From: erik pernod Date: Thu, 17 Oct 2019 01:28:56 +0200 Subject: [PATCH 23/47] [SofaCUDA] Fix CudaSPHFluidFF compilation due to Data prefix changes in SPHFluidFF --- .../sofa/gpu/cuda/CudaSPHFluidForceField.h | 12 ++-- .../sofa/gpu/cuda/CudaSPHFluidForceField.inl | 72 +++++++++---------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index 256accb..3b23a33 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -82,16 +82,16 @@ class SPHFluidForceFieldInternalData< gpu::cuda::CudaVectorTypesparticleRadius.getValue(); + Real h = m->d_particleRadius.getValue(); params.h = h; params.h2 = h*h; params.inv_h2 = 1/(h*h); - params.stiffness = (Real)(kFactor*m->pressureStiffness.getValue()); - params.mass = m->particleMass.getValue(); + params.stiffness = (Real)(kFactor*m->d_pressureStiffness.getValue()); + params.mass = m->d_particleMass.getValue(); params.mass2 = params.mass*params.mass; - params.density0 = m->density0.getValue(); - params.viscosity = (Real)(bFactor*m->viscosity.getValue()); - params.surfaceTension = (Real)(kFactor*m->surfaceTension.getValue()); + params.density0 = m->d_density0.getValue(); + params.viscosity = (Real)(bFactor*m->d_viscosity.getValue()); + params.surfaceTension = (Real)(kFactor*m->d_surfaceTension.getValue()); if (kernelType == 1) { params.CWd = SPHKernel::constW(h); diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index e3d9c75..f3d9a5e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -85,23 +85,23 @@ void SPHFluidForceFieldInternalData::Kernels_addDForc template <> void SPHFluidForceField::addForce(const core::MechanicalParams* /*mparams*/, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) { - if (grid == NULL) return; + if (m_grid == NULL) return; - const int kernelT = kernelType.getValue(); - const int pressureT = pressureType.getValue(); - const Real viscosity = this->viscosity.getValue(); - const int viscosityT = (viscosity == 0) ? 0 : viscosityType.getValue(); - const Real surfaceTension = this->surfaceTension.getValue(); - const int surfaceTensionT = (surfaceTension <= 0) ? 0 : surfaceTensionType.getValue(); + const int kernelT = d_kernelType.getValue(); + const int pressureT = d_pressureType.getValue(); + const Real viscosity = this->d_viscosity.getValue(); + const int viscosityT = (viscosity == 0) ? 0 : d_viscosityType.getValue(); + const Real surfaceTension = this->d_surfaceTension.getValue(); + const int surfaceTensionT = (surfaceTension <= 0) ? 0 : d_surfaceTensionType.getValue(); VecDeriv& f = *d_f.beginEdit(); const VecCoord& x = d_x.getValue(); const VecDeriv& v = d_v.getValue(); - grid->updateGrid(x); + m_grid->updateGrid(x); data.fillParams(this, kernelT); f.resize(x.size()); - Grid::Grid* g = grid->getGrid(); + Grid::Grid* g = m_grid->getGrid(); data.pos4.recreate(x.size()); data.Kernels_computeDensity( kernelT, pressureT, g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), @@ -123,14 +123,14 @@ void SPHFluidForceField::addDForce(const core::Mechan { mparams->setKFactorUsed(true); #if 0 - if (grid == NULL) return; + if (m_grid == NULL) return; - const int kernelT = kernelType.getValue(); - const int pressureT = pressureType.getValue(); - const Real viscosity = this->viscosity.getValue(); - const int viscosityT = (viscosity == 0) ? 0 : viscosityType.getValue(); - const Real surfaceTension = this->surfaceTension.getValue(); - const int surfaceTensionT = (surfaceTension <= 0) ? 0 : surfaceTensionType.getValue(); + const int kernelT = d_kernelType.getValue(); + const int pressureT = d_pressureType.getValue(); + const Real viscosity = this->d_viscosity.getValue(); + const int viscosityT = (viscosity == 0) ? 0 : d_viscosityType.getValue(); + const Real surfaceTension = this->d_surfaceTension.getValue(); + const int surfaceTensionT = (surfaceTension <= 0) ? 0 : d_surfaceTensionType.getValue(); VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); @@ -140,7 +140,7 @@ void SPHFluidForceField::addDForce(const core::Mechan const VecDeriv& v = this->mstate->read(core::ConstVecDerivId::velocity())->getValue(); data.fillParams(this, kernelT, mparams->kFactor(), mparams->bFactor()); df.resize(dx.size()); - Grid::Grid* g = grid->getGrid(); + Grid::Grid* g = m_grid->getGrid(); data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); @@ -174,23 +174,23 @@ void SPHFluidForceFieldInternalData::Kernels_addDForc template <> void SPHFluidForceField::addForce(const core::MechanicalParams* /*mparams*/, DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& d_v) { - if (grid == NULL) return; + if (m_grid == NULL) return; - const int kernelT = kernelType.getValue(); - const int pressureT = pressureType.getValue(); - const Real viscosity = this->viscosity.getValue(); - const int viscosityT = (viscosity == 0) ? 0 : viscosityType.getValue(); - const Real surfaceTension = this->surfaceTension.getValue(); - const int surfaceTensionT = (surfaceTension <= 0) ? 0 : surfaceTensionType.getValue(); + const int kernelT = d_kernelType.getValue(); + const int pressureT = d_pressureType.getValue(); + const Real viscosity = this->d_viscosity.getValue(); + const int viscosityT = (viscosity == 0) ? 0 : d_viscosityType.getValue(); + const Real surfaceTension = this->d_surfaceTension.getValue(); + const int surfaceTensionT = (surfaceTension <= 0) ? 0 : d_surfaceTensionType.getValue(); VecDeriv& f = *d_f.beginEdit(); const VecCoord& x = d_x.getValue(); const VecDeriv& v = d_v.getValue(); - grid->updateGrid(x); + m_grid->updateGrid(x); data.fillParams(this, kernelT); f.resize(x.size()); - Grid::Grid* g = grid->getGrid(); + Grid::Grid* g = m_grid->getGrid(); data.pos4.recreate(x.size()); data.Kernels_computeDensity( kernelT, pressureT, g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), @@ -212,14 +212,14 @@ void SPHFluidForceField::addDForce(const core::Mechan { mparams->setKFactorUsed(true); #if 0 - if (grid == NULL) return; + if (m_grid == NULL) return; - const int kernelT = kernelType.getValue(); - const int pressureT = pressureType.getValue(); - const Real viscosity = this->viscosity.getValue(); - const int viscosityT = (viscosity == 0) ? 0 : viscosityType.getValue(); - const Real surfaceTension = this->surfaceTension.getValue(); - const int surfaceTensionT = (surfaceTension <= 0) ? 0 : surfaceTensionType.getValue(); + const int kernelT = d_kernelType.getValue(); + const int pressureT = d_pressureType.getValue(); + const Real viscosity = this->d_viscosity.getValue(); + const int viscosityT = (viscosity == 0) ? 0 : d_viscosityType.getValue(); + const Real surfaceTension = this->d_surfaceTension.getValue(); + const int surfaceTensionT = (surfaceTension <= 0) ? 0 : d_surfaceTensionType.getValue(); VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); @@ -227,7 +227,7 @@ void SPHFluidForceField::addDForce(const core::Mechan const VecDeriv& v = this->mstate->read(core::ConstVecDerivId::velocity())->getValue(); data.fillParams(this, mparams->kFactor(), mparams->bFactor()); df.resize(dx.size()); - Grid::Grid* g = grid->getGrid(); + Grid::Grid* g = m_grid->getGrid(); data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); @@ -243,7 +243,7 @@ template <> void SPHFluidForceField::draw(const core::visual::VisualParams* vparams) { if (!vparams->displayFlags().getShowForceFields()) return; - //if (grid != NULL) + //if (m_grid != NULL) // grid->draw(vparams); helper::ReadAccessor x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); helper::ReadAccessor > pos4 = this->data.pos4; @@ -257,7 +257,7 @@ void SPHFluidForceField::draw(const core::visual::Vis for (unsigned int i=0; i Date: Mon, 21 Oct 2019 22:52:27 +0200 Subject: [PATCH 24/47] [SofaCUDA] Fix CudaParticleSource compilation --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp index 1ef91b4..bd3d783 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp @@ -23,7 +23,7 @@ #include "CudaParticleSource.inl" #include #include -#include +#include namespace sofa { From 8a88bd768a6d6b7d6bf6ea71e322951e1164d4fd Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Fri, 17 Jan 2020 12:34:30 +0100 Subject: [PATCH 25/47] Allowing SofaCUDA to compile without opengl --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 2 ++ .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 2 ++ 2 files changed, 4 insertions(+) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index f3d9a5e..cc59d2c 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -242,6 +242,7 @@ void SPHFluidForceField::addDForce(const core::Mechan template <> void SPHFluidForceField::draw(const core::visual::VisualParams* vparams) { +#ifdef SOFA_NO_OPENGL if (!vparams->displayFlags().getShowForceFields()) return; //if (m_grid != NULL) // grid->draw(vparams); @@ -271,6 +272,7 @@ void SPHFluidForceField::draw(const core::visual::Vis } glEnd(); glPointSize(1); +#endif // SOFA_NO_OPENGL } } // namespace forcefield diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index e3e4f76..1f3624f 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -300,6 +300,7 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::draw(const core::visual::VisualParams* ) { +#ifdef SOFA_NO_OPENGL if (!lastX) return; int nbPoints = particleHash.size(); int index0 = nbCells+BSIZE; @@ -330,6 +331,7 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes Date: Fri, 3 Apr 2020 14:26:59 +0200 Subject: [PATCH 26/47] fix CUDA collision models --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index cc59d2c..d071230 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -272,6 +272,8 @@ void SPHFluidForceField::draw(const core::visual::Vis } glEnd(); glPointSize(1); +#else + SOFA_UNUSED(vparams); #endif // SOFA_NO_OPENGL } From e848f96c4e006a4b5abf5d2c0920a7978ae8b5ae Mon Sep 17 00:00:00 2001 From: htalbot Date: Thu, 7 May 2020 23:22:43 +0200 Subject: [PATCH 27/47] Update and simplify license header --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl | 4 ++-- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp | 4 ++-- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h | 4 ++-- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 4 ++-- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp index bd3d783..0d11b8d 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu index 25efee7..54b8024 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index 7fc91d1..c4d9cc6 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index 4501d01..6ff9140 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp index 3bfbb93..f402a0f 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu index 8282824..fad0986 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h index 1fa3a9e..687af94 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 1121cd8..28ea3e5 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp index f11e100..cb23d9a 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu index a6e072d..fa90796 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index 3b23a33..e571ea4 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index d071230..0c311d5 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index 1ee5cf6..6cbb8d6 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu index 8a55f0c..edd78f4 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index 78fa704..7bddce6 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index 1f3624f..e1a1117 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -1,6 +1,6 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture, development version * -* (c) 2006-2019 INRIA, USTL, UJF, CNRS, MGH * +* 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 * From 840331eaebe34d8ac704417009f96227009a4e10 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Thu, 24 Sep 2020 19:02:02 +0200 Subject: [PATCH 28/47] [All] Standardize index type for Vector/Matrix templates (#1453) * harmonize index type for fixed_array/Vec/Mat * Fix compil with gcc * Fix some plugins * fix msvc * more * moar * Fix SPH compil * Fix compilation and fix issue with rendering (needing uint) * fix for gcc * Fix SofaCarving * Fix Manifold topo plugin * more * Fix compil + restore int for matrix * fix SofaCUDA * Fix clang * Continue with indices * Fix Cuda * fix with clang + other * Fix Cuda * Fix bug * Fix PointSetTopo and topo tests * Fix vectypes bug * Remove some signed/unsigned warnings * Change BaseVector/Basematrix index to index_type (+fix warnings&co) * Fix nasty bug with enum being ints * revert BaseMatrix type to int, as solvers needs int (and i wont change it for now) * Remove irrelevant tests + change index type for ROI (should fix test) --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index 7bddce6..87236d2 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -86,7 +86,7 @@ class SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes* old2new, helper::vector* new2old); + void reorderIndices(helper::vector* old2new, helper::vector* new2old); GridData data; Real getCellWidth() const { return cellWidth; } diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index e1a1117..20c3090 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -98,9 +98,9 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes -void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(helper::vector* /*old2new*/, helper::vector* /*new2old*/) +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(helper::vector* /*old2new*/, helper::vector* /*new2old*/) { - std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(helper::vector* old2new, helper::vector* new2old)"< > >::reorderIndices(helper::vector* old2new, helper::vector* new2old)"< Date: Thu, 1 Oct 2020 01:40:10 +0200 Subject: [PATCH 29/47] Merge remote-tracking branch 'defrost/pr-fix-default-APIVersion' into master-with-upstream-integration # Conflicts: # modules/SofaGraphComponent/SceneCheckAPIChange.h --- .../sofa/gpu/cuda/CudaParticleSource.inl | 4 -- .../sofa/gpu/cuda/CudaSPHFluidForceField.inl | 50 ++++++++----------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index 6ff9140..1bcd6fa 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -67,7 +67,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectResponse of last particles ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values @@ -81,7 +80,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values @@ -102,7 +100,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values @@ -121,7 +118,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectResponse of last particle ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 0c311d5..56bb479 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -39,14 +39,14 @@ namespace cuda extern "C" { - void SPHFluidForceFieldCuda3f_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* pos4, const void* x); - void SPHFluidForceFieldCuda3f_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v); +void SPHFluidForceFieldCuda3f_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* pos4, const void* x); +void SPHFluidForceFieldCuda3f_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v); //void SPHFluidForceFieldCuda3f_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v, const void* dx); #ifdef SOFA_GPU_CUDA_DOUBLE - void SPHFluidForceFieldCuda3d_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* pos4, const void* x); - void SPHFluidForceFieldCuda3d_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v); +void SPHFluidForceFieldCuda3d_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* pos4, const void* x); +void SPHFluidForceFieldCuda3d_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v); //void SPHFluidForceFieldCuda3d_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v, const void* dx); #endif // SOFA_GPU_CUDA_DOUBLE @@ -104,16 +104,15 @@ void SPHFluidForceField::addForce(const core::Mechani Grid::Grid* g = m_grid->getGrid(); data.pos4.recreate(x.size()); data.Kernels_computeDensity( kernelT, pressureT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - data.pos4.deviceWrite(), x.deviceRead()); - if (this->f_printLog.getValue()) - { - sout << "density[" << 0 << "] = " << data.pos4[0][3] << sendl; - sout << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3] << sendl; - } + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + data.pos4.deviceWrite(), x.deviceRead()); + + msg_info() << "density[" << 0 << "] = " << data.pos4[0][3] + << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3]; + data.Kernels_addForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); d_f.endEdit(); } @@ -135,15 +134,13 @@ void SPHFluidForceField::addDForce(const core::Mechan VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); - //sout << "addDForce(" << mparams->kFactor() << "," << mparams->bFactor() << ")" << sendl; - //const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); const VecDeriv& v = this->mstate->read(core::ConstVecDerivId::velocity())->getValue(); data.fillParams(this, kernelT, mparams->kFactor(), mparams->bFactor()); df.resize(dx.size()); Grid::Grid* g = m_grid->getGrid(); data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); d_df.endEdit(); #endif @@ -193,16 +190,13 @@ void SPHFluidForceField::addForce(const core::Mechani Grid::Grid* g = m_grid->getGrid(); data.pos4.recreate(x.size()); data.Kernels_computeDensity( kernelT, pressureT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - data.pos4.deviceWrite(), x.deviceRead()); - if (this->f_printLog.getValue()) - { - sout << "density[" << 0 << "] = " << data.pos4[0][3] << sendl; - sout << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3] << sendl; - } + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + data.pos4.deviceWrite(), x.deviceRead()); + msg_info() << "density[" << 0 << "] = " << data.pos4[0][3] + << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3]; data.Kernels_addForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); d_f.endEdit(); } @@ -229,8 +223,8 @@ void SPHFluidForceField::addDForce(const core::Mechan df.resize(dx.size()); Grid::Grid* g = m_grid->getGrid(); data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); d_df.endEdit(); #endif } From d760557c8d1114d11b7185d891dc5c8a4640dd2f Mon Sep 17 00:00:00 2001 From: Damien Marchal Date: Thu, 1 Oct 2020 01:40:10 +0200 Subject: [PATCH 30/47] Merge remote-tracking branch 'defrost/pr-fix-default-APIVersion' into master-with-upstream-integration # Conflicts: # modules/SofaGraphComponent/SceneCheckAPIChange.h --- .../sofa/gpu/cuda/CudaParticleSource.inl | 4 -- .../sofa/gpu/cuda/CudaSPHFluidForceField.inl | 50 ++++++++----------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index 6ff9140..1bcd6fa 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -67,7 +67,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectResponse of last particles ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values @@ -81,7 +80,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values @@ -102,7 +100,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values @@ -121,7 +118,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectResponse of last particle ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 0c311d5..56bb479 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -39,14 +39,14 @@ namespace cuda extern "C" { - void SPHFluidForceFieldCuda3f_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* pos4, const void* x); - void SPHFluidForceFieldCuda3f_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v); +void SPHFluidForceFieldCuda3f_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* pos4, const void* x); +void SPHFluidForceFieldCuda3f_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v); //void SPHFluidForceFieldCuda3f_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v, const void* dx); #ifdef SOFA_GPU_CUDA_DOUBLE - void SPHFluidForceFieldCuda3d_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* pos4, const void* x); - void SPHFluidForceFieldCuda3d_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v); +void SPHFluidForceFieldCuda3d_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* pos4, const void* x); +void SPHFluidForceFieldCuda3d_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v); //void SPHFluidForceFieldCuda3d_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v, const void* dx); #endif // SOFA_GPU_CUDA_DOUBLE @@ -104,16 +104,15 @@ void SPHFluidForceField::addForce(const core::Mechani Grid::Grid* g = m_grid->getGrid(); data.pos4.recreate(x.size()); data.Kernels_computeDensity( kernelT, pressureT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - data.pos4.deviceWrite(), x.deviceRead()); - if (this->f_printLog.getValue()) - { - sout << "density[" << 0 << "] = " << data.pos4[0][3] << sendl; - sout << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3] << sendl; - } + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + data.pos4.deviceWrite(), x.deviceRead()); + + msg_info() << "density[" << 0 << "] = " << data.pos4[0][3] + << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3]; + data.Kernels_addForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); d_f.endEdit(); } @@ -135,15 +134,13 @@ void SPHFluidForceField::addDForce(const core::Mechan VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); - //sout << "addDForce(" << mparams->kFactor() << "," << mparams->bFactor() << ")" << sendl; - //const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); const VecDeriv& v = this->mstate->read(core::ConstVecDerivId::velocity())->getValue(); data.fillParams(this, kernelT, mparams->kFactor(), mparams->bFactor()); df.resize(dx.size()); Grid::Grid* g = m_grid->getGrid(); data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); d_df.endEdit(); #endif @@ -193,16 +190,13 @@ void SPHFluidForceField::addForce(const core::Mechani Grid::Grid* g = m_grid->getGrid(); data.pos4.recreate(x.size()); data.Kernels_computeDensity( kernelT, pressureT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - data.pos4.deviceWrite(), x.deviceRead()); - if (this->f_printLog.getValue()) - { - sout << "density[" << 0 << "] = " << data.pos4[0][3] << sendl; - sout << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3] << sendl; - } + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + data.pos4.deviceWrite(), x.deviceRead()); + msg_info() << "density[" << 0 << "] = " << data.pos4[0][3] + << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3]; data.Kernels_addForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); d_f.endEdit(); } @@ -229,8 +223,8 @@ void SPHFluidForceField::addDForce(const core::Mechan df.resize(dx.size()); Grid::Grid* g = m_grid->getGrid(); data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); d_df.endEdit(); #endif } From 1787a9e41015e7bcc9d14f6905b58bc3ad245f27 Mon Sep 17 00:00:00 2001 From: Damien Marchal Date: Thu, 1 Oct 2020 01:40:10 +0200 Subject: [PATCH 31/47] Merge remote-tracking branch 'defrost/pr-fix-default-APIVersion' into master-with-upstream-integration # Conflicts: # modules/SofaGraphComponent/SceneCheckAPIChange.h --- .../sofa/gpu/cuda/CudaParticleSource.inl | 4 -- .../sofa/gpu/cuda/CudaSPHFluidForceField.inl | 50 ++++++++----------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index 6ff9140..1bcd6fa 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -67,7 +67,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectResponse of last particles ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values @@ -81,7 +80,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values @@ -102,7 +100,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectVelocity of last particles ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values @@ -121,7 +118,6 @@ using namespace gpu::cuda; // if (!this->mstate) return; // const VecIndex& lastparticles = this->lastparticles.getValue(); // if (lastparticles.empty()) return; -// //sout << "ParticleSource: projectResponse of last particle ("<getTime(); // if (time < f_start.getValue() || time > f_stop.getValue()) return; // // constraint the last values diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 0c311d5..56bb479 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -39,14 +39,14 @@ namespace cuda extern "C" { - void SPHFluidForceFieldCuda3f_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* pos4, const void* x); - void SPHFluidForceFieldCuda3f_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v); +void SPHFluidForceFieldCuda3f_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* pos4, const void* x); +void SPHFluidForceFieldCuda3f_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v); //void SPHFluidForceFieldCuda3f_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3f* params, void* f, const void* pos4, const void* v, const void* dx); #ifdef SOFA_GPU_CUDA_DOUBLE - void SPHFluidForceFieldCuda3d_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* pos4, const void* x); - void SPHFluidForceFieldCuda3d_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v); +void SPHFluidForceFieldCuda3d_computeDensity(int kernelType, int pressureType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* pos4, const void* x); +void SPHFluidForceFieldCuda3d_addForce (int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v); //void SPHFluidForceFieldCuda3d_addDForce(int kernelType, int pressureType, int viscosityType, int surfaceTensionType, unsigned int size, const void* cells, const void* cellGhost, GPUSPHFluid3d* params, void* f, const void* pos4, const void* v, const void* dx); #endif // SOFA_GPU_CUDA_DOUBLE @@ -104,16 +104,15 @@ void SPHFluidForceField::addForce(const core::Mechani Grid::Grid* g = m_grid->getGrid(); data.pos4.recreate(x.size()); data.Kernels_computeDensity( kernelT, pressureT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - data.pos4.deviceWrite(), x.deviceRead()); - if (this->f_printLog.getValue()) - { - sout << "density[" << 0 << "] = " << data.pos4[0][3] << sendl; - sout << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3] << sendl; - } + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + data.pos4.deviceWrite(), x.deviceRead()); + + msg_info() << "density[" << 0 << "] = " << data.pos4[0][3] + << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3]; + data.Kernels_addForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); d_f.endEdit(); } @@ -135,15 +134,13 @@ void SPHFluidForceField::addDForce(const core::Mechan VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); - //sout << "addDForce(" << mparams->kFactor() << "," << mparams->bFactor() << ")" << sendl; - //const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); const VecDeriv& v = this->mstate->read(core::ConstVecDerivId::velocity())->getValue(); data.fillParams(this, kernelT, mparams->kFactor(), mparams->bFactor()); df.resize(dx.size()); Grid::Grid* g = m_grid->getGrid(); data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); d_df.endEdit(); #endif @@ -193,16 +190,13 @@ void SPHFluidForceField::addForce(const core::Mechani Grid::Grid* g = m_grid->getGrid(); data.pos4.recreate(x.size()); data.Kernels_computeDensity( kernelT, pressureT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - data.pos4.deviceWrite(), x.deviceRead()); - if (this->f_printLog.getValue()) - { - sout << "density[" << 0 << "] = " << data.pos4[0][3] << sendl; - sout << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3] << sendl; - } + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + data.pos4.deviceWrite(), x.deviceRead()); + msg_info() << "density[" << 0 << "] = " << data.pos4[0][3] + << "density[" << data.pos4.size()/2 << "] = " << data.pos4[data.pos4.size()/2][3]; data.Kernels_addForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + f.deviceWrite(), data.pos4.deviceRead(), v.deviceRead()); d_f.endEdit(); } @@ -229,8 +223,8 @@ void SPHFluidForceField::addDForce(const core::Mechan df.resize(dx.size()); Grid::Grid* g = m_grid->getGrid(); data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, - g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), - df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); + g->getNbCells(), g->getCellsVector().deviceRead(), g->getCellGhostVector().deviceRead(), + df.deviceWrite(), data.pos4.deviceRead(), v.deviceRead(), dx.deviceRead()); d_df.endEdit(); #endif } From b328dd0753f20b678a2457caf5a38cd75683b49d Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Mon, 26 Oct 2020 10:40:54 +0100 Subject: [PATCH 32/47] [All] Uniform size type (#1515) Uniform size type to be same type as index_type move index_type to sofa namespace (in sofa/config.h) (was located in defaulttype before, does not really make sense) So now : index_type is defined as sofa::index_type size_type is defined as sofa::size_type --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index 87236d2..02619ff 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -86,7 +86,7 @@ class SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes* old2new, helper::vector* new2old); + void reorderIndices(helper::vector* old2new, helper::vector* new2old); GridData data; Real getCellWidth() const { return cellWidth; } diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index 20c3090..80d77c7 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -98,9 +98,9 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes -void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(helper::vector* /*old2new*/, helper::vector* /*new2old*/) +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(helper::vector* /*old2new*/, helper::vector* /*new2old*/) { - std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(helper::vector* old2new, helper::vector* new2old)"< > >::reorderIndices(helper::vector* old2new, helper::vector* new2old)"< Date: Wed, 10 Mar 2021 18:50:17 +0100 Subject: [PATCH 33/47] [All] Remove SOFA_NO_OPENGL (not the cmake option) (#1888) * remove last use of SOFA_NO_OPENGL (except in sofaconfig/framework) * update image * add registration and distancegrid * add sphfluid * add eulerianfluid (along with a config.h.in) * add simplegui * add cuda * revert eulerianfluid as sofa.gl is required anyway * fix simplegui * replace ifdef with if... ==1 * update some config.cmake.in * image component was still using ogl without guards * fix compilation for a bunch of plugins without Sofa.GL * fix compilation Co-authored-by: Guillaume Paran --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 56bb479..acb7788 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -236,7 +236,7 @@ void SPHFluidForceField::addDForce(const core::Mechan template <> void SPHFluidForceField::draw(const core::visual::VisualParams* vparams) { -#ifdef SOFA_NO_OPENGL +#if SOFACUDA_HAVE_SOFA_GL == 1 if (!vparams->displayFlags().getShowForceFields()) return; //if (m_grid != NULL) // grid->draw(vparams); @@ -268,7 +268,7 @@ void SPHFluidForceField::draw(const core::visual::Vis glPointSize(1); #else SOFA_UNUSED(vparams); -#endif // SOFA_NO_OPENGL +#endif // SOFACUDA_HAVE_SOFA_GL == 1 } } // namespace forcefield diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index 80d77c7..fb0aeb9 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -300,7 +300,7 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::draw(const core::visual::VisualParams* ) { -#ifdef SOFA_NO_OPENGL +#if SOFACUDA_HAVE_SOFA_GL == 1 if (!lastX) return; int nbPoints = particleHash.size(); int index0 = nbCells+BSIZE; @@ -331,7 +331,7 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes Date: Mon, 15 Mar 2021 10:33:29 +0100 Subject: [PATCH 34/47] [All] Add forward declaration and opaque API for ExecParams, MechanicalParams, VisualParams and ConstraintParams (#1794) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [SofaCore] Add forward declarations for parameters. * [SofaSimulationCore] Add forward declaration. * [all] Update all the code base to use forward declaration & opaque api. * [SofaBaseMechanics] Updates two tests to use execparams::defaultInstance() * [all] Remove commented code * FIXUP * [BulletCollisionDetection] Use mechanicalparams::defaultInstance() * [plugins/PreassembledMass] Use mechanicalparams::defaultInstance() * [all] Remove the Doxygen style comments "/// From sofa/core/fwd.h" * [all] Rename asExecParam to dynamicCastToExecParam (to make it constant with other opaque cast nameing) * [all] Unify all name for cast function. The names are: MyObject* castTo(Base*); Base* castToBase(MyType*); ExecParams* castToExecParams(OtherParam); Co-authored-by: Guillaume Paran --- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 8 ++++---- .../SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 28ea3e5..914db95 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -93,8 +93,8 @@ void ParticlesRepulsionForceField::addDForce(const co VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); - Real kFactor = (Real)mparams->kFactorIncludingRayleighDamping(this->rayleighStiffness.getValue()); - Real bFactor = (Real)mparams->bFactor(); + Real kFactor = (Real)sofa::core::mechanicalparams::kFactorIncludingRayleighDamping(mparams,this->rayleighStiffness.getValue()); + Real bFactor = (Real)sofa::core::mechanicalparams::bFactor(mparams); const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); GPURepulsion3f repulsion; @@ -145,8 +145,8 @@ void ParticlesRepulsionForceField::addDForce(const co VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); - Real kFactor = (Real)mparams->kFactorIncludingRayleighDamping(this->rayleighStiffness.getValue()); - Real bFactor = (Real)mparams->bFactor(); + Real kFactor = (Real)sofa::core::mechanicalparams::kFactorIncludingRayleighDamping(mparams,this->rayleighStiffness.getValue()); + Real bFactor = (Real)sofa::core::mechanicalparams::bFactor(mparams); const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); GPURepulsion3d repulsion; diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index acb7788..f37518e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -25,7 +25,7 @@ #include "CudaSPHFluidForceField.h" #include #include -//#include +#include namespace sofa { @@ -135,7 +135,7 @@ void SPHFluidForceField::addDForce(const core::Mechan const VecDeriv& dx = d_dx.getValue(); const VecDeriv& v = this->mstate->read(core::ConstVecDerivId::velocity())->getValue(); - data.fillParams(this, kernelT, mparams->kFactor(), mparams->bFactor()); + data.fillParams(this, kernelT, mparams->kFactor(), sofa::core::mechanicalparams::bFactor(mparams)); df.resize(dx.size()); Grid::Grid* g = m_grid->getGrid(); data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, @@ -219,7 +219,7 @@ void SPHFluidForceField::addDForce(const core::Mechan const VecDeriv& dx = d_dx.getValue(); //const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); const VecDeriv& v = this->mstate->read(core::ConstVecDerivId::velocity())->getValue(); - data.fillParams(this, mparams->kFactor(), mparams->bFactor()); + data.fillParams(this, mparams->kFactor(), sofa::core::mechanicalparams::bFactor(mparams)); df.resize(dx.size()); Grid::Grid* g = m_grid->getGrid(); data.Kernels_addDForce( kernelT, pressureT, viscosityT, surfaceTensionT, From 6cb55c1021d6c10e085aa0f47b91d89aea4fc5d8 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Mon, 3 May 2021 10:13:06 +0200 Subject: [PATCH 35/47] [Sofa.GL] Remove warnings from deprecated headers (#2045) * use correct headers/namespace for gl stuff * apply to more plugins --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index f37518e..a11c0a4 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -24,7 +24,7 @@ #include "CudaSPHFluidForceField.h" #include -#include +#include #include namespace sofa @@ -262,7 +262,7 @@ void SPHFluidForceField::draw(const core::visual::Vis { glColor3f(f-1,0,2-f); } - helper::gl::glVertexT(x[i]); + sofa::gl::glVertexT(x[i]); } glEnd(); glPointSize(1); diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index fb0aeb9..adf7a1f 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -37,7 +37,7 @@ #include #include #include -#include +#include namespace sofa { @@ -327,7 +327,7 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes>4)&3; glColor4ub(63+r*64,63+g*64,63+b*64,255); //glVertex3fv(sortedPos[i].ptr()); - helper::gl::glVertexT((*lastX)[p]); + sofa::gl::glVertexT((*lastX)[p]); } glEnd(); glPointSize(1); From 44bee837b5759fa616aaa9347dd0b65eac7a27dd Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Thu, 1 Jul 2021 21:19:59 +0200 Subject: [PATCH 36/47] [All] Remove use of compatibility layer (#2179) * re-enable warnings when using compat headers * sofaframework compiles * sofabase compiles * sofagl compiles * modules compiles * gui compiles * tests compiles * image * plugins * linux, plugins... * physicsapi, cuda * remove more uses * compiles without sofa.compat * compiles without sofa.compat with plugins * Fix headlessrecorder * fix geomagic * fix sofaassimp * fix imagetoolbox * Fix compilation crash with masses * Update SofaKernel/modules/Sofa.GL/src/sofa/gl/BasicShapes.h Co-authored-by: Alex Bilger * restore compat in cmake * fix compilation * fix sparseldl * [All] FIX deprecated includes "sofa/helper/ArgumentParser.h" # Conflicts: # applications/projects/SofaFlowVR/Main.cpp # applications/projects/runSofa/Main.cpp # applications/tutorials/oneParticle/oneParticle.cpp * [All] FIX deprecated includes "sofa/helper/ArgumentParser.h" (2) Co-authored-by: Alex Bilger Co-authored-by: Guillaume Paran --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 2 +- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index e571ea4..22028c8 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -78,7 +78,7 @@ class SPHFluidForceFieldInternalData< gpu::cuda::CudaVectorTypes params; - gpu::cuda::CudaVector pos4; + gpu::cuda::CudaVector pos4; void fillParams(Main* m, int kernelType, double kFactor=1.0, double bFactor=1.0) { diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index a11c0a4..5ec2f61 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -241,7 +241,7 @@ void SPHFluidForceField::draw(const core::visual::Vis //if (m_grid != NULL) // grid->draw(vparams); helper::ReadAccessor x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); - helper::ReadAccessor > pos4 = this->data.pos4; + helper::ReadAccessor > pos4 = this->data.pos4; if (pos4.empty()) return; glDisable(GL_LIGHTING); glColor3f(0,1,1); diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index 02619ff..e30cd9d 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -36,7 +36,7 @@ #include #include -#include +#include namespace sofa { @@ -86,7 +86,7 @@ class SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes* old2new, helper::vector* new2old); + void reorderIndices(type::vector* old2new, type::vector* new2old); GridData data; Real getCellWidth() const { return cellWidth; } diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index adf7a1f..d9225bb 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -98,9 +98,9 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes -void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(helper::vector* /*old2new*/, helper::vector* /*new2old*/) +void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(type::vector* /*old2new*/, type::vector* /*new2old*/) { - std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(helper::vector* old2new, helper::vector* new2old)"< > >::reorderIndices(type::vector* old2new, type::vector* new2old)"< > cpusort; + type::vector< std::pair > cpusort; cpusort.resize(8*nbPoints); for (int i=0; i<8*nbPoints; ++i) cpusort[i] = std::make_pair(pparticleHash[i],pcells[index0+i]); From 09c5f62343fe247c169868caf3154bc6ff7328d0 Mon Sep 17 00:00:00 2001 From: erik pernod Date: Thu, 3 Mar 2022 00:32:12 +0100 Subject: [PATCH 37/47] [SofaCUDA] Remove calls to __umul24 on device (#2715) * [SofaCUDA] Remove umul24 use * [SofaCuda] Remove fastmul macro --- .../SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu | 10 +++++----- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu | 4 ++-- .../SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu | 6 +++--- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu index 54b8024..6f03d33 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu @@ -54,14 +54,14 @@ extern "C" template __global__ void ParticleSourceCuda3t_fillValues_kernel(unsigned int totalsize, unsigned int subsetsize, real* dest, const unsigned int* indices, real fx, real fy, real fz) { - unsigned int index0 = umul24(blockIdx.x,BSIZE); + unsigned int index0 = blockIdx.x * BSIZE; unsigned int index = index0+threadIdx.x; if (index < subsetsize) { unsigned int dindex = indices[index]; if (dindex < totalsize) { - unsigned int dindex3 = umul24(dindex,3); + unsigned int dindex3 = dindex * 3; dest[dindex3+0] = fx; dest[dindex3+1] = fy; dest[dindex3+2] = fz; @@ -72,15 +72,15 @@ __global__ void ParticleSourceCuda3t_fillValues_kernel(unsigned int totalsize, u template __global__ void ParticleSourceCuda3t_copyValuesWithOffset_kernel(unsigned int totalsize, unsigned int subsetsize, real* dest, const unsigned int* indices, const real* src, real fx, real fy, real fz) { - unsigned int index0 = umul24(blockIdx.x,BSIZE); + unsigned int index0 = blockIdx.x * BSIZE; unsigned int index = index0+threadIdx.x; if (index < subsetsize) { unsigned int dindex = indices[index]; if (dindex < totalsize) { - unsigned int dindex3 = umul24(dindex,3); - unsigned int index3 = umul24(index,3); + unsigned int dindex3 = dindex * 3; + unsigned int index3 = index * 3; dest[dindex3+0] = src[index3+0]+fx; dest[dindex3+1] = src[index3+1]+fy; dest[dindex3+2] = src[index3+2]+fz; diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu index fad0986..639ac3e 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu @@ -104,7 +104,7 @@ __global__ void ParticlesRepulsionForceFieldCuda3t_addForce_kernel(int size, con __shared__ int ghost; __shared__ real temp_x[BSIZE*3]; __shared__ real temp_v[BSIZE*3]; - int tx3 = __umul24(threadIdx.x,3); + int tx3 = threadIdx.x * 3; for (int cell = blockIdx.x; cell < size; cell += gridDim.x) { if (!threadIdx.x) @@ -194,7 +194,7 @@ __global__ void ParticlesRepulsionForceFieldCuda3t_addDForce_kernel(int size, co __shared__ int ghost; __shared__ real temp_x[BSIZE*3]; __shared__ real temp_dx[BSIZE*3]; - int tx3 = __umul24(threadIdx.x,3); + int tx3 = threadIdx.x * 3; for (int cell = blockIdx.x; cell < size; cell += gridDim.x) { if (!threadIdx.x) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu index fa90796..283ec7a 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu @@ -493,7 +493,7 @@ __global__ void SPHFluidForceFieldCuda3t_computeDensity_kernel(int size, const i __shared__ int2 range; __shared__ int ghost; __shared__ real temp_x[BSIZE*3]; - int tx3 = __umul24(threadIdx.x,3); + int tx3 = threadIdx.x * 3; for (int cell = blockIdx.x; cell < size; cell += gridDim.x) { __syncthreads(); @@ -578,7 +578,7 @@ __global__ void SPHFluidForceFieldCuda3t_addForce_kernel(int size, const int *ce __shared__ int ghost; __shared__ real temp_x[BSIZE*4]; __shared__ real temp_v[BSIZE*3]; - int tx3 = __umul24(threadIdx.x,3); + int tx3 = threadIdx.x * 3; int tx4 = threadIdx.x << 2; for (int cell = blockIdx.x; cell < size; cell += gridDim.x) { @@ -672,7 +672,7 @@ __global__ void SPHFluidForceFieldCuda3t_addDForce_kernel(int size, const int *c __shared__ real temp_x[BSIZE*4]; __shared__ real temp_v[BSIZE*3]; __shared__ real temp_dx[BSIZE*3]; - int tx3 = __umul24(threadIdx.x,3); + int tx3 = threadIdx.x * 3; int tx4 = threadIdx.x << 2; for (int cell = blockIdx.x; cell < size; cell += gridDim.x) { diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu index edd78f4..9f459e1 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu @@ -139,8 +139,8 @@ __device__ __inline__ float3 getPos3(const float3* pos, int index0, int index) { //return pos[index]; - int index03 = __umul24(index0,3); - int index3 = __umul24(threadIdx.x,3); + int index03 = index0 * 3; + int index3 = threadIdx.x * 3; ftemp[threadIdx.x] = ((const float*)pos)[index03+threadIdx.x]; ftemp[threadIdx.x+BSIZE] = ((const float*)pos)[index03+threadIdx.x+BSIZE]; ftemp[threadIdx.x+2*BSIZE] = ((const float*)pos)[index03+threadIdx.x+2*BSIZE]; @@ -155,7 +155,7 @@ __device__ __inline__ float4 getPos4(const float4* pos, int index0, int index) __device__ __inline__ float4 getPos4(const float3* pos, int index0, int index) { - int index3 = __umul24(threadIdx.x,3); + int index3 = threadIdx.x * 3; pos += index0; ftemp[threadIdx.x] = ((const float*)pos)[threadIdx.x]; ftemp[threadIdx.x+BSIZE] = ((const float*)pos)[threadIdx.x+BSIZE]; From f9103fe5bd83eea86e7cfdc7eaab1ad3ad36e075 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Fri, 17 Jun 2022 09:19:06 +0200 Subject: [PATCH 38/47] [Sofa] Compilation without Compatibility mode (#2975) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ** gather compat options in cmake files * update tests * clean cmake for compat and fix non-sofang modules (leftovers) * fix compat and articulated plugin * fix install file for cimgplugin and sofatest * re-enable non-sofang module haptic and validation for non-compat mode * fix haptic and validation tests * fix sensable emu * fix: force sofa.component to load everything * fix msvc * Apply suggestions from code review (cmake.in fixes) Co-authored-by: Guillaume Paran * fix cuda * update plugins * fix tests (scenecreator) Co-authored-by: Frédérick ROY Co-authored-by: Guillaume Paran --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index 6cbb8d6..9edc37b 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -20,7 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #include -#include +#include #include namespace sofa From 7694931b44e2fd411108654596f44128315c05d7 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Wed, 8 Feb 2023 12:47:25 +0100 Subject: [PATCH 39/47] [SofaCUDA] Reorganize following SOFA structure (1/n) (#3601) * Move to mapping folder * Compatibility layer * Usual module structure: moduleName/src/moduleName --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h index c4d9cc6..9bd87e8 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h @@ -22,6 +22,6 @@ #ifndef SOFA_GPU_CUDA_CUDAPARTICLESOURCE_H #define SOFA_GPU_CUDA_CUDAPARTICLESOURCE_H -#include "CudaTypes.h" +#include #endif From f543a92a98c1890a07b21b47c0d9d19d7c9ef5b4 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Wed, 24 Jan 2024 15:10:16 +0100 Subject: [PATCH 40/47] [SofaCUDA] Generalize the use of MessageDispatcher in SofaCUDA (#4430) * [SofaCUDA] Generalize the use of MessageDispatcher in SofaCUDA * Remove non-required plugin in an example scene --------- Co-authored-by: Paul Baksic <30337881+bakpaul@users.noreply.github.com> --- .../sofa/gpu/cuda/CudaSpatialGridContainer.inl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index d9225bb..97b157d 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -88,19 +88,19 @@ SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes template template void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::findNeighbors(NeighborListener* /*dest*/, Real /*dist*/) { - std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::findNeighbors(NeighborListener* dest, Real dist)"< > >::findNeighbors(NeighborListener* dest, Real dist)"; } template void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::computeField(ParticleField* /*field*/, Real /*dist*/) { - std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::computeField(ParticleField* field, Real dist)"< > >::computeField(ParticleField* field, Real dist)"; } template void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(type::vector* /*old2new*/, type::vector* /*new2old*/) { - std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes > >::reorderIndices(type::vector* old2new, type::vector* new2old)"< > >::reorderIndices(type::vector* old2new, type::vector* new2old)"; } @@ -169,7 +169,7 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_compu int /*cellBits*/, Real /*cellWidth*/, int /*nbPoints*/, void* /*particleIndex*/, void* /*particleHash*/, const void* /*x*/) { - std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_computeHash()"< >::kernel_computeHash()"; } template<> @@ -177,7 +177,7 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_updat int /*cellBits*/, int /*index0*/, Real /*cellWidth*/, int /*nbPoints*/, const void* /*particleHash*/, void* /*cells*/, void* /*cellGhost*/) { - std::cerr << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_updateGrid()"< >::kernel_updateGrid()"; } #endif // SOFA_GPU_CUDA_DOUBLE @@ -315,7 +315,7 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes Date: Tue, 6 Feb 2024 02:16:56 +0100 Subject: [PATCH 41/47] [SofaCUDA] Fix spatial grid compilation with double (#4478) --- .../SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl index 97b157d..bc546aa 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl @@ -169,7 +169,7 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_compu int /*cellBits*/, Real /*cellWidth*/, int /*nbPoints*/, void* /*particleIndex*/, void* /*particleHash*/, const void* /*x*/) { - msg_error() << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_computeHash()"; + msg_error("SpatialGrid") << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_computeHash()"; } template<> @@ -177,7 +177,7 @@ void SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_updat int /*cellBits*/, int /*index0*/, Real /*cellWidth*/, int /*nbPoints*/, const void* /*particleHash*/, void* /*cells*/, void* /*cellGhost*/) { - msg_error() << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_updateGrid()"; + msg_error("SpatialGrid") << "TODO: SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVec3dTypes > >::kernel_updateGrid()"; } #endif // SOFA_GPU_CUDA_DOUBLE From 676aabceebc076ac5b06306fa1f9306a9035727a Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Thu, 22 Feb 2024 07:09:05 +0100 Subject: [PATCH 42/47] [all] Apply nested namespaces (#4482) * [all] Apply nested namespaces * Fix compilation * Revert nested namespaces on .cu files to fix compilation * Fix bad refactoring --- .../SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp | 15 +++++---------- .../SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl | 15 ++++----------- .../gpu/cuda/CudaParticlesRepulsionForceField.cpp | 13 ++++--------- .../gpu/cuda/CudaParticlesRepulsionForceField.h | 15 ++++----------- .../gpu/cuda/CudaParticlesRepulsionForceField.inl | 15 ++++----------- .../sofa/gpu/cuda/CudaSPHFluidForceField.cpp | 13 ++++--------- .../sofa/gpu/cuda/CudaSPHFluidForceField.h | 15 ++++----------- .../sofa/gpu/cuda/CudaSPHFluidForceField.inl | 15 ++++----------- .../sofa/gpu/cuda/CudaSpatialGridContainer.cpp | 13 ++++--------- .../sofa/gpu/cuda/CudaSpatialGridContainer.h | 12 ++---------- .../sofa/gpu/cuda/CudaSpatialGridContainer.inl | 15 ++++----------- 11 files changed, 43 insertions(+), 113 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp index 0d11b8d..9b7441f 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp @@ -28,21 +28,17 @@ namespace sofa { -namespace core -{ -namespace behavior + +namespace core::behavior { template class ProjectiveConstraintSet; #ifdef SOFA_GPU_CUDA_DOUBLE template class ProjectiveConstraintSet; #endif -} // namespace behavior -} // namespace core +} // namespace core::behavior -namespace gpu -{ -namespace cuda +namespace gpu::cuda { @@ -54,8 +50,7 @@ int ParticleSourceCudaClass = core::RegisterObject("Supports GPU-side computatio #endif // SOFA_GPU_CUDA_DOUBLE ; -} // namespace cuda +} // namespace gpu::cuda -} // namespace gpu } // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl index 1bcd6fa..6ee83d7 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl @@ -28,10 +28,8 @@ namespace sofa { -namespace gpu -{ -namespace cuda +namespace gpu::cuda { extern "C" @@ -49,14 +47,10 @@ extern "C" #endif // SOFA_GPU_CUDA_DOUBLE } -} // namespace cuda - -} // namespace gpu +} // namespace gpu::cuda -namespace component -{ -namespace misc +namespace component::misc { using namespace gpu::cuda; @@ -136,9 +130,8 @@ using namespace gpu::cuda; // #endif // SOFA_GPU_CUDA_DOUBLE -} // namespace misc +} // namespace component::misc -} // namespace component } // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp index f402a0f..042d77d 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp @@ -25,13 +25,8 @@ #include #include -namespace sofa -{ - -namespace gpu -{ -namespace cuda +namespace sofa::gpu::cuda { int ParticlesRepulsionForceFieldCudaClass = core::RegisterObject("Supports GPU-side computations using CUDA") @@ -41,8 +36,8 @@ int ParticlesRepulsionForceFieldCudaClass = core::RegisterObject("Supports GPU-s #endif // SOFA_GPU_CUDA_DOUBLE ; -} // namespace cuda +} // namespace sofa::gpu::cuda + + -} // namespace gpu -} // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h index 687af94..632e352 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h @@ -29,10 +29,8 @@ namespace sofa { -namespace gpu -{ -namespace cuda +namespace gpu::cuda { template @@ -47,14 +45,10 @@ struct GPURepulsion typedef GPURepulsion GPURepulsion3f; typedef GPURepulsion GPURepulsion3d; -} // namespace cuda - -} // namespace gpu +} // namespace gpu::cuda -namespace component -{ -namespace forcefield +namespace component::forcefield { template <> @@ -73,9 +67,8 @@ void ParticlesRepulsionForceField::addDForce(const co #endif // SOFA_GPU_CUDA_DOUBLE -} // namespace forcefield +} // namespace component::forcefield -} // namespace component } // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 914db95..6f21ee6 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -29,10 +29,8 @@ namespace sofa { -namespace gpu -{ -namespace cuda +namespace gpu::cuda { extern "C" @@ -49,14 +47,10 @@ extern "C" #endif // SOFA_GPU_CUDA_DOUBLE } -} // namespace cuda - -} // namespace gpu +} // namespace gpu::cuda -namespace component -{ -namespace forcefield +namespace component::forcefield { using namespace gpu::cuda; @@ -166,9 +160,8 @@ void ParticlesRepulsionForceField::addDForce(const co #endif // SOFA_GPU_CUDA_DOUBLE -} // namespace forcefield +} // namespace component::forcefield -} // namespace component } // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp index cb23d9a..68a52f5 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp @@ -25,13 +25,8 @@ #include #include -namespace sofa -{ - -namespace gpu -{ -namespace cuda +namespace sofa::gpu::cuda { int SPHFluidForceFieldCudaClass = core::RegisterObject("Supports GPU-side computations using CUDA") @@ -41,8 +36,8 @@ int SPHFluidForceFieldCudaClass = core::RegisterObject("Supports GPU-side comput #endif // SOFA_GPU_CUDA_DOUBLE ; -} // namespace cuda +} // namespace sofa::gpu::cuda + + -} // namespace gpu -} // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h index 22028c8..9f59ad5 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h @@ -29,10 +29,8 @@ namespace sofa { -namespace gpu -{ -namespace cuda +namespace gpu::cuda { template @@ -58,14 +56,10 @@ struct GPUSPHFluid typedef GPUSPHFluid GPUSPHFluid3f; typedef GPUSPHFluid GPUSPHFluid3d; -} // namespace cuda - -} // namespace gpu +} // namespace gpu::cuda -namespace component -{ -namespace forcefield +namespace component::forcefield { template @@ -133,9 +127,8 @@ void SPHFluidForceField::addDForce(const core::Mechan #endif // SOFA_GPU_CUDA_DOUBLE -} // namespace forcefield +} // namespace component::forcefield -} // namespace component } // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 5ec2f61..bceaf05 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -30,10 +30,8 @@ namespace sofa { -namespace gpu -{ -namespace cuda +namespace gpu::cuda { extern "C" @@ -52,14 +50,10 @@ void SPHFluidForceFieldCuda3d_addForce (int kernelType, int pressureType, int vi #endif // SOFA_GPU_CUDA_DOUBLE } -} // namespace cuda - -} // namespace gpu +} // namespace gpu::cuda -namespace component -{ -namespace forcefield +namespace component::forcefield { using namespace gpu::cuda; @@ -271,9 +265,8 @@ void SPHFluidForceField::draw(const core::visual::Vis #endif // SOFACUDA_HAVE_SOFA_GL == 1 } -} // namespace forcefield +} // namespace component::forcefield -} // namespace component } // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp index 9edc37b..7434a00 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp @@ -23,13 +23,8 @@ #include #include -namespace sofa -{ - -namespace component -{ -namespace container +namespace sofa::component::container { using namespace sofa::defaulttype; @@ -51,8 +46,8 @@ template class SpatialGrid< SpatialGridTypes< CudaVec3dTypes > >; #endif // SOFA_GPU_CUDA_DOUBLE -} // namespace container +} // namespace sofa::component::container + + -} // namespace component -} // namespace sofa diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h index e30cd9d..f1f3697 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h @@ -38,13 +38,8 @@ #include #include -namespace sofa -{ - -namespace component -{ -namespace container +namespace sofa::component::container { using namespace sofa::defaulttype; @@ -127,10 +122,7 @@ class SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes Date: Thu, 6 Mar 2025 09:42:39 +0100 Subject: [PATCH 43/47] [all] Set of fixes before lifecycle (#5306) * fix compilation * Fix compilation in tutorials * Fix compilation plugin Assimp * fix compilation again * Fix compilation, especially using vec_id::write_access * Complete compilation on Assimp * fix compilation (cuda with sph) * fix compilation (cuda with distancegrid) * Update visitor names * Fix compilation in OglVolumetricModel --------- Co-authored-by: Frederick Roy --- .../sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl | 4 ++-- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl index 6f21ee6..7d8ea0f 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl @@ -90,7 +90,7 @@ void ParticlesRepulsionForceField::addDForce(const co Real kFactor = (Real)sofa::core::mechanicalparams::kFactorIncludingRayleighDamping(mparams,this->rayleighStiffness.getValue()); Real bFactor = (Real)sofa::core::mechanicalparams::bFactor(mparams); - const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); + const VecCoord& x = this->mstate->read(sofa::core::vec_id::read_access::position)->getValue(); GPURepulsion3f repulsion; repulsion.d = distance.getValue(); repulsion.d2 = repulsion.d*repulsion.d; @@ -142,7 +142,7 @@ void ParticlesRepulsionForceField::addDForce(const co Real kFactor = (Real)sofa::core::mechanicalparams::kFactorIncludingRayleighDamping(mparams,this->rayleighStiffness.getValue()); Real bFactor = (Real)sofa::core::mechanicalparams::bFactor(mparams); - const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); + const VecCoord& x = this->mstate->read(sofa::core::vec_id::read_access::position)->getValue(); GPURepulsion3d repulsion; repulsion.d = distance.getValue(); repulsion.d2 = repulsion.d*repulsion.d; diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index bceaf05..5493d61 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -234,7 +234,7 @@ void SPHFluidForceField::draw(const core::visual::Vis if (!vparams->displayFlags().getShowForceFields()) return; //if (m_grid != NULL) // grid->draw(vparams); - helper::ReadAccessor x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); + helper::ReadAccessor x = this->mstate->read(sofa::core::vec_id::read_access::position)->getValue(); helper::ReadAccessor > pos4 = this->data.pos4; if (pos4.empty()) return; glDisable(GL_LIGHTING); From 40818c856ae0ca5705e3385780a8d5a92b21ae97 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 26 Mar 2025 09:11:00 +0100 Subject: [PATCH 44/47] [all] Lifecycle : Remove SOFA_ATTRIBUTE_DEPRECATED (part 2) (#5347) * Remove SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA_IN_IO_MESH * Remove SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA_IN_VISUAL * Remove SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA_IN_SETTING * Cleaning : remove unnecessary includes * forgotten VEC3STATE_AS_VISUALSTATE * Remove SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA_IN_PLAYBACK * fix compilation * Remove SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA_IN_TOPOLOGY_CONTAINER_DYNAMIC * Remove SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA_IN_ENGINE_GENERATE * Remove ALL SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA* * Disabling all v24.12 SOFA_ATTRIBUTE_DEPRECATED * Disable all SOFA_HEADER_DEPRECATED and Fix older lifecycle forgotten * Disable all SOFA_ATTRIBUTE_DEPRECATED * forgotten setOriginalData * complete removal of SparseCommon.cpp * remove SOFAGENERALLOADER_HAVE_ZLIB compat * Remove RemovedData d_draw * fix compilation * Fix PluginManager_Test * Fix all uses of vec_id * Fix compilation: macro didn't exists * Fix scenes using plane definition in TrianglePressureForceField --------- Co-authored-by: Frederick Roy Co-authored-by: Paul Baksic Co-authored-by: Frederick Roy --- .../plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl index 5493d61..752ea1f 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl @@ -128,7 +128,7 @@ void SPHFluidForceField::addDForce(const core::Mechan VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); - const VecDeriv& v = this->mstate->read(core::ConstVecDerivId::velocity())->getValue(); + const VecDeriv& v = this->mstate->read(core::vec_id::read_access::velocity)->getValue(); data.fillParams(this, kernelT, mparams->kFactor(), sofa::core::mechanicalparams::bFactor(mparams)); df.resize(dx.size()); Grid::Grid* g = m_grid->getGrid(); @@ -212,7 +212,7 @@ void SPHFluidForceField::addDForce(const core::Mechan VecDeriv& df = *d_df.beginEdit(); const VecDeriv& dx = d_dx.getValue(); //const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); - const VecDeriv& v = this->mstate->read(core::ConstVecDerivId::velocity())->getValue(); + const VecDeriv& v = this->mstate->read(core::vec_id::read_access::velocity)->getValue(); data.fillParams(this, mparams->kFactor(), sofa::core::mechanicalparams::bFactor(mparams)); df.resize(dx.size()); Grid::Grid* g = m_grid->getGrid(); From c44d61c45dab6ce1c6631bc4c6e25509155dfd61 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Mon, 12 May 2025 17:53:03 +0200 Subject: [PATCH 45/47] skeleton for the CUDA extension of SPH --- CMakeLists.txt | 3 + extensions/CUDA/CMakeLists.txt | 27 ++++++++ .../CUDA/SofaSphFluid.CUDAConfig.cmake.in | 9 +++ .../CUDA/src/SofaSphFluid/CUDA/config.h.in | 37 +++++++++++ .../CUDA/src/SofaSphFluid/CUDA/init.cpp | 61 +++++++++++++++++++ extensions/CUDA/src/SofaSphFluid/CUDA/init.h | 29 +++++++++ src/SofaSphFluid/initSPHFluid.cpp | 8 ++- src/SofaSphFluid/initSPHFluid.h | 30 +++++++++ 8 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 extensions/CUDA/CMakeLists.txt create mode 100644 extensions/CUDA/SofaSphFluid.CUDAConfig.cmake.in create mode 100644 extensions/CUDA/src/SofaSphFluid/CUDA/config.h.in create mode 100644 extensions/CUDA/src/SofaSphFluid/CUDA/init.cpp create mode 100644 extensions/CUDA/src/SofaSphFluid/CUDA/init.h create mode 100644 src/SofaSphFluid/initSPHFluid.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d1e691..d515d1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,7 @@ sofa_find_package(Sofa.GL QUIET) set(PLUGIN_SPH_SRC_DIR src/SofaSphFluid) set(HEADER_FILES ${PLUGIN_SPH_SRC_DIR}/config.h.in + ${PLUGIN_SPH_SRC_DIR}/initSPHFluid.h ${PLUGIN_SPH_SRC_DIR}/ParticleSink.h ${PLUGIN_SPH_SRC_DIR}/ParticleSink.inl ${PLUGIN_SPH_SRC_DIR}/ParticleSource.h @@ -74,3 +75,5 @@ sofa_create_package_with_targets( INCLUDE_INSTALL_DIR ${PROJECT_NAME} RELOCATABLE "plugins" ) + +sofa_add_subdirectory(plugin extensions/CUDA SofaSphFluid.CUDA) diff --git a/extensions/CUDA/CMakeLists.txt b/extensions/CUDA/CMakeLists.txt new file mode 100644 index 0000000..b0784a6 --- /dev/null +++ b/extensions/CUDA/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.12) +project(SofaSphFluid.CUDA) + +set(HEADER_FILES + src/SofaSphFluid/CUDA/init.h + src/SofaSphFluid/CUDA/config.h.in +) + +set(SOURCE_FILES + src/SofaSphFluid/CUDA/init.cpp +) + +sofa_find_package(SofaSphFluid REQUIRED) +sofa_find_package(SofaCUDA REQUIRED) + +add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) +target_link_libraries(${PROJECT_NAME} SofaSphFluid) +target_link_libraries(${PROJECT_NAME} SofaCUDA) + +sofa_create_package_with_targets( + PACKAGE_NAME ${PROJECT_NAME} + PACKAGE_VERSION ${Sofa_VERSION} + TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES + INCLUDE_SOURCE_DIR "src" + INCLUDE_INSTALL_DIR "${PROJECT_NAME}" + RELOCATABLE "plugins" +) diff --git a/extensions/CUDA/SofaSphFluid.CUDAConfig.cmake.in b/extensions/CUDA/SofaSphFluid.CUDAConfig.cmake.in new file mode 100644 index 0000000..67b3bbe --- /dev/null +++ b/extensions/CUDA/SofaSphFluid.CUDAConfig.cmake.in @@ -0,0 +1,9 @@ +# CMake package configuration file for the SofaSphFluid.CUDA library + +@PACKAGE_GUARD@ +@PACKAGE_INIT@ + +find_package(SofaSphFluid QUIET REQUIRED) +find_package(SofaCUDA QUIET REQUIRED) + +check_required_components(SofaSphFluid.CUDA) diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/config.h.in b/extensions/CUDA/src/SofaSphFluid/CUDA/config.h.in new file mode 100644 index 0000000..3c937ec --- /dev/null +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/config.h.in @@ -0,0 +1,37 @@ +/****************************************************************************** +* 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 . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#pragma once + +#include + +#ifdef SOFA_BUILD_SOFASPHFLUID_CUDA +# define SOFA_TARGET @PROJECT_NAME@ +# define SOFA_SOFASPHFLUID_CUDA_API SOFA_EXPORT_DYNAMIC_LIBRARY +#else +# define SOFA_SOFASPHFLUID_CUDA_API SOFA_IMPORT_DYNAMIC_LIBRARY +#endif + +namespace sofasphfluid::cuda +{ + constexpr const char* MODULE_NAME = "@PROJECT_NAME@"; + constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@"; +} // namespace sofasphfluid::cuda diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/init.cpp b/extensions/CUDA/src/SofaSphFluid/CUDA/init.cpp new file mode 100644 index 0000000..93bd1e6 --- /dev/null +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/init.cpp @@ -0,0 +1,61 @@ +/****************************************************************************** +* SofaSphFluid plugin * +* (c) 2006 Inria, University of Lille, CNRS * +* * +* 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 . * +******************************************************************************* +* Authors: see Authors.md * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include +#include +#include + +namespace sofasphfluid::cuda +{ + +extern "C" { + SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); +} + +void initExternalModule() +{ + init(); +} + +const char* getModuleName() +{ + return MODULE_NAME; +} + +const char* getModuleVersion() +{ + return MODULE_VERSION; +} + +void init() +{ + static bool first = true; + if (first) + { + sofasphfluid::init(); + sofa::gpu::cuda::init(); + first = false; + } +} + +} // namespace sofasphfluid::cuda diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/init.h b/extensions/CUDA/src/SofaSphFluid/CUDA/init.h new file mode 100644 index 0000000..3267619 --- /dev/null +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/init.h @@ -0,0 +1,29 @@ +/****************************************************************************** +* 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 . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#pragma once + +#include + +namespace sofasphfluid::cuda +{ +SOFA_SOFASPHFLUID_CUDA_API void init(); +} // namespace sofasphdluid::cuda diff --git a/src/SofaSphFluid/initSPHFluid.cpp b/src/SofaSphFluid/initSPHFluid.cpp index 0c146b3..de55649 100644 --- a/src/SofaSphFluid/initSPHFluid.cpp +++ b/src/SofaSphFluid/initSPHFluid.cpp @@ -20,6 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #include +#include #include #include @@ -65,7 +66,7 @@ SOFA_SPH_FLUID_API const char* getModuleDescription(); SOFA_SPH_FLUID_API void registerObjects(sofa::core::ObjectFactory* factory); } -void initExternalModule() +void init() { static bool first = true; if (first) @@ -77,6 +78,11 @@ void initExternalModule() } } +void initExternalModule() +{ + init(); +} + const char* getModuleName() { return MODULE_NAME; diff --git a/src/SofaSphFluid/initSPHFluid.h b/src/SofaSphFluid/initSPHFluid.h new file mode 100644 index 0000000..a0a7b4a --- /dev/null +++ b/src/SofaSphFluid/initSPHFluid.h @@ -0,0 +1,30 @@ +/****************************************************************************** +* 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 . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#pragma once +#include + +namespace sofasphfluid +{ + +SOFA_SPH_FLUID_API void init(); + +} From 166670cd4e3649b93680f028feec0fcad14b24c1 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Mon, 12 May 2025 20:59:26 +0200 Subject: [PATCH 46/47] move files from the sofa structure to the extension structure --- extensions/CUDA/CMakeLists.txt | 25 +++++++++++++++++-- .../SofaSphFluid/CUDA}/CudaParticleSource.cpp | 0 .../SofaSphFluid/CUDA}/CudaParticleSource.cu | 0 .../SofaSphFluid/CUDA}/CudaParticleSource.h | 0 .../SofaSphFluid/CUDA}/CudaParticleSource.inl | 0 .../CudaParticlesRepulsionForceField.cpp | 0 .../CUDA}/CudaParticlesRepulsionForceField.cu | 0 .../CUDA}/CudaParticlesRepulsionForceField.h | 0 .../CudaParticlesRepulsionForceField.inl | 0 .../CUDA}/CudaSPHFluidForceField.cpp | 0 .../CUDA}/CudaSPHFluidForceField.cu | 0 .../CUDA}/CudaSPHFluidForceField.h | 0 .../CUDA}/CudaSPHFluidForceField.inl | 0 .../CUDA}/CudaSpatialGridContainer.cpp | 0 .../CUDA}/CudaSpatialGridContainer.cu | 0 .../CUDA}/CudaSpatialGridContainer.h | 0 .../CUDA}/CudaSpatialGridContainer.inl | 0 17 files changed, 23 insertions(+), 2 deletions(-) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaParticleSource.cpp (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaParticleSource.cu (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaParticleSource.h (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaParticleSource.inl (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaParticlesRepulsionForceField.cpp (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaParticlesRepulsionForceField.cu (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaParticlesRepulsionForceField.h (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaParticlesRepulsionForceField.inl (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaSPHFluidForceField.cpp (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaSPHFluidForceField.cu (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaSPHFluidForceField.h (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaSPHFluidForceField.inl (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaSpatialGridContainer.cpp (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaSpatialGridContainer.cu (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaSpatialGridContainer.h (100%) rename {applications/plugins/SofaCUDA/sofa/gpu/cuda => extensions/CUDA/src/SofaSphFluid/CUDA}/CudaSpatialGridContainer.inl (100%) diff --git a/extensions/CUDA/CMakeLists.txt b/extensions/CUDA/CMakeLists.txt index b0784a6..8acc8bd 100644 --- a/extensions/CUDA/CMakeLists.txt +++ b/extensions/CUDA/CMakeLists.txt @@ -1,19 +1,40 @@ cmake_minimum_required(VERSION 3.12) -project(SofaSphFluid.CUDA) +project(SofaSphFluid.CUDA CUDA CXX) set(HEADER_FILES src/SofaSphFluid/CUDA/init.h src/SofaSphFluid/CUDA/config.h.in + + src/SofaSphFluid/CUDA/CudaParticleSource.h + src/SofaSphFluid/CUDA/CudaParticleSource.inl + src/SofaSphFluid/CUDA/CudaSPHFluidForceField.h + src/SofaSphFluid/CUDA/CudaSPHFluidForceField.inl + src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.h + src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.inl + src/SofaSphFluid/CUDA/CudaSpatialGridContainer.h + src/SofaSphFluid/CUDA/CudaSpatialGridContainer.inl ) set(SOURCE_FILES src/SofaSphFluid/CUDA/init.cpp + + src/SofaSphFluid/CUDA/CudaParticleSource.cpp + src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cpp + src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cpp + src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cpp +) + +set(CUDA_SOURCES + src/SofaSphFluid/CUDA/CudaParticleSource.cu + src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cu + src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cu + src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cu ) sofa_find_package(SofaSphFluid REQUIRED) sofa_find_package(SofaCUDA REQUIRED) -add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) +add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${CUDA_SOURCES}) target_link_libraries(${PROJECT_NAME} SofaSphFluid) target_link_libraries(${PROJECT_NAME} SofaCUDA) diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cpp similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cpp rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cpp diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cu similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.cu rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cu diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.h similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.h rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.h diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.inl similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticleSource.inl rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.inl diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cpp similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cpp rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cpp diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.cu rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cu diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.h rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.h diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaParticlesRepulsionForceField.inl rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.inl diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cpp similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cpp rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cpp diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.cu rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cu diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.h rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.h diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSPHFluidForceField.inl rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.inl diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cpp similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cpp rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cpp diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cu similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.cu rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cu diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.h similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.h rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.h diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.inl similarity index 100% rename from applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaSpatialGridContainer.inl rename to extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.inl From c0652fb1c7a75ab6f8b9378c5ef5699763a2d020 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Mon, 12 May 2025 21:03:27 +0200 Subject: [PATCH 47/47] adapt includes --- .../SofaSphFluid/CUDA/CudaParticleSource.cpp | 2 +- .../src/SofaSphFluid/CUDA/CudaParticleSource.cu | 4 ++-- .../src/SofaSphFluid/CUDA/CudaParticleSource.h | 2 +- .../SofaSphFluid/CUDA/CudaParticleSource.inl | 2 +- .../CUDA/CudaParticlesRepulsionForceField.cpp | 2 +- .../CUDA/CudaParticlesRepulsionForceField.cu | 4 ++-- .../CUDA/CudaParticlesRepulsionForceField.h | 4 ++-- .../CUDA/CudaParticlesRepulsionForceField.inl | 2 +- .../CUDA/CudaSPHFluidForceField.cpp | 2 +- .../SofaSphFluid/CUDA/CudaSPHFluidForceField.cu | 4 ++-- .../SofaSphFluid/CUDA/CudaSPHFluidForceField.h | 5 +++-- .../CUDA/CudaSpatialGridContainer.cpp | 11 ++++++----- .../CUDA/CudaSpatialGridContainer.cu | 6 +++--- .../CUDA/CudaSpatialGridContainer.h | 17 +++++++++++++++-- .../CUDA/CudaSpatialGridContainer.inl | 4 ++-- 15 files changed, 43 insertions(+), 28 deletions(-) diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cpp b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cpp index 9b7441f..a7d1714 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cpp +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cpp @@ -19,7 +19,7 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include "CudaTypes.h" +#include #include "CudaParticleSource.inl" #include #include diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cu b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cu index 6f03d33..bca3121 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cu +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.cu @@ -19,8 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include "CudaCommon.h" -#include "CudaMath.h" +#include +#include #include "cuda.h" #if defined(__cplusplus) && CUDA_VERSION < 2000 diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.h b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.h index 9bd87e8..37847f0 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.h +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.h @@ -22,6 +22,6 @@ #ifndef SOFA_GPU_CUDA_CUDAPARTICLESOURCE_H #define SOFA_GPU_CUDA_CUDAPARTICLESOURCE_H -#include +#include #endif diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.inl b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.inl index 6ee83d7..9a66fdb 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.inl +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticleSource.inl @@ -23,7 +23,7 @@ #define SOFA_GPU_CUDA_CUDAPARTICLESOURCE_INL #include "CudaParticleSource.h" -#include +#include namespace sofa { diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cpp b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cpp index 042d77d..68d2d48 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cpp +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cpp @@ -19,7 +19,7 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include +#include #include "CudaParticlesRepulsionForceField.inl" #include #include diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cu b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cu index 639ac3e..cafd2e8 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cu +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.cu @@ -19,8 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include -#include +#include +#include #include "cuda.h" #if defined(__cplusplus) && CUDA_VERSION < 2000 diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.h b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.h index 632e352..7631366 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.h +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.h @@ -22,9 +22,9 @@ #ifndef SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_H #define SOFA_GPU_CUDA_CUDAPARTICLESREPULSIONFORCEFIELD_H -#include +#include #include -#include +#include namespace sofa { diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.inl b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.inl index 7d8ea0f..2931e07 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.inl +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaParticlesRepulsionForceField.inl @@ -24,7 +24,7 @@ #include "CudaParticlesRepulsionForceField.h" #include -//#include +//#include namespace sofa { diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cpp b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cpp index 68a52f5..c6dd42f 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cpp +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cpp @@ -19,7 +19,7 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include +#include #include "CudaSPHFluidForceField.inl" #include #include diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cu b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cu index 283ec7a..1ab6b88 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cu +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.cu @@ -19,8 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include -#include +#include +#include #include "cuda.h" #if defined(__cplusplus) && CUDA_VERSION < 2000 diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.h b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.h index 9f59ad5..7b9ead1 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.h +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSPHFluidForceField.h @@ -22,9 +22,10 @@ #ifndef SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_H #define SOFA_GPU_CUDA_CUDASPHFLUIDFORCEFIELD_H -#include +#include +#include #include -#include +#include namespace sofa { diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cpp b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cpp index 7434a00..3fe81be 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cpp +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cpp @@ -19,7 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include +#define SOFASPHFLUID_CUDA_CUDASPATIALGRIDCONTAINER_CPP +#include #include #include @@ -36,13 +37,13 @@ int SpatialGridContainerCudaClass = core::RegisterObject("GPU support using CUDA .add< SpatialGridContainer >() ; -template class SOFA_GPU_CUDA_API SpatialGridContainer< CudaVec3fTypes >; -template class SOFA_GPU_CUDA_API SpatialGrid< SpatialGridTypes< CudaVec3fTypes > >; +template class SOFA_SOFASPHFLUID_CUDA_API SpatialGridContainer< CudaVec3fTypes >; +template class SOFA_SOFASPHFLUID_CUDA_API SpatialGrid< SpatialGridTypes< CudaVec3fTypes > >; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SpatialGridContainer< CudaVec3dTypes >; -template class SpatialGrid< SpatialGridTypes< CudaVec3dTypes > >; +template class SOFA_SOFASPHFLUID_CUDA_API SpatialGridContainer< CudaVec3dTypes >; +template class SOFA_SOFASPHFLUID_CUDA_API SpatialGrid< SpatialGridTypes< CudaVec3dTypes > >; #endif // SOFA_GPU_CUDA_DOUBLE diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cu b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cu index 9f459e1..83af602 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cu +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.cu @@ -50,9 +50,9 @@ */ -#include -#include -#include +#include +#include +#include #include #if defined(__cplusplus) && CUDA_VERSION < 2000 diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.h b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.h index f1f3697..da55f21 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.h +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.h @@ -34,8 +34,9 @@ #ifndef SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_H #define SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_H +#include #include -#include +#include #include @@ -122,7 +123,19 @@ class SpatialGrid< SpatialGridTypes < gpu::cuda::CudaVectorTypes; +extern template class SOFA_SOFASPHFLUID_CUDA_API SpatialGrid >; + +#ifdef SOFA_GPU_CUDA_DOUBLE + +extern template class SOFA_SOFASPHFLUID_CUDA_API SpatialGridContainer< sofa::gpu::cuda::CudaVec3dTypes >; +extern template class SOFA_SOFASPHFLUID_CUDA_API SpatialGrid< sofa::component::container::SpatialGridTypes< sofa::gpu::cuda::CudaVec3dTypes > >; + +#endif // SOFA_GPU_CUDA_DOUBLE +#endif + +} // namespace sofa::component::container #endif diff --git a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.inl b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.inl index 4f2bb3f..e75986a 100644 --- a/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.inl +++ b/extensions/CUDA/src/SofaSphFluid/CUDA/CudaSpatialGridContainer.inl @@ -34,8 +34,8 @@ #ifndef SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_INL #define SOFA_GPU_CUDA_CUDASPATIALGRIDCONTAINER_INL -#include -#include +#include +#include #include #include