Skip to content

Commit 387623b

Browse files
committed
Merge master
Signed-off-by: paul.profizi <[email protected]>
2 parents 8d82939 + 5c3eb1c commit 387623b

File tree

1,548 files changed

+247650
-68199
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,548 files changed

+247650
-68199
lines changed

.ci/build_doc.bat

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
set SPHINX_APIDOC_OPTIONS=inherited-members
2-
call sphinx-apidoc -o ../docs/source/api ../ansys ../ansys/dpf/core/log.py ^
3-
../ansys/dpf/core/help.py ../ansys/dpf/core/mapping_types.py ../ansys/dpf/core/ipconfig.py ^
4-
../ansys/dpf/core/field_base.py ../ansys/dpf/core/cache.py ../ansys/dpf/core/misc.py ^
5-
../ansys/dpf/core/check_version.py ../ansys/dpf/core/operators/build.py ../ansys/dpf/core/operators/specification.py ^
6-
../ansys/dpf/core/vtk_helper.py ^
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 ^
79
-f --implicit-namespaces --separate --no-headings
810
pushd .
9-
cd ../docs/
11+
cd ../doc/
1012
call make clean
11-
call make html
13+
call make html -v -v -v -P
14+
15+
dir
16+
17+
rem Patch pyVista issue with elemental plots
18+
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
1228
popd

.ci/build_operators_doc.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import ansys.dpf.core as dpf
2+
from ansys.dpf.core.server_context import (
3+
SERVER_CONTEXT,
4+
)
5+
6+
print(f"Server version: {dpf.global_server().version}")
7+
# Generate entry documentation
8+
print("Generating operator documentation")
9+
print(f"Current context: {SERVER_CONTEXT}")
10+
dpf.operators.utility.html_doc(r"../doc/source/_static/dpf_operators.html").eval()
11+
print("Done.\n")

.ci/build_wheel.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# This script generates the different versions of the ansys-dpf-core wheels based on a given input.
2+
# Input can be one of ["any", "win", "manylinux1", "manylinux_2_17"]
3+
4+
import argparse
5+
import subprocess
6+
import os
7+
import sys
8+
import shutil
9+
import tempfile
10+
11+
12+
supported_platforms = {
13+
"any": "any",
14+
"win": "win_amd64",
15+
"manylinux1": "manylinux1_x86_64",
16+
"manylinux_2_17": "manylinux_2_17_x86_64",
17+
}
18+
19+
argParser = argparse.ArgumentParser()
20+
argParser.add_argument("-p", "--platform", help="platform")
21+
argParser.add_argument("-w", "--wheelhouse", help="platform", action="store_true")
22+
23+
args = argParser.parse_args()
24+
25+
if args.platform not in supported_platforms:
26+
raise ValueError(
27+
f"Platform {args.platform} is not supported. "
28+
f"Supported platforms are: {list(supported_platforms.keys())}"
29+
)
30+
else:
31+
requested_platform = supported_platforms[args.platform]
32+
print(requested_platform)
33+
34+
# Move binaries out of the source depending on platform requested
35+
# any: move all binaries out before building
36+
# win: move .so binaries out before building
37+
# lin: move .dll binaries out before building
38+
with tempfile.TemporaryDirectory() as tmpdirname:
39+
print("Created temporary directory: ", tmpdirname)
40+
41+
# 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+
47+
# Move the binaries
48+
gatebin_folder_path = os.path.join(
49+
os.path.curdir, os.path.join("src", "ansys", "dpf", "gatebin")
50+
)
51+
binaries_to_move = []
52+
moved = []
53+
if "win" in requested_platform or "any" == requested_platform:
54+
# Move linux binaries
55+
binaries_to_move.extend(["libAns.Dpf.GrpcClient.so", "libDPFClientAPI.so"])
56+
if "linux" in requested_platform or "any" == requested_platform:
57+
# Move windows binaries
58+
binaries_to_move.extend(["Ans.Dpf.GrpcClient.dll", "DPFClientAPI.dll"])
59+
if "any" == requested_platform:
60+
binaries_to_move.extend(["_version.py"])
61+
62+
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+
print(f"Moving {src} to {dst}")
66+
shutil.move(src=src, dst=dst)
67+
moved.append([dst, src])
68+
69+
if "any" == requested_platform:
70+
# Also remove the gatebin folder
71+
os.rmdir(gatebin_folder_path)
72+
73+
# Call the build
74+
if not args.wheelhouse:
75+
cmd = [sys.executable, "-m", "build", "--wheel"]
76+
else:
77+
cmd = [sys.executable, "-m", "pip", "wheel", "-w", "dist", "."]
78+
try:
79+
subprocess.run(cmd, capture_output=False, text=True)
80+
print("Done building the wheel.")
81+
except Exception as e:
82+
print(f"Build failed with error: {e}")
83+
84+
if "any" == requested_platform:
85+
# Recreate the gatebin folder
86+
os.mkdir(gatebin_folder_path)
87+
88+
# Move binaries back
89+
for move_back in moved:
90+
print(f"Moving back {move_back[0]} to {move_back[1]}")
91+
shutil.move(src=move_back[0], dst=move_back[1])
92+
print("Binaries moved back.")
93+
94+
print(f"Done building {requested_platform} wheel for ansys-dpf-core!")

.ci/code_generation.py

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,15 @@
1+
# import subprocess
2+
13
from ansys.dpf import core
4+
from ansys.dpf.core.operators import build
25
import os
36
import glob
47
from pathlib import Path
5-
import time
68
import shutil
79

8-
if os.name == "posix":
9-
LIB_TO_GENERATE = [
10-
"libAns.Dpf.Native.so",
11-
"libAns.Dpf.FEMutils.so",
12-
"libmapdlOperatorsCore.so",
13-
"libmeshOperatorsCore.so",
14-
"libAns.Dpf.Math.so",
15-
"libAns.Dpf.Hdf5.so",
16-
"libAns.Dpf.LSDYNAHGP.so",
17-
"libAns.Dpf.LivePost.so",
18-
"libans.dpf.pointcloudsearch.so",
19-
"libAns.Dpf.Vtk.so",
20-
]
21-
else:
22-
LIB_TO_GENERATE = [
23-
"Ans.Dpf.Native.dll",
24-
"Ans.Dpf.Mechanical.dll",
25-
"Ans.Dpf.FEMutils.dll",
26-
"meshOperatorsCore.dll",
27-
"mapdlOperatorsCore.dll",
28-
"Ans.Dpf.Math.dll",
29-
"Ans.Dpf.PythonPluginWrapper.dll"
30-
"Ans.Dpf.Hdf5.dll",
31-
"Ans.Dpf.FlowDiagram.dll",
32-
"Ans.Dpf.LSDYNAHGP.dll",
33-
"Ans.Dpf.LivePost.dll",
34-
"Ans.Dpf.PointCloudSearch.dll",
35-
"Ans.Dpf.Vtk.dll",
36-
]
3710

3811
local_dir = os.path.dirname(os.path.abspath(__file__))
39-
TARGET_PATH = os.path.join(local_dir, os.pardir, "ansys", "dpf", "core", "operators")
12+
TARGET_PATH = os.path.join(local_dir, os.pardir, "src", "ansys", "dpf", "core", "operators")
4013
files = glob.glob(os.path.join(TARGET_PATH, "*"))
4114
for f in files:
4215
if Path(f).stem == "specification":
@@ -52,14 +25,8 @@
5225
os.remove(f)
5326
except:
5427
pass
28+
29+
core.set_default_server_context(core.AvailableServerContexts.premium)
5530
core.start_local_server(config=core.AvailableServerConfigs.LegacyGrpcServer)
56-
code_gen = core.Operator("python_generator")
57-
code_gen.connect(1, TARGET_PATH)
58-
for lib in LIB_TO_GENERATE:
59-
code_gen.connect(0, lib)
60-
if lib != LIB_TO_GENERATE[0]:
61-
code_gen.connect(2, False)
62-
else:
63-
code_gen.connect(2, True)
64-
code_gen.run()
65-
time.sleep(0.1)
31+
32+
build.build_operators()

.ci/display_test.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

.ci/requirements_test_xvfb.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

.ci/run_examples.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,42 @@
44
import subprocess
55
import sys
66

7+
import ansys.dpf.core as dpf
8+
from ansys.dpf.core.examples import get_example_required_minimum_dpf_version
9+
10+
711
os.environ["PYVISTA_OFF_SCREEN"] = "true"
812
os.environ["MPLBACKEND"] = "Agg"
913

1014
actual_path = pathlib.Path(__file__).parent.absolute()
1115
print(os.path.join(actual_path, os.path.pardir, "examples"))
1216

17+
# Get the DPF server version
18+
server = dpf.server.get_or_create_server(None)
19+
server_version = server.version
20+
server.shutdown()
21+
print(f"Server version: {server_version}")
1322

1423
for root, subdirectories, files in os.walk(os.path.join(actual_path, os.path.pardir, "examples")):
1524
for subdirectory in subdirectories:
1625
subdir = os.path.join(root, subdirectory)
1726
for file in glob.iglob(os.path.join(subdir, "*.py")):
18-
print("\n\n--------------------------------------------------\n")
27+
if sys.platform == "linux" and "08-python-operators" in file:
28+
continue
29+
elif "win" in sys.platform and "06-distributed_stress_averaging" in file:
30+
# Currently very unstable in the GH CI
31+
continue
32+
print("\n--------------------------------------------------")
1933
print(file)
20-
print("--------------------------------------------------\n")
34+
minimum_version_str = get_example_required_minimum_dpf_version(file)
35+
if float(server_version) - float(minimum_version_str) < -0.05:
36+
print(f"Example skipped as it requires DPF {minimum_version_str}.")
37+
continue
2138
try:
22-
subprocess.check_call([sys.executable, file])
39+
out = subprocess.check_output([sys.executable, file])
2340
except subprocess.CalledProcessError as e:
2441
sys.stderr.write(str(e.args))
2542
if e.returncode != 3221225477:
43+
print(out)
2644
raise e
45+
print("PASS")

.ci/run_non_regression_examples.py

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,56 @@
1414

1515
list_tests = [
1616
os.path.join(actual_path, os.path.pardir, "examples", "00-basic"),
17-
os.path.join(actual_path, os.path.pardir, "examples", "01-static-transient"),
18-
os.path.join(actual_path, os.path.pardir, "examples", "02-modal-harmonic"),
19-
os.path.join(actual_path, os.path.pardir, "examples", "05-plotting", "00-basic_plotting.py"),
20-
os.path.join(actual_path, os.path.pardir, "examples", "05-plotting",
21-
"05-plot_on_warped_mesh.py"),
22-
os.path.join(actual_path, os.path.pardir, "examples", "06-distributed-post",
23-
"00-distributed_total_disp.py"),
24-
]
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+
),
35+
]
2536

2637
if core.SERVER_CONFIGURATION != core.AvailableServerConfigs.InProcessServer:
27-
list_tests.append(os.path.join(actual_path, os.path.pardir, "examples", "07-python-operators",
28-
"00-wrapping_numpy_capabilities.py"))
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+
)
2947

3048
for path in list_tests:
3149
if os.path.isdir(path):
3250
for file in glob.iglob(os.path.join(path, "*.py")):
33-
print("\n\n--------------------------------------------------\n")
51+
print("\n--------------------------------------------------")
3452
print(file)
35-
print("--------------------------------------------------\n")
3653
try:
3754
subprocess.check_call([sys.executable, file])
3855
except subprocess.CalledProcessError as e:
3956
sys.stderr.write(str(e.args))
4057
if e.returncode != 3221225477:
4158
raise e
59+
print("PASS")
4260
else:
43-
print("\n\n--------------------------------------------------\n")
61+
print("\n--------------------------------------------------")
4462
print(path)
45-
print("--------------------------------------------------\n")
4663
try:
4764
subprocess.check_call([sys.executable, file])
4865
except subprocess.CalledProcessError as e:
4966
sys.stderr.write(str(e.args))
5067
if e.returncode != 3221225477:
5168
raise e
69+
print("PASS")

0 commit comments

Comments
 (0)