Skip to content

Commit

Permalink
add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ryichando committed Jan 8, 2025
1 parent 096dfed commit 6f23d99
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04

ENV NVIDIA_DRIVER_CAPABILITIES=utility,compute
ENV LANG=en_US.UTF-8

RUN apt update
RUN apt install -y git python3 curl

RUN mkdir -p /root/ppf-contact-solver
WORKDIR /root/ppf-contact-solver

RUN curl https://raw.githubusercontent.com/st-tech/ppf-contact-solver/refs/heads/main/warmup.py -o warmup.py
RUN python3 warmup.py

WORKDIR /root/
RUN rm -rf ppf-contact-solver
RUN rm -rf /var/lib/apt/lists/*
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,17 @@ git clone https://github.com/st-tech/ppf-contact-solver.git
Move into the ```ppf-contact-solver``` and let ```warmup.py``` do all the rest 💤:
> [!NOTE]
> If you’re suspicious, you can look around ```warmup.py``` before you proceed. Run `less warmup.py`, scroll all the way to the bottom, and hit `q` to quit.
```
cd ppf-contact-solver
python3 warmup.py
```
> [!NOTE]
> If you’re suspicious, you can look around ```warmup.py``` before you proceed. Run `less warmup.py`, scroll all the way to the bottom, and hit `q` to quit.
> If you encounter issues in ```warmup.py```, you can try our pre-build Docker image ```ghcr.io/st-tech/ppf-contact-solver-base:latest```, which does not need to run ```warmup.py```.
> See ``Dockerfile`` to learn how this image is built.
Now we're set. Let's kick in the compilation!🏃
Expand Down
8 changes: 5 additions & 3 deletions examples/needle.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,31 @@
"metadata": {},
"outputs": [],
"source": [
"import random\n",
"\n",
"from frontend import App\n",
"\n",
"app = App.create(\"needle\")\n",
"\n",
"V, F = app.mesh.square(res=129)\n",
"app.asset.add.tri(\"sheet\", V, F)\n",
"\n",
"V, F = app.mesh.cone(height=5, Nr=40, Ny=64, Nb=12, radius=1)\n",
"V, F = app.mesh.cone(height=5, Nr=20, Ny=32, Nb=12, radius=1)\n",
"app.asset.add.tri(\"cone\", V, F)\n",
"\n",
"V, F, T = app.mesh.icosphere(r=0.25, subdiv_count=4).tetrahedralize()\n",
"app.asset.add.tet(\"sphere\", V, F, T)\n",
"\n",
"scene = app.scene.create(\"needle-sphere\")\n",
"scene.add(\"cone\").scale(0.2).rotate(90, \"x\").at(0, -0.25, 0).jitter().pin()\n",
"scene.add(\"sphere\").at(0, 1, 0).jitter().pin().pull().hold(1.0).unpin()\n",
"scene.add(\"sphere\").at(0, 1, 0).pin().pull().hold(1.0).unpin()\n",
"\n",
"n, space = 5, 0.05\n",
"for i in range(n):\n",
" y = (i + 1) * space\n",
" deg = i * 90 / n\n",
" obj = scene.add(\"sheet\").direction([1, 0, 0], [0, 1, 0])\n",
" obj.at(0, y, 0).jitter().rotate(90, \"x\").rotate(deg, \"y\")\n",
" obj.at(0, y, 0).rotate(90, \"x\").rotate(deg + 5 * random.random(), \"y\")\n",
"\n",
"fixed = scene.build().report()\n",
"fixed.preview()"
Expand Down

0 comments on commit 6f23d99

Please sign in to comment.