Skip to content

Commit 3a8914b

Browse files
committed
Merge branch 'main' into release/0.1
2 parents 604ddb3 + 20189fd commit 3a8914b

File tree

5 files changed

+67
-30
lines changed

5 files changed

+67
-30
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ repos:
22

33

44
- repo: https://github.com/psf/black
5-
rev: 23.1.0
5+
rev: 23.7.0
66
hooks:
77
- id: black
88
args:
99
- --line-length=100
1010

1111
- repo: https://github.com/adamchainz/blacken-docs
12-
rev: 1.13.0
12+
rev: 1.15.0
1313
hooks:
1414
- id: blacken-docs
15-
additional_dependencies: [black==22.12.0]
15+
additional_dependencies: [black==23.7.0]
1616
args:
1717
- --line-length=100
1818

@@ -29,7 +29,7 @@ repos:
2929
- --max-line-length=120
3030

3131
- repo: https://github.com/codespell-project/codespell
32-
rev: v2.2.4
32+
rev: v2.2.5
3333
hooks:
3434
- id: codespell
3535
args: ["--toml", "pyproject.toml"]
@@ -52,6 +52,6 @@ repos:
5252

5353
# this validates our github workflow files
5454
- repo: https://github.com/python-jsonschema/check-jsonschema
55-
rev: 0.22.0
55+
rev: 0.23.3
5656
hooks:
5757
- id: check-github-workflows

doc/source/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
pyvista.OFF_SCREEN = True
1919

2020
# must be less than or equal to the XVFB window size
21-
pyvista.rcParams["window_size"] = np.array([1024, 768])
21+
try:
22+
pyvista.global_theme.window_size = np.array([1024, 768])
23+
except AttributeError:
24+
# for compatibility with pyvista < 0.40
25+
pyvista.rcParams["window_size"] = np.array([1024, 768])
2226

2327
# Save figures in specified directory
2428
pyvista.FIGURE_PATH = os.path.join(os.path.abspath("./images/"), "auto-generated/")

pyproject.toml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,43 +36,44 @@ dependencies = [
3636

3737
[project.optional-dependencies]
3838
tests = [
39-
"ansys-mapdl-core==0.65.0",
40-
"scipy==1.10.1",
41-
"pyansys-tools-report==0.5.0",
42-
"pytest==7.3.2",
39+
"ansys-mapdl-core==0.65.2",
40+
"scipy==1.11.1",
41+
"pyansys-tools-report==0.6.0",
42+
"pytest==7.4.0",
4343
"pytest-cov==4.1.0",
44-
"pytest-rerunfailures==11.1.2",
45-
"pyvista==0.39.1",
44+
"pytest-rerunfailures==12.0",
45+
"pyvista==0.41.1",
4646
"vtk==9.2.6",
4747
]
4848
doc = [
49-
"Sphinx==6.2.1",
50-
"ansys-mapdl-core==0.65.0",
51-
"ansys-mapdl-reader==0.52.15",
52-
"ansys-sphinx-theme==0.9.9",
49+
"Sphinx==7.1.2",
50+
"ansys-mapdl-core==0.65.2",
51+
"ansys-mapdl-reader==0.52.19",
52+
"ansys-sphinx-theme==0.10.2",
5353
"jupyter_sphinx==0.4.0",
54-
"jupyterlab==4.0.2",
54+
"jupyterlab==4.0.4",
5555
"numpydoc==1.5.0",
56-
"pandas==2.0.2",
56+
"pandas==2.0.3",
5757
"pypandoc==1.11",
5858
"pytest-sphinx==0.5.0",
59-
"pyvista==0.39.1",
59+
"pyvista==0.41.1",
6060
"sphinx-autobuild==2021.3.14",
61-
"sphinx-autodoc-typehints==1.23.0",
61+
"sphinx-autodoc-typehints==1.24.0",
6262
"sphinx-copybutton==0.5.2",
6363
"sphinx-notfound-page==0.8.3",
6464
"sphinx-gallery==0.13.0",
65+
"trame==3.1.0",
6566
"vtk==9.2.6",
6667
]
6768

6869
[tool.flit.module]
6970
name = "ansys.math.core"
7071

7172
[project.urls]
72-
Homepage = "https://github.com/ansys/ansys-math/"
73+
Homepage = "https://github.com/ansys/pyansys-math/"
7374
Documentation = "https://math.docs.pyansys.com"
74-
Source = "https://github.com/ansys/ansys-math"
75-
Tracker = "https://github.com/ansys/ansys-math/issues"
75+
Source = "https://github.com/ansys/pyansys-math"
76+
Tracker = "https://github.com/ansys/pyansys-math/issues"
7677

7778
[tool.black]
7879
line-length = 100
@@ -93,4 +94,4 @@ show_missing = true
9394
[tool.codespell]
9495
skip = '*.pyc,*.txt,*.gif,*.png,*.jpg,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./doc/build/*,./doc/images/*,./dist/*,*~,.hypothesis*,./doc/source/examples/*,*cover,*.dat,*.mac,build,./docker/mapdl/v*,./factory/*,PKG-INFO,*.mypy_cache/*,./docker/mapdl/*,./_unused/*'
9596
ignore-words = "doc/styles/Vocab/ANSYS/accept.txt"
96-
quiet-level = 3
97+
quiet-level = 3

src/ansys/math/core/math.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,27 @@ def _status(self):
141141
def _parm(self):
142142
return interp_star_status(self._status)
143143

144-
def free(self):
145-
"""Delete all AnsMath objects.
144+
def free(self, mat=None):
145+
"""Delete AnsMath objects.
146+
147+
mat: AnsMath object, optional
148+
AnsMath object to be deleted. Default value is None;
149+
all the AnsMath objects are deleted.
146150
147151
Examples
148152
--------
153+
>>> u = mm.vec(10)
149154
>>> mm.free()
155+
>>> mm.status()
156+
150157
"""
151-
self._mapdl.run("*FREE,ALL", mute=True)
158+
if mat is not None:
159+
if isinstance(mat, AnsMathObj):
160+
self._mapdl.run(f"*FREE,{mat.id}", mute=True)
161+
else:
162+
raise TypeError("The object to delete needs to be an AnsMath object.")
163+
else:
164+
self._mapdl.run("*FREE,ALL", mute=True)
152165

153166
def __repr__(self):
154167
return self._status

tests/test_math.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,30 @@ def test_invalid_sparse_name(mm):
720720
mm.matrix(mat, name=1)
721721

722722

723-
def test_free(mm):
724-
my_mat = mm.ones(10)
723+
def test_free_all(mm):
724+
my_mat1 = mm.ones(10)
725+
my_mat2 = mm.ones(10)
725726
mm.free()
726727
with pytest.raises(MapdlRuntimeError, match="This vector has been deleted"):
727-
my_mat.size
728+
my_mat1.size
729+
with pytest.raises(MapdlRuntimeError, match="This vector has been deleted"):
730+
my_mat2.size
731+
732+
733+
def test_free_mat(mm):
734+
my_mat1 = mm.ones(10)
735+
my_mat2 = mm.ones(10)
736+
mm.free(my_mat1)
737+
assert my_mat2.size == 10
738+
with pytest.raises(MapdlRuntimeError, match="This vector has been deleted"):
739+
my_mat1.size
740+
741+
742+
def test_free_mat_failing(mm):
743+
my_mat1 = mm.ones(10)
744+
arrmy_mat1 = my_mat1.asarray()
745+
with pytest.raises(TypeError, match="The object to delete needs to be an AnsMath object."):
746+
mm.free(arrmy_mat1)
728747

729748

730749
def test_repr(mm):

0 commit comments

Comments
 (0)