Skip to content

Commit 45847c6

Browse files
committed
new version, better test, better integration with settings
1 parent b0c8179 commit 45847c6

13 files changed

+38
-75
lines changed

.appveyor.yml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,33 @@ environment:
1313
PYTHON_VERSION: "3.6.x" # currently 3.6.8
1414
PYTHON_ARCH: "64"
1515

16-
# - config: Release
17-
# PYTHON: "C:\\Python35-x64"
18-
# PYTHON_VERSION: "3.5.x" # currently 3.5.8
19-
# PYTHON_ARCH: "64"
16+
- config: Release
17+
PYTHON: "C:\\Python35-x64"
18+
PYTHON_VERSION: "3.5.x" # currently 3.5.8
19+
PYTHON_ARCH: "64"
2020

21-
# - config: Release
22-
# PYTHON: "C:\\Python27-x64"
23-
# PYTHON_VERSION: "2.7.x" # currently 2.7.15
24-
# PYTHON_ARCH: "64"
21+
- config: Release
22+
PYTHON: "C:\\Python27-x64"
23+
PYTHON_VERSION: "2.7.x" # currently 2.7.15
24+
PYTHON_ARCH: "64"
2525
install:
2626
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
2727
- "python --version"
2828
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
2929
- "python -m pip install numpy"
3030
- "python -c \"import numpy as np;import sys;print(np.get_include())\""
31-
32-
# - "dir C:\\Python36-x64\\lib\\site-packages\\numpy\\core\\include"
33-
# - "dir C:\\Python36-x64\\lib\\site-packages\\numpy\\core\\include\\numpy"
3431
build:
3532
parallel: true
3633
build_script:
37-
# - "MSBuild /help"
3834
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
3935
- cd c:\projects\polyfempy
4036
- "python --version"
41-
# - set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
42-
# - set MSBuildOptions=/v:m /p:Configuration=%config% /logger:%MSBuildLogger%
43-
- python setup.py install
37+
- python setup.py build --debug install
4438

4539
test_script:
4640
- cd c:\projects\polyfempy
47-
- python tests/bending.py
48-
- python tests/gravity.py
49-
- python tests/inflation.py
50-
- python tests/plane_hole.py
51-
- python tests/torsion.py
41+
- python test/test_bending.py
42+
- python test/test_gravity.py
43+
- python test/test_inflation.py
44+
- python test/test_plane_hole.py
45+
- python test/test_torsion.py

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ install:
2222
- pip install numpy
2323
- pip install plotly
2424
script:
25-
- python setup.py install
26-
- python tests/bending.py
27-
- python tests/gravity.py
28-
- python tests/inflation.py
29-
- python tests/plane_hole.py
30-
- python tests/torsion.py
25+
- python setup.py build --debug install
26+
- python test/test_bending.py
27+
- python test/test_gravity.py
28+
- python test/test_inflation.py
29+
- python test/test_plane_hole.py
30+
- python test/test_torsion.py
3131
# deploy:
3232
# provider: pypi
3333
# user: "teseoch"

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111

1212

13-
<aside class="warning">
14-
The python bindings are in alpha. Expect a lot of API changes and possible bugs. Use at your own peril!
15-
</aside>
1613

14+
The python bindings are in alpha. Expect a lot of API changes and possible bugs. Use at your own peril!
15+
16+
<br/>
1717
I am making efforts to provide a simple python interface to Polyfem.
1818

1919
For doing so I am maintaining a *conda* package which can be easily installed [https://anaconda.org/conda-forge/polyfempy](https://anaconda.org/conda-forge/polyfempy).
@@ -22,7 +22,7 @@ Note that the conda deployment is slow and this tutorial will follow the deploym
2222

2323
If you hare in a hurry for the juicy latest feature you can clone the repository [Polyfem-python](https://github.com/polyfem/polyfem-python) and use `pip` to install:
2424
```
25-
python setup.py develop
25+
python setup.py install
2626
```
2727
and
2828
```
@@ -32,4 +32,6 @@ for testing.
3232

3333
For python documentation [https://polyfem.github.io/python/](https://polyfem.github.io/python/).
3434

35+
For python jupyter notebook [https://polyfem.github.io/python_examples/](https://polyfem.github.io/python_examples/).
36+
3537
For full documentation see [https://polyfem.github.io/](https://polyfem.github.io/).

cmake/PolyfemPythonDownloadExternal.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endfunction()
2727
function(polyfem_python_download_polyfem)
2828
polyfem_python_download_project(polyfem
2929
GIT_REPOSITORY https://github.com/polyfem/polyfem.git
30-
GIT_TAG 545389f97c37c465de56035cc975dcd980f27648
30+
GIT_TAG 758b9b2cd9fc960f9d3fef777b7ae072d4c535b0
3131
)
3232
endfunction()
3333

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,5 @@ def build_extension(self, ext):
101101
"Programming Language :: Python :: 3",
102102
"License :: OSI Approved :: MIT License"
103103
],
104-
test_suite="tests"
104+
test_suite="test"
105105
)

src/binding.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ PYBIND11_MODULE(polyfempy, m) {
6969

7070
.def(py::init<>())
7171

72-
.def("settings", [](polyfem::State &self, const std::string &json) {
72+
.def("settings", [](polyfem::State &self, const py::object &json) {
7373
init_globals(self);
74-
self.init(json::parse(json));
74+
const std::string json_string = py::str(json);
75+
self.init(json::parse(json_string));
7576
},
7677
"load PDE and problem parameters from the settings",
7778
py::arg("json"))
File renamed without changes.

tests/bending.py renamed to test/test_bending.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_run(self):
3737

3838
solver = pf.Solver()
3939

40-
solver.settings(str(settings))
40+
solver.settings(settings)
4141
solver.load_mesh_from_path_and_tags(mesh_path, tag_path)
4242

4343
solver.solve()

tests/gravity.py renamed to test/test_gravity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_run(self):
4242
settings.set_problem(problem)
4343

4444
solver = pf.Solver()
45-
solver.settings(str(settings))
45+
solver.settings(settings)
4646

4747
# This time we are using pts and faces instead of loading from the disk
4848
solver.set_mesh(pts, faces)

tests/inflation.py renamed to test/test_inflation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_run(self):
3333

3434

3535

36-
solver.settings(str(settings))
36+
solver.settings(settings)
3737
solver.load_mesh_from_path(mesh_path)
3838

3939
solver.solve()
@@ -48,7 +48,7 @@ def test_run(self):
4848
settings.set_problem(problem)
4949

5050
#reload the parameters and mesh
51-
solver.settings(settings.serialize())
51+
solver.settings(settings)
5252
solver.load_mesh_from_path(mesh_path)
5353

5454
#set the rhs as prev sol

0 commit comments

Comments
 (0)