Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MechanicalLoad] Apply new factory registration mechanism #4983

Merged
merged 6 commits into from
Sep 20, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;


int ConicalForceFieldClass = core::RegisterObject("Repulsion applied by a cone toward the exterior")
.add< ConicalForceField<Vec3Types> >()

;
void registerConicalForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Outward repulsion applied by a cone geometry.")
.add< ConicalForceField<Vec3Types> >());
}

template class ConicalForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ SReal ConstantForceField<defaulttype::Rigid3Types>::getPotentialEnergy(const cor
template <> SOFA_COMPONENT_MECHANICALLOAD_API
SReal ConstantForceField<defaulttype::Rigid2Types>::getPotentialEnergy(const core::MechanicalParams*, const DataVecCoord& ) const { return 0; }



int ConstantForceFieldClass = core::RegisterObject("Constant forces applied to given degrees of freedom")
void registerConstantForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Constant forces applied to given degrees of freedom.")
.add< ConstantForceField<Vec3Types> >()
.add< ConstantForceField<Vec2Types> >()
.add< ConstantForceField<Vec1Types> >()
.add< ConstantForceField<Vec6Types> >()
.add< ConstantForceField<Rigid3Types> >()
.add< ConstantForceField<Rigid2Types> >()
.add< ConstantForceField<Rigid2Types> >());
}

;
template class SOFA_COMPONENT_MECHANICALLOAD_API ConstantForceField<Vec3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API ConstantForceField<Vec2Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API ConstantForceField<Vec1Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;

int DiagonalVelocityDampingForceFieldClass = core::RegisterObject("Diagonal velocity damping")
.add< DiagonalVelocityDampingForceField<Vec3Types> >()
.add< DiagonalVelocityDampingForceField<Vec2Types> >()
.add< DiagonalVelocityDampingForceField<Vec1Types> >()
.add< DiagonalVelocityDampingForceField<Vec6Types> >()
.add< DiagonalVelocityDampingForceField<Rigid3Types> >()
.add< DiagonalVelocityDampingForceField<Rigid2Types> >()

;
void registerDiagonalVelocityDampingForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Diagonal velocity damping.")
.add< DiagonalVelocityDampingForceField<Vec3Types> >()
.add< DiagonalVelocityDampingForceField<Vec2Types> >()
.add< DiagonalVelocityDampingForceField<Vec1Types> >()
.add< DiagonalVelocityDampingForceField<Vec6Types> >()
.add< DiagonalVelocityDampingForceField<Rigid3Types> >()
.add< DiagonalVelocityDampingForceField<Rigid2Types> >());
}

template class SOFA_COMPONENT_MECHANICALLOAD_API DiagonalVelocityDampingForceField<Vec3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API DiagonalVelocityDampingForceField<Vec2Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;

int EdgePressureForceFieldClass = core::RegisterObject("Apply a force on edges, distributed on the edge nodes")
.add< EdgePressureForceField<Vec3Types> >()
;
void registerEdgePressureForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Apply a force on edges, distributed on the edge nodes.")
.add< EdgePressureForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_MECHANICALLOAD_API EdgePressureForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;

int EllipsoidForceFieldClass = core::RegisterObject("Repulsion applied by an ellipsoid toward the exterior or the interior")

void registerEllipsoidForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Outward / inward repulsion applied by an ellipsoid geometry.")
.add< EllipsoidForceField<Vec3Types> >()
.add< EllipsoidForceField<Vec2Types> >()
.add< EllipsoidForceField<Vec1Types> >()
.add< EllipsoidForceField<Vec1Types> >());
}

;
template class SOFA_COMPONENT_MECHANICALLOAD_API EllipsoidForceField<Vec3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API EllipsoidForceField<Vec2Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API EllipsoidForceField<Vec1Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ void Gravity::apply()
getContext()->setGravity( f_gravity.getValue() );
}

int GravityClass = core::RegisterObject("Gravity in world coordinates")
.add< Gravity >()
;
void registerGravity(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Gravity in world coordinates.")
.add< Gravity >());
}

} // namespace sofa::component::mechanicalload
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;

int InteractionEllipsoidForceFieldClass = core::RegisterObject("Repulsion applied by an ellipsoid toward the exterior or the interior")
.add< InteractionEllipsoidForceField<Vec3Types, Rigid3Types> >()
;
void registerInteractionEllipsoidForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Outward / inward repulsion applied by an ellipsoid geometry, which can possibly act on several objects.")
.add< InteractionEllipsoidForceField<Vec3Types, Rigid3Types> >());
}

template class SOFA_COMPONENT_MECHANICALLOAD_API InteractionEllipsoidForceField<Vec3Types, Rigid3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;

int LinearForceFieldClass = core::RegisterObject("Linearly interpolated force applied to given degrees of freedom")
void registerLinearForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Linearly-interpolated force applied to given degrees of freedom.")
.add< LinearForceField<Vec3Types> >()
.add< LinearForceField<Vec2Types> >()
.add< LinearForceField<Vec1Types> >()
.add< LinearForceField<Vec6Types> >()
.add< LinearForceField<Rigid3Types> >()
// .add< LinearForceField<Rigid2Types> >()
.add< LinearForceField<Rigid3Types> >());
}

;
template class SOFA_COMPONENT_MECHANICALLOAD_API LinearForceField<Vec3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API LinearForceField<Vec2Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API LinearForceField<Vec1Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API LinearForceField<Vec6Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API LinearForceField<Rigid3Types>;
// template class SOFA_COMPONENT_MECHANICALLOAD_API LinearForceField<Rigid2Types>;


template <>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;


int OscillatingTorsionPressureForceFieldClass = core::RegisterObject("OscillatingTorsionPressure")
.add< OscillatingTorsionPressureForceField<Vec3Types> >()

;
void registerOscillatingTorsionPressureForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("OscillatingTorsionPressure.")
.add< OscillatingTorsionPressureForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_MECHANICALLOAD_API OscillatingTorsionPressureForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;

int PlaneForceFieldClass = core::RegisterObject("Repulsion applied by a plane toward the exterior (half-space)")
.add< PlaneForceField<Vec3Types> >()
.add< PlaneForceField<Vec2Types> >()
.add< PlaneForceField<Vec1Types> >()
.add< PlaneForceField<Vec6Types> >()
.add< PlaneForceField<Rigid3Types> >()

;
void registerPlaneForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Repulsion along the normal to a plane.")
.add< PlaneForceField<Vec3Types> >()
.add< PlaneForceField<Vec2Types> >()
.add< PlaneForceField<Vec1Types> >()
.add< PlaneForceField<Vec6Types> >()
.add< PlaneForceField<Rigid3Types> >());
}
template class SOFA_COMPONENT_MECHANICALLOAD_API PlaneForceField<Vec3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API PlaneForceField<Vec2Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API PlaneForceField<Vec1Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;

int QuadPressureForceFieldClass = core::RegisterObject("QuadPressure")
.add< QuadPressureForceField<Vec3Types> >()

;
void registerQuadPressureForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Pressure applied on a quadrangular geometry.")
.add< QuadPressureForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_MECHANICALLOAD_API QuadPressureForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;


int SphereForceFieldClass = core::RegisterObject("Repulsion applied by a sphere toward the exterior")
void registerSphereForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Outward repulsion applied by a sphere geometry")
.add< SphereForceField<Vec3Types> >()
.add< SphereForceField<Vec2Types> >()
.add< SphereForceField<Vec1Types> >()
.add< SphereForceField<Vec1Types> >());
}

;
template class SOFA_COMPONENT_MECHANICALLOAD_API SphereForceField<Vec3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API SphereForceField<Vec2Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API SphereForceField<Vec1Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,14 @@ template <>
void SurfacePressureForceField<defaulttype::Rigid3Types>::verifyDerivative(VecDeriv& /*v_plus*/, VecDeriv& /*v*/, VecVec3DerivValues& /*DVval*/, VecVec3DerivIndices& /*DVind*/, const VecDeriv& /*Din*/)
{}


using namespace sofa::defaulttype;

int SurfacePressureForceFieldClass = core::RegisterObject("SurfacePressure")
.add<SurfacePressureForceField<Vec3Types> >()
.add<SurfacePressureForceField<Rigid3Types> >();
void registerSurfacePressureForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Pressure applied on a generic surface (triangular or quadrangular).")
.add<SurfacePressureForceField<Vec3Types> >()
.add<SurfacePressureForceField<Rigid3Types> >());
}

template class SOFA_COMPONENT_MECHANICALLOAD_API SurfacePressureForceField<Vec3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API SurfacePressureForceField<Rigid3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;

int TaitSurfacePressureForceFieldClass = core::RegisterObject("\
void registerTaitSurfacePressureForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("\
This component computes the volume enclosed by a surface mesh \
and apply a pressure force following Tait's equation: $P = P_0 - B((V/V_0)^\\gamma - 1)$.\n\
This ForceField can be used to apply :\n\
* a constant pressure (set $B=0$ and use $P_0$)\n\
* an ideal gas pressure (set $\\gamma=1$ and use $B$)\n\
* a pressure from water (set $\\gamma=7$ and use $B$)")
.add< TaitSurfacePressureForceField<Vec3Types> >()

;

.add< TaitSurfacePressureForceField<Vec3Types> >());
}
template class SOFA_COMPONENT_MECHANICALLOAD_API TaitSurfacePressureForceField<Vec3Types>;

} // namespace sofa::component::mechanicalload
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;

int TorsionForceFieldClass = core::RegisterObject("Applies a torque to specified points")
void registerTorsionForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Applies a torque to specified degrees of freedom.")
.add< TorsionForceField<Vec3Types> >()
.add< TorsionForceField<Rigid3Types> >()

;
.add< TorsionForceField<Rigid3Types> >());
}

template class SOFA_COMPONENT_MECHANICALLOAD_API TorsionForceField<Vec3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API TorsionForceField<Rigid3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;

int TrianglePressureForceFieldClass = core::RegisterObject("TrianglePressure")
.add< TrianglePressureForceField<Vec3Types> >()

;
void registerTrianglePressureForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Pressure applied on a triangular geometry.")
.add< TrianglePressureForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_MECHANICALLOAD_API TrianglePressureForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,22 @@ namespace sofa::component::mechanicalload

using namespace sofa::defaulttype;

int UniformVelocityDampingForceFieldClass = core::RegisterObject("Uniform velocity damping")
.add< UniformVelocityDampingForceField<Vec3Types> >()
.add< UniformVelocityDampingForceField<Vec2Types> >()
.add< UniformVelocityDampingForceField<Vec1Types> >()
.add< UniformVelocityDampingForceField<Vec6Types> >()
.add< UniformVelocityDampingForceField<Rigid3Types> >()
.add< UniformVelocityDampingForceField<Rigid2Types> >()

;


template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Vec3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Vec2Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Vec1Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Vec6Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Rigid3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Rigid2Types>;

void registerUniformVelocityDampingForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Uniform velocity damping.")
.add< UniformVelocityDampingForceField<Vec3Types> >()
.add< UniformVelocityDampingForceField<Vec2Types> >()
.add< UniformVelocityDampingForceField<Vec1Types> >()
.add< UniformVelocityDampingForceField<Vec6Types> >()
.add< UniformVelocityDampingForceField<Rigid3Types> >()
.add< UniformVelocityDampingForceField<Rigid2Types> >());
}

template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Vec3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Vec2Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Vec1Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Vec6Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Rigid3Types>;
template class SOFA_COMPONENT_MECHANICALLOAD_API UniformVelocityDampingForceField<Rigid2Types>;

} // namespace sofa::component::mechanicalload
Loading
Loading