|
13 | 13 |
|
14 | 14 | sys.path.append(os.path.abspath(os.path.dirname(__file__)))
|
15 | 15 |
|
| 16 | +# Constants declaration |
| 17 | +EXAMPLES = { |
| 18 | + "mapdl_motorbike_frame": [ |
| 19 | + "project_setup.py", |
| 20 | + "project_query.py", |
| 21 | + "exec_mapdl.py", |
| 22 | + "motorbike_frame_results.txt", |
| 23 | + "motorbike_frame.mac", |
| 24 | + ], |
| 25 | + "mapdl_tyre_performance": [ |
| 26 | + "project_setup.py", |
| 27 | + "tire_performance_simulation.mac", |
| 28 | + "2d_tire_geometry.iges", |
| 29 | + ], |
| 30 | + "mapdl_linked_analyses": [ |
| 31 | + "project_setup.py", |
| 32 | + "prestress.dat", |
| 33 | + "modal.dat", |
| 34 | + "harmonic.dat", |
| 35 | + ], |
| 36 | + "lsdyna_cylinder_plate": [ |
| 37 | + "lsdyna_job.py", |
| 38 | + "cylinder_plate.k", |
| 39 | + "postprocess.cfile", |
| 40 | + ], |
| 41 | + "python_two_bar_truss_problem": [ |
| 42 | + "project_setup.py", |
| 43 | + "exec_python.py", |
| 44 | + "evaluate.py", |
| 45 | + "input_parameters.json", |
| 46 | + ], |
| 47 | + "fluent_2d_heat_exchanger": [ |
| 48 | + "project_setup.py", |
| 49 | + "heat_exchanger.jou", |
| 50 | + "heat_exchanger.cas.h5", |
| 51 | + ], |
| 52 | + "fluent_nozzle": [ |
| 53 | + "project_setup.py", |
| 54 | + "solve.jou", |
| 55 | + "nozzle.cas", |
| 56 | + ], |
| 57 | + "cfx_static_mixer": [ |
| 58 | + "project_setup.py", |
| 59 | + "exec_cfx.py", |
| 60 | + "runInput.ccl", |
| 61 | + "StaticMixer_001.cfx", |
| 62 | + "StaticMixer_001.def", |
| 63 | + ], |
| 64 | +} |
| 65 | + |
16 | 66 | # -- Project information -----------------------------------------------------
|
17 | 67 |
|
18 | 68 | # General information about the project.
|
@@ -343,72 +393,25 @@ def archive_examples(app: sphinx.application.Sphinx) -> None:
|
343 | 393 | Sphinx application instance containing the all the doc build configuration.
|
344 | 394 |
|
345 | 395 | """
|
346 |
| - EXAMPLES = { |
347 |
| - "mapdl_motorbike_frame": [ |
348 |
| - "project_setup.py", |
349 |
| - "project_query.py", |
350 |
| - "exec_mapdl.py", |
351 |
| - "motorbike_frame_results.txt", |
352 |
| - "motorbike_frame.mac", |
353 |
| - ], |
354 |
| - "mapdl_tyre_performance": [ |
355 |
| - "project_setup.py", |
356 |
| - "tire_performance_simulation.mac", |
357 |
| - "2d_tire_geometry.iges", |
358 |
| - ], |
359 |
| - "mapdl_linked_analyses": [ |
360 |
| - "project_setup.py", |
361 |
| - "prestress.dat", |
362 |
| - "modal.dat", |
363 |
| - "harmonic.dat", |
364 |
| - ], |
365 |
| - "lsdyna_cylinder_plate": [ |
366 |
| - "lsdyna_job.py", |
367 |
| - "cylinder_plate.k", |
368 |
| - "postprocess.cfile", |
369 |
| - ], |
370 |
| - "python_two_bar_truss_problem": [ |
371 |
| - "project_setup.py", |
372 |
| - "exec_python.py", |
373 |
| - "evaluate.py", |
374 |
| - "input_parameters.json", |
375 |
| - ], |
376 |
| - "fluent_2d_heat_exchanger": [ |
377 |
| - "project_setup.py", |
378 |
| - "heat_exchanger.jou", |
379 |
| - "heat_exchanger.cas.h5", |
380 |
| - ], |
381 |
| - "fluent_nozzle": [ |
382 |
| - "project_setup.py", |
383 |
| - "solve.jou", |
384 |
| - "nozzle.cas", |
385 |
| - ], |
386 |
| - "cfx_static_mixer": [ |
387 |
| - "project_setup.py", |
388 |
| - "exec_cfx.py", |
389 |
| - "runInput.ccl", |
390 |
| - "StaticMixer_001.cfx", |
391 |
| - "StaticMixer_001.def", |
392 |
| - ], |
393 |
| - } |
394 |
| - SOURCE_DIR = Path(app.srcdir) |
395 |
| - ROOT_PATH = SOURCE_DIR.parent.parent |
| 396 | + |
| 397 | + source_dir = Path(app.srcdir) |
| 398 | + root_path = source_dir.parent.parent |
396 | 399 |
|
397 | 400 | # Create zip files for each example
|
398 |
| - build_path = ROOT_PATH / "build" |
| 401 | + build_path = root_path / "build" |
399 | 402 | build_path.mkdir(exist_ok=True)
|
400 | 403 | for name, files in EXAMPLES.items():
|
401 | 404 | with ZipFile(build_path / f"{name}.zip", "w") as zip_archive:
|
402 | 405 | for file in files:
|
403 |
| - zip_archive.write(ROOT_PATH / "examples" / name / file, file) |
| 406 | + zip_archive.write(root_path / "examples" / name / file, file) |
404 | 407 |
|
405 | 408 | with ZipFile(build_path / "pyhps_examples.zip", "w") as zip_archive:
|
406 | 409 | for name, files in EXAMPLES.items():
|
407 | 410 | for file in files:
|
408 |
| - zip_archive.write(ROOT_PATH / "examples" / name / file, Path(name) / file) |
| 411 | + zip_archive.write(root_path / "examples" / name / file, Path(name) / file) |
409 | 412 |
|
410 | 413 | # Copy zipped example files to target directory at build time
|
411 |
| - download_files_dir = SOURCE_DIR.parent / "_build" / "html" / "_downloads" |
| 414 | + download_files_dir = source_dir.parent / "_build" / "html" / "_downloads" |
412 | 415 | download_files_dir.mkdir(exist_ok=True)
|
413 | 416 | for file_path in build_path.glob("*"):
|
414 | 417 | if file_path.is_file():
|
|
0 commit comments