23#ifndef VCL_MESH_COMPONENTS_ADJACENT_EDGES_H
24#define VCL_MESH_COMPONENTS_ADJACENT_EDGES_H
26#include "base/predicates.h"
27#include "base/reference_container_component.h"
29#include <vclib/base.h>
84 typename ParentElemType = void,
88 public ReferenceContainerComponent<
98 CompId::ADJACENT_EDGES,
106 using Base = ReferenceContainerComponent<
109 CompId::ADJACENT_EDGES,
125 using AdjacentEdgeIterator = Base::Iterator;
126 using ConstAdjacentEdgeIterator = Base::ConstIterator;
258 Base::setElement(
it, e);
269 Base::setElement(
it,
ei);
280 Base::setElement(
it, e);
291 Base::setElement(
it,
ei);
583 return Base::elements();
609 template<
typename Element>
612 void serialize(std::ostream&
os)
const
616 if constexpr (N < 0) {
624 void deserialize(std::istream& is)
626 if constexpr (N < 0) {
628 vcl::deserialize(is, n);
633 vcl::deserialize(is, aei);
639 template<
typename Element>
640 void importIndicesFrom(
const Element& e)
642 for (uint i = 0; i < e.adjEdgesNumber(); ++i) {
669 BTIBTBB::IsDerivedFromSpecializationOfV<T, AdjacentEdges>;
700 RemoveRef<T>::VERTEX_NUMBER == RemoveRef<T>::ADJ_EDGE_NUMBER;
725 typename ParentElemType,
728template<
typename Element>
729void AdjacentEdges<STORE_INDICES, Edge, N, TTVN, ParentElemType, VERT, OPT>::
730 importFrom(
const Element& e,
bool importRefs)
734 if (isAdjacentEdgesAvailableOn(e)) {
735 if constexpr (N > 0) {
737 if constexpr (N == Element::ADJ_EDGE_NUMBER) {
738 importIndicesFrom(e);
742 else if constexpr (Element::ADJ_EDGE_NUMBER < 0) {
743 if (e.adjEdgesNumber() == N) {
744 importIndicesFrom(e);
755 Base::resize(e.adjEdgesNumber());
756 importIndicesFrom(e);
775bool isAdjacentEdgesAvailableOn(
const auto& element)
A class representing a box in N-dimensional space.
Definition box.h:46
Box()
The Empty constructor of a box, initializes a null box.
Definition box.h:65
PointT size() const
Computes the size of the box.
Definition box.h:267
The Edge class represents an Edge element of the vcl::Mesh class.
Definition edge.h:47
The Element class.
Definition element.h:75
The AdjacentEdges class is a container of Edge indices or pointers. It could be used by any Element t...
Definition adjacent_edges.h:105
void setAdjEdge(ConstAdjacentEdgeIndexIterator it, uint ei)
Sets the adjacent edge pointed by the iterator.
Definition adjacent_edges.h:289
ConstAdjacentEdgeIndexIterator adjEdgeIndexBegin() const
Returns an iterator to the first adjacent edge index in the container of this component.
Definition adjacent_edges.h:532
AdjacentEdges()=default
Empty constructor.
Edge * adjEdgeMod(int i)
Returns the pointer to the i-th adjacent edge of the element but using as index the module between i ...
Definition adjacent_edges.h:199
void setAdjEdge(uint i, uint ei)
Sets the i-th adjacent edge of the element.
Definition adjacent_edges.h:248
uint adjEdgeIndex(uint i) const
Returns the index in the edge container of the i-th adjacent edge of the element.
Definition adjacent_edges.h:177
const Edge * adjEdgeMod(int i) const
Same of adjEdgeMod, but returns a const Pointer to the adjacent edge.
Definition adjacent_edges.h:209
void insertAdjEdge(uint i, uint ei)
Inserts the adjacent edge with the given index in the container at the given position.
Definition adjacent_edges.h:467
void eraseAdjEdge(uint i)
Removes the adjacent edge at the given position from the container.
Definition adjacent_edges.h:480
ConstAdjacentEdgeIterator adjEdgeBegin() const
Returns a const iterator to the first adjacent edge in the container of this component.
Definition adjacent_edges.h:513
const Edge * adjEdge(uint i) const
Returns a const pointer to the i-th adjacent edge of the element.
Definition adjacent_edges.h:169
void setAdjEdges(Rng &&r)
Sets all the adjacent edges of the element.
Definition adjacent_edges.h:348
View< AdjacentEdgeIterator > adjEdges()
Returns a lightweight view object that stores the begin and end iterators of the container of adjacen...
Definition adjacent_edges.h:563
bool containsAdjEdge(uint ei) const
Returns true if the container of adjacent edges contains the given index, false otherwise.
Definition adjacent_edges.h:391
View< ConstAdjacentEdgeIndexIterator > adjEdgeIndices() const
Returns a lightweight view object that stores the begin and end iterators of the container of adjacen...
Definition adjacent_edges.h:602
void pushAdjEdge(uint ei)
Pushes in the back of the container the given adjacent edge.
Definition adjacent_edges.h:441
void resizeAdjEdges(uint n)
Resize the container of the adjacent edges to the given size.
Definition adjacent_edges.h:423
AdjacentEdgeIterator adjEdgeBegin()
Returns an iterator to the first adjacent edge in the container of this component.
Definition adjacent_edges.h:497
ConstAdjacentEdgeIterator adjEdgeEnd() const
Returns a const iterator to the end of the container of this component.
Definition adjacent_edges.h:524
bool containsAdjEdge(const Edge *e) const
Returns true if the container of adjacent edges contains the given edge, false otherwise.
Definition adjacent_edges.h:378
View< ConstAdjacentEdgeIterator > adjEdges() const
Returns a lightweight const view object that stores the begin and end iterators of the container of a...
Definition adjacent_edges.h:581
static const int ADJ_EDGE_NUMBER
Static size of the container. If the container is dynamic, this value will be negative and you should...
Definition adjacent_edges.h:134
Edge * adjEdge(uint i)
Returns the pointer to the i-th adjacent edge of the element.
Definition adjacent_edges.h:161
void pushAdjEdge(Edge *e)
Pushes in the back of the container the given adjacent edge.
Definition adjacent_edges.h:432
void setAdjEdge(ConstAdjacentEdgeIterator it, Edge *e)
Sets the adjacent edge pointed by the iterator.
Definition adjacent_edges.h:256
void clearAdjEdges()
Clears the container of adjacent edges, making it empty.
Definition adjacent_edges.h:487
void setAdjEdges(Rng &&r)
Sets all the adjacent edges of the element.
Definition adjacent_edges.h:365
void setAdjEdge(ConstAdjacentEdgeIterator it, uint ei)
Sets the adjacent edge pointed by the iterator.
Definition adjacent_edges.h:267
uint adjEdgesNumber() const
Returns the number of adjacent edges of this element.
Definition adjacent_edges.h:152
void setAdjEdge(ConstAdjacentEdgeIndexIterator it, Edge *e)
Sets the adjacent edge pointed by the iterator.
Definition adjacent_edges.h:278
ConstAdjacentEdgeIndexIterator adjEdgeIndexEnd() const
Returns an iterator to the end of the container of this component.
Definition adjacent_edges.h:542
AdjacentEdgeIterator adjEdgeEnd()
Returns an iterator to the end of the container of this component.
Definition adjacent_edges.h:505
void insertAdjEdge(uint i, Edge *e)
Inserts the given adjacent edge in the container at the given position.
Definition adjacent_edges.h:453
uint indexOfAdjEdge(uint ei) const
Returns the index of the adjacent edge with the given index in the container of the element....
Definition adjacent_edges.h:413
uint adjEdgeIndexMod(int i) const
Returns the index in the edge container of the i-th adjacent edge of the element, but using as index ...
Definition adjacent_edges.h:231
void setAdjEdge(uint i, Edge *e)
Sets the i-th adjacent edge of the element.
Definition adjacent_edges.h:239
void setAdjEdgeMod(int i, Edge *e)
Sets the i-th adjacent edge of the element, but using as index the module between i and the number of...
Definition adjacent_edges.h:313
uint indexOfAdjEdge(const Edge *e) const
Returns the index of the given adjacent edge in the container of the element. If the given adjacent e...
Definition adjacent_edges.h:402
void setAdjEdgeMod(int i, uint ei)
Sets the i-th adjacent edge of the element, but using as index the module between i and the number of...
Definition adjacent_edges.h:334
A concept that checks whether a type T (that should be a Element) has the AdjacentEdges component (in...
Definition adjacent_edges.h:668
A concept that checks whether a type T (that should be a Element) has the AdjacentEdges component (in...
Definition adjacent_edges.h:682
HasRightNumberOfAdjacentEdges concept.
Definition adjacent_edges.h:698
Evaluates to true if the type T is a component that is stored vertically in its element container,...
Definition component.h:74
Evaluates to true if the type T is tied to the number of vertices in the face.
Definition component.h:126
SanityCheckAdjacentEdges concept.
Definition adjacent_edges.h:715