23#ifndef VCL_MESH_COMPONENTS_ADJACENT_FACES_H
24#define VCL_MESH_COMPONENTS_ADJACENT_FACES_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_FACES,
106 using Base = ReferenceContainerComponent<
109 CompId::ADJACENT_FACES,
125 using AdjacentFaceIterator = Base::Iterator;
126 using ConstAdjacentFaceIterator = Base::ConstIterator;
255 Base::setElement(
it, f);
266 Base::setElement(
it,
fi);
277 Base::setElement(
it, f);
288 Base::setElement(
it,
fi);
580 return Base::elements();
606 void __adjacentFaces()
const {}
610 template<
typename Element>
613 void serialize(std::ostream&
os)
const
617 if constexpr (N < 0) {
625 void deserialize(std::istream& is)
627 if constexpr (N < 0) {
629 vcl::deserialize(is, n);
634 vcl::deserialize(is, afi);
640 template<
typename Element>
641 void importIndicesFrom(
const Element& e)
643 for (uint i = 0; i < e.adjFaceCount(); ++i) {
670 BTIBTBB::IsDerivedFromSpecializationOfV<T, AdjacentFaces>;
701 RemoveRef<T>::VERTEX_COUNT == RemoveRef<T>::ADJ_FACE_COUNT;
726 typename ParentElemType,
729template<
typename Element>
730void AdjacentFaces<STORE_INDICES, Face, N, TTVC, ParentElemType, VERT, OPT>::
731 importFrom(
const Element& e,
bool importRefs)
735 if (isAdjacentFacesAvailableOn(e)) {
736 if constexpr (N > 0) {
738 if constexpr (N == Element::ADJ_FACE_COUNT) {
739 importIndicesFrom(e);
742 else if constexpr (Element::ADJ_FACE_COUNT < 0) {
743 if (e.adjFaceCount() == N) {
744 importIndicesFrom(e);
755 Base::resize(e.adjFaceCount());
756 importIndicesFrom(e);
775bool isAdjacentFacesAvailableOn(
const auto& element)
The Element class.
Definition element.h:75
The Face class represents an Face element of the vcl::Mesh class.
Definition face.h:48
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 AdjacentFaces class is a container of Face indices or pointers. It could be used by any Element t...
Definition adjacent_faces.h:105
void setAdjFaces(Rng &&r)
Sets all the adjacent faces of this element.
Definition adjacent_faces.h:362
void resizeAdjFaces(uint n)
Resize the container of the adjacent faces to the given size.
Definition adjacent_faces.h:420
void setAdjFace(ConstAdjacentFaceIndexIterator it, uint fi)
Sets the adjacent face pointed by the iterator.
Definition adjacent_faces.h:286
void eraseAdjFace(uint i)
Removes the adjacent face at the given position from the container.
Definition adjacent_faces.h:477
Face * adjFace(uint i)
Returns the pointer to the i-th adjacent face of this element.
Definition adjacent_faces.h:161
bool containsAdjFace(uint fi) const
Returns true if the container of adjacent faces contains the face with the given index,...
Definition adjacent_faces.h:388
Face * adjFaceMod(int i)
Returns the pointer to the i-th adjacent face of this element but using as index the module between i...
Definition adjacent_faces.h:199
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...
Definition adjacent_faces.h:331
void clearAdjFaces()
Clears the container of adjacent faces, making it empty.
Definition adjacent_faces.h:484
View< AdjacentFaceIterator > adjFaces()
Returns a lightweight view object that stores the begin and end iterators of the container of adjacen...
Definition adjacent_faces.h:560
void setAdjFaces(Rng &&r)
Sets all the adjacent faces of this element.
Definition adjacent_faces.h:345
AdjacentFaceIterator adjFaceEnd()
Returns an iterator to the end of the container of this component.
Definition adjacent_faces.h:502
bool containsAdjFace(const Face *f) const
Returns true if the container of adjacent faces contains the given face, false otherwise.
Definition adjacent_faces.h:375
View< ConstAdjacentFaceIndexIterator > adjFaceIndices() const
Returns a lightweight view object that stores the begin and end iterators of the container of adjacen...
Definition adjacent_faces.h:599
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...
Definition adjacent_faces.h:310
uint adjFaceCount() const
Returns the number of adjacent faces of this element.
Definition adjacent_faces.h:152
const Face * adjFace(uint i) const
Returns a const pointer to the i-th adjacent face of this element.
Definition adjacent_faces.h:169
void pushAdjFace(uint fi)
Pushes in the back of the container the given adjacent face.
Definition adjacent_faces.h:438
void setAdjFace(ConstAdjacentFaceIterator it, Face *f)
Sets the adjacent face pointed by the iterator.
Definition adjacent_faces.h:253
ConstAdjacentFaceIterator adjFaceEnd() const
Returns a const iterator to the end of the container of this component.
Definition adjacent_faces.h:521
static const int ADJ_FACE_COUNT
Static size of the container. If the container is dynamic, this value will be negative and you should...
Definition adjacent_faces.h:134
const Face * adjFaceMod(int i) const
Same of adjFaceMod, but returns a const Pointer to the adjacent face.
Definition adjacent_faces.h:208
uint indexOfAdjFace(const Face *f) const
Returns the index of the given adjacent face in the container of this element. If the given adjacent ...
Definition adjacent_faces.h:399
void setAdjFace(uint i, uint fi)
Sets the i-th adjacent face of the element.
Definition adjacent_faces.h:245
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 ...
Definition adjacent_faces.h:229
ConstAdjacentFaceIndexIterator adjFaceIndexEnd() const
Returns an iterator to the end of the container of this component.
Definition adjacent_faces.h:539
void setAdjFace(ConstAdjacentFaceIterator it, uint fi)
Sets the adjacent face pointed by the iterator.
Definition adjacent_faces.h:264
void insertAdjFace(uint i, uint fi)
Inserts the adjacent face with the given index in the container at the given position.
Definition adjacent_faces.h:464
ConstAdjacentFaceIndexIterator adjFaceIndexBegin() const
Returns an iterator to the first adjacent face index in the container of this component.
Definition adjacent_faces.h:529
void setAdjFace(ConstAdjacentFaceIndexIterator it, Face *f)
Sets the adjacent face pointed by the iterator.
Definition adjacent_faces.h:275
AdjacentFaces()=default
Empty constructor.
uint adjFaceIndex(uint i) const
Returns the index in the face container of the i-th adjacent face of the element.
Definition adjacent_faces.h:177
AdjacentFaceIterator adjFaceBegin()
Returns an iterator to the first adjacent face in the container of this component.
Definition adjacent_faces.h:494
ConstAdjacentFaceIterator adjFaceBegin() const
Returns a const iterator to the first adjacent face in the container of this component.
Definition adjacent_faces.h:510
void pushAdjFace(Face *f)
Pushes in the back of the container the given adjacent face.
Definition adjacent_faces.h:429
uint indexOfAdjFace(uint fi) const
Returns the index of the adjacent face with the given index in the container of this element....
Definition adjacent_faces.h:410
void setAdjFace(uint i, Face *f)
Sets the i-th adjacent face of this element.
Definition adjacent_faces.h:237
void insertAdjFace(uint i, Face *f)
Inserts the given adjacent face in the container at the given position.
Definition adjacent_faces.h:450
View< ConstAdjacentFaceIterator > adjFaces() const
Returns a lightweight const view object that stores the begin and end iterators of the container of a...
Definition adjacent_faces.h:578
A concept that checks whether a type T (that should be a Element) has the AdjacentFaces component (in...
Definition adjacent_faces.h:669
A concept that checks whether a type T (that should be a Element) has the AdjacentFaces component (in...
Definition adjacent_faces.h:683
HasRightNumberOfAdjacentFaces concept.
Definition adjacent_faces.h:699
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
SanityCheckAdjacentFaces concept.
Definition adjacent_faces.h:716