23#ifndef VCL_MESH_COMPONENTS_MARK_H
24#define VCL_MESH_COMPONENTS_MARK_H
26#include "bases/component.h"
28#include <vclib/concepts/mesh/components/mark.h>
29#include <vclib/io/serialization.h>
81template<
typename ParentElemType =
void,
bool OPT = false>
84 Mark<ParentElemType, OPT>,
88 !std::is_same_v<ParentElemType, void>,
91 using Base = Component<
96 !std::is_same_v<ParentElemType, void>,
107 if constexpr (!Base::IS_VERTICAL) {
130 int mark()
const {
return Base::data(); }
147 if constexpr (std::is_pointer<E>::value) {
148 return e->mark() ==
mark();
151 return e.mark() ==
mark();
167 template<
typename Element>
168 void importFrom(
const Element& e,
bool =
true)
171 if (isMarkAvailableOn(e)) {
172 markRef() = e.mark();
177 void serialize(std::ostream& os)
const { vcl::serialize(os,
mark()); }
179 void deserialize(std::istream& is) { vcl::deserialize(is, markRef()); }
182 int& markRef() {
return Base::data(); }
199bool isMarkAvailableOn(
const ElementOrMeshConcept
auto& element)
201 return isComponentAvailableOn<CompId::MARK>(element);
The Element class.
Definition element.h:57
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
The Mark class is an utility class useful to un-mark components in constant time.
Definition mark.h:90
void incrementMark()
Increments the mark of the current element/mesh by 1.
Definition mark.h:158
bool hasSameMark(const E &e) const
Checks if the current element/mesh has the same mark of the given input element/mesh e.
Definition mark.h:145
void decrementMark()
Decrements the mark of the current element/mesh by 1.
Definition mark.h:163
void init()
Initializes the mark to 0.
Definition mark.h:122
void resetMark()
Resets the mark to 0.
Definition mark.h:135
int mark() const
Returns the value of the mark.
Definition mark.h:130
Mark()
Constructor that initializes the mark to 0.
Definition mark.h:105
HasMark concept is satisfied only if a Element/Mesh class provides the types and member functions spe...
Definition mark.h:47