Skip to content

Commit

Permalink
updating mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
mtao committed Dec 15, 2024
1 parent d9e0c52 commit f90b176
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/wmtk/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ simplex::IdSimplex Mesh::get_id_simplex(const simplex::Simplex& s) const
simplex::Simplex Mesh::get_simplex(const simplex::IdSimplex& s) const
{
const Tuple& t = tuple_from_id(s.primitive_type(), s.index());
return simplex::Simplex(*this, s.primitive_type(), t);
return simplex::Simplex(s.primitive_type(), t);
}

Tuple Mesh::get_tuple_from_id_simplex(const simplex::IdSimplex& s) const
Expand Down Expand Up @@ -112,7 +112,16 @@ bool Mesh::is_boundary(const simplex::Simplex& s) const

bool Mesh::is_valid(const Tuple& tuple) const
{
return !tuple.is_null() && !is_removed(tuple);
const bool nullity = tuple.is_null();
const bool removed = is_removed(tuple);
const bool bad = nullity || removed;
#if !defined(NDEBUG)
if(bad) {
logger().debug("Mesh::is_valid failed, got nullity:{} removedness:{}", nullity, removed);

}
#endif
return !bad;
}

bool Mesh::is_removed(const Tuple& tuple) const
Expand Down Expand Up @@ -143,16 +152,7 @@ bool Mesh::is_removed(int64_t index, PrimitiveType pt) const

bool Mesh::is_valid(const simplex::Simplex& s) const
{
#if defined(WMTK_ENABLE_SIMPLEX_ID_CACHING)
if (!is_valid(s.tuple())) {
return false;
} else {
const int64_t id_tuple = id(s.tuple(), s.primitive_type());
return id_tuple == s.m_index;
}
#else
return is_valid(s.tuple()) && !is_removed(s.tuple(), s.primitive_type());
#endif
}


Expand Down
1 change: 1 addition & 0 deletions src/wmtk/Mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include "multimesh/attribute/UseParentScopeRAII.hpp"


#include "simplex/IdSimplex.hpp"
#include "simplex/NavigatableSimplex.hpp"
#include "simplex/Simplex.hpp"
Expand Down

0 comments on commit f90b176

Please sign in to comment.