Skip to content

Commit ee67091

Browse files
committed
Update according to SOFA changes
1 parent ede540c commit ee67091

File tree

9 files changed

+81
-42
lines changed

9 files changed

+81
-42
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ project(ShapeMatchingPlugin LANGUAGES CXX)
33

44
set(SHAPEMATCHINGPLUGIN_SRC "src/${PROJECT_NAME}")
55

6+
find_package(Sofa.Core REQUIRED)
7+
68
set(HEADER_FILES
79
${SHAPEMATCHINGPLUGIN_SRC}/config.h.in
810
${SHAPEMATCHINGPLUGIN_SRC}/initShapeMatchingPlugin.h
@@ -18,10 +20,8 @@ set(SOURCE_FILES
1820
${SHAPEMATCHINGPLUGIN_SRC}/ShapeMatchingForceField.cpp
1921
)
2022

21-
find_package(SofaBaseLinearSolver REQUIRED)
22-
2323
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
24-
target_link_libraries(${PROJECT_NAME} PUBLIC SofaBaseLinearSolver)
24+
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Core)
2525

2626
sofa_create_package_with_targets(
2727
PACKAGE_NAME ${PROJECT_NAME}

ShapeMatchingPluginConfig.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
@PACKAGE_INIT@
44

5-
find_package(SofaBaseLinearSolver QUIET REQUIRED)
5+
find_package(Sofa.Core QUIET REQUIRED)
66

77
if(NOT TARGET @PROJECT_NAME@)
88
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")

examples/ConstraintRotationFinder.scn

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
11
<Node name="root" gravity="0.0 -2.0 0.0" dt="0.04">
2-
<RequiredPlugin name="SofaBoundaryCondition"/>
3-
<RequiredPlugin name="SofaConstraint"/>
4-
<RequiredPlugin name="SofaDeformable"/>
5-
<RequiredPlugin name="SofaEngine"/>
6-
<RequiredPlugin name="SofaGeneralDeformable"/>
7-
<RequiredPlugin name="SofaImplicitOdeSolver"/>
8-
<RequiredPlugin name="SofaLoader"/>
9-
<RequiredPlugin name="SofaMeshCollision"/>
10-
<RequiredPlugin name="SofaOpenglVisual"/>
11-
<RequiredPlugin name="ShapeMatchingPlugin"/>
122

13-
<FreeMotionAnimationLoop initial_guess="true" displayTime="1" />
14-
<DefaultPipeline verbose="0" draw="0" />
3+
<Node name="plugins">
4+
<RequiredPlugin name="ShapeMatchingPlugin"/> <!-- Needed to use components [ShapeMatchingRotationFinder] -->
5+
<RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
6+
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase,BruteForceBroadPhase,CollisionPipeline] -->
7+
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [LocalMinDistance] -->
8+
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [LineCollisionModel,PointCollisionModel,TriangleCollisionModel] -->
9+
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
10+
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Correction"/> <!-- Needed to use components [PrecomputedConstraintCorrection] -->
11+
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Solver"/> <!-- Needed to use components [LCPConstraintSolver] -->
12+
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedConstraint] -->
13+
<RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
14+
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
15+
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
16+
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
17+
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
18+
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
19+
<RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [MeshSpringForceField,QuadBendingSprings] -->
20+
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
21+
<RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
22+
<RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
23+
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
24+
</Node>
25+
26+
<FreeMotionAnimationLoop />
27+
<CollisionPipeline verbose="0" draw="0" />
1528
<BruteForceBroadPhase />
1629
<BVHNarrowPhase />
1730
<LocalMinDistance name="Proximity" alarmDistance="0.50" contactDistance="0.25" />
18-
<DefaultContactManager name="Response" response="FrictionContact" />
31+
<CollisionResponse name="Response" response="FrictionContactConstraint"/>
1932
<LCPConstraintSolver maxIt="1000" tolerance="0.001" />
20-
<DefaultAnimationLoop />
2133
<DefaultVisualManagerLoop />
2234
<Node name="Floor">
2335
<RegularGridTopology nx="2" ny="1" nz="2" xmin="20" xmax="-20" ymin="-3.05" ymax="-3.05" zmin="-20" zmax="20" />

examples/RotationFinder.scn

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
<Node name="root" gravity="0.0 -2.0 0.0" dt="0.04">
2-
<RequiredPlugin name="SofaBoundaryCondition"/>
3-
<RequiredPlugin name="SofaDeformable"/>
4-
<RequiredPlugin name="SofaEngine"/>
5-
<RequiredPlugin name="SofaGeneralDeformable"/>
6-
<RequiredPlugin name="SofaImplicitOdeSolver"/>
7-
<RequiredPlugin name="SofaMeshCollision"/>
8-
<RequiredPlugin name="SofaOpenglVisual"/>
9-
<RequiredPlugin name="SofaLoader"/>
10-
<RequiredPlugin name="ShapeMatchingPlugin"/>
112

12-
<DefaultPipeline verbose="0" draw="0" />
3+
<Node name="plugins">
4+
<RequiredPlugin name="ShapeMatchingPlugin"/> <!-- Needed to use components [ShapeMatchingRotationFinder] -->
5+
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase,BruteForceBroadPhase,CollisionPipeline] -->
6+
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [NewProximityIntersection] -->
7+
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
8+
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
9+
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedConstraint] -->
10+
<RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
11+
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
12+
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
13+
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
14+
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
15+
<RequiredPlugin name="Sofa.Component.MechanicalLoad"/> <!-- Needed to use components [PlaneForceField,SphereForceField] -->
16+
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
17+
<RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [MeshSpringForceField,QuadBendingSprings] -->
18+
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
19+
<RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
20+
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
21+
</Node>
22+
23+
<CollisionPipeline verbose="0" draw="0" />
1324
<BruteForceBroadPhase />
1425
<BVHNarrowPhase />
15-
<DefaultContactManager name="Response" />
26+
<CollisionResponse name="Response" />
1627
<NewProximityIntersection alarmDistance="0.002" contactDistance="0.001" />
1728
<DefaultAnimationLoop />
1829
<DefaultVisualManagerLoop />

examples/ShapeMatchingForceField.scn

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
<Node name="root" dt="0.02">
2-
<RequiredPlugin name="SofaImplicitOdeSolver"/>
3-
<RequiredPlugin name="SofaLoader"/>
4-
<RequiredPlugin name="SofaOpenglVisual"/>
5-
<RequiredPlugin name="SofaMeshCollision"/>
6-
<RequiredPlugin name="ShapeMatchingPlugin"/>
2+
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase,BruteForceBroadPhase,CollisionPipeline] -->
3+
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [MinProximityIntersection] -->
4+
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [LineCollisionModel,PointCollisionModel,SphereCollisionModel,TriangleCollisionModel] -->
5+
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
6+
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
7+
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
8+
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
9+
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
10+
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
11+
<RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [InfoComponent] -->
12+
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
13+
<RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
14+
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
15+
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
16+
<RequiredPlugin name="ShapeMatchingPlugin"/> <!-- Needed to use components [ShapeMatchingForceField,ShapeMatchingRotationFinder] -->
717

18+
<DefaultAnimationLoop/>
819
<VisualStyle displayFlags="showBehaviorModels showForceFields" />
9-
<DefaultPipeline verbose="0" draw="0" />
20+
<CollisionPipeline verbose="0" draw="0" />
1021
<BruteForceBroadPhase />
1122
<BVHNarrowPhase />
1223
<MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" />
13-
<DefaultContactManager name="Response" response="default" />
24+
<CollisionResponse name="Response" response="PenalityContactForceField" />
1425
<Node name="cubeFEM">
1526
<EulerImplicitSolver name="cg_odesolver" printLog="false" />
1627
<CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" />

src/ShapeMatchingPlugin/ShapeMatchingForceField.inl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <sofa/helper/rmath.h>
2828
#include <assert.h>
2929
#include <iostream>
30-
#include <sofa/simulation/Node.h>
3130

3231
namespace sofa::component::forcefield
3332
{

src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ void ShapeMatchingRotationFinder<DataTypes>::draw(const core::visual::VisualPara
558558

559559
vparams->drawTool()->disableLighting();
560560

561-
std::vector<type::Vector3> vertices;
561+
std::vector<type::Vec3> vertices;
562562
std::vector<type::RGBAColor> colors;
563563

564564
for (unsigned int i=0 ; i<m_rotations.size() ; i++)
@@ -590,7 +590,7 @@ void ShapeMatchingRotationFinder<DataTypes>::draw(const core::visual::VisualPara
590590

591591
vparams->drawTool()->disableLighting();
592592

593-
std::vector<type::Vector3> vertices;
593+
std::vector<type::Vec3> vertices;
594594
std::vector<type::RGBAColor> colors;
595595

596596
float r, g, b;

src/ShapeMatchingPlugin/config.h.in

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,10 @@
3131
# define SOFA_SHAPEMATCHINGPLUGIN_API SOFA_EXPORT_DYNAMIC_LIBRARY
3232
#else
3333
# define SOFA_SHAPEMATCHINGPLUGIN_API SOFA_IMPORT_DYNAMIC_LIBRARY
34-
#endif
34+
#endif
35+
36+
namespace shapematching
37+
{
38+
constexpr const char* MODULE_NAME = "@PROJECT_NAME@";
39+
constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@";
40+
}

src/ShapeMatchingPlugin/initShapeMatchingPlugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ namespace sofa::component
5353

5454
const char* getModuleName()
5555
{
56-
return "ShapeMatchingPlugin";
56+
return shapematching::MODULE_NAME;
5757
}
5858

5959
const char* getModuleVersion()
6060
{
61-
return "1.0";
61+
return shapematching::MODULE_VERSION;
6262
}
6363

6464
const char* getModuleLicense()

0 commit comments

Comments
 (0)