diff --git a/src/ipc/smooth_contact/primitives/edge3.cpp b/src/ipc/smooth_contact/primitives/edge3.cpp index 53c20974f..aa8c43ae6 100644 --- a/src/ipc/smooth_contact/primitives/edge3.cpp +++ b/src/ipc/smooth_contact/primitives/edge3.cpp @@ -388,7 +388,7 @@ Edge3::Edge3( { orientable = (mesh.is_orient_vertex(mesh.edges()(id, 0)) - && mesh.is_orient_vertex(mesh.edges()(id, 0))); + && mesh.is_orient_vertex(mesh.edges()(id, 1))); std::array neighbors { { -1, -1, -1, -1 } }; { @@ -448,20 +448,25 @@ Edge3::Edge3( d.normalized(), vertices.row(m_vertex_ids[0]), vertices.row(m_vertex_ids[1]), vertices.row(m_vertex_ids[2]), vertices.row(m_vertex_ids[3]), params, otypes, orientable); - } else if (has_neighbor_1 || has_neighbor_2) { - m_vertex_ids = { { neighbors[0], neighbors[1], - has_neighbor_1 ? neighbors[2] : neighbors[3] } }; - } else { - m_vertex_ids = { { neighbors[0], neighbors[1] } }; - m_is_active = true; + log_and_throw_error( + "Codimensional objects in 3D are not supported yet!"); + + if (has_neighbor_1 || has_neighbor_2) { + m_vertex_ids = { { neighbors[0], neighbors[1], + has_neighbor_1 ? neighbors[2] : neighbors[3] } }; + + } else { + m_vertex_ids = { { neighbors[0], neighbors[1] } }; + m_is_active = true; + } } } -int Edge3::n_vertices() const { return N_EDGE_NEIGHBORS_3D; } +int Edge3::n_vertices() const { return m_vertex_ids.size(); } double Edge3::potential( - Eigen::ConstRef d, Eigen::ConstRef x) const + Eigen::ConstRef d, Eigen::ConstRef x) const { #ifdef IPC_TOOLKIT_DEBUG_AUTODIFF return smooth_edge3_term_template( @@ -475,7 +480,7 @@ double Edge3::potential( } Vector15d Edge3::grad( - Eigen::ConstRef d, Eigen::ConstRef x) const + Eigen::ConstRef d, Eigen::ConstRef x) const { #ifdef IPC_TOOLKIT_DEBUG_AUTODIFF Vector15d tmp; @@ -495,7 +500,7 @@ Vector15d Edge3::grad( } Matrix15d Edge3::hessian( - Eigen::ConstRef d, Eigen::ConstRef x) const + Eigen::ConstRef d, Eigen::ConstRef x) const { #ifdef IPC_TOOLKIT_DEBUG_AUTODIFF Vector15d tmp; diff --git a/src/ipc/smooth_contact/primitives/edge3.hpp b/src/ipc/smooth_contact/primitives/edge3.hpp index c57ddfc30..6fbff3b25 100644 --- a/src/ipc/smooth_contact/primitives/edge3.hpp +++ b/src/ipc/smooth_contact/primitives/edge3.hpp @@ -22,11 +22,14 @@ class Edge3 : public Primitive { int n_dofs() const override { return n_vertices() * DIM; } double potential( - Eigen::ConstRef d, Eigen::ConstRef x) const; + Eigen::ConstRef d, + Eigen::ConstRef x) const; Vector15d grad( - Eigen::ConstRef d, Eigen::ConstRef x) const; + Eigen::ConstRef d, + Eigen::ConstRef x) const; Matrix15d hessian( - Eigen::ConstRef d, Eigen::ConstRef x) const; + Eigen::ConstRef d, + Eigen::ConstRef x) const; private: OrientationTypes otypes;