23#ifndef VCL_MESH_COMPONENTS_ADJACENT_VERTICES_H
24#define VCL_MESH_COMPONENTS_ADJACENT_VERTICES_H
26#include "base/predicates.h"
27#include "base/reference_container_component.h"
29#include <vclib/base.h>
79 typename ParentElemType = void,
83 public ReferenceContainerComponent<
85 AdjacentVertices<STORE_INDICES, Vertex, ParentElemType, VERT, OPT>,
86 CompId::ADJACENT_VERTICES,
94 using Base = ReferenceContainerComponent<
97 CompId::ADJACENT_VERTICES,
113 using AdjacentVertexIterator = Base::Iterator;
114 using ConstAdjacentVertexIterator = Base::ConstIterator;
242 Base::setElement(
it, v);
254 Base::setElement(
it,
vi);
265 Base::setElement(
it, v);
277 Base::setElement(
it,
vi);
567 return Base::elements();
593 void __adjacentVertices()
const {}
597 template<
typename Element>
600 void serialize(std::ostream&
os)
const
611 void deserialize(std::istream& is)
614 vcl::deserialize(is, n);
619 vcl::deserialize(is, aei);
625 template<
typename Element>
626 void importIndicesFrom(
const Element& e)
628 for (uint i = 0; i < e.adjVerticesNumber(); ++i) {
656 BTTBB::IsDerivedFromSpecializationOfV<T, AdjacentVertices>;
678 typename ParentElemType,
681template<
typename Element>
682void AdjacentVertices<STORE_INDICES, Vertex, ParentElemType, VERT, OPT>::
683 importFrom(
const Element& e,
bool importRefs)
687 if (isAdjacentVerticesAvailableOn(e)) {
690 resizeAdjVertices(e.adjVerticesNumber());
691 importIndicesFrom(e);
711bool isAdjacentVerticesAvailableOn(
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 Element class.
Definition element.h:75
The Vertex class represents an Vertex element of the vcl::Mesh class.
Definition vertex.h:46
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
A concept that checks whether a type T (that should be a Element) has the AdjacentVertices component ...
Definition adjacent_vertices.h:655
A concept that checks whether a type T (that should be a Element) has the AdjacentVertices component ...
Definition adjacent_vertices.h:669
Evaluates to true if the type T is a component that is stored vertically in its element container,...
Definition component.h:74