|
Wildmeshing Toolkit
|
Several attribute collections for the same simplex type, behind one container. More...
#include <AttributeCollection.hpp>
Public Member Functions | |
| void | add (AbstractAttributeContainer *c) |
| void | move (size_t from, size_t to) override |
| void | resize (size_t s) override |
| void | reset_from (size_t first) override |
| void | clear () override |
| void | rollback () override |
| void | begin_protect () override |
| void | end_protect () override |
| void | append_recorded (std::vector< size_t > &out) override |
Private Attributes | |
| std::vector< AbstractAttributeContainer * > | m_children |
Several attribute collections for the same simplex type, behind one container.
A mesh exposes exactly one p_vertex_attrs / p_face_attrs / ... slot, so a class hierarchy that wants to split its attributes – shared fields on a base class, application-specific fields on the derived one – has nowhere to register the second collection. Point the slot at one of these instead and register both.
Splitting rather than unioning matters because an AttributeCollection<T> is a member: a derived class cannot change its type, and AttributeCollection<Derived> is not usable as an AttributeCollection<Base> (the storage is a std::vector<Derived>, so it has the wrong stride). Without this, every application pays for every other application's fields on every simplex.
The children keep their own rollback lists and are protected and rolled back independently, which is exactly right: AttributeCollection::operator[] records the rollback entry, so a write to an extras collection inside an operation is undone on failure just like a write to the shared one. Order of registration is the order of forwarding; no child observes another.
Non-owning: the collections outlive the group by being members of the same objects.
|
inlineoverridevirtual |
Appends to out the index of every entry this thread has recorded since begin_protect(): every entry the operation reached through non-const access, which rollback() would write back. Lets a caller check that an operation stayed within the simplices it owns.
Reimplemented from wmtk::AbstractAttributeContainer.
|
inlineoverridevirtual |
Implements wmtk::AbstractAttributeContainer.
|
inlineoverridevirtual |
Implements wmtk::AbstractAttributeContainer.
|
inlineoverridevirtual |
Implements wmtk::AbstractAttributeContainer.
|
inlineoverridevirtual |
Reimplemented from wmtk::AbstractAttributeContainer.
|
inlineoverridevirtual |
Resets every entry from first to the end of the storage to a default-constructed value. consolidate_mesh() calls it on the spare region past the compacted live range: move() leaves its source intact, so without this those slots would still hold the records compacted out of them, and the next operation handed one would inherit a dead simplex's attributes.
Implements wmtk::AbstractAttributeContainer.
|
inlineoverridevirtual |
Implements wmtk::AbstractAttributeContainer.
|
inlineoverridevirtual |
Implements wmtk::AbstractAttributeContainer.