Visual Computing Library
devel
|
The AdjacentEdges class is a container of Edge indices or pointers. It could be used by any Element to save adjacencies information (also the Edge element itself). More...
#include <vclib/mesh/components/adjacent_edges.h>
Public Types | |
using | AdjacentEdgeIterator = Base::Iterator |
using | AdjacentEdgeType = Edge |
Expose the type of the Adjacent Edge. | |
using | ConstAdjacentEdgeIndexIterator = Base::ConstIndexIterator |
using | ConstAdjacentEdgeIterator = Base::ConstIterator |
Public Member Functions | |
AdjacentEdges ()=default | |
Empty constructor. | |
Edge * | adjEdge (uint i) |
Returns the pointer to the i-th adjacent edge of the element. | |
const Edge * | adjEdge (uint i) const |
Returns a const pointer to the i-th adjacent edge of the element. | |
AdjacentEdgeIterator | adjEdgeBegin () |
Returns an iterator to the first adjacent edge in the container of this component. | |
ConstAdjacentEdgeIterator | adjEdgeBegin () const |
Returns a const iterator to the first adjacent edge in the container of this component. | |
AdjacentEdgeIterator | adjEdgeEnd () |
Returns an iterator to the end of the container of this component. | |
ConstAdjacentEdgeIterator | adjEdgeEnd () const |
Returns a const iterator to the end of the container of this component. | |
uint | adjEdgeIndex (uint i) const |
Returns the index in the edge container of the i-th adjacent edge of the element. | |
ConstAdjacentEdgeIndexIterator | adjEdgeIndexBegin () const |
Returns an iterator to the first adjacent edge index in the container of this component. | |
ConstAdjacentEdgeIndexIterator | adjEdgeIndexEnd () const |
Returns an iterator to the end of the container of this component. | |
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 the module between i and the number of adjacent edges. You can use this function if you need to get the "index
of the adjacent edge next to position k", without check if it is less than the number of adjacent edges. Works also for negative numbers: | |
View< ConstAdjacentEdgeIndexIterator > | adjEdgeIndices () const |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent edge indices of the element. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops: | |
Edge * | adjEdgeMod (int i) |
Returns the pointer to the i-th adjacent edge of the element but using as index the module between i and the number of adjacent edges. You can use this function if you need to get the "next adjacent edge after
position k", without check if it is less than the number of adj edges. Works also for negative numbers: | |
const Edge * | adjEdgeMod (int i) const |
Same of adjEdgeMod, but returns a const Pointer to the adjacent edge. | |
View< AdjacentEdgeIterator > | adjEdges () |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent edges of the element. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops: | |
View< ConstAdjacentEdgeIterator > | adjEdges () const |
Returns a lightweight const view object that stores the begin and end iterators of the container of adjacent edges of the element. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops: | |
uint | adjEdgesNumber () const |
Returns the number of adjacent edges of this element. | |
void | clearAdjEdges () |
Clears the container of adjacent edges, making it empty. | |
bool | containsAdjEdge (const Edge *e) const |
Returns true if the container of adjacent edges contains the given edge, false otherwise. | |
bool | containsAdjEdge (uint ei) const |
Returns true if the container of adjacent edges contains the given index, false otherwise. | |
void | eraseAdjEdge (uint i) |
Removes the adjacent edge at the given position from the container. | |
uint | indexOfAdjEdge (const Edge *e) const |
Returns the index of the given adjacent edge in the container of the element. If the given adjacent edge is not in the container, returns UINT_NULL. | |
uint | indexOfAdjEdge (uint ei) const |
Returns the index of the adjacent edge with the given index in the container of the element. If the adjacent edge with the given index is not in the container, returns UINT_NULL. | |
void | insertAdjEdge (uint i, Edge *e) |
Inserts the given adjacent edge in the container at the given position. | |
void | insertAdjEdge (uint i, uint ei) |
Inserts the adjacent edge with the given index in the container at the given position. | |
void | pushAdjEdge (Edge *e) |
Pushes in the back of the container the given adjacent edge. | |
void | pushAdjEdge (uint ei) |
Pushes in the back of the container the given adjacent edge. | |
void | resizeAdjEdges (uint n) |
Resize the container of the adjacent edges to the given size. | |
void | setAdjEdge (ConstAdjacentEdgeIndexIterator it, Edge *e) |
Sets the adjacent edge pointed by the iterator. | |
void | setAdjEdge (ConstAdjacentEdgeIndexIterator it, uint ei) |
Sets the adjacent edge pointed by the iterator. | |
void | setAdjEdge (ConstAdjacentEdgeIterator it, Edge *e) |
Sets the adjacent edge pointed by the iterator. | |
void | setAdjEdge (ConstAdjacentEdgeIterator it, uint ei) |
Sets the adjacent edge pointed by the iterator. | |
void | setAdjEdge (uint i, Edge *e) |
Sets the i-th adjacent edge of the element. | |
void | setAdjEdge (uint i, uint ei) |
Sets the i-th adjacent edge of the element. | |
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 adjacent edges. You can use this function if you need to set the "next adjacent edge after position k", without check if it is less than the number of adjacent edges. Works also for negative numbers: | |
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 adjacent edges. You can use this function if you need to set the "next adjacent edge after position k", without check if it is less than the number of adjacent edges. Works also for negative numbers: | |
template<Range Rng> requires InputRange<Rng, Edge*> | |
void | setAdjEdges (Rng &&r) |
Sets all the adjacent edges of the element. | |
template<Range Rng> requires InputRange<Rng, uint> | |
void | setAdjEdges (Rng &&r) |
Sets all the adjacent edges of the element. | |
Static Public Attributes | |
static const int | ADJ_EDGE_NUMBER = Base::SIZE |
Static size of the container. If the container is dynamic, this value will be negative and you should use the adjEdgesNumber() member function. | |
Protected Member Functions | |
void | deserialize (std::istream &is) |
template<typename Element > | |
void | importFrom (const Element &e, bool importRefs=true) |
void | serialize (std::ostream &os) const |
Private Types | |
using | Base = ReferenceContainerComponent< STORE_INDICES, AdjacentEdges< STORE_INDICES, Edge, N, TTVN, ParentElemType, VERT, OPT >, CompId::ADJACENT_EDGES, Edge, N, ParentElemType, VERT, OPT, TTVN > |
Private Member Functions | |
template<typename Element > | |
void | importIndicesFrom (const Element &e) |
The AdjacentEdges class is a container of Edge indices or pointers. It could be used by any Element to save adjacencies information (also the Edge element itself).
It is a random access container having static or dynamic size, depending on the value of the template argument N (a negative number means dynamic).
The member functions of this class will be available in the instance of any Element that will contain this component.
For example, if you have a Vertex Element v
that has the AdjacentEdges component, you'll be able to access to this component member functions from v
:
TTVN
template value on the specialization of your component to check if it is tied to the Vertex Number. For further details check the documentation of the ContainerComponent class.STORE_INDICES | If true, the component will store indices, otherwise pointers to Edge. |
Edge | The type of the adjacent Edge element. |
N | The size of the container, that will represent the number of storable adjacent edges. If negative, the container is dynamic. |
TTVN | If true, the size of the container will be tied to the Vertex Number of the component (this is used mostly on Face elements). |
ParentElemType | This type is used to get access to the Element that has the component (and, in case, to the Mesh that has the Element). If the component doesn't need to access the Element, this type can be void. Note: if the component is vertical (or optional), this type cannot be void. |
VERT | If true, the component will be stored vertically. This argument is considered only if the ElementType is not void. |
OPT | If true, the component will be optional. This argument is considered only if the component is stored vertically. |
|
default |
Empty constructor.
If the Adjacent Edges container size is static, initializes all the Adjacent Edges to nullptr
, otherwise the container will be empty.
|
inline |
Returns the pointer to the i-th adjacent edge of the element.
[in] | i | the position of the required adjacent edge in this container; the value must be between 0 and the number of adj edges. |
|
inline |
Returns a const pointer to the i-th adjacent edge of the element.
[in] | i | the position of the required adjacent edge in this container; the value must be between 0 and the number of adj edges. |
|
inline |
Returns an iterator to the first adjacent edge in the container of this component.
|
inline |
Returns a const iterator to the first adjacent edge in the container of this component.
|
inline |
Returns an iterator to the end of the container of this component.
|
inline |
Returns a const iterator to the end of the container of this component.
|
inline |
Returns the index in the edge container of the i-th adjacent edge of the element.
[in] | i | the position of the required edge in this container. |
|
inline |
Returns an iterator to the first adjacent edge index in the container of this component.
|
inline |
Returns an iterator to the end of the container of this component.
|
inline |
Returns the index in the edge container of the i-th adjacent edge of the element, but using as index the module between i and the number of adjacent edges. You can use this function if you need to get the "index of the adjacent edge next to position k", without check if it is less than the number of adjacent edges. Works also for negative numbers:
[in] | i | the position of the required adjacent edge in this container, w.r.t. the position 0; value is modularized on adjEdgesNumber(). |
|
inline |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent edge indices of the element. The view object exposes the iterators trough the begin()
and end()
member functions, and therefore the returned object can be used in range-based for loops:
|
inline |
Returns the pointer to the i-th adjacent edge of the element but using as index the module between i and the number of adjacent edges. You can use this function if you need to get the "next adjacent edge after position k", without check if it is less than the number of adj edges. Works also for negative numbers:
[in] | i | the position of the required adjacent edge in this container, w.r.t. the position 0; value is modularized on adjEdgeNumber(). |
|
inline |
Same of adjEdgeMod, but returns a const Pointer to the adjacent edge.
[in] | i | the position of the required adjacent edge in this container, w.r.t. the position 0; value is modularized on adjEdgeNumber(). |
|
inline |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent edges of the element. The view object exposes the iterators trough the begin()
and end()
member functions, and therefore the returned object can be used in range-based for loops:
|
inline |
Returns a lightweight const view object that stores the begin and end iterators of the container of adjacent edges of the element. The view object exposes the iterators trough the begin()
and end()
member functions, and therefore the returned object can be used in range-based for loops:
|
inline |
Returns the number of adjacent edges of this element.
|
inline |
Clears the container of adjacent edges, making it empty.
|
inline |
Returns true
if the container of adjacent edges contains the given edge, false
otherwise.
[in] | e | the pointer to the edge to search. |
true
if the container of adjacent edges contains the given edge, false
otherwise.
|
inline |
Returns true
if the container of adjacent edges contains the given index, false
otherwise.
[in] | ei | the index to the edge to search. |
true
if the container of adjacent edges contains the given index, false
otherwise.
|
inline |
Removes the adjacent edge at the given position from the container.
[in] | i | The position of the adjacent edge to remove from this container. |
|
inline |
Returns the index of the given adjacent edge in the container of the element. If the given adjacent edge is not in the container, returns UINT_NULL.
[in] | e | the pointer to the adjacent edge to search. |
|
inline |
Returns the index of the adjacent edge with the given index in the container of the element. If the adjacent edge with the given index is not in the container, returns UINT_NULL.
[in] | ei | the index to the adjacent edge to search. |
|
inline |
Inserts the given adjacent edge in the container at the given position.
[in] | i | The position in this container where to insert the adjacent edge. |
[in] | e | The pointer to the adjacent edge to insert in the container. |
|
inline |
Inserts the adjacent edge with the given index in the container at the given position.
[in] | i | The position in this container where to insert the adjacent edge. |
[in] | ei | The index to the adjacent edge to insert in the container. |
|
inline |
Pushes in the back of the container the given adjacent edge.
[in] | e | The pointer to the adjacent edge to push in the back of the container. |
|
inline |
Pushes in the back of the container the given adjacent edge.
[in] | ei | The index to the adjacent edge to push in the back of the container. |
|
inline |
Resize the container of the adjacent edges to the given size.
[in] | n | The new size of the adjacent edges container. |
|
inline |
Sets the adjacent edge pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent edge; the value must be between begin() and end(). |
[in] | e | The pointer to the adjacent edge to set to the element. |
|
inline |
Sets the adjacent edge pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent edge; the value must be between begin() and end(). |
[in] | ei | The index in the edge container of the edge to set. |
|
inline |
Sets the adjacent edge pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent edge; the value must be between begin() and end(). |
[in] | e | The pointer to the adjacent edge to set to the element. |
|
inline |
Sets the adjacent edge pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent edge; the value must be between begin() and end(). |
[in] | ei | The index in the edge container of the edge to set. |
|
inline |
Sets the i-th adjacent edge of the element.
[in] | i | the position in this container on which set the adj edge; the value must be between 0 and the number of adj edges. |
[in] | e | The pointer to the adjacent edge to set to the element. |
|
inline |
Sets the i-th adjacent edge of the element.
[in] | i | the position in this container on which set the adj edge; the value must be between 0 and the number of adj edges. |
[in] | ei | The index in the edge container of the edge to set. |
|
inline |
Sets the i-th adjacent edge of the element, but using as index the module between i and the number of adjacent edges. You can use this function if you need to set the "next adjacent edge after position k", without check if it is less than the number of adjacent edges. Works also for negative numbers:
[in] | i | the position in this container w.r.t. the position 0 on which set the adj edge; value is modularized on adjEdgesNumber(). |
[in] | e | The pointer to the adj edge to set to the element. |
|
inline |
Sets the i-th adjacent edge of the element, but using as index the module between i and the number of adjacent edges. You can use this function if you need to set the "next adjacent edge after position k", without check if it is less than the number of adjacent edges. Works also for negative numbers:
[in] | i | the position in this container w.r.t. the position 0 on which set the adj edge; value is modularized on adjEdgesNumber(). |
[in] | ei | The index in the edge container of the edge to set. |
|
inline |
Sets all the adjacent edges of the element.
If the size of the container is static, the size of the input range must be the same one of the container.
Rng | The type of the range of adjacent edges to set. The value type of the range must be convertible to a pointer to an AdjacentEdge. |
[in] | r | range of edge pointers to set. |
|
inline |
Sets all the adjacent edges of the element.
If the size of the container is static, the size of the input range must be the same one of the container.
Rng | The type of the range of adjacent edges to set. The value type of the range must be convertible to an unsigned integer. |
[in] | r | range of edges indices to set. |