Skip to content

Commit cd7e7dd

Browse files
committed
removed overloading and updated polyfem
1 parent b313578 commit cd7e7dd

File tree

7 files changed

+15
-19
lines changed

7 files changed

+15
-19
lines changed

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 c679ec3b52e8be63d4e092fd2f315432045a73f5
30+
GIT_TAG 263ce74e59a0a207d2e42ac5fe6fdb5cbd947597
3131
)
3232
endfunction()
3333

src/binding.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,20 @@ PYBIND11_MODULE(polyfempy, m) {
8282
"sets polyfem log level, valid value between 0 (all logs) and 6 (no logs)",
8383
py::arg("log_level"))
8484

85-
.def("load_mesh", [](polyfem::State &s) {
85+
.def("load_mesh_from_settings", [](polyfem::State &s) {
8686
init_globals();
8787
s.load_mesh();
8888
},
8989
"Loads a mesh from the 'mesh' field of the json and 'bc_tag' if any bc tags")
9090

91-
.def("load_mesh", [](polyfem::State &s, const std::string &path) {
91+
.def("load_mesh_from_path", [](polyfem::State &s, const std::string &path) {
9292
init_globals();
9393
s.args["mesh"] = path;
9494
s.load_mesh();
9595
},
9696
"Loads a mesh from the path and 'bc_tag' from the json if any bc tags",
9797
py::arg("path"))
98-
.def("load_mesh", [](polyfem::State &s, const std::string &path, const std::string &bc_tag) {
98+
.def("load_mesh_from_path_and_tags", [](polyfem::State &s, const std::string &path, const std::string &bc_tag) {
9999
init_globals();
100100
s.args["mesh"] = path;
101101
s.args["bc_tag"] = bc_tag;
@@ -106,17 +106,13 @@ PYBIND11_MODULE(polyfempy, m) {
106106
.def("set_mesh", [](polyfem::State &s, const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) {
107107
init_globals();
108108

109-
GEO::Mesh M;
110109
if(V.cols() == 2)
111-
polyfem::to_geogram_mesh(V, F, M);
110+
s.mesh = std::make_unique<polyfem::Mesh2D>();
112111
else
113-
polyfem::to_geogram_mesh_3d(V, F, M);
114-
s.load_mesh(M, [](const polyfem::RowVectorNd&){ return -1; }, true);
112+
s.mesh = std::make_unique<polyfem::Mesh3D>();
113+
s.mesh->build_from_matrices(V, F);
115114

116-
double boundary_id_threshold = s.args["boundary_id_threshold"];
117-
if(boundary_id_threshold <= 0)
118-
boundary_id_threshold = s.mesh->is_volume() ? 1e-2 : 1e-7;
119-
s.mesh->compute_boundary_ids(boundary_id_threshold);
115+
s.load_mesh();
120116
},
121117
"Loads a mesh from vertices and connectivity",
122118
py::arg("vertices"), py::arg("connectivity"))
@@ -142,7 +138,7 @@ PYBIND11_MODULE(polyfempy, m) {
142138
py::arg("boundary_marker"))
143139

144140

145-
.def("set_rhs", [](polyfem::State &s, std::string &path) {
141+
.def("set_rhs_from_path", [](polyfem::State &s, std::string &path) {
146142
init_globals();
147143
s.args["rhs_path"] = path;
148144
},

tests/bending.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_run(self):
3434
solver = pf.Solver()
3535

3636
solver.settings(str(settings))
37-
solver.load_mesh(mesh_path, tag_path)
37+
solver.load_mesh_from_path_and_tags(mesh_path, tag_path)
3838

3939
solver.solve()
4040

tests/gravity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import numpy as np
44
import polyfempy as pf
5-
from utils import plot
5+
from .utils import plot
66

77

88
class Gravity(unittest.TestCase):

tests/inflation.py

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

3232

3333
solver.settings(str(settings))
34-
solver.load_mesh(mesh_path)
34+
solver.load_mesh_from_path(mesh_path)
3535

3636
solver.solve()
3737
sol = solver.get_solution()
@@ -46,7 +46,7 @@ def test_run(self):
4646

4747
#reload the parameters and mesh
4848
solver.settings(settings.serialize())
49-
solver.load_mesh(mesh_path)
49+
solver.load_mesh_from_path(mesh_path)
5050

5151
#set the rhs as prev sol
5252
solver.set_rhs(sol)

tests/plane_hole.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_run(self):
3434
solver = pf.Solver()
3535

3636
solver.settings(str(settings))
37-
solver.load_mesh(mesh_path)
37+
solver.load_mesh_from_path(mesh_path)
3838

3939
solver.solve()
4040

tests/torsion.py

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

4040

4141
solver.settings(str(settings))
42-
solver.load_mesh(mesh_path)
42+
solver.load_mesh_from_path(mesh_path)
4343

4444
solver.solve()
4545

0 commit comments

Comments
 (0)