Skip to content

Commit 140410b

Browse files
committed
Merge main into merged_legacy
2 parents 527dad7 + 55cfb8c commit 140410b

24 files changed

Lines changed: 3367 additions & 113 deletions

.github/workflows/ci.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
8+
jobs:
9+
build-and-test:
10+
name: Run on ${{ matrix.os }} with SOFA ${{ matrix.sofa_branch }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-22.04, macos-13, windows-2022]
16+
sofa_branch: [master]
17+
18+
steps:
19+
20+
- name: Setup SOFA and environment
21+
id: sofa
22+
uses: sofa-framework/sofa-setup-action@v5
23+
with:
24+
sofa_root: ${{ github.workspace }}/sofa
25+
sofa_version: ${{ matrix.sofa_branch }}
26+
sofa_scope: 'standard'
27+
sofa_with_sofapython3: 'true'
28+
29+
- name: Checkout source code
30+
uses: actions/checkout@v2
31+
with:
32+
path: ${{ env.WORKSPACE_SRC_PATH }}
33+
34+
- name: Build and install
35+
shell: bash
36+
run: |
37+
cmake_options="-GNinja \
38+
-DCMAKE_BUILD_TYPE=Release \
39+
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
40+
-DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake" \
41+
"
42+
if [ -e "$(command -v ccache)" ]; then
43+
cmake_options="$cmake_options -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
44+
fi
45+
cmake_options="$(echo $cmake_options)" # prettify
46+
47+
if [[ "$RUNNER_OS" == "Windows" ]]; then
48+
cmd //c "${{ steps.sofa.outputs.vs_vsdevcmd }} \
49+
&& cd /d $WORKSPACE_BUILD_PATH \
50+
&& cmake $cmake_options ../src \
51+
&& ninja install"
52+
else
53+
cd "$WORKSPACE_BUILD_PATH"
54+
ccache -z
55+
cmake $cmake_options ../src
56+
ninja install
57+
echo ${CCACHE_BASEDIR}
58+
ccache -s
59+
fi
60+
61+
- name: Sanitize artifact name
62+
id: sanitize
63+
# This step removes special characters from the artifact name to ensure compatibility with upload-artifact
64+
# Characters removed: " : < > | * ? \r \n \ /
65+
# Spaces are replaced with underscores
66+
# This sanitization prevents errors in artifact creation and retrieval
67+
shell: pwsh
68+
run: |
69+
$originalName = "Shell_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}"
70+
$artifact_name = $originalName -replace '[":;<>|*?\r\n\\/]', '' -replace ' ', '_'
71+
echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT
72+
73+
- name: Create artifact
74+
uses: actions/upload-artifact@v4.4.0
75+
with:
76+
name: ${{ steps.sanitize.outputs.artifact_name }}
77+
path: ${{ env.WORKSPACE_INSTALL_PATH }}
78+
79+
- name: Install artifact
80+
uses: actions/download-artifact@v4.1.7
81+
with:
82+
name: ${{ steps.sanitize.outputs.artifact_name }}
83+
path: ${{ env.WORKSPACE_ARTIFACT_PATH }}
84+
85+
deploy:
86+
name: Deploy artifacts
87+
if: always() && startsWith(github.repository, 'SofaDefrost') && (startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/')) # we are not on a fork and on a branch or a tag (not a PR)
88+
needs: [build-and-test]
89+
runs-on: ubuntu-latest
90+
continue-on-error: true
91+
steps:
92+
- name: Get artifacts
93+
uses: actions/download-artifact@v4.1.7
94+
with:
95+
path: artifacts
96+
97+
- name: Zip artifacts
98+
shell: bash
99+
run: |
100+
cd $GITHUB_WORKSPACE/artifacts
101+
for artifact in *; do
102+
zip $artifact.zip -r $artifact/*
103+
done
104+
- name: Upload release
105+
uses: softprops/action-gh-release@v1
106+
with:
107+
name: ${{ github.ref_name }}
108+
tag_name: release-${{ github.ref_name }}
109+
fail_on_unmatched_files: false
110+
target_commitish: ${{ github.ref_name }}
111+
files: |
112+
artifacts/Shell_*_Linux.zip
113+
artifacts/Shell_*_Windows.zip
114+
artifacts/Shell_*_macOS.zip

CMakeLists.txt

Lines changed: 101 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.12)
2-
project(SofaShells VERSION 1.0 LANGUAGES CXX)
3-
2+
project(Shell VERSION 1.0 LANGUAGES CXX)
43

4+
# Find and load CMake configuration of packages containing this plugin's dependencies
55
find_package(Sofa.Config REQUIRED)
66
sofa_find_package(Sofa.GL REQUIRED)
77
sofa_find_package(Sofa.Type REQUIRED)
@@ -17,135 +17,126 @@ sofa_find_package(Sofa.Component.Constraint.Lagrangian.Solver REQUIRED)
1717
sofa_find_package(Sofa.Component.Topology.Container.Dynamic REQUIRED)
1818
sofa_find_package(Sofa.Component.Collision.Detection.Intersection REQUIRED)
1919

20-
21-
22-
set(README_FILE "SofaShells.txt" )
20+
set(README_FILE README.md)
2321
set(SOFASHELLS_SRC_DIR src/SofaShells)
2422

25-
2623
option(SOFA-PLUGIN_SHELLS_ADAPTIVITY "Enables shells adaptivity" OFF)
2724

28-
25+
# List all files
26+
set(SHELL_SRC_DIR src/Shell)
2927
set(HEADER_FILES
30-
31-
${SOFASHELLS_SRC_DIR}/config.h.in
32-
${SOFASHELLS_SRC_DIR}/controller/MeshChangedEvent.h
33-
${SOFASHELLS_SRC_DIR}/controller/MeshInterpolator.h
34-
${SOFASHELLS_SRC_DIR}/controller/MeshInterpolator.inl
35-
${SOFASHELLS_SRC_DIR}/controller/TriangleSwitchExample.h
36-
${SOFASHELLS_SRC_DIR}/controller/TriangleSwitchExample.inl
37-
${SOFASHELLS_SRC_DIR}/engine/JoinMeshPoints.h
38-
${SOFASHELLS_SRC_DIR}/engine/JoinMeshPoints.inl
39-
${SOFASHELLS_SRC_DIR}/engine/FindClosePoints.h
40-
${SOFASHELLS_SRC_DIR}/engine/FindClosePoints.inl
41-
${SOFASHELLS_SRC_DIR}/forcefield/BezierTriangularBendingFEMForceField.h
42-
${SOFASHELLS_SRC_DIR}/forcefield/BezierTriangularBendingFEMForceField.inl
43-
${SOFASHELLS_SRC_DIR}/forcefield/CstFEMForceField.h
44-
${SOFASHELLS_SRC_DIR}/forcefield/CstFEMForceField.inl
45-
${SOFASHELLS_SRC_DIR}/forcefield/TriangularBendingFEMForceField.h
46-
${SOFASHELLS_SRC_DIR}/forcefield/TriangularBendingFEMForceField.inl
47-
${SOFASHELLS_SRC_DIR}/forcefield/TriangularShellForceField.h
48-
${SOFASHELLS_SRC_DIR}/forcefield/TriangularShellForceField.inl
49-
${SOFASHELLS_SRC_DIR}/mapping/BendingPlateMechanicalMapping.h
50-
${SOFASHELLS_SRC_DIR}/mapping/BendingPlateMechanicalMapping.inl
51-
${SOFASHELLS_SRC_DIR}/mapping/BezierTriangleMechanicalMapping.h
52-
${SOFASHELLS_SRC_DIR}/mapping/BezierTriangleMechanicalMapping.inl
53-
${SOFASHELLS_SRC_DIR}/misc/PointProjection.h
54-
${SOFASHELLS_SRC_DIR}/misc/PointProjection.inl
55-
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolation.h
56-
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolation.inl
57-
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolationM.h
58-
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolationM.inl
59-
${SOFASHELLS_SRC_DIR}/shells2/forcefield/BezierShellForceField.h
60-
${SOFASHELLS_SRC_DIR}/shells2/forcefield/BezierShellForceField.inl
61-
${SOFASHELLS_SRC_DIR}/shells2/mapping/BezierShellMechanicalMapping.h
62-
${SOFASHELLS_SRC_DIR}/shells2/mapping/BezierShellMechanicalMapping.inl
63-
)
28+
${SOFASHELLS_SRC_DIR}/config.h.in
29+
${SOFASHELLS_SRC_DIR}/controller/MeshChangedEvent.h
30+
${SOFASHELLS_SRC_DIR}/controller/MeshInterpolator.h
31+
${SOFASHELLS_SRC_DIR}/controller/MeshInterpolator.inl
32+
${SOFASHELLS_SRC_DIR}/controller/TriangleSwitchExample.h
33+
${SOFASHELLS_SRC_DIR}/controller/TriangleSwitchExample.inl
34+
${SOFASHELLS_SRC_DIR}/engine/JoinMeshPoints.h
35+
${SOFASHELLS_SRC_DIR}/engine/JoinMeshPoints.inl
36+
${SOFASHELLS_SRC_DIR}/engine/FindClosePoints.h
37+
${SOFASHELLS_SRC_DIR}/engine/FindClosePoints.inl
38+
${SOFASHELLS_SRC_DIR}/forcefield/BezierTriangularBendingFEMForceField.h
39+
${SOFASHELLS_SRC_DIR}/forcefield/BezierTriangularBendingFEMForceField.inl
40+
${SOFASHELLS_SRC_DIR}/forcefield/CstFEMForceField.h
41+
${SOFASHELLS_SRC_DIR}/forcefield/CstFEMForceField.inl
42+
${SOFASHELLS_SRC_DIR}/forcefield/TriangularBendingFEMForceField.h
43+
${SOFASHELLS_SRC_DIR}/forcefield/TriangularBendingFEMForceField.inl
44+
${SOFASHELLS_SRC_DIR}/forcefield/TriangularShellForceField.h
45+
${SOFASHELLS_SRC_DIR}/forcefield/TriangularShellForceField.inl
46+
${SOFASHELLS_SRC_DIR}/mapping/BendingPlateMechanicalMapping.h
47+
${SOFASHELLS_SRC_DIR}/mapping/BendingPlateMechanicalMapping.inl
48+
${SOFASHELLS_SRC_DIR}/mapping/BezierTriangleMechanicalMapping.h
49+
${SOFASHELLS_SRC_DIR}/mapping/BezierTriangleMechanicalMapping.inl
50+
${SOFASHELLS_SRC_DIR}/misc/PointProjection.h
51+
${SOFASHELLS_SRC_DIR}/misc/PointProjection.inl
52+
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolation.h
53+
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolation.inl
54+
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolationM.h
55+
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolationM.inl
56+
${SOFASHELLS_SRC_DIR}/shells2/forcefield/BezierShellForceField.h
57+
${SOFASHELLS_SRC_DIR}/shells2/forcefield/BezierShellForceField.inl
58+
${SOFASHELLS_SRC_DIR}/shells2/mapping/BezierShellMechanicalMapping.h
59+
${SOFASHELLS_SRC_DIR}/shells2/mapping/BezierShellMechanicalMapping.inl
60+
)
6461

6562
set(SOURCE_FILES
66-
67-
${SOFASHELLS_SRC_DIR}/initPluginShells.cpp
68-
${SOFASHELLS_SRC_DIR}/controller/MeshChangedEvent.cpp
69-
${SOFASHELLS_SRC_DIR}/controller/MeshInterpolator.cpp
70-
${SOFASHELLS_SRC_DIR}/controller/TriangleSwitchExample.cpp
71-
${SOFASHELLS_SRC_DIR}/engine/JoinMeshPoints.cpp
72-
${SOFASHELLS_SRC_DIR}/engine/FindClosePoints.cpp
73-
${SOFASHELLS_SRC_DIR}/forcefield/BezierTriangularBendingFEMForceField.cpp
74-
${SOFASHELLS_SRC_DIR}/forcefield/CstFEMForceField.cpp
75-
${SOFASHELLS_SRC_DIR}/forcefield/TriangularBendingFEMForceField.cpp
76-
${SOFASHELLS_SRC_DIR}/forcefield/TriangularShellForceField.cpp
77-
${SOFASHELLS_SRC_DIR}/mapping/BendingPlateMechanicalMapping.cpp
78-
${SOFASHELLS_SRC_DIR}/mapping/BezierTriangleMechanicalMapping.cpp
79-
${SOFASHELLS_SRC_DIR}/misc/PointProjection.cpp
80-
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolation.cpp
81-
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolationM.cpp
82-
${SOFASHELLS_SRC_DIR}/shells2/forcefield/BezierShellForceField.cpp
83-
${SOFASHELLS_SRC_DIR}/shells2/mapping/BezierShellMechanicalMapping.cpp
84-
)
85-
86-
87-
88-
89-
63+
${SOFASHELLS_SRC_DIR}/initPluginShells.cpp
64+
${SOFASHELLS_SRC_DIR}/controller/MeshChangedEvent.cpp
65+
${SOFASHELLS_SRC_DIR}/controller/MeshInterpolator.cpp
66+
${SOFASHELLS_SRC_DIR}/controller/TriangleSwitchExample.cpp
67+
${SOFASHELLS_SRC_DIR}/engine/JoinMeshPoints.cpp
68+
${SOFASHELLS_SRC_DIR}/engine/FindClosePoints.cpp
69+
${SOFASHELLS_SRC_DIR}/forcefield/BezierTriangularBendingFEMForceField.cpp
70+
${SOFASHELLS_SRC_DIR}/forcefield/CstFEMForceField.cpp
71+
${SOFASHELLS_SRC_DIR}/forcefield/TriangularBendingFEMForceField.cpp
72+
${SOFASHELLS_SRC_DIR}/forcefield/TriangularShellForceField.cpp
73+
${SOFASHELLS_SRC_DIR}/mapping/BendingPlateMechanicalMapping.cpp
74+
${SOFASHELLS_SRC_DIR}/mapping/BezierTriangleMechanicalMapping.cpp
75+
${SOFASHELLS_SRC_DIR}/misc/PointProjection.cpp
76+
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolation.cpp
77+
${SOFASHELLS_SRC_DIR}/shells2/fem/BezierShellInterpolationM.cpp
78+
${SOFASHELLS_SRC_DIR}/shells2/forcefield/BezierShellForceField.cpp
79+
${SOFASHELLS_SRC_DIR}/shells2/mapping/BezierShellMechanicalMapping.cpp
80+
)
9081

9182
if(SOFA-PLUGIN_SHELLS_ADAPTIVITY)
92-
set(COMPILER_DEFINE "SOFA_BUILD_SHELLS_ADAPTIVITY")
93-
94-
list(APPEND HEADER_FILES
95-
96-
${SOFASHELLS_SRC_DIR}/controller/AdaptiveCuttingController.h
97-
${SOFASHELLS_SRC_DIR}/controller/AdaptiveCuttingController.inl
98-
${SOFASHELLS_SRC_DIR}/controller/Test2DAdapter.h
99-
${SOFASHELLS_SRC_DIR}/controller/Test2DAdapter.inl
100-
${SOFASHELLS_SRC_DIR}/misc/Optimize2DSurface.h
101-
${SOFASHELLS_SRC_DIR}/misc/Optimize2DSurface.inl
102-
${SOFASHELLS_SRC_DIR}/misc/SurfaceParametrization.h
103-
${SOFASHELLS_SRC_DIR}/misc/SurfaceParametrization.inl
104-
)
105-
106-
107-
list(APPEND SOURCE_FILES
108-
109-
${SOFASHELLS_SRC_DIR}/controller/AdaptiveCuttingController.cpp
110-
${SOFASHELLS_SRC_DIR}/controller/Test2DAdapter.cpp
111-
${SOFASHELLS_SRC_DIR}/misc/Optimize2DSurface.cpp
112-
${SOFASHELLS_SRC_DIR}/misc/SurfaceParametrization.cpp
113-
)
114-
115-
116-
if(SofaGui_FOUND AND SofaOpenglVisual_FOUND)
83+
set(COMPILER_DEFINE "SOFA_BUILD_SHELLS_ADAPTIVITY")
84+
85+
list(APPEND HEADER_FILES
86+
${SOFASHELLS_SRC_DIR}/controller/AdaptiveCuttingController.h
87+
${SOFASHELLS_SRC_DIR}/controller/AdaptiveCuttingController.inl
88+
${SOFASHELLS_SRC_DIR}/controller/Test2DAdapter.h
89+
${SOFASHELLS_SRC_DIR}/controller/Test2DAdapter.inl
90+
${SOFASHELLS_SRC_DIR}/misc/Optimize2DSurface.h
91+
${SOFASHELLS_SRC_DIR}/misc/Optimize2DSurface.inl
92+
${SOFASHELLS_SRC_DIR}/misc/SurfaceParametrization.h
93+
${SOFASHELLS_SRC_DIR}/misc/SurfaceParametrization.inl
94+
)
11795

118-
list(APPEND HEADER_FILES
119-
${SOFASHELLS_SRC_DIR}/cutting/AdaptiveCutting.h
120-
)
96+
list(APPEND SOURCE_FILES
97+
${SOFASHELLS_SRC_DIR}/controller/AdaptiveCuttingController.cpp
98+
${SOFASHELLS_SRC_DIR}/controller/Test2DAdapter.cpp
99+
${SOFASHELLS_SRC_DIR}/misc/Optimize2DSurface.cpp
100+
${SOFASHELLS_SRC_DIR}/misc/SurfaceParametrization.cpp
101+
)
121102

122-
list(APPEND SOURCE_FILES
123-
${SOFASHELLS_SRC_DIR}/cutting/AdaptiveCutting.cpp
124-
)
103+
if(SofaGui_FOUND AND SofaOpenglVisual_FOUND)
104+
list(APPEND HEADER_FILES
105+
${SOFASHELLS_SRC_DIR}/cutting/AdaptiveCutting.h
106+
)
125107

126-
endif()
108+
list(APPEND SOURCE_FILES
109+
${SOFASHELLS_SRC_DIR}/cutting/AdaptiveCutting.cpp
110+
)
111+
endif()
127112

128113
endif()
129114

130115

131116
# Create the plugin library
132117
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${README_FILES})
133118

134-
# Link the plugin library to its dependency
135-
target_link_libraries(${PROJECT_NAME} Sofa.Component.Controller Sofa.Helper Sofa.Type Sofa.Component.Topology.Container.Dynamic Sofa.Component.StateContainer
136-
Sofa.Core Sofa.Geometry Sofa.GL Sofa.Component.Collision.Detection.Intersection Sofa.Component.Mapping.NonLinear Sofa.Component.Constraint.Lagrangian.Model
137-
Sofa.Component.Constraint.Lagrangian.Solver Sofa.Component.Constraint.Lagrangian Sofa.Component.Constraint
138-
Sofa.Simulation.Core Sofa.Component.Constraint.Projective Sofa.Component.Mass Sofa.Component.SolidMechanics.Spring Sofa.Component.MechanicalLoad
139-
Sofa.Component.LinearSolver.Iterative Sofa.Component.ODESolver.Backward Sofa.Component.Engine.Select Sofa.Component.Mapping.Linear
119+
# Link the plugin library to its dependency(ies).
120+
target_link_libraries(${PROJECT_NAME}
121+
Sofa.Component.Controller
122+
Sofa.Component.Topology.Container.Dynamic
123+
Sofa.Component.StateContainer
124+
Sofa.GL
125+
Sofa.Component.Collision.Detection.Intersection
126+
Sofa.Component.Mapping.NonLinear
127+
Sofa.Component.Constraint.Lagrangian.Model
128+
Sofa.Component.Constraint.Lagrangian.Solver
129+
Sofa.Component.Constraint.Lagrangian
130+
Sofa.Component.Constraint.Projective
131+
Sofa.Component.Mass
132+
Sofa.Component.SolidMechanics.Spring
133+
Sofa.Component.MechanicalLoad
134+
Sofa.Component.LinearSolver.Iterative
135+
Sofa.Component.ODESolver.Backward
136+
Sofa.Component.Engine.Select
137+
Sofa.Component.Mapping.Linear
140138
)
141139

142-
143-
if(SofaGui_FOUND AND SofaOpenglVisual_FOUND)
144-
target_link_libraries(${PROJECT_NAME} SofaGui SofaOpenglVisual)
145-
endif()
146-
147-
148-
# Create package Config, Version & Target files
149140
sofa_create_package_with_targets(
150141
PACKAGE_NAME ${PROJECT_NAME}
151142
PACKAGE_VERSION ${PROJECT_VERSION}

0 commit comments

Comments
 (0)