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
12 changes: 7 additions & 5 deletions src/ShapeMatchingPlugin/ShapeMatchingForceField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@
#include <sofa/defaulttype/VecTypes.h>
#include <sofa/core/ObjectFactory.h>

namespace sofa::component::forcefield
namespace shapematchingplugin
{

using namespace sofa::defaulttype;

int ShapeMatchingForceFieldClass = core::RegisterObject("Meshless deformations based on shape matching")
.add< ShapeMatchingForceField<Vec3Types> >()
;
void registerShapeMatchingForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Meshless deformations based on shape matching")
.add< ShapeMatchingForceField<Vec3Types> >());
}

template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingForceField<Vec3Types>;

} // namespace sofa::component::forcefield
} // namespace shapematchingplugin
6 changes: 3 additions & 3 deletions src/ShapeMatchingPlugin/ShapeMatchingForceField.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include <ShapeMatchingPlugin/ShapeMatchingRotationFinder.h>

namespace sofa::component::forcefield
namespace shapematchingplugin
{

/// Meshless deformations based on shape matching
Expand All @@ -57,7 +57,7 @@ class ShapeMatchingForceField : public core::behavior::ForceField<DataTypes>
ShapeMatchingForceField();

public:
SingleLink<ShapeMatchingForceField<DataTypes>, container::ShapeMatchingRotationFinder<DataTypes>, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_rotationFinder;
SingleLink<ShapeMatchingForceField<DataTypes>, ShapeMatchingRotationFinder<DataTypes>, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_rotationFinder;
Data<Real> d_stiffness;

void init() override;
Expand All @@ -74,4 +74,4 @@ class ShapeMatchingForceField : public core::behavior::ForceField<DataTypes>
extern template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingForceField<defaulttype::Vec3Types>;
#endif // !defined(SOFA_COMPONENT_FORCEFIELD_SHAPEMATCHINGFORCEFIELD_CPP)

} // namespace sofa::component::forcefield
} // namespace shapematchingplugin
6 changes: 3 additions & 3 deletions src/ShapeMatchingPlugin/ShapeMatchingForceField.inl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <assert.h>
#include <iostream>

namespace sofa::component::forcefield
namespace shapematchingplugin
{

template<class DataTypes>
Expand All @@ -47,7 +47,7 @@ void ShapeMatchingForceField<DataTypes>::init()

if (!l_rotationFinder.get())
{
sofa::core::sptr< container::ShapeMatchingRotationFinder<DataTypes>> rotationFinder;
sofa::core::sptr< ShapeMatchingRotationFinder<DataTypes>> rotationFinder;
this->getContext()->get(rotationFinder);
if (!rotationFinder)
{
Expand Down Expand Up @@ -148,4 +148,4 @@ void ShapeMatchingForceField<DataTypes>::draw(const core::visual::VisualParams*
}


} // namespace sofa::component::forcefield
} // namespace shapematchingplugin
14 changes: 8 additions & 6 deletions src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@
#include <ShapeMatchingPlugin/ShapeMatchingRotationFinder.inl>
#include <sofa/core/ObjectFactory.h>

namespace sofa::component::container
namespace shapematchingplugin
{

using namespace sofa::defaulttype;

// Register in the Factory
int ShapeMatchingRotationFinderClass = core::RegisterObject("ShapeMatchingRotationFinder")
.add< ShapeMatchingRotationFinder< Vec3Types > >()
.addAlias("RotationFinder")
;
void registerShapeMatchingRotationFinder(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("ShapeMatchingRotationFinder")
.add< ShapeMatchingRotationFinder< Vec3Types > >()
.addAlias("RotationFinder"));
}

template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingRotationFinder< defaulttype::Vec3Types >;

} // namespace sofa::component::container
} // namespace shapematchingplugin
4 changes: 2 additions & 2 deletions src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* "Meshless Deformations Based on Shape Matching" (Muller, Heidelberger, Teschner and Gross)
*
*/
namespace sofa::component::container
namespace shapematchingplugin
{

template <class DataTypes>
Expand Down Expand Up @@ -120,4 +120,4 @@ class ShapeMatchingRotationFinder : public sofa::core::behavior::RotationFinder<
extern template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingRotationFinder< defaulttype::Vec3Types >;
#endif

} // namespace sofa::component::container
} // namespace shapematchingplugin
4 changes: 2 additions & 2 deletions src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.inl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <ShapeMatchingPlugin/polar_decomposition_3x3.h>


namespace sofa::component::container
namespace shapematchingplugin
{

using namespace sofa::core::topology;
Expand Down Expand Up @@ -619,4 +619,4 @@ void ShapeMatchingRotationFinder<DataTypes>::draw(const core::visual::VisualPara
vparams->drawTool()->restoreLastState();
}

} // namespace sofa::component::container
} // namespace shapematchingplugin
4 changes: 3 additions & 1 deletion src/ShapeMatchingPlugin/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <sofa/config.h>
#include <sofa/config/sharedlibrary_defines.h>

using namespace sofa;

#define SHAPEMATCHINGPLUGIN_VERSION @PROJECT_VERSION@

#ifdef SOFA_BUILD_SHAPEMATCHINGPLUGIN
Expand All @@ -33,7 +35,7 @@
# define SOFA_SHAPEMATCHINGPLUGIN_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

namespace shapematching
namespace shapematchingplugin
{
constexpr const char* MODULE_NAME = "@PROJECT_NAME@";
constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@";
Expand Down
24 changes: 15 additions & 9 deletions src/ShapeMatchingPlugin/initShapeMatchingPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@
******************************************************************************/
#include <ShapeMatchingPlugin/initShapeMatchingPlugin.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>

namespace sofa::component
namespace shapematchingplugin
{

extern void registerShapeMatchingForceField(sofa::core::ObjectFactory* factory);
extern void registerShapeMatchingRotationFinder(sofa::core::ObjectFactory* factory);

extern "C" {
SOFA_SHAPEMATCHINGPLUGIN_API void initExternalModule();
SOFA_SHAPEMATCHINGPLUGIN_API const char* getModuleName();
SOFA_SHAPEMATCHINGPLUGIN_API const char* getModuleVersion();
SOFA_SHAPEMATCHINGPLUGIN_API const char* getModuleLicense();
SOFA_SHAPEMATCHINGPLUGIN_API const char* getModuleDescription();
SOFA_SHAPEMATCHINGPLUGIN_API const char* getModuleComponentList();
SOFA_SHAPEMATCHINGPLUGIN_API void registerObjects(sofa::core::ObjectFactory* factory);
}

void initShapeMatchingPlugin()
Expand All @@ -44,6 +48,9 @@ namespace sofa::component

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

static bool first = true;
if (first)
{
Expand All @@ -53,12 +60,12 @@ namespace sofa::component

const char* getModuleName()
{
return shapematching::MODULE_NAME;
return MODULE_NAME;
}

const char* getModuleVersion()
{
return shapematching::MODULE_VERSION;
return MODULE_VERSION;
}

const char* getModuleLicense()
Expand All @@ -71,11 +78,10 @@ namespace sofa::component
return "Plugin with ShapeMatchingPlugin";
}

const char* getModuleComponentList()
void registerObjects(sofa::core::ObjectFactory* factory)
{
/// string containing the names of the classes provided by the plugin
static std::string classes = sofa::core::ObjectFactory::getInstance()->listClassesFromTarget(sofa_tostring(SOFA_TARGET));
return classes.c_str();
registerShapeMatchingForceField(factory);
registerShapeMatchingRotationFinder(factory);
}

} // namespace sofa::component
} // namespace shapematchingplugin
4 changes: 2 additions & 2 deletions src/ShapeMatchingPlugin/initShapeMatchingPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
******************************************************************************/
#include <ShapeMatchingPlugin/config.h>

namespace sofa::component
namespace shapematchingplugin
{

void SOFA_SHAPEMATCHINGPLUGIN_API initShapeMatchingPlugin();

} // namespace sofa::component
} // namespace shapematchingplugin
Loading