23#ifndef VCL_MESH_COMPONENTS_ADJACENT_VERTICES_H
24#define VCL_MESH_COMPONENTS_ADJACENT_VERTICES_H
26#include "bases/reference_container_component.h"
28#include <vclib/concepts/mesh/components/adjacent_vertices.h>
29#include <vclib/types/view.h>
79 typename ParentElemType = void,
85 AdjacentVertices<STORE_INDICES, Vertex, ParentElemType, VERT, OPT>,
86 CompId::ADJACENT_VERTICES,
97 CompId::ADJACENT_VERTICES,
113 using AdjacentVertexIterator = Base::Iterator;
114 using ConstAdjacentVertexIterator = Base::ConstIterator;
115 using ConstAdjacentVertexIndexIterator = Base::ConstIndexIterator;
242 Base::setElement(
it, v);
254 Base::setElement(
it,
vi);
265 Base::setElement(
it, v);
277 Base::setElement(
it,
vi);
337 Base::setElements(
r);
354 Base::setElements(
r);
367 return Base::containsElement(v);
391 return Base::indexOfElement(v);
496 return Base::elementBegin();
507 return Base::elementEnd();
518 return Base::elementIndexBegin();
528 return Base::elementIndexEnd();
567 return Base::elements();
588 return Base::elementIndices();
593 void __adjacentVertices()
const {}
597 template<
typename Element>
602 if (isAdjacentVerticesAvailableOn(e)) {
606 importIndicesFrom(e);
612 void serialize(std::ostream& os)
const
623 void deserialize(std::istream& is)
626 vcl::deserialize(is, n);
631 vcl::deserialize(is, aei);
637 template<
typename Element>
638 void importIndicesFrom(
const Element& e)
640 for (uint i = 0; i < e.adjVerticesNumber(); ++i) {
661bool isAdjacentVerticesAvailableOn(
const ElementConcept
auto& element)
663 return isComponentAvailableOn<CompId::ADJACENT_VERTICES>(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 Vertex class represents an Vertex element of the vcl::Mesh class.
Definition vertex.h:47
The AdjacentVertices class is a container of Vertex indices or pointers. It is a component that makes...
Definition adjacent_vertices.h:93
void insertAdjVertex(uint i, Vertex *v)
Inserts the given adjacent vertex in the container at the given position.
Definition adjacent_vertices.h:441
void setAdjVertex(ConstAdjacentVertexIndexIterator it, Vertex *v)
Sets the adjacent vertex pointed by the iterator.
Definition adjacent_vertices.h:263
void clearAdjVertices()
Clears the container of adjacent vertices, making it empty.
Definition adjacent_vertices.h:469
void insertAdjVertex(uint i, uint vi)
Inserts the given adjacent vertex in the container at the given position.
Definition adjacent_vertices.h:452
uint adjVertexIndex(uint i) const
Returns the index in the vertex container of the i-th adjacent vertex of the element.
Definition adjacent_vertices.h:158
ConstAdjacentVertexIterator adjVertexBegin() const
Returns a const iterator to the first adjacent vertex in the container of this component.
Definition adjacent_vertices.h:494
void eraseAdjVertex(uint i)
Removes the adjacent vertex at the given position from the container.
Definition adjacent_vertices.h:462
void resizeAdjVertices(uint n)
Resize the container of the adjacent vertices to the given size.
Definition adjacent_vertices.h:411
uint adjVertexIndexMod(int i) const
Returns the index in the vertex container of the i-th adjacent vertex of the element,...
Definition adjacent_vertices.h:215
View< ConstAdjacentVertexIndexIterator > adjVertexIndices() const
Returns a lightweight view object that stores the begin and end iterators of the container of adjacen...
Definition adjacent_vertices.h:586
void setAdjVertex(uint i, Vertex *v)
Sets the i-th adjacent vertex of the element.
Definition adjacent_vertices.h:223
AdjacentVertexIterator adjVertexEnd()
Returns an iterator to the end of the container of this component.
Definition adjacent_vertices.h:486
ConstAdjacentVertexIterator adjVertexEnd() const
Returns a const iterator to the end of the container of this component.
Definition adjacent_vertices.h:505
void setAdjVertex(ConstAdjacentVertexIndexIterator it, uint vi)
Sets the adjacent vertex pointed by the iterator.
Definition adjacent_vertices.h:275
void setAdjVertexMod(int i, uint vi)
Sets the i-th adjacent vertex of the element, but using as index the module between i and the number ...
Definition adjacent_vertices.h:321
void setAdjVertex(uint i, uint vi)
Sets the i-th adjacent vertex of the element.
Definition adjacent_vertices.h:232
void pushAdjVertex(Vertex *v)
Pushes in the back of the container the given adjacent vertex.
Definition adjacent_vertices.h:420
Vertex * adjVertex(uint i)
Returns the pointer to the i-th adjacent vertex of an element.
Definition adjacent_vertices.h:141
uint indexOfAdjVertex(const Vertex *v) const
Returns the index of the given adjacent vertex in the container of the element. If the given adjacent...
Definition adjacent_vertices.h:389
bool containsAdjVertex(uint vi) const
Returns true if the container of adjacent vertices contains the given vertex, false otherwise.
Definition adjacent_vertices.h:378
uint indexOfAdjVertex(uint vi) const
Returns the index of the adjacent vertex with the given index in the container of the element....
Definition adjacent_vertices.h:403
void setAdjVertexMod(int i, Vertex *v)
Sets the i-th adjacent vertex of the element, but using as index the module between i and the number ...
Definition adjacent_vertices.h:299
void setAdjVertex(ConstAdjacentVertexIterator it, Vertex *v)
Sets the adjacent vertex pointed by the iterator.
Definition adjacent_vertices.h:240
void setAdjVertices(Rng &&r)
Sets all the adjacent vertices of this element.
Definition adjacent_vertices.h:352
uint adjVerticesNumber() const
Returns the number of adjacent vertices of the element.
Definition adjacent_vertices.h:132
const Vertex * adjVertex(uint i) const
Returns a const pointer to the i-th adjacent vertex of the element.
Definition adjacent_vertices.h:150
ConstAdjacentVertexIndexIterator adjVertexIndexEnd() const
Returns an iterator to the end of the container of this component.
Definition adjacent_vertices.h:526
Vertex * adjVertexMod(int i)
Returns the pointer to the i-th adjacent vertex of the element, but using as index the module between...
Definition adjacent_vertices.h:180
void setAdjVertices(Rng &&r)
Sets all the adjacent vertices of this element.
Definition adjacent_vertices.h:335
void setAdjVertex(ConstAdjacentVertexIterator it, uint vi)
Sets the adjacent vertex pointed by the iterator.
Definition adjacent_vertices.h:252
AdjacentVertices()=default
Empty constructor.
void pushAdjVertex(uint vi)
Pushes in the back of the container the given adjacent vertex..
Definition adjacent_vertices.h:429
ConstAdjacentVertexIndexIterator adjVertexIndexBegin() const
Returns an iterator to the first adjacent vertex index in the container of this component.
Definition adjacent_vertices.h:516
View< AdjacentVertexIterator > adjVertices()
Returns a lightweight view object that stores the begin and end iterators of the container of adjacen...
Definition adjacent_vertices.h:547
const Vertex * adjVertexMod(int i) const
Same of adjVertexMod, but returns a const Pointer to the adjacent vertex.
Definition adjacent_vertices.h:190
View< ConstAdjacentVertexIterator > adjVertices() const
Returns a lightweight const view object that stores the begin and end iterators of the container of a...
Definition adjacent_vertices.h:565
AdjacentVertexIterator adjVertexBegin()
Returns an iterator to the first adjacent vertex in the container of this component.
Definition adjacent_vertices.h:479
bool containsAdjVertex(const Vertex *v) const
Returns true if the container of adjacent vertices contains the given vertex, false otherwise.
Definition adjacent_vertices.h:365
The ReferenceContainerComponent is a class that inherits from the IndexContainerComponent or PointerC...
Definition reference_container_component.h:99