Wildmeshing Toolkit
AttributesUpdate.cpp
Go to the documentation of this file.
1 #include "AttributesUpdate.hpp"
2 
4 
5 namespace wmtk::operations {
6 
7 
9  : Operation(m)
10 {}
11 
12 std::vector<simplex::Simplex> AttributesUpdate::unmodified_primitives(
13  const simplex::Simplex& simplex) const
14 {
15  return {simplex};
16 }
17 
18 
19 std::vector<simplex::Simplex> AttributesUpdate::execute(const simplex::Simplex& simplex)
20 {
21  assert(simplex.primitive_type() == primitive_type());
22  assert(mesh().is_valid(simplex.tuple()));
23 
24  // const simplex::SimplexCollection star = simplex::closed_star(mesh(), simplex);
25  // const auto star_faces = star.simplex_vector();
26  // std::vector<Tuple> incident_face_tuple;
27  // incident_face_tuple.reserve(star_faces.size());
28  // for (const simplex::Simplex& s : star_faces) {
29  // incident_face_tuple.emplace_back(s.tuple());
30  // }
31 
32  // mesh().update_vertex_operation_hashes(simplex.tuple(), accessor);
33  //
34  // assert(!mesh().is_valid(simplex.tuple(), accessor));
35 
36 #if defined(WMTK_ENABLE_HASH_UPDATE)
37  auto new_tuple = resurrect_tuple(simplex.tuple());
38 #else
39  auto new_tuple = simplex.tuple();
40 #endif
41  assert(mesh().is_valid(new_tuple));
42 
43  return {simplex::Simplex(mesh(), primitive_type(), new_tuple)};
44 }
45 
47  : AttributesUpdate(m)
48 {}
49 
50 std::vector<simplex::Simplex> AttributesUpdateWithFunction::execute(const simplex::Simplex& simplex)
51 {
52  if (bool(m_function)) {
53  if (!m_function(mesh(), simplex)) return {};
54  }
55  return AttributesUpdate::execute(simplex);
56 }
57 
58 } // namespace wmtk::operations
virtual PrimitiveType primitive_type() const override
virtual std::vector< simplex::Simplex > execute(const simplex::Simplex &simplex) override
returns an empty vector in case of failure
virtual std::vector< simplex::Simplex > unmodified_primitives(const simplex::Simplex &simplex) const override
Returns all simplices that will be potentially affected by the operation.
std::vector< simplex::Simplex > execute(const simplex::Simplex &simplex) override
returns an empty vector in case of failure
const Mesh & mesh() const
Definition: Operation.hpp:45
const Tuple & tuple() const
Definition: Simplex.hpp:53
PrimitiveType primitive_type() const
Definition: Simplex.hpp:51