Skip to content

Commit de92eaa

Browse files
committed
Merge with master
2 parents cdbfc37 + 640780c commit de92eaa

File tree

1,120 files changed

+34741
-11945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,120 files changed

+34741
-11945
lines changed

.ci/build_doc.bat

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
set SPHINX_APIDOC_OPTIONS=inherited-members
2-
call sphinx-apidoc -o ../doc/source/api ../src/ansys ../src/ansys/dpf/core/log.py ^
3-
../src/ansys/dpf/core/help.py ../src/ansys/dpf/core/mapping_types.py ../src/ansys/dpf/core/ipconfig.py ^
4-
../src/ansys/dpf/core/field_base.py ../src/ansys/dpf/core/cache.py ../src/ansys/dpf/core/misc.py ^
5-
../src/ansys/dpf/core/check_version.py ../src/ansys/dpf/core/operators/build.py ../src/ansys/dpf/core/operators/specification.py ^
6-
../src/ansys/dpf/core/vtk_helper.py ../src/ansys/dpf/core/label_space.py ../src/ansys/dpf/core/examples/python_plugins/* ^
7-
../src/ansys/dpf/core/examples/examples.py ../src/ansys/dpf/gate/* ../src/ansys/dpf/gatebin/* ../src/ansys/grpc/dpf/* ^
8-
../src/ansys/dpf/core/property_fields_container.py ^
9-
-f --implicit-namespaces --separate --no-headings
1+
@echo off
2+
3+
REM Move to the documentation directory
104
pushd .
115
cd ../doc/
6+
7+
REM Clean the previous build
128
call make clean
9+
10+
REM Build the HTML documentation
1311
call make html -v -v -v -P
1412

13+
REM Display the directory contents for verification
1514
dir
1615

17-
rem Patch pyVista issue with elemental plots
16+
REM Patch pyVista issue with elemental plots by copying necessary images
17+
xcopy source\examples\04-advanced\02-volume_averaged_stress\sphx_glr_02-volume_averaged_stress_001.png build\html\_images\ /y /f
18+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_001.png build\html\_images\ /y /f
19+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_002.png build\html\_images\ /y /f
20+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_003.png build\html\_images\ /y /f
21+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_004.png build\html\_images\ /y /f
22+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_005.png build\html\_images\ /y /f
23+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_006.png build\html\_images\ /y /f
24+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_007.png build\html\_images\ /y /f
25+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_thumb.png build\html\_images\ /y /f
1826

19-
xcopy source\examples\04-advanced\02-volume_averaged_stress\sphx_glr_02-volume_averaged_stress_001.png build\html\_images\ /y /f
20-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_001.png build\html\_images\ /y /f
21-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_002.png build\html\_images\ /y /f
22-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_003.png build\html\_images\ /y /f
23-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_004.png build\html\_images\ /y /f
24-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_005.png build\html\_images\ /y /f
25-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_006.png build\html\_images\ /y /f
26-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_007.png build\html\_images\ /y /f
27-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_thumb.png build\html\_images\ /y /f
27+
REM Return to the original directory
2828
popd

.ci/build_wheel.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,22 @@
22
# Input can be one of ["any", "win", "manylinux1", "manylinux_2_17"]
33

44
import argparse
5-
import subprocess
65
import os
7-
import sys
6+
from pathlib import Path
87
import shutil
8+
import subprocess
9+
import sys
910
import tempfile
1011

11-
1212
supported_platforms = {
1313
"any": "any",
1414
"win": "win_amd64",
1515
"manylinux1": "manylinux1_x86_64",
1616
"manylinux_2_17": "manylinux_2_17_x86_64",
17+
# Accommodate tox.ini automatic platform substitutions
18+
"linux": "manylinux_2_17_x86_64",
19+
"win32": "win_amd64",
20+
"darwin": "any",
1721
}
1822

1923
argParser = argparse.ArgumentParser()
@@ -39,15 +43,13 @@
3943
print("Created temporary directory: ", tmpdirname)
4044

4145
# Create the temporary build-opts.cfg
42-
build_opts_path = os.path.join(tmpdirname, "build-opts.cfg")
43-
with open(build_opts_path, "w") as build_opts_file:
44-
build_opts_file.write(f"[bdist_wheel]\nplat-name={requested_platform}")
45-
os.environ["DIST_EXTRA_CONFIG"] = build_opts_path
46+
build_opts_path = Path(tmpdirname) / "build-opts.cfg"
47+
48+
build_opts_path.write_text(f"[bdist_wheel]\nplat-name={requested_platform}", encoding="utf-8")
49+
os.environ["DIST_EXTRA_CONFIG"] = str(build_opts_path)
4650

4751
# Move the binaries
48-
gatebin_folder_path = os.path.join(
49-
os.path.curdir, os.path.join("src", "ansys", "dpf", "gatebin")
50-
)
52+
gatebin_folder_path = Path.cwd() / "src" / "ansys" / "dpf" / "gatebin"
5153
binaries_to_move = []
5254
moved = []
5355
if "win" in requested_platform or "any" == requested_platform:
@@ -60,15 +62,15 @@
6062
binaries_to_move.extend(["_version.py"])
6163

6264
for binary_name in binaries_to_move:
63-
src = os.path.join(gatebin_folder_path, binary_name)
64-
dst = os.path.join(tmpdirname, binary_name)
65+
src = gatebin_folder_path / binary_name
66+
dst = Path(tmpdirname) / binary_name
6567
print(f"Moving {src} to {dst}")
6668
shutil.move(src=src, dst=dst)
6769
moved.append([dst, src])
6870

6971
if "any" == requested_platform:
7072
# Also remove the gatebin folder
71-
os.rmdir(gatebin_folder_path)
73+
gatebin_folder_path.rmdir()
7274

7375
# Call the build
7476
if not args.wheelhouse:
@@ -83,7 +85,7 @@
8385

8486
if "any" == requested_platform:
8587
# Recreate the gatebin folder
86-
os.mkdir(gatebin_folder_path)
88+
gatebin_folder_path.mkdir()
8789

8890
# Move binaries back
8991
for move_back in moved:

.ci/code_generation.py

Lines changed: 15 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,32 @@
11
# import subprocess
22

3-
from ansys.dpf import core
4-
from ansys.dpf.core.operators import build
5-
import os
63
import glob
4+
import os
75
from pathlib import Path
8-
import time
96
import shutil
107

8+
from ansys.dpf import core
9+
from ansys.dpf.core.operators import build
1110

12-
core.set_default_server_context(core.AvailableServerContexts.premium)
13-
14-
if os.name == "posix":
15-
LIB_TO_GENERATE = [
16-
"libAns.Dpf.Native.so",
17-
"libAns.Dpf.FEMutils.so",
18-
"libmapdlOperatorsCore.so",
19-
"libmeshOperatorsCore.so",
20-
"libAns.Dpf.Math.so",
21-
"libAns.Dpf.Hdf5.so",
22-
"libAns.Dpf.LSDYNAHGP.so",
23-
"libAns.Dpf.LivePost.so",
24-
"libans.dpf.pointcloudsearch.so",
25-
"libAns.Dpf.Vtk.so",
26-
"libAns.Dpf.MechanicalResults.so",
27-
]
28-
LIB_OPTIONAL_TO_GENERATE = [
29-
"libAns.Dpf.SystemCouplingMapping.so",
30-
]
31-
else:
32-
LIB_TO_GENERATE = [
33-
"Ans.Dpf.Native.dll",
34-
"Ans.Dpf.FEMutils.dll",
35-
"meshOperatorsCore.dll",
36-
"mapdlOperatorsCore.dll",
37-
"Ans.Dpf.Math.dll",
38-
"Ans.Dpf.PythonPluginWrapper.dll",
39-
"Ans.Dpf.Hdf5.dll",
40-
"Ans.Dpf.FlowDiagram.dll",
41-
"Ans.Dpf.LSDYNAHGP.dll",
42-
"Ans.Dpf.LivePost.dll",
43-
"Ans.Dpf.PointCloudSearch.dll",
44-
"Ans.Dpf.Vtk.dll",
45-
"Ans.Dpf.MechanicalResults.dll",
46-
]
47-
LIB_OPTIONAL_TO_GENERATE = [
48-
"Ans.Dpf.SystemCouplingMapping.dll",
49-
]
50-
51-
local_dir = os.path.dirname(os.path.abspath(__file__))
52-
TARGET_PATH = os.path.join(local_dir, os.pardir, "src", "ansys", "dpf", "core", "operators")
53-
files = glob.glob(os.path.join(TARGET_PATH, "*"))
54-
for f in files:
55-
if Path(f).stem == "specification":
11+
local_dir = Path(__file__).parent
12+
TARGET_PATH = local_dir.parent / "src" / "ansys" / "dpf" / "core" / "operators"
13+
files = TARGET_PATH.glob("*")
14+
for file_path in files:
15+
if file_path.stem == "specification":
5616
continue
57-
if Path(f).name == "build.py":
17+
if file_path.name == "build.py":
5818
continue
59-
if Path(f).name == "operator.mustache":
19+
if file_path.name == "operator.mustache":
6020
continue
6121
try:
62-
if os.path.isdir(f):
63-
shutil.rmtree(f)
22+
if file_path.is_dir():
23+
shutil.rmtree(file_path)
6424
else:
65-
os.remove(f)
25+
file_path.unlink()
6626
except:
6727
pass
68-
core.start_local_server(config=core.AvailableServerConfigs.LegacyGrpcServer)
69-
code_gen = core.Operator("python_generator")
70-
code_gen.connect(1, TARGET_PATH)
71-
for lib in LIB_TO_GENERATE:
72-
try:
73-
code_gen.connect(0, lib)
74-
if lib != LIB_TO_GENERATE[0]:
75-
code_gen.connect(2, False)
76-
else:
77-
code_gen.connect(2, True)
78-
print(f"Generating {lib} operators for server {core.SERVER.version}...")
79-
code_gen.run()
80-
time.sleep(0.1)
81-
except Exception as e:
82-
print(f"Could not generate operators for library {lib}:\n{str(e)}")
83-
raise e
84-
85-
for lib in LIB_OPTIONAL_TO_GENERATE:
86-
try:
87-
code_gen.connect(0, lib)
88-
if lib != LIB_OPTIONAL_TO_GENERATE[0]:
89-
code_gen.connect(2, False)
90-
else:
91-
code_gen.connect(2, True)
92-
print(f"Generating optional {lib} operators for server {core.SERVER.version}...")
93-
code_gen.run()
94-
time.sleep(0.1)
95-
except Exception as e:
96-
print(f"Could not generate operators for optional library {lib}:\n{str(e)}")
9728

98-
# Reorder imports alphabetically in __init__.py files to reduce changes raised
99-
for init_file_path in glob.glob(os.path.join(TARGET_PATH, "**/__init__.py"), recursive=True):
100-
with open(init_file_path, "r") as init_file:
101-
lines = init_file.readlines()
102-
with open(init_file_path, "w") as init_file:
103-
init_file.writelines(sorted(lines))
29+
core.set_default_server_context(core.AvailableServerContexts.premium)
30+
core.start_local_server(config=core.AvailableServerConfigs.LegacyGrpcServer)
10431

10532
build.build_operators()

.ci/run_examples.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
import os
21
import glob
3-
import pathlib
2+
import os
3+
from pathlib import Path
44
import subprocess
55
import sys
66

77
import ansys.dpf.core as dpf
88
from ansys.dpf.core.examples import get_example_required_minimum_dpf_version
99

10-
1110
os.environ["PYVISTA_OFF_SCREEN"] = "true"
1211
os.environ["MPLBACKEND"] = "Agg"
1312

14-
actual_path = pathlib.Path(__file__).parent.absolute()
15-
print(os.path.join(actual_path, os.path.pardir, "examples"))
13+
actual_path = Path(__file__).parent.absolute()
14+
examples_path = actual_path.parent / "examples"
15+
print(examples_path)
1616

1717
# Get the DPF server version
1818
server = dpf.server.get_or_create_server(None)
1919
server_version = server.version
2020
server.shutdown()
2121
print(f"Server version: {server_version}")
2222

23-
for root, subdirectories, files in os.walk(os.path.join(actual_path, os.path.pardir, "examples")):
23+
for root, subdirectories, files in os.walk(examples_path):
2424
for subdirectory in subdirectories:
25-
subdir = os.path.join(root, subdirectory)
26-
for file in glob.iglob(os.path.join(subdir, "*.py")):
27-
if sys.platform == "linux" and "08-python-operators" in file:
25+
subdir = Path(root) / subdirectory
26+
for file in subdir.glob("*.py"):
27+
if sys.platform == "linux" and "08-python-operators" in str(file):
2828
continue
29-
elif "win" in sys.platform and "06-distributed_stress_averaging" in file:
29+
elif "win" in sys.platform and "06-distributed_stress_averaging" in str(file):
3030
# Currently very unstable in the GH CI
3131
continue
3232
print("\n--------------------------------------------------")
3333
print(file)
3434
minimum_version_str = get_example_required_minimum_dpf_version(file)
3535
if float(server_version) - float(minimum_version_str) < -0.05:
36-
print(f"Example skipped as it requires DPF {minimum_version_str}.")
36+
print(f"Example skipped as it requires DPF {minimum_version_str}.", flush=True)
3737
continue
3838
try:
39-
out = subprocess.check_output([sys.executable, file])
39+
out = subprocess.check_output([sys.executable, str(file)])
4040
except subprocess.CalledProcessError as e:
4141
sys.stderr.write(str(e.args))
4242
if e.returncode != 3221225477:
43-
print(out)
43+
print(out, flush=True)
4444
raise e
45-
print("PASS")
45+
print("PASS", flush=True)

.ci/run_non_regression_examples.py

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,39 @@
1-
import os
21
import glob
3-
from ansys.dpf import core
2+
import os
43
import pathlib
54
import subprocess
65
import sys
76

7+
from ansys.dpf import core
8+
89
os.environ["PYVISTA_OFF_SCREEN"] = "true"
910
os.environ["MPLBACKEND"] = "Agg"
1011

1112
actual_path = pathlib.Path(__file__).parent.absolute()
12-
print(os.path.join(actual_path, os.path.pardir, "examples"))
13+
examples_path = actual_path.parent / "examples"
14+
print(examples_path)
1315

1416

1517
list_tests = [
16-
os.path.join(actual_path, os.path.pardir, "examples", "00-basic"),
17-
os.path.join(actual_path, os.path.pardir, "examples", "01-transient_analyses"),
18-
os.path.join(actual_path, os.path.pardir, "examples", "02-modal_analyses"),
19-
os.path.join(actual_path, os.path.pardir, "examples", "03-harmonic_analyses"),
20-
os.path.join(actual_path, os.path.pardir, "examples", "06-plotting", "00-basic_plotting.py"),
21-
os.path.join(
22-
actual_path,
23-
os.path.pardir,
24-
"examples",
25-
"06-plotting",
26-
"05-plot_on_warped_mesh.py",
27-
),
28-
os.path.join(
29-
actual_path,
30-
os.path.pardir,
31-
"examples",
32-
"07-distributed-post",
33-
"00-distributed_total_disp.py",
34-
),
18+
examples_path / "00-basic",
19+
examples_path / "01-transient_analyses",
20+
examples_path / "02-modal_analyses",
21+
examples_path / "03-harmonic_analyses",
22+
examples_path / "06-plotting" / "00-basic_plotting.py",
23+
examples_path / "06-plotting" / "05-plot_on_warped_mesh.py",
24+
examples_path / "07-distributed-post" / "00-distributed_total_disp.py",
3525
]
3626

3727
if core.SERVER_CONFIGURATION != core.AvailableServerConfigs.InProcessServer:
38-
list_tests.append(
39-
os.path.join(
40-
actual_path,
41-
os.path.pardir,
42-
"examples",
43-
"08-python-operators",
44-
"00-wrapping_numpy_capabilities.py",
45-
)
46-
)
28+
list_tests.append(examples_path / "08-python-operators" / "00-wrapping_numpy_capabilities.py")
4729

4830
for path in list_tests:
49-
if os.path.isdir(path):
50-
for file in glob.iglob(os.path.join(path, "*.py")):
31+
if path.is_dir():
32+
for file in path.glob("*.py"):
5133
print("\n--------------------------------------------------")
5234
print(file)
5335
try:
54-
subprocess.check_call([sys.executable, file])
36+
subprocess.check_call([sys.executable, str(file)])
5537
except subprocess.CalledProcessError as e:
5638
sys.stderr.write(str(e.args))
5739
if e.returncode != 3221225477:
@@ -61,7 +43,7 @@
6143
print("\n--------------------------------------------------")
6244
print(path)
6345
try:
64-
subprocess.check_call([sys.executable, file])
46+
subprocess.check_call([sys.executable, str(file)])
6547
except subprocess.CalledProcessError as e:
6648
sys.stderr.write(str(e.args))
6749
if e.returncode != 3221225477:

0 commit comments

Comments
 (0)