23#ifndef VCL_MESH_COMPONENTS_MARK_H
24#define VCL_MESH_COMPONENTS_MARK_H
26#include "base/component.h"
27#include "base/predicates.h"
29#include <vclib/base.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);
170 void serialize(std::ostream&
os)
const { vcl::serialize(
os,
mark()); }
172 void deserialize(std::istream& is) { vcl::deserialize(is, markRef()); }
175 int& markRef() {
return Base::data(); }
198concept HasMark = TB::IsDerivedFromSpecializationOfV<T, Mark>;
215template<
typename ParentElemType,
bool OPT>
216template<
typename Element>
217void Mark<ParentElemType, OPT>::importFrom(
const Element& e,
bool)
220 if (isMarkAvailableOn(e)) {
221 markRef() = e.mark();
239bool isMarkAvailableOn(
const auto& element)
A class representing a box in N-dimensional space.
Definition box.h:46
The Element class.
Definition element.h:75
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
A concept that checks whether a type T (that should be a Element or a Mesh) has the Mark component (i...
Definition mark.h:198
A concept that checks whether a type T (that should be a Element or a Mesh) has the Mark component (i...
Definition mark.h:210
Evaluates to true if the type T is a component that is stored vertically in its element container,...
Definition component.h:74