Skip to content

Commit ec2ec42

Browse files
committed
raise error on codim edges
1 parent 4599790 commit ec2ec42

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

src/ipc/smooth_contact/primitives/edge3.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ Edge3::Edge3(
388388
{
389389
orientable =
390390
(mesh.is_orient_vertex(mesh.edges()(id, 0))
391-
&& mesh.is_orient_vertex(mesh.edges()(id, 0)));
391+
&& mesh.is_orient_vertex(mesh.edges()(id, 1)));
392392

393393
std::array<index_t, 4> neighbors { { -1, -1, -1, -1 } };
394394
{
@@ -448,20 +448,24 @@ Edge3::Edge3(
448448
d.normalized(), vertices.row(m_vertex_ids[0]),
449449
vertices.row(m_vertex_ids[1]), vertices.row(m_vertex_ids[2]),
450450
vertices.row(m_vertex_ids[3]), params, otypes, orientable);
451-
} else if (has_neighbor_1 || has_neighbor_2) {
452-
m_vertex_ids = { { neighbors[0], neighbors[1],
453-
has_neighbor_1 ? neighbors[2] : neighbors[3] } };
454-
455451
} else {
456-
m_vertex_ids = { { neighbors[0], neighbors[1] } };
457-
m_is_active = true;
452+
log_and_throw_error("Codimensional objects in 3D are not supported yet!");
453+
454+
if (has_neighbor_1 || has_neighbor_2) {
455+
m_vertex_ids = { { neighbors[0], neighbors[1],
456+
has_neighbor_1 ? neighbors[2] : neighbors[3] } };
457+
458+
} else {
459+
m_vertex_ids = { { neighbors[0], neighbors[1] } };
460+
m_is_active = true;
461+
}
458462
}
459463
}
460464

461-
int Edge3::n_vertices() const { return N_EDGE_NEIGHBORS_3D; }
465+
int Edge3::n_vertices() const { return m_vertex_ids.size(); }
462466

463467
double Edge3::potential(
464-
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<Vector12d> x) const
468+
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<VectorMax12d> x) const
465469
{
466470
#ifdef IPC_TOOLKIT_DEBUG_AUTODIFF
467471
return smooth_edge3_term_template<double>(
@@ -475,7 +479,7 @@ double Edge3::potential(
475479
}
476480

477481
Vector15d Edge3::grad(
478-
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<Vector12d> x) const
482+
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<VectorMax12d> x) const
479483
{
480484
#ifdef IPC_TOOLKIT_DEBUG_AUTODIFF
481485
Vector15d tmp;
@@ -495,7 +499,7 @@ Vector15d Edge3::grad(
495499
}
496500

497501
Matrix15d Edge3::hessian(
498-
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<Vector12d> x) const
502+
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<VectorMax12d> x) const
499503
{
500504
#ifdef IPC_TOOLKIT_DEBUG_AUTODIFF
501505
Vector15d tmp;

src/ipc/smooth_contact/primitives/edge3.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ class Edge3 : public Primitive {
2222
int n_dofs() const override { return n_vertices() * DIM; }
2323

2424
double potential(
25-
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<Vector12d> x) const;
25+
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<VectorMax12d> x) const;
2626
Vector15d grad(
27-
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<Vector12d> x) const;
27+
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<VectorMax12d> x) const;
2828
Matrix15d hessian(
29-
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<Vector12d> x) const;
29+
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<VectorMax12d> x) const;
3030

3131
private:
3232
OrientationTypes otypes;

0 commit comments

Comments
 (0)