Skip to content

Commit

Permalink
Merge pull request #840 from mtao/mtao/fix_is_valid_debug
Browse files Browse the repository at this point in the history
Fix is_valid debug messages
  • Loading branch information
mtao authored Nov 17, 2024
2 parents 6ca2e12 + 59045fb commit 5179fbf
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
14 changes: 13 additions & 1 deletion src/wmtk/EdgeMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,19 @@ bool EdgeMesh::is_valid(const Tuple& tuple) const
return false;
}

if (tuple.m_local_vid < 0 || tuple.m_global_cid < 0) return false;
const bool is_connectivity_valid = tuple.m_local_vid >= 0 && tuple.m_global_cid >= 0;
if (!is_connectivity_valid) {
#if !defined(NDEBUG)
logger().debug(
"tuple.m_local_vid={} >= 0"
" tuple.m_global_cid={} >= 0",
tuple.m_local_vid,
tuple.m_global_cid);
assert(tuple.m_local_vid >= 0);
assert(tuple.m_global_cid >= 0);
#endif
return false;
}
return true;
}

Expand Down
17 changes: 17 additions & 0 deletions src/wmtk/TetMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,23 @@ bool TetMesh::is_valid(const Tuple& tuple) const
autogen::tet_mesh::tuple_is_valid_for_ccw(tuple);

if (!is_connectivity_valid) {
#if !defined(NDEBUG)
logger().debug(
"tuple.m_local_vid={} >= 0 && tuple.m_local_eid={} >= 0 &&"
"tuple.m_local_fid={} >= 0 &&"
" tuple.m_global_cid={} >= 0 &&"
" autogen::tet_mesh::tuple_is_valid_for_ccw(tuple)={}",
tuple.m_local_vid,
tuple.m_local_eid,
tuple.m_local_fid,
tuple.m_global_cid,
autogen::tet_mesh::tuple_is_valid_for_ccw(tuple));
assert(tuple.m_local_vid >= 0);
assert(tuple.m_local_eid >= 0);
assert(tuple.m_local_fid >= 0);
assert(tuple.m_global_cid >= 0);
assert(autogen::tet_mesh::tuple_is_valid_for_ccw(tuple));
#endif
return false;
}

Expand Down
9 changes: 4 additions & 5 deletions src/wmtk/TriMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,6 @@ bool TriMesh::is_valid(const Tuple& tuple) const

if (!is_connectivity_valid) {
#if !defined(NDEBUG)
assert(tuple.m_local_vid >= 0);
assert(tuple.m_local_eid >= 0);
assert(tuple.m_global_cid);
assert(autogen::tri_mesh::tuple_is_valid_for_ccw(tuple));
logger().debug(
"tuple.m_local_vid={} >= 0 && tuple.m_local_eid={} >= 0 &&"
" tuple.m_global_cid={} >= 0 &&"
Expand All @@ -361,7 +357,10 @@ bool TriMesh::is_valid(const Tuple& tuple) const
tuple.m_local_eid,
tuple.m_global_cid,
autogen::tri_mesh::tuple_is_valid_for_ccw(tuple));
;
assert(tuple.m_local_vid >= 0);
assert(tuple.m_local_eid >= 0);
assert(tuple.m_global_cid >= 0);
assert(autogen::tri_mesh::tuple_is_valid_for_ccw(tuple));
#endif
return false;
}
Expand Down

0 comments on commit 5179fbf

Please sign in to comment.