Skip to content

Commit

Permalink
updated polyfem + update_obstacle_displacement
Browse files Browse the repository at this point in the history
  • Loading branch information
teseoch committed Apr 9, 2022
1 parent d13d847 commit 842336d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmake/recipes/polyfem.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include(FetchContent)
FetchContent_Declare(
polyfem
GIT_REPOSITORY https://github.com/polyfem/polyfem.git
GIT_TAG 76afcb9bd6d2dcd24a344478f1d7025540b05395
GIT_TAG fcab1f5339e1f25eb2f2d214d17b7ec68a1bc0a2
GIT_SHALLOW FALSE
)
FetchContent_MakeAvailable(polyfem)
Expand Down
13 changes: 10 additions & 3 deletions src/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ PYBIND11_MODULE(polyfempy, m)
// py::scoped_ostream_redirect output;

if (V.cols() == 2)
s.mesh = std::make_unique<polyfem::Mesh2D>();
s.mesh = std::make_unique<polyfem::CMesh2D>();
else
s.mesh = std::make_unique<polyfem::Mesh3D>();
s.mesh->build_from_matrices(V, F);
Expand All @@ -372,7 +372,7 @@ PYBIND11_MODULE(polyfempy, m)
// py::scoped_ostream_redirect output;

if (V.cols() == 2)
s.mesh = std::make_unique<polyfem::Mesh2D>();
s.mesh = std::make_unique<polyfem::CMesh2D>();
else
s.mesh = std::make_unique<polyfem::Mesh3D>();
s.mesh->build_from_matrices(V, F);
Expand Down Expand Up @@ -790,6 +790,13 @@ PYBIND11_MODULE(polyfempy, m)
throw "Updating BC works only for Tensor GenericProblems";
} },
"updates pressure boundary", py::arg("id"), py::arg("val"), py::arg("interp") = std::string(""))
.def(
"update_obstacle_displacement", [](polyfem::State &self, const int oid, const py::object &val, const std::string &interp) {
using namespace polyfem;
// py::scoped_ostream_redirect output;
const json json_val = val;
self.obstacle.change_displacement(oid, json_val, interp); },
"updates obstacle displacement", py::arg("oid"), py::arg("val"), py::arg("interp") = std::string(""))
.def(
"render", [rendering_lambda](polyfem::State &self, int width, int height, const Eigen::MatrixXd &camera_positionm, const double camera_fov, const double camera_near, const double camera_far, const bool is_perspective, const Eigen::MatrixXd &lookatm, const Eigen::MatrixXd &upm, const Eigen::MatrixXd &ambient_lightm, const std::vector<std::pair<Eigen::MatrixXd, Eigen::MatrixXd>> &lights, const Eigen::MatrixXd &diffuse_colorm, const Eigen::MatrixXd &specular_colorm, const double specular_exponent) {
using namespace Eigen;
Expand Down Expand Up @@ -1073,7 +1080,7 @@ PYBIND11_MODULE(polyfempy, m)
if (vertices.size() > 0 && cells.size() > 0)
{
if (is2d)
state.mesh = std::make_unique<polyfem::Mesh2D>();
state.mesh = std::make_unique<polyfem::CMesh2D>();
else
state.mesh = std::make_unique<polyfem::Mesh3D>();
state.mesh->build_from_matrices(vertices, cells);
Expand Down

0 comments on commit 842336d

Please sign in to comment.