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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/SofaSphFluid/OglFluidModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ namespace sofa::component::visualmodel

SOFA_DECL_CLASS(OglFluidModel)

int OglFluidModelClass = sofa::core::RegisterObject("Particle model for OpenGL display, using glsl")
.add< OglFluidModel<sofa::defaulttype::Vec3Types> >();
void registerOglFluidModel(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Particle model for OpenGL display, using glsl.")
.add< OglFluidModel<sofa::defaulttype::Vec3Types> >());
}

template class SOFA_SPH_FLUID_API OglFluidModel<sofa::defaulttype::Vec3Types>;

Expand Down
10 changes: 6 additions & 4 deletions src/SofaSphFluid/ParticleSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
namespace sofa::component::misc
{

int ParticleSinkClass = core::RegisterObject("Parametrable particle generator")
.add< ParticleSink<defaulttype::Vec3Types> >()
.add< ParticleSink<defaulttype::Vec2Types> >()
;
void registerParticleSink(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Parametrable particle generator.")
.add< ParticleSink<defaulttype::Vec3Types> >()
.add< ParticleSink<defaulttype::Vec2Types> >());
}

template class SOFA_SPH_FLUID_API ParticleSink<defaulttype::Vec3Types>;
template class SOFA_SPH_FLUID_API ParticleSink<defaulttype::Vec2Types>;
Expand Down
11 changes: 6 additions & 5 deletions src/SofaSphFluid/ParticleSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@
namespace sofa::component::misc
{

int ParticleSourceClass = core::RegisterObject("Parametrable particle generator")
.add< ParticleSource<defaulttype::Vec3Types> >()
.add< ParticleSource<defaulttype::Vec2Types> >()
void registerParticleSource(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Parametrable particle generator.")
.add< ParticleSource<defaulttype::Vec3Types> >()
.add< ParticleSource<defaulttype::Vec2Types> >());
}

;

template class SOFA_SPH_FLUID_API ParticleSource<defaulttype::Vec3Types>;
template class SOFA_SPH_FLUID_API ParticleSource<defaulttype::Vec2Types>;


}


13 changes: 6 additions & 7 deletions src/SofaSphFluid/ParticlesRepulsionForceField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@ namespace sofa::component::forcefield
using namespace sofa::defaulttype;
using namespace core::behavior;


int ParticlesRepulsionForceFieldClass = core::RegisterObject("ForceField using SpatialGridContainer to compute repulsion forces in a set of spheres")
.add< ParticlesRepulsionForceField<Vec3Types> >()
.add< ParticlesRepulsionForceField<Vec2Types> >()

;
void registerParticlesRepulsionForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("ForceField using SpatialGridContainer to compute repulsion forces in a set of spheres.")
.add< ParticlesRepulsionForceField<Vec3Types> >()
.add< ParticlesRepulsionForceField<Vec2Types> >());
}

template class SOFA_SPH_FLUID_API ParticlesRepulsionForceField<Vec3Types>;
template class SOFA_SPH_FLUID_API ParticlesRepulsionForceField<Vec2Types>;


} // namespace sofa::component::forcefield


Expand Down
12 changes: 5 additions & 7 deletions src/SofaSphFluid/SPHFluidForceField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,15 @@ namespace sofa::component::forcefield
using namespace sofa::defaulttype;
using namespace core::behavior;


int SPHFluidForceFieldClass = core::RegisterObject("Smooth Particle Hydrodynamics")
.add< SPHFluidForceField<Vec3Types> >()
//.add< SPHFluidForceField<Vec2Types> >()

;
void registerSPHFluidForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Smooth Particle Hydrodynamics.")
.add< SPHFluidForceField<Vec3Types> >());
}

template class SOFA_SPH_FLUID_API SPHFluidForceField<Vec3Types>;
template class SOFA_SPH_FLUID_API SPHFluidForceField<Vec2Types>;


} // namespace sofa::component::forcefield


Expand Down
9 changes: 5 additions & 4 deletions src/SofaSphFluid/SPHFluidSurfaceMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ namespace sofa::component::mapping
using namespace sofa::defaulttype;

// Register in the Factory
int SPHFluidSurfaceMappingClass = core::RegisterObject("SPHFluidSurfaceMappingClass")
.addAlias("MarchingCubeMapping")
.add< SPHFluidSurfaceMapping< Vec3Types, Vec3Types > >()
;
void registerSPHFluidSurfaceMapping(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Mapping the surface of a Smooth Particle Hydrodynamics model.")
.add< SPHFluidSurfaceMapping< Vec3Types, Vec3Types > >());
}

template class SOFA_SPH_FLUID_API SPHFluidSurfaceMapping< Vec3Types, Vec3Types >;

Expand Down
10 changes: 5 additions & 5 deletions src/SofaSphFluid/SpatialGridContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ namespace sofa::component::container
using namespace sofa::defaulttype;
using namespace core::behavior;


int SpatialGridContainerClass = core::RegisterObject("Hashing spatial grid container, used for SPH fluids for instance.")
.add< SpatialGridContainer<Vec3Types> >()
;
void registerSpatialGridContainer(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Hashing spatial grid container, used for SPH fluids for instance.")
.add< SpatialGridContainer<Vec3Types> >());
}

template class SOFA_SPH_FLUID_API SpatialGridContainer< Vec3Types >;
template class SOFA_SPH_FLUID_API SpatialGrid< SpatialGridTypes< Vec3Types > >;


} // namespace sofa::component::container


Expand Down
8 changes: 5 additions & 3 deletions src/SofaSphFluid/SpatialGridPointModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ namespace sofa::component::collision

using namespace sofa::component::collision::geometry;

int SpatialGridPointModelClass = core::RegisterObject("Collision model which represents a set of points, spatially grouped using a SpatialGridContainer")
.add< SpatialGridPointModel >()
;
void registerSpatialGridPointModel(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Collision model which represents a set of points, spatially grouped using a SpatialGridContainer.")
.add< SpatialGridPointModel >());
}

SpatialGridPointModel::SpatialGridPointModel()
: d_leafScale(initData(&d_leafScale,0,"leafScale","at which level should the first cube layer be constructed.\nNote that this must not be greater than GRIDDIM_LOG2"))
Expand Down
9 changes: 6 additions & 3 deletions src/SofaSphFluid/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#ifndef SOFASPHFLUID_CONFIG_H
#define SOFASPHFLUID_CONFIG_H
#pragma once

#include <sofa/config.h>

Expand All @@ -33,4 +32,8 @@
# define SOFA_SPH_FLUID_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#endif
namespace sofasphfluid
{
constexpr const char* MODULE_NAME = "@PROJECT_NAME@";
constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@";
} // namespace sofasphfluid
57 changes: 48 additions & 9 deletions src/SofaSphFluid/initSPHFluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,39 @@
******************************************************************************/
#include <SofaSphFluid/config.h>

#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>

namespace sofa::component

namespace sofa::component::misc
{
extern void registerParticleSink(sofa::core::ObjectFactory* factory);
extern void registerParticleSource(sofa::core::ObjectFactory* factory);
}
namespace sofa::component::collision
{
extern void registerSpatialGridPointModel(sofa::core::ObjectFactory* factory);
}
namespace sofa::component::container
{
extern void registerSpatialGridContainer(sofa::core::ObjectFactory* factory);
}
namespace sofa::component::forcefield
{
extern void registerParticlesRepulsionForceField(sofa::core::ObjectFactory* factory);
extern void registerSPHFluidForceField(sofa::core::ObjectFactory* factory);
}
namespace sofa::component::mapping
{
extern void registerSPHFluidSurfaceMapping(sofa::core::ObjectFactory* factory);
}
namespace sofa::component::visualmodel
{
extern void registerOglFluidModel(sofa::core::ObjectFactory* factory);
}


namespace sofasphfluid
{

extern "C" {
Expand All @@ -31,26 +62,29 @@ SOFA_SPH_FLUID_API const char* getModuleName();
SOFA_SPH_FLUID_API const char* getModuleVersion();
SOFA_SPH_FLUID_API const char* getModuleLicense();
SOFA_SPH_FLUID_API const char* getModuleDescription();
SOFA_SPH_FLUID_API const char* getModuleComponentList();
SOFA_SPH_FLUID_API void registerObjects(sofa::core::ObjectFactory* factory);
}

void initExternalModule()
{
static bool first = true;
if (first)
{
// make sure that this plugin is registered into the PluginManager
sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME);

first = false;
}
}

const char* getModuleName()
{
return "SofaSphFluid";
return MODULE_NAME;
}

const char* getModuleVersion()
{
return "1.0";
return MODULE_VERSION;
}

const char* getModuleLicense()
Expand All @@ -63,13 +97,18 @@ const char* getModuleDescription()
return "This plugin contains fluids simulation based on the SPH method.";
}

const char* getModuleComponentList()
void registerObjects(sofa::core::ObjectFactory* factory)
{
return "SpatialGridContainer SPHFluidForceField SPHFluidSurfaceMapping"
" ParticleSink ParticuleSource ParticlesRepulsionForceField";
sofa::component::misc::registerParticleSink(factory);
sofa::component::misc::registerParticleSource( factory);
sofa::component::collision::registerSpatialGridPointModel(factory);
sofa::component::container::registerSpatialGridContainer(factory);
sofa::component::forcefield::registerParticlesRepulsionForceField(factory);
sofa::component::forcefield::registerSPHFluidForceField(factory);
sofa::component::mapping::registerSPHFluidSurfaceMapping(factory);
sofa::component::visualmodel::registerOglFluidModel(factory);
}


} // namespace sofa::component
} // namespace sofasphfluid


Loading