Skip to content

Commit 391b1af

Browse files
committed
Merge branch 'ipc-sim-main' into frictions
2 parents de07836 + 425a3bc commit 391b1af

File tree

12 files changed

+520
-25
lines changed

12 files changed

+520
-25
lines changed

.devcontainer/Dockerfile

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
FROM ubuntu:22.04
2+
3+
# Set environment variables
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ENV CCACHE_DIR=/home/devuser/.ccache
6+
ENV CCACHE_MAXSIZE=1G
7+
ENV CXX_STANDARD=17
8+
9+
# Update package lists
10+
RUN apt-get update
11+
12+
# Install essential packages
13+
RUN apt-get install -y --no-install-recommends \
14+
build-essential \
15+
git \
16+
wget \
17+
curl \
18+
fish \
19+
zsh \
20+
ninja-build \
21+
ccache \
22+
libeigen3-dev \
23+
libtbb-dev \
24+
libspdlog-dev \
25+
python3 \
26+
python3-pip \
27+
python3-dev \
28+
libgmp-dev \
29+
libssl-dev \
30+
libncurses5-dev \
31+
libncursesw5-dev \
32+
libxml2-dev \
33+
libjsoncpp-dev \
34+
libz3-dev \
35+
sudo \
36+
software-properties-common \
37+
lsb-release \
38+
gnupg \
39+
&& rm -rf /var/lib/apt/lists/*
40+
41+
# Create a new user with sudo privileges
42+
RUN useradd -m devuser \
43+
&& echo "devuser:password" | chpasswd \
44+
&& usermod -aG sudo devuser \
45+
&& echo "devuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
46+
&& mkdir -p $CCACHE_DIR \
47+
&& chown devuser:devuser $CCACHE_DIR
48+
49+
# Set up Python tools
50+
RUN pip3 install --upgrade pip setuptools wheel pre-commit
51+
52+
# Add Kitware APT repository for CMake
53+
RUN wget -qO- https://apt.kitware.com/keys/kitware-archive-latest.asc | \
54+
gpg --dearmor -o /usr/share/keyrings/kitware-archive-keyring.gpg
55+
56+
RUN echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" | \
57+
tee /etc/apt/sources.list.d/kitware.list > /dev/null
58+
59+
# Update package lists and install CMake
60+
RUN apt-get update
61+
RUN apt-get install -y cmake
62+
63+
# Verify CMake installation
64+
RUN cmake --version
65+
66+
# Install LLVM/Clang and Clang-Format version 18
67+
RUN wget -q https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
68+
RUN chmod +x /tmp/llvm.sh
69+
RUN /tmp/llvm.sh 18 || true
70+
71+
RUN apt-get update && apt-get install -y clang-18 clang-tools-18 clang-format-18
72+
73+
RUN clang-18 --version
74+
RUN clang++-18 --version
75+
RUN clang-format-18 --version
76+
77+
# 12. Set the default user and working directory
78+
USER devuser
79+
80+
WORKDIR /home/devuser/workspace
81+
82+
CMD ["bash"]

.devcontainer/devcontainer.json

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
3+
"name": "IPCToolkit C++ Development Container",
4+
"build": {
5+
"dockerfile": "Dockerfile",
6+
"context": ".."
7+
},
8+
"customizations": {
9+
"vscode": {
10+
"settings": {
11+
"terminal.integrated.shell.linux": "/bin/fish",
12+
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
13+
"C_Cpp.default.intelliSenseMode": "gcc-x64",
14+
"C_Cpp.default.compilerPath": "/usr/bin/clang++-18",
15+
"C_Cpp.clang_format_path": "/usr/bin/clang-format-18",
16+
"C_Cpp.clang_format_style": "file",
17+
"cmake.configureOnOpen": true,
18+
"cmake.buildDirectory": "${workspaceFolder}/build",
19+
"python.pythonPath": "/usr/bin/python3",
20+
"python.linting.enabled": true,
21+
"python.linting.pylintEnabled": true,
22+
"python.formatting.provider": "black",
23+
"prettier.requireConfig": true
24+
},
25+
"extensions": [
26+
"ms-vscode.cpptools",
27+
"ms-vscode.cmake-tools",
28+
"xaver.clang-format",
29+
"ms-python.python",
30+
"ms-azuretools.vscode-docker",
31+
"eamodio.gitlens",
32+
"esbenp.prettier-vscode",
33+
"mhutchie.git-graph",
34+
"twxs.cmake",
35+
"jeff-hykin.better-cpp-syntax",
36+
"vadimcn.vscode-lldb",
37+
"cschlosser.doxdocgen",
38+
"ms-python.vscode-pylance",
39+
"mutantdino.resourcemonitor",
40+
"randomfractalsinc.vscode-data-preview",
41+
"oderwat.indent-rainbow",
42+
"formulahendry.code-runner",
43+
"donjayamanne.git-extension-pack"
44+
]
45+
}
46+
},
47+
"postCreateCommand": "pre-commit install",
48+
"remoteUser": "devuser",
49+
"mounts": [
50+
"source=${localWorkspaceFolder}/.ccache,target=/home/devuser/.ccache,type=bind,consistency=cached"
51+
],
52+
"forwardPorts": [],
53+
"remoteEnv": {
54+
"CCACHE_DIR": "/home/devuser/.ccache",
55+
"CCACHE_MAXSIZE": "1G"
56+
},
57+
"workspaceFolder": "/home/devuser/workspace",
58+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/devuser/workspace,type=bind,consistency=cached"
59+
}

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ repos:
99
args:
1010
- --style=file
1111
- --verbose
12-
files: '\.(c|cc|cpp|h|hpp|cxx|hh|inl|ipp)$'
12+
files: '\.(c|cc|cpp|h|hpp|tpp|cxx|hh|inl|ipp)$'

CMakePresets.json

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
{
2+
"version": 3,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor":
6+
},
7+
"configurePresets": [
8+
{
9+
"name": "base-release",
10+
"hidden": true,
11+
"description": "Base preset for release builds",
12+
"cacheVariables": {
13+
"CMAKE_BUILD_TYPE": "Release",
14+
"CMAKE_CXX_STANDARD": "17"
15+
}
16+
},
17+
{
18+
"name": "base-debug",
19+
"hidden": true,
20+
"description": "Base preset for debug builds",
21+
"cacheVariables": {
22+
"CMAKE_BUILD_TYPE": "Debug",
23+
"CMAKE_CXX_STANDARD": "17"
24+
}
25+
},
26+
{
27+
"name": "default",
28+
"inherits": "base-release",
29+
"displayName": "Default Configuration",
30+
"description": "Default build configuration",
31+
"binaryDir": "${sourceDir}/build/default"
32+
},
33+
{
34+
"name": "cuda",
35+
"inherits": "base-release",
36+
"displayName": "CUDA Enabled",
37+
"description": "Build with CUDA support",
38+
"binaryDir": "${sourceDir}/build/cuda",
39+
"cacheVariables": {
40+
"IPC_TOOLKIT_WITH_CUDA": "ON"
41+
}
42+
},
43+
{
44+
"name": "simd",
45+
"inherits": "base-release",
46+
"displayName": "SIMD Enabled",
47+
"description": "Build with SIMD optimizations",
48+
"binaryDir": "${sourceDir}/build/simd",
49+
"cacheVariables": {
50+
"IPC_TOOLKIT_WITH_SIMD": "ON"
51+
}
52+
},
53+
{
54+
"name": "test",
55+
"inherits": "base-debug",
56+
"displayName": "Build for Testing",
57+
"description": "Build with unit tests enabled",
58+
"binaryDir": "${sourceDir}/build/test",
59+
"cacheVariables": {
60+
"IPC_TOOLKIT_WITH_CUDA": "ON",
61+
"IPC_TOOLKIT_BUILD_TESTS": "ON",
62+
"IPC_TOOLKIT_BUILD_PYTHON": "OFF"
63+
}
64+
},
65+
{
66+
"name": "python",
67+
"inherits": "base-release",
68+
"displayName": "Python Bindings",
69+
"description": "Build with Python bindings enabled",
70+
"binaryDir": "${sourceDir}/build/python",
71+
"cacheVariables": {
72+
"IPC_TOOLKIT_BUILD_PYTHON": "ON",
73+
"IPC_TOOLKIT_BUILD_TESTS": "OFF",
74+
"IPC_TOOLKIT_WITH_SIMD": "OFF",
75+
"IPC_TOOLKIT_WITH_CUDA": "OFF"
76+
}
77+
},
78+
{
79+
"name": "coverage",
80+
"inherits": "base-debug",
81+
"displayName": "Code Coverage",
82+
"description": "Build for code coverage",
83+
"binaryDir": "${sourceDir}/build/coverage",
84+
"cacheVariables": {
85+
"IPC_TOOLKIT_WITH_CODE_COVERAGE": "ON",
86+
"IPC_TOOLKIT_BUILD_TESTS": "ON",
87+
88+
}
89+
},
90+
{
91+
"name": "debug-cuda",
92+
"inherits": [ "base-debug", "cuda" ],
93+
"displayName": "CUDA Debug",
94+
"description": "Debug build with CUDA support",
95+
"binaryDir": "${sourceDir}/build/debug-cuda"
96+
},
97+
],
98+
"buildPresets": [
99+
{
100+
"name": "default-build",
101+
"configurePreset": "default",
102+
"description": "Build using default configuration"
103+
},
104+
{
105+
"name": "cuda-build",
106+
"configurePreset": "cuda",
107+
"description": "Build with CUDA support"
108+
},
109+
{
110+
"name": "test-build",
111+
"configurePreset": "test",
112+
"description": "Build for running tests"
113+
},
114+
{
115+
"name": "python-build",
116+
"configurePreset": "python",
117+
"description": "Build with Python bindings enabled"
118+
},
119+
{
120+
"name": "debug-cuda-build",
121+
"configurePreset": "debug-cuda",
122+
"description": "Debug build with CUDA support"
123+
},
124+
],
125+
"testPresets": [
126+
{
127+
"name": "default-tests",
128+
"description": "Run default tests",
129+
"configurePreset": "test",
130+
"execution": {
131+
"stopOnFailure": true
132+
}
133+
},
134+
{
135+
"name": "cuda-tests",
136+
"description": "Run tests with CUDA enabled",
137+
"configurePreset": "cuda",
138+
"execution": {
139+
"stopOnFailure": true
140+
}
141+
},
142+
{
143+
"name": "debug-cuda-tests",
144+
"description": "Run tests with CUDA Debug configuration",
145+
"configurePreset": "debug-cuda",
146+
"execution": {
147+
"stopOnFailure": true
148+
}
149+
}
150+
]
151+
}

python/src/ccd/additive_ccd.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ void define_additive_ccd(py::module_& m)
99
{
1010
py::class_<AdditiveCCD, NarrowPhaseCCD>(m, "AdditiveCCD")
1111
.def(
12-
py::init<const double>(),
12+
py::init<const double, const double>(),
1313
R"ipc_Qu8mg5v7(
1414
Construct a new AdditiveCCD object.
1515
1616
Parameters:
1717
conservative_rescaling: The conservative rescaling of the time of impact.
1818
)ipc_Qu8mg5v7",
19+
py::arg("max_iterations") = AdditiveCCD::DEFAULT_MAX_ITERATIONS,
1920
py::arg("conservative_rescaling") =
2021
AdditiveCCD::DEFAULT_CONSERVATIVE_RESCALING)
2122
.def_readonly_static(

src/ipc/candidates/candidates.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ double Candidates::compute_cfl_stepsize(
318318
// If alpha_F < 0.5 * alpha_C, then we should do full CCD.
319319
if (alpha_F < 0.5 * alpha_C) {
320320
return ipc::compute_collision_free_stepsize(
321-
mesh, vertices_t0, vertices_t1, min_distance, //
322-
broad_phase_method, narrow_phase_ccd);
321+
mesh, vertices_t0, vertices_t1, min_distance, broad_phase_method,
322+
narrow_phase_ccd);
323323
}
324324
return std::min(alpha_C, alpha_F);
325325
}

0 commit comments

Comments
 (0)