Wildmeshing Toolkit
MaxEdgeLengthInvariant.cpp
Go to the documentation of this file.
2 #include <wmtk/Mesh.hpp>
4 
5 namespace wmtk {
7  const Mesh& m,
8  const TypedAttributeHandle<double>& coordinate,
9  double threshold_squared)
10  : Invariant(m, true, false, false)
11  , m_coordinate_handle(coordinate)
12  , m_threshold_squared(threshold_squared)
13 {}
15 {
17 
18  auto p0 = accessor.const_vector_attribute(t.tuple());
19  auto p1 = accessor.const_vector_attribute(mesh().switch_tuple(t.tuple(), PrimitiveType::Vertex));
20  const double l_squared = (p1 - p0).squaredNorm();
21  return l_squared < m_threshold_squared;
22 }
23 } // namespace wmtk
MaxEdgeLengthInvariant(const Mesh &m, const TypedAttributeHandle< double > &coordinate, double threshold_squared)
const TypedAttributeHandle< double > m_coordinate_handle
bool before(const simplex::Simplex &t) const override
const attribute::Accessor< T, Mesh, D > create_const_accessor(const attribute::MeshAttributeHandle &handle) const
A CachingAccessor that uses tuples for accessing attributes instead of indices.
Definition: Accessor.hpp:25
ConstMapResult< D > const_vector_attribute(const ArgType &t) const
Handle that represents attributes for some mesh.
const Mesh & mesh() const
Definition: Invariant.cpp:35
const Tuple & tuple() const
Definition: Simplex.hpp:53
Definition: Accessor.hpp:6