Skip to content

Commit e94c11d

Browse files
authored
Merge pull request #196 from Huangzizhou/gcp
GCP does not support 3D codim objects yet; we raise an error for GCP when co-dimensional edges are detected.
2 parents 42cf86e + 3988fb5 commit e94c11d

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

src/ipc/smooth_contact/primitives/edge3.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ Edge3::Edge3(
390390
{
391391
orientable =
392392
(mesh.is_orient_vertex(mesh.edges()(id, 0))
393-
&& mesh.is_orient_vertex(mesh.edges()(id, 0)));
393+
&& mesh.is_orient_vertex(mesh.edges()(id, 1)));
394394

395395
std::array<index_t, 4> neighbors { { -1, -1, -1, -1 } };
396396
{
@@ -450,20 +450,25 @@ Edge3::Edge3(
450450
d.normalized(), vertices.row(m_vertex_ids[0]),
451451
vertices.row(m_vertex_ids[1]), vertices.row(m_vertex_ids[2]),
452452
vertices.row(m_vertex_ids[3]), params, otypes, orientable);
453-
} else if (has_neighbor_1 || has_neighbor_2) {
454-
m_vertex_ids = { { neighbors[0], neighbors[1],
455-
has_neighbor_1 ? neighbors[2] : neighbors[3] } };
456-
457453
} else {
458-
m_vertex_ids = { { neighbors[0], neighbors[1] } };
459-
m_is_active = true;
454+
log_and_throw_error(
455+
"Codimensional objects in 3D are not supported yet!");
456+
457+
if (has_neighbor_1 || has_neighbor_2) {
458+
m_vertex_ids = { { neighbors[0], neighbors[1],
459+
has_neighbor_1 ? neighbors[2] : neighbors[3] } };
460+
461+
} else {
462+
m_vertex_ids = { { neighbors[0], neighbors[1] } };
463+
m_is_active = true;
464+
}
460465
}
461466
}
462467

463-
int Edge3::n_vertices() const { return N_EDGE_NEIGHBORS_3D; }
468+
int Edge3::n_vertices() const { return m_vertex_ids.size(); }
464469

465470
double Edge3::potential(
466-
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<Vector12d> x) const
471+
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<VectorMax12d> x) const
467472
{
468473
#ifdef IPC_TOOLKIT_DEBUG_AUTODIFF
469474
return smooth_edge3_term_template<double>(
@@ -477,7 +482,7 @@ double Edge3::potential(
477482
}
478483

479484
Vector15d Edge3::grad(
480-
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<Vector12d> x) const
485+
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<VectorMax12d> x) const
481486
{
482487
#ifdef IPC_TOOLKIT_DEBUG_AUTODIFF
483488
Vector15d tmp;
@@ -497,7 +502,7 @@ Vector15d Edge3::grad(
497502
}
498503

499504
Matrix15d Edge3::hessian(
500-
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<Vector12d> x) const
505+
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<VectorMax12d> x) const
501506
{
502507
#ifdef IPC_TOOLKIT_DEBUG_AUTODIFF
503508
Vector15d tmp;

src/ipc/smooth_contact/primitives/edge3.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ 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,
26+
Eigen::ConstRef<VectorMax12d> x) const;
2627
Vector15d grad(
27-
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<Vector12d> x) const;
28+
Eigen::ConstRef<Eigen::Vector3d> d,
29+
Eigen::ConstRef<VectorMax12d> x) const;
2830
Matrix15d hessian(
29-
Eigen::ConstRef<Eigen::Vector3d> d, Eigen::ConstRef<Vector12d> x) const;
31+
Eigen::ConstRef<Eigen::Vector3d> d,
32+
Eigen::ConstRef<VectorMax12d> x) const;
3033

3134
private:
3235
OrientationTypes otypes;

0 commit comments

Comments
 (0)