Wildmeshing Toolkit
Loading...
Searching...
No Matches
OperationSequence.cpp
Go to the documentation of this file.
2
3
4namespace wmtk::operations {
5
6
8 Mesh& mesh,
9 const std::vector<std::shared_ptr<Operation>>& operations)
10 : Operation(mesh)
11 , m_operations(operations)
12{}
13
15
16
17std::vector<simplex::Simplex> OperationSequence::operator()(const simplex::Simplex& simplex)
18{
19 assert(!m_operations.empty());
20
21 if (!before(simplex)) {
22 return {};
23 }
24
25 const auto simplex_resurrect = simplex;
26
27 auto mods = execute_operations(simplex_resurrect);
28 if (!mods.empty()) { // success should be marked here
30 }
31 // TODO after?
32 return mods;
33}
34
35
37{
38 assert(!m_operations.empty());
39
40 for (auto& o : m_operations) {
41 o->reserve_enough_simplices();
42 }
43}
44
46{
47 assert(!m_operations.empty());
48 const PrimitiveType res = m_operations.front()->primitive_type();
49 // #ifndef NDEBUG
50 // for (const auto& o : m_operations) {
51 // assert(o->primitive_type() == res);
52 // }
53 // #endif
54 return res;
55}
56
57
58} // namespace wmtk::operations
virtual bool before(const simplex::Simplex &simplex) const
Definition Operation.cpp:97
void apply_attribute_transfer(const std::vector< simplex::Simplex > &direct_mods)
std::vector< simplex::Simplex > operator()(const simplex::Simplex &simplex) override
PrimitiveType primitive_type() const override
virtual std::vector< simplex::Simplex > execute_operations(const simplex::Simplex &simplex)=0
std::vector< std::shared_ptr< Operation > > m_operations
OperationSequence(Mesh &mesh, const std::vector< std::shared_ptr< Operation > > &operations={})