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;
257 Base::setElement(
it, e);
268 Base::setElement(
it,
ei);
279 Base::setElement(
it, e);
290 Base::setElement(
it,
ei);
582 return Base::elements();
608 template<
typename Element>
611 void serialize(std::ostream&
os)
const
615 if constexpr (N < 0) {
623 void deserialize(std::istream& is)
625 if constexpr (N < 0) {
627 vcl::deserialize(is, n);
632 vcl::deserialize(is, aei);
638 template<
typename Element>
639 void importIndicesFrom(
const Element& e)
641 for (uint i = 0; i < e.adjEdgeCount(); ++i) {
668 BTIBTBB::IsDerivedFromSpecializationOfV<T, AdjacentEdges>;
699 RemoveRef<T>::VERTEX_COUNT == RemoveRef<T>::ADJ_EDGE_COUNT;
724 typename ParentElemType,
727template<
typename Element>
728void AdjacentEdges<STORE_INDICES, Edge, N, TTVC, ParentElemType, VERT, OPT>::
729 importFrom(
const Element& e,
bool importRefs)
733 if (isAdjacentEdgesAvailableOn(e)) {
734 if constexpr (N > 0) {
736 if constexpr (N == Element::ADJ_EDGE_COUNT) {
737 importIndicesFrom(e);
740 else if constexpr (Element::ADJ_EDGE_COUNT < 0) {
741 if (e.adjEdgeCount() == N) {
742 importIndicesFrom(e);
753 Base::resize(e.adjEdgeCount());
754 importIndicesFrom(e);
773bool isAdjacentEdgesAvailableOn(
const auto& element)
The Edge class represents an Edge element of the vcl::Mesh class.
Definition edge.h:47
The Element class.
Definition element.h:75
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:41
Segment()
Default constructor. Creates a segment with endpoints at the origin.
Definition segment.h:66
The AdjacentEdges class is a container of Edge indices or pointers. It could be used by any Element t...
Definition adjacent_edges.h:105
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:412
AdjacentEdgeIterator adjEdgeBegin()
Returns an iterator to the first adjacent edge in the container of this component.
Definition adjacent_edges.h:496
void setAdjEdge(ConstAdjacentEdgeIterator it, Edge *e)
Sets the adjacent edge pointed by the iterator.
Definition adjacent_edges.h:255
AdjacentEdgeIterator adjEdgeEnd()
Returns an iterator to the end of the container of this component.
Definition adjacent_edges.h:504
bool containsAdjEdge(uint ei) const
Returns true if the container of adjacent edges contains the given index, false otherwise.
Definition adjacent_edges.h:390
void clearAdjEdges()
Clears the container of adjacent edges, making it empty.
Definition adjacent_edges.h:486
AdjacentEdges()=default
Empty constructor.
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:401
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:601
void setAdjEdges(Rng &&r)
Sets all the adjacent edges of the element.
Definition adjacent_edges.h:364
void setAdjEdge(ConstAdjacentEdgeIndexIterator it, Edge *e)
Sets the adjacent edge pointed by the iterator.
Definition adjacent_edges.h:277
static const int ADJ_EDGE_COUNT
Static size of the container. If the container is dynamic, this value will be negative and you should...
Definition adjacent_edges.h:134
View< AdjacentEdgeIterator > adjEdges()
Returns a lightweight view object that stores the begin and end iterators of the container of adjacen...
Definition adjacent_edges.h:562
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 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:333
const Edge * adjEdgeMod(int i) const
Same of adjEdgeMod, but returns a const Pointer to the adjacent edge.
Definition adjacent_edges.h:209
ConstAdjacentEdgeIndexIterator adjEdgeIndexEnd() const
Returns an iterator to the end of the container of this component.
Definition adjacent_edges.h:541
void setAdjEdge(uint i, Edge *e)
Sets the i-th adjacent edge of the element.
Definition adjacent_edges.h:238
uint adjEdgeCount() const
Returns the number of adjacent edges of this element.
Definition adjacent_edges.h:152
ConstAdjacentEdgeIterator adjEdgeBegin() const
Returns a const iterator to the first adjacent edge in the container of this component.
Definition adjacent_edges.h:512
void setAdjEdges(Rng &&r)
Sets all the adjacent edges of the element.
Definition adjacent_edges.h:347
void insertAdjEdge(uint i, Edge *e)
Inserts the given adjacent edge in the container at the given position.
Definition adjacent_edges.h:452
bool containsAdjEdge(const Edge *e) const
Returns true if the container of adjacent edges contains the given edge, false otherwise.
Definition adjacent_edges.h:377
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
ConstAdjacentEdgeIterator adjEdgeEnd() const
Returns a const iterator to the end of the container of this component.
Definition adjacent_edges.h:523
void resizeAdjEdges(uint n)
Resize the container of the adjacent edges to the given size.
Definition adjacent_edges.h:422
void setAdjEdge(uint i, uint ei)
Sets the i-th adjacent edge of the element.
Definition adjacent_edges.h:247
Edge * adjEdge(uint i)
Returns the pointer to the i-th adjacent edge of the element.
Definition adjacent_edges.h:161
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:312
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 pushAdjEdge(uint ei)
Pushes in the back of the container the given adjacent edge.
Definition adjacent_edges.h:440
void setAdjEdge(ConstAdjacentEdgeIterator it, uint ei)
Sets the adjacent edge pointed by the iterator.
Definition adjacent_edges.h:266
void pushAdjEdge(Edge *e)
Pushes in the back of the container the given adjacent edge.
Definition adjacent_edges.h:431
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:580
void eraseAdjEdge(uint i)
Removes the adjacent edge at the given position from the container.
Definition adjacent_edges.h:479
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:466
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:230
ConstAdjacentEdgeIndexIterator adjEdgeIndexBegin() const
Returns an iterator to the first adjacent edge index in the container of this component.
Definition adjacent_edges.h:531
void setAdjEdge(ConstAdjacentEdgeIndexIterator it, uint ei)
Sets the adjacent edge pointed by the iterator.
Definition adjacent_edges.h:288
A concept that checks whether a type T (that should be a Element) has the AdjacentEdges component (in...
Definition adjacent_edges.h:667
A concept that checks whether a type T (that should be a Element) has the AdjacentEdges component (in...
Definition adjacent_edges.h:681
HasRightNumberOfAdjacentEdges concept.
Definition adjacent_edges.h:697
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:714