|
26 | 26 | { |
27 | 27 | "cell_type": "code", |
28 | 28 | "execution_count": 1, |
29 | | - "metadata": {}, |
30 | | - "outputs": [], |
| 29 | + "metadata": { |
| 30 | + "execution": { |
| 31 | + "iopub.execute_input": "2025-11-12T15:38:26.398940Z", |
| 32 | + "iopub.status.busy": "2025-11-12T15:38:26.398784Z", |
| 33 | + "iopub.status.idle": "2025-11-12T15:38:26.924892Z", |
| 34 | + "shell.execute_reply": "2025-11-12T15:38:26.924430Z" |
| 35 | + } |
| 36 | + }, |
| 37 | + "outputs": [ |
| 38 | + { |
| 39 | + "name": "stdout", |
| 40 | + "output_type": "stream", |
| 41 | + "text": [ |
| 42 | + "Python Version: 3.9.25 (main, Nov 3 2025, 22:33:05) \n", |
| 43 | + "[GCC 11.2.0]\n", |
| 44 | + "Platform: linux\n", |
| 45 | + "System: Linux 6.12.0-55.41.1.el10_0.x86_64\n" |
| 46 | + ] |
| 47 | + }, |
| 48 | + { |
| 49 | + "name": "stdout", |
| 50 | + "output_type": "stream", |
| 51 | + "text": [ |
| 52 | + "PyGeM version: 2.0.0\n" |
| 53 | + ] |
| 54 | + } |
| 55 | + ], |
31 | 56 | "source": [ |
32 | | - "from pygem import FFDParameters, FFD, UnvHandler\n", |
| 57 | + "import sys\n", |
| 58 | + "import platform\n", |
| 59 | + "print(f\"Python Version: {sys.version}\")\n", |
| 60 | + "print(f\"Platform: {sys.platform}\")\n", |
| 61 | + "print(f\"System: {platform.system()} {platform.release()}\")\n", |
| 62 | + "\n", |
| 63 | + "try:\n", |
| 64 | + " import pygem\n", |
| 65 | + " print(f\"PyGeM version: {pygem.__version__}\")\n", |
| 66 | + "except ImportError:\n", |
| 67 | + " print(f\"PyGeM not found. Installing...\")\n", |
| 68 | + " import subprocess\n", |
| 69 | + "\n", |
| 70 | + " # Installing from local source. It can be replaced with github installation once pushed and merged.\n", |
| 71 | + " subprocess.check_call([sys.executable, \"-m\", \"pip\", \"install\", \"-e\", \".[tut]\"])\n", |
| 72 | + " import pygem\n", |
| 73 | + "\n", |
| 74 | + " print(f\"PyGeM version: {pygem.__version__}\")\n", |
| 75 | + "\n", |
| 76 | + "import numpy as np\n", |
33 | 77 | "\n", |
34 | | - "params = FFDParameters()\n", |
35 | | - "params.read_parameters(\n", |
| 78 | + "np.random.seed(42)\n", |
| 79 | + "\n", |
| 80 | + "from pygem import FFD\n", |
| 81 | + "from pygem.unvhandler import UnvHandler\n", |
| 82 | + "\n", |
| 83 | + "ffd = FFD()\n", |
| 84 | + "ffd.read_parameters(\n", |
36 | 85 | " filename=\"../tests/test_datasets/parameters_test_ffd_pipe_unv_C0.prm\"\n", |
37 | 86 | ")" |
38 | 87 | ] |
|
47 | 96 | { |
48 | 97 | "cell_type": "code", |
49 | 98 | "execution_count": 2, |
50 | | - "metadata": {}, |
| 99 | + "metadata": { |
| 100 | + "execution": { |
| 101 | + "iopub.execute_input": "2025-11-12T15:38:26.930136Z", |
| 102 | + "iopub.status.busy": "2025-11-12T15:38:26.929913Z", |
| 103 | + "iopub.status.idle": "2025-11-12T15:38:27.046957Z", |
| 104 | + "shell.execute_reply": "2025-11-12T15:38:27.046505Z" |
| 105 | + } |
| 106 | + }, |
51 | 107 | "outputs": [ |
52 | 108 | { |
53 | 109 | "name": "stdout", |
|
63 | 119 | "n control points y: 2\r\n", |
64 | 120 | "n control points z: 3\r\n", |
65 | 121 | "\r\n", |
66 | | - "# box lenght indicates the length of the FFD bounding box along the three canonical directions (x, y, z).\r\n", |
| 122 | + "# box length indicates the length of the FFD bounding box along the three canonical directions (x, y, z).\r\n", |
67 | 123 | "# It uses the local coordinate system.\r\n", |
68 | | - "# For example to create a 2 x 1.5 x 3 meters box use the following: lenght box: 2.0, 1.5, 3.0\r\n", |
69 | | - "box lenght x: 2.2\r\n", |
70 | | - "box lenght y: 2.2\r\n", |
71 | | - "box lenght z: 6.0\r\n", |
| 124 | + "# For example to create a 2 x 1.5 x 3 meters box use the following: box length: 2.0, 1.5, 3.0\r\n", |
| 125 | + "box length x: 2.2\r\n", |
| 126 | + "box length y: 2.2\r\n", |
| 127 | + "box length z: 6.0\r\n", |
72 | 128 | "\r\n", |
73 | 129 | "# box origin indicates the x, y, and z coordinates of the origin of the FFD bounding box. That is center of\r\n", |
74 | 130 | "# rotation of the bounding box. It corresponds to the point coordinates with position [0][0][0].\r\n", |
75 | 131 | "# See section \"Parameters weights\" for more details.\r\n", |
76 | | - "# For example, if the origin is equal to 0., 0., 0., use the following: origin box: 0., 0., 0.\r\n", |
| 132 | + "# For example, if the origin is equal to 0., 0., 0., use the following: box origin: 0., 0., 0.\r\n", |
77 | 133 | "box origin x: -1.1\r\n", |
78 | 134 | "box origin y: -1.1\r\n", |
79 | 135 | "box origin z: 2.0\r\n", |
|
99 | 155 | "# | 0 | 1 | 0 | -2.1 |\r\n", |
100 | 156 | "# | 0 | 0 | 1 | 3.4 |\r\n", |
101 | 157 | "\r\n", |
102 | | - "# parameter x collects the displacements along x, normalized with the box lenght x.\r\n", |
| 158 | + "# parameter x collects the displacements along x, normalized with the box length x.\r\n", |
103 | 159 | "parameter x: 0 0 0 0.0\r\n", |
104 | 160 | " 0 0 1 0.8\r\n", |
105 | 161 | " 0 0 2 0.0\r\n", |
|
113 | 169 | " 1 1 1 0.8\r\n", |
114 | 170 | " 1 1 2 0.0\r\n", |
115 | 171 | "\r\n", |
116 | | - "# parameter y collects the displacements along y, normalized with the box lenght y.\r\n", |
| 172 | + "# parameter y collects the displacements along y, normalized with the box length y.\r\n", |
117 | 173 | "parameter y: 0 0 0 0.0\r\n", |
118 | 174 | " 0 0 1 0.0\r\n", |
119 | 175 | " 0 0 2 0.0\r\n", |
|
127 | 183 | " 1 1 1 0.0\r\n", |
128 | 184 | " 1 1 2 0.0\r\n", |
129 | 185 | "\r\n", |
130 | | - "# parameter z collects the displacements along z, normalized with the box lenght z.\r\n", |
| 186 | + "# parameter z collects the displacements along z, normalized with the box length z.\r\n", |
131 | 187 | "parameter z: 0 0 0 0.0\r\n", |
132 | 188 | " 0 0 1 0.0\r\n", |
133 | 189 | " 0 0 2 0.0\r\n", |
|
159 | 215 | { |
160 | 216 | "cell_type": "code", |
161 | 217 | "execution_count": 3, |
162 | | - "metadata": {}, |
| 218 | + "metadata": { |
| 219 | + "execution": { |
| 220 | + "iopub.execute_input": "2025-11-12T15:38:27.048915Z", |
| 221 | + "iopub.status.busy": "2025-11-12T15:38:27.048743Z", |
| 222 | + "iopub.status.idle": "2025-11-12T15:38:27.150618Z", |
| 223 | + "shell.execute_reply": "2025-11-12T15:38:27.150194Z" |
| 224 | + } |
| 225 | + }, |
163 | 226 | "outputs": [], |
164 | 227 | "source": [ |
165 | 228 | "unv_handler = UnvHandler()\n", |
|
180 | 243 | { |
181 | 244 | "cell_type": "code", |
182 | 245 | "execution_count": 4, |
183 | | - "metadata": {}, |
| 246 | + "metadata": { |
| 247 | + "execution": { |
| 248 | + "iopub.execute_input": "2025-11-12T15:38:27.152910Z", |
| 249 | + "iopub.status.busy": "2025-11-12T15:38:27.152742Z", |
| 250 | + "iopub.status.idle": "2025-11-12T15:38:27.303104Z", |
| 251 | + "shell.execute_reply": "2025-11-12T15:38:27.302539Z" |
| 252 | + } |
| 253 | + }, |
184 | 254 | "outputs": [], |
185 | 255 | "source": [ |
186 | | - "free_form = FFD(params, mesh_points)\n", |
187 | | - "free_form.perform()\n", |
188 | | - "new_mesh_points = free_form.modified_mesh_points\n", |
| 256 | + "new_mesh_points = ffd(mesh_points)\n", |
189 | 257 | "\n", |
190 | 258 | "unv_handler.write(new_mesh_points, \"test_pipe_mod_C0.unv\")" |
191 | 259 | ] |
|
214 | 282 | { |
215 | 283 | "cell_type": "code", |
216 | 284 | "execution_count": 5, |
217 | | - "metadata": {}, |
| 285 | + "metadata": { |
| 286 | + "execution": { |
| 287 | + "iopub.execute_input": "2025-11-12T15:38:27.305275Z", |
| 288 | + "iopub.status.busy": "2025-11-12T15:38:27.305095Z", |
| 289 | + "iopub.status.idle": "2025-11-12T15:38:27.419912Z", |
| 290 | + "shell.execute_reply": "2025-11-12T15:38:27.419460Z" |
| 291 | + } |
| 292 | + }, |
218 | 293 | "outputs": [ |
219 | 294 | { |
220 | 295 | "name": "stdout", |
|
230 | 305 | "n control points y: 2\r\n", |
231 | 306 | "n control points z: 5\r\n", |
232 | 307 | "\r\n", |
233 | | - "# box lenght indicates the length of the FFD bounding box along the three canonical directions (x, y, z).\r\n", |
| 308 | + "# box length indicates the length of the FFD bounding box along the three canonical directions (x, y, z).\r\n", |
234 | 309 | "# It uses the local coordinate system.\r\n", |
235 | | - "# For example to create a 2 x 1.5 x 3 meters box use the following: lenght box: 2.0, 1.5, 3.0\r\n", |
236 | | - "box lenght x: 2.2\r\n", |
237 | | - "box lenght y: 2.2\r\n", |
238 | | - "box lenght z: 6.0\r\n", |
| 310 | + "# For example to create a 2 x 1.5 x 3 meters box use the following: box length: 2.0, 1.5, 3.0\r\n", |
| 311 | + "box length x: 2.2\r\n", |
| 312 | + "box length y: 2.2\r\n", |
| 313 | + "box length z: 6.0\r\n", |
239 | 314 | "\r\n", |
240 | 315 | "# box origin indicates the x, y, and z coordinates of the origin of the FFD bounding box. That is center of\r\n", |
241 | 316 | "# rotation of the bounding box. It corresponds to the point coordinates with position [0][0][0].\r\n", |
242 | 317 | "# See section \"Parameters weights\" for more details.\r\n", |
243 | | - "# For example, if the origin is equal to 0., 0., 0., use the following: origin box: 0., 0., 0.\r\n", |
| 318 | + "# For example, if the origin is equal to 0., 0., 0., use the following: box origin: 0., 0., 0.\r\n", |
244 | 319 | "box origin x: -1.1\r\n", |
245 | 320 | "box origin y: -1.1\r\n", |
246 | 321 | "box origin z: 2.0\r\n", |
|
266 | 341 | "# | 0 | 1 | 0 | -2.1 |\r\n", |
267 | 342 | "# | 0 | 0 | 1 | 3.4 |\r\n", |
268 | 343 | "\r\n", |
269 | | - "# parameter x collects the displacements along x, normalized with the box lenght x.\r\n", |
| 344 | + "# parameter x collects the displacements along x, normalized with the box length x.\r\n", |
270 | 345 | "parameter x: 0 0 0 0.0\r\n", |
271 | 346 | " 0 0 1 0.0\r\n", |
272 | 347 | " 0 0 2 0.8\r\n", |
|
288 | 363 | " 1 1 3 0.0\r\n", |
289 | 364 | " 1 1 4 0.0\r\n", |
290 | 365 | "\r\n", |
291 | | - "# parameter y collects the displacements along y, normalized with the box lenght y.\r\n", |
| 366 | + "# parameter y collects the displacements along y, normalized with the box length y.\r\n", |
292 | 367 | "parameter y: 0 0 0 0.0\r\n", |
293 | 368 | " 0 0 1 0.0\r\n", |
294 | 369 | " 0 0 2 0.0\r\n", |
|
310 | 385 | " 1 1 3 0.0\r\n", |
311 | 386 | " 1 1 4 0.0\r\n", |
312 | 387 | "\r\n", |
313 | | - "# parameter z collects the displacements along z, normalized with the box lenght z.\r\n", |
| 388 | + "# parameter z collects the displacements along z, normalized with the box length z.\r\n", |
314 | 389 | "parameter z: 0 0 0 0.0\r\n", |
315 | 390 | " 0 0 1 0.0\r\n", |
316 | 391 | " 0 0 2 0.0\r\n", |
|
348 | 423 | { |
349 | 424 | "cell_type": "code", |
350 | 425 | "execution_count": 6, |
351 | | - "metadata": {}, |
| 426 | + "metadata": { |
| 427 | + "execution": { |
| 428 | + "iopub.execute_input": "2025-11-12T15:38:27.421770Z", |
| 429 | + "iopub.status.busy": "2025-11-12T15:38:27.421601Z", |
| 430 | + "iopub.status.idle": "2025-11-12T15:38:27.569322Z", |
| 431 | + "shell.execute_reply": "2025-11-12T15:38:27.568953Z" |
| 432 | + } |
| 433 | + }, |
352 | 434 | "outputs": [], |
353 | 435 | "source": [ |
354 | | - "params = FFDParameters()\n", |
355 | | - "params.read_parameters(\n", |
| 436 | + "ffd = FFD()\n", |
| 437 | + "ffd.read_parameters(\n", |
356 | 438 | " filename=\"../tests/test_datasets/parameters_test_ffd_pipe_unv_C1.prm\"\n", |
357 | 439 | ")\n", |
358 | 440 | "\n", |
359 | | - "free_form = FFD(params, mesh_points)\n", |
360 | | - "free_form.perform()\n", |
361 | | - "new_mesh_points = free_form.modified_mesh_points\n", |
| 441 | + "new_mesh_points = ffd(mesh_points)\n", |
362 | 442 | "\n", |
363 | 443 | "unv_handler.write(new_mesh_points, \"test_pipe_mod_C1.unv\")" |
364 | 444 | ] |
|
379 | 459 | "kernelspec": { |
380 | 460 | "display_name": "Python 2", |
381 | 461 | "language": "python", |
382 | | - "name": "python2" |
| 462 | + "name": "python3" |
383 | 463 | }, |
384 | 464 | "language_info": { |
385 | 465 | "codemirror_mode": { |
386 | 466 | "name": "ipython", |
387 | | - "version": 2 |
| 467 | + "version": 3 |
388 | 468 | }, |
389 | 469 | "file_extension": ".py", |
390 | 470 | "mimetype": "text/x-python", |
391 | 471 | "name": "python", |
392 | 472 | "nbconvert_exporter": "python", |
393 | | - "pygments_lexer": "ipython2", |
394 | | - "version": "2.7.13" |
| 473 | + "pygments_lexer": "ipython3", |
| 474 | + "version": "3.9.25" |
395 | 475 | } |
396 | 476 | }, |
397 | 477 | "nbformat": 4, |
|
0 commit comments