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  assert(mesh().is_valid(simplex.tuple()));
37 
38  return {simplex};
39 }
40 
42  : AttributesUpdate(m)
43 {}
44 
45 std::vector<simplex::Simplex> AttributesUpdateWithFunction::execute(const simplex::Simplex& simplex)
46 {
47  if (bool(m_function)) {
48  if (!m_function(mesh(), simplex)) return {};
49  }
50  return AttributesUpdate::execute(simplex);
51 }
52 
53 } // 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