Visual Computing Library
|
The AdjacentFaces class is a container of Face indices or pointers. It could be used by any Element to save adjacencies information (also the Face element itself). More...
#include <vclib/mesh/components/adjacent_faces.h>
Public Types | |
using | AdjacentFaceType = Face |
Expose the type of the Adjacent Face. | |
using | AdjacentFaceIterator = Base::Iterator |
using | ConstAdjacentFaceIterator = Base::ConstIterator |
using | ConstAdjacentFaceIndexIterator = Base::ConstIndexIterator |
Public Member Functions | |
AdjacentFaces ()=default | |
Empty constructor. | |
uint | adjFacesNumber () const |
Returns the number of adjacent faces of this element. | |
Face * | adjFace (uint i) |
Returns the pointer to the i-th adjacent face of this element. | |
const Face * | adjFace (uint i) const |
Returns a const pointer to the i-th adjacent face of this element. | |
uint | adjFaceIndex (uint i) const |
Returns the index in the face container of the i-th adjacent face of the element. | |
Face * | adjFaceMod (int i) |
Returns the pointer to the i-th adjacent face of this element but using as index the module between i and the number of adjacent faces. | |
const Face * | adjFaceMod (int i) const |
Same of adjFaceMod, but returns a const Pointer to the adjacent face. | |
uint | adjFaceIndexMod (int i) const |
Returns the index in the face container of the i-th adjacent face of the element, but using as index the module between i and the number of adjacent faces. You can use this function if you need to get the "index
of the adjacent face next to position k", without check if it is less than the number of adjacent faces. Works also for negative numbers: | |
void | setAdjFace (uint i, Face *f) |
Sets the i-th adjacent face of this element. | |
void | setAdjFace (uint i, uint fi) |
Sets the i-th adjacent face of the element. | |
void | setAdjFace (ConstAdjacentFaceIterator it, Face *f) |
Sets the adjacent face pointed by the iterator. | |
void | setAdjFace (ConstAdjacentFaceIterator it, uint fi) |
Sets the adjacent face pointed by the iterator. | |
void | setAdjFace (ConstAdjacentFaceIndexIterator it, Face *f) |
Sets the adjacent face pointed by the iterator. | |
void | setAdjFace (ConstAdjacentFaceIndexIterator it, uint fi) |
Sets the adjacent face pointed by the iterator. | |
void | setAdjFaceMod (int i, Face *f) |
Sets the i-th adjacent face of the element, but using as index the module between i and the number of adjacent faces. You can use this function if you need to set the "next adjacent face after position k", without check if it is less than the number of adjacent faces. Works also for negative numbers: | |
void | setAdjFaceMod (int i, uint fi) |
Sets the i-th adjacent face of the element, but using as index the module between i and the number of adjacent faces. You can use this function if you need to set the "next adjacent face after position k", without check if it is less than the number of adjacent faces. Works also for negative numbers: | |
template<Range Rng> requires InputRange<Rng, Face*> | |
void | setAdjFaces (Rng &&r) |
Sets all the adjacent faces of this element. | |
template<Range Rng> requires InputRange<Rng, uint> | |
void | setAdjFaces (Rng &&r) |
Sets all the adjacent faces of this element. | |
bool | containsAdjFace (const Face *f) const |
Returns true if the container of adjacent faces contains the given face, false otherwise. | |
bool | containsAdjFace (uint fi) const |
Returns true if the container of adjacent faces contains the face with the given index, false otherwise. | |
uint | indexOfAdjFace (const Face *f) const |
Returns the index of the given adjacent face in the container of this element. If the given adjacent face is not in the container, returns UINT_NULL. | |
uint | indexOfAdjFace (uint fi) const |
Returns the index of the adjacent face with the given index in the container of this element. If the adjacent face with the given index is not in the container, returns UINT_NULL. | |
void | resizeAdjFaces (uint n) |
Resize the container of the adjacent faces to the given size. | |
void | pushAdjFace (Face *f) |
Pushes in the back of the container the given adjacent face. | |
void | pushAdjFace (uint fi) |
Pushes in the back of the container the given adjacent face. | |
void | insertAdjFace (uint i, Face *f) |
Inserts the given adjacent face in the container at the given position. | |
void | insertAdjFace (uint i, uint fi) |
Inserts the adjacent face with the given index in the container at the given position. | |
void | eraseAdjFace (uint i) |
Removes the adjacent face at the given position from the container. | |
void | clearAdjFaces () |
Clears the container of adjacent faces, making it empty. | |
AdjacentFaceIterator | adjFaceBegin () |
Returns an iterator to the first adjacent face in the container of this component. | |
AdjacentFaceIterator | adjFaceEnd () |
Returns an iterator to the end of the container of this component. | |
ConstAdjacentFaceIterator | adjFaceBegin () const |
Returns a const iterator to the first adjacent face in the container of this component. | |
ConstAdjacentFaceIterator | adjFaceEnd () const |
Returns a const iterator to the end of the container of this component. | |
ConstAdjacentFaceIndexIterator | adjFaceIndexBegin () const |
Returns an iterator to the first adjacent face index in the container of this component. | |
ConstAdjacentFaceIndexIterator | adjFaceIndexEnd () const |
Returns an iterator to the end of the container of this component. | |
View< AdjacentFaceIterator > | adjFaces () |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent faces 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< ConstAdjacentFaceIterator > | adjFaces () const |
Returns a lightweight const view object that stores the begin and end iterators of the container of adjacent faces 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< ConstAdjacentFaceIndexIterator > | adjFaceIndices () const |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent face 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: | |
void | __adjacentFaces () const |
Static Public Attributes | |
static const int | ADJ_FACE_NUMBER = Base::SIZE |
Static size of the container. If the container is dynamic, this value will be negative and you should use the adjFacesNumber() member function. | |
Protected Member Functions | |
template<typename Element > | |
void | importFrom (const Element &e, bool importRefs=true) |
void | serialize (std::ostream &os) const |
void | deserialize (std::istream &is) |
![]() | |
uint | size () const |
Elem * | element (uint i) |
const Elem * | element (uint i) const |
uint | elementIndex (uint i) const |
Elem * | elementMod (int i) |
const Elem * | elementMod (int i) const |
uint | elementIndexMod (int i) const |
void | setElement (uint i, Elem *e) |
void | setElement (uint i, uint ei) |
void | setElement (Base::ConstIterator it, Elem *v) |
void | setElement (Base::ConstIterator it, uint vi) |
void | setElement (Base::ConstIndexIterator it, Elem *v) |
void | setElement (Base::ConstIndexIterator it, uint vi) |
void | setElementMod (int i, Elem *e) |
void | setElementMod (int i, uint ei) |
template<Range Rng> requires InputRange<Rng, Elem*> | |
void | setElements (Rng &&r) |
template<Range Rng> requires InputRange<Rng, uint> | |
void | setElements (Rng &&r) |
bool | containsElement (const Elem *e) const |
bool | containsElement (uint ei) const |
uint | indexOfElement (const Elem *e) const |
uint | indexOfElement (uint ei) const |
Base::Iterator | elementBegin () |
Base::Iterator | elementEnd () |
Base::ConstIterator | elementBegin () const |
Base::ConstIterator | elementEnd () const |
Base::ConstIndexIterator | elementIndexBegin () const |
Base::ConstIndexIterator | elementIndexEnd () const |
View< typename Base::Iterator > | elements () |
View< typename Base::ConstIterator > | elements () const |
View< typename Base::ConstIndexIterator > | elementIndices () const |
void | resize (uint n) |
void | pushBack (Elem *e=nullptr) |
void | pushBack (uint ei) |
void | insert (uint i, Elem *e=nullptr) |
void | insert (uint i, uint ei) |
void | erase (uint i) |
void | clear () |
uint | indexFromPointer (const Elem *v) const |
Elem * | elemFromParent (uint vi) |
const Elem * | elemFromParent (uint vi) const |
Private Types | |
using | Base = ReferenceContainerComponent< STORE_INDICES, AdjacentFaces< STORE_INDICES, Face, N, TTVN, ParentElemType, VERT, OPT >, CompId::ADJACENT_FACES, Face, N, ParentElemType, VERT, OPT, TTVN > |
Private Member Functions | |
template<typename Element > | |
void | importIndicesFrom (const Element &e) |
Additional Inherited Members | |
![]() | |
using | Base = std::conditional_t< STORE_INDICES, IndexContainerComponent< DerivedComponent, COMP_ID, Elem, N, ParentElemType, VERT, OPT, TTVN >, PointerContainerComponent< DerivedComponent, COMP_ID, Elem, N, ParentElemType, VERT, OPT, TTVN > > |
The AdjacentFaces class is a container of Face indices or pointers. It could be used by any Element to save adjacencies information (also the Face element itself).
It is a random access container having static or dynamic size, depending on the value of 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 AdjacentFaces 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 Face. |
Face | The type of the adjacent Face element. |
N | The size of the container, that will represent the number of storable adjacent faces. 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 Faces container size is static, initializes all the Adjacent Faces to nullptr
, otherwise the container will be empty.
|
inline |
Returns the pointer to the i-th adjacent face of this element.
[in] | i | the position of the required adjacent face in this container; the value must be between 0 and the number of adj faces. |
|
inline |
Returns a const pointer to the i-th adjacent face of this element.
[in] | i | the position of the required adjacent face in this container; the value must be between 0 and the number of adj faces. |
|
inline |
Returns an iterator to the first adjacent face in the container of this component.
|
inline |
Returns a const iterator to the first adjacent face 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 face container of the i-th adjacent face of the element.
[in] | i | the position of the required face in this container. |
|
inline |
Returns an iterator to the first adjacent face 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 face container of the i-th adjacent face of the element, but using as index the module between i and the number of adjacent faces. You can use this function if you need to get the "index of the adjacent face next to position k", without check if it is less than the number of adjacent faces. Works also for negative numbers:
[in] | i | the position of the required adjacent face in this container, w.r.t. the position 0; value is modularized on adjFacesNumber(). |
|
inline |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent face 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 face of this element but using as index the module between i and the number of adjacent faces.
You can use this function if you need to get the "next adjacent face after position k", without check if it is less than the number of adj faces. Works also for negative numbers:
[in] | i | the position of the required adjacent face in this container, w.r.t. the position 0; value is modularized on adjFacesNumber(). |
|
inline |
Same of adjFaceMod, but returns a const Pointer to the adjacent face.
[in] | i | the position of the required adjacent face in this container, w.r.t. the position 0; value is modularized on adjFacesNumber(). |
|
inline |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent faces 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 faces 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 faces of this element.
|
inline |
Clears the container of adjacent faces, making it empty.
|
inline |
Returns true
if the container of adjacent faces contains the given face, false
otherwise.
[in] | f | the pointer to the face to search. |
true
if the container of adjacent faces contains the given face, false
otherwise.
|
inline |
Returns true
if the container of adjacent faces contains the face with the given index, false
otherwise.
[in] | fi | the index of the face to search. |
true
if the container of adjacent faces contains the face with the given index, false
otherwise.
|
inline |
Removes the adjacent face at the given position from the container.
[in] | i | The position of the adjacent face to remove from this container. |
|
inline |
Returns the index of the given adjacent face in the container of this element. If the given adjacent face is not in the container, returns UINT_NULL.
[in] | f | the pointer to the adjacent face to search. |
|
inline |
Returns the index of the adjacent face with the given index in the container of this element. If the adjacent face with the given index is not in the container, returns UINT_NULL.
[in] | fi | the index of the adjacent face to search. |
|
inline |
Inserts the given adjacent face in the container at the given position.
[in] | i | The position in this container where to insert the adjacent face. |
[in] | f | The pointer to the adjacent face to insert in the container. |
|
inline |
Inserts the adjacent face with the given index in the container at the given position.
[in] | i | The position in this container where to insert the adjacent face. |
[in] | fi | The index to the adjacent face to insert in the container. |
|
inline |
Pushes in the back of the container the given adjacent face.
[in] | f | The pointer to the adjacent face to push in the back of the container. |
|
inline |
Pushes in the back of the container the given adjacent face.
[in] | fi | The index to the adjacent face to push in the back of the container. |
|
inline |
Resize the container of the adjacent faces to the given size.
[in] | n | The new size of the adjacent faces container. |
|
inline |
Sets the adjacent face pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent face; the value must be between begin() and end(). |
[in] | f | The pointer to the adjacent face to set to the element. |
|
inline |
Sets the adjacent face pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent face; the value must be between begin() and end(). |
[in] | fi | The index in the face container of the face to set. |
|
inline |
Sets the adjacent face pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent face; the value must be between begin() and end(). |
[in] | f | The pointer to the adjacent face to set to the element. |
|
inline |
Sets the adjacent face pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent face; the value must be between begin() and end(). |
[in] | fi | The index in the face container of the face to set. |
|
inline |
Sets the i-th adjacent face of this element.
[in] | i | the position in this container on which set the adj face; the value must be between 0 and the number of adj faces. |
[in] | f | The pointer to the adjacent face to set to this element. |
|
inline |
Sets the i-th adjacent face of the element.
[in] | i | the position in this container on which set the adj face; the value must be between 0 and the number of adj faces. |
[in] | fi | The index in the face container of the face to set. |
|
inline |
Sets the i-th adjacent face of the element, but using as index the module between i and the number of adjacent faces. You can use this function if you need to set the "next adjacent face after position k", without check if it is less than the number of adjacent faces. Works also for negative numbers:
[in] | i | the position in this container w.r.t. the position 0 on which set the adj face; value is modularized on adjFacesNumber(). |
[in] | f | The pointer to the adj face to set to the element. |
|
inline |
Sets the i-th adjacent face of the element, but using as index the module between i and the number of adjacent faces. You can use this function if you need to set the "next adjacent face after position k", without check if it is less than the number of adjacent faces. Works also for negative numbers:
[in] | i | the position in this container w.r.t. the position 0 on which set the adj face; value is modularized on adjFacesNumber(). |
[in] | fi | The index in the face containrt of the face to set. |
|
inline |
Sets all the adjacent faces of this 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 faces to set. The value type of the range must be convertible to a pointer to an AdjacentFace. |
[in] | r | range of face pointers to set. |
|
inline |
Sets all the adjacent faces of this 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 faces to set. The value type of the range must be convertible to an unsigned integer. |
[in] | r | range of face indices to set. |