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;
258 Base::setElement(
it, f);
269 Base::setElement(
it,
fi);
280 Base::setElement(
it, f);
291 Base::setElement(
it,
fi);
583 return Base::elements();
609 void __adjacentFaces()
const {}
613 template<
typename Element>
616 void serialize(std::ostream&
os)
const
620 if constexpr (N < 0) {
628 void deserialize(std::istream& is)
630 if constexpr (N < 0) {
632 vcl::deserialize(is, n);
637 vcl::deserialize(is, afi);
643 template<
typename Element>
644 void importIndicesFrom(
const Element& e)
646 for (uint i = 0; i < e.adjFacesNumber(); ++i) {
673 BTIBTBB::IsDerivedFromSpecializationOfV<T, AdjacentFaces>;
704 RemoveRef<T>::VERTEX_NUMBER == RemoveRef<T>::ADJ_FACE_NUMBER;
729 typename ParentElemType,
732template<
typename Element>
733void AdjacentFaces<STORE_INDICES, Face, N, TTVN, ParentElemType, VERT, OPT>::
734 importFrom(
const Element& e,
bool importRefs)
738 if (isAdjacentFacesAvailableOn(e)) {
739 if constexpr (N > 0) {
741 if constexpr (N == Element::ADJ_FACE_NUMBER) {
742 importIndicesFrom(e);
746 else if constexpr (Element::ADJ_FACE_NUMBER < 0) {
747 if (e.adjFacesNumber() == N) {
748 importIndicesFrom(e);
759 Base::resize(e.adjFacesNumber());
760 importIndicesFrom(e);
779bool isAdjacentFacesAvailableOn(
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 Face class represents an Face element of the vcl::Mesh class.
Definition face.h:48
The AdjacentFaces class is a container of Face indices or pointers. It could be used by any Element t...
Definition adjacent_faces.h:105
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:602
ConstAdjacentFaceIndexIterator adjFaceIndexEnd() const
Returns an iterator to the end of the container of this component.
Definition adjacent_faces.h:542
void setAdjFaces(Rng &&r)
Sets all the adjacent faces of this element.
Definition adjacent_faces.h:365
ConstAdjacentFaceIterator adjFaceBegin() const
Returns a const iterator to the first adjacent face in the container of this component.
Definition adjacent_faces.h:513
ConstAdjacentFaceIterator adjFaceEnd() const
Returns a const iterator to the end of the container of this component.
Definition adjacent_faces.h:524
void setAdjFace(uint i, uint fi)
Sets the i-th adjacent face of the element.
Definition adjacent_faces.h:248
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:200
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:581
void setAdjFace(ConstAdjacentFaceIterator it, uint fi)
Sets the adjacent face pointed by the iterator.
Definition adjacent_faces.h:267
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:313
uint adjFacesNumber() const
Returns the number of adjacent faces of this element.
Definition adjacent_faces.h:152
void setAdjFace(ConstAdjacentFaceIndexIterator it, Face *f)
Sets the adjacent face pointed by the iterator.
Definition adjacent_faces.h:278
void pushAdjFace(Face *f)
Pushes in the back of the container the given adjacent face.
Definition adjacent_faces.h:432
void setAdjFace(ConstAdjacentFaceIterator it, Face *f)
Sets the adjacent face pointed by the iterator.
Definition adjacent_faces.h:256
AdjacentFaceIterator adjFaceBegin()
Returns an iterator to the first adjacent face in the container of this component.
Definition adjacent_faces.h:497
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
static const int ADJ_FACE_NUMBER
Static size of the container. If the container is dynamic, this value will be negative and you should...
Definition adjacent_faces.h:134
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:402
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:413
const Face * adjFace(uint i) const
Returns a const pointer to the i-th adjacent face of this element.
Definition adjacent_faces.h:169
View< AdjacentFaceIterator > adjFaces()
Returns a lightweight view object that stores the begin and end iterators of the container of adjacen...
Definition adjacent_faces.h:563
void pushAdjFace(uint fi)
Pushes in the back of the container the given adjacent face.
Definition adjacent_faces.h:441
bool containsAdjFace(const Face *f) const
Returns true if the container of adjacent faces contains the given face, false otherwise.
Definition adjacent_faces.h:378
void resizeAdjFaces(uint n)
Resize the container of the adjacent faces to the given size.
Definition adjacent_faces.h:423
void clearAdjFaces()
Clears the container of adjacent faces, making it empty.
Definition adjacent_faces.h:487
const Face * adjFaceMod(int i) const
Same of adjFaceMod, but returns a const Pointer to the adjacent face.
Definition adjacent_faces.h:210
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:334
ConstAdjacentFaceIndexIterator adjFaceIndexBegin() const
Returns an iterator to the first adjacent face index in the container of this component.
Definition adjacent_faces.h:532
Face * adjFace(uint i)
Returns the pointer to the i-th adjacent face of this element.
Definition adjacent_faces.h:161
void setAdjFace(uint i, Face *f)
Sets the i-th adjacent face of this element.
Definition adjacent_faces.h:240
void setAdjFaces(Rng &&r)
Sets all the adjacent faces of this element.
Definition adjacent_faces.h:348
AdjacentFaces()=default
Empty constructor.
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:232
bool containsAdjFace(uint fi) const
Returns true if the container of adjacent faces contains the face with the given index,...
Definition adjacent_faces.h:391
void setAdjFace(ConstAdjacentFaceIndexIterator it, uint fi)
Sets the adjacent face pointed by the iterator.
Definition adjacent_faces.h:289
void insertAdjFace(uint i, Face *f)
Inserts the given adjacent face in the container at the given position.
Definition adjacent_faces.h:453
AdjacentFaceIterator adjFaceEnd()
Returns an iterator to the end of the container of this component.
Definition adjacent_faces.h:505
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:467
void eraseAdjFace(uint i)
Removes the adjacent face at the given position from the container.
Definition adjacent_faces.h:480
A concept that checks whether a type T (that should be a Element) has the AdjacentFaces component (in...
Definition adjacent_faces.h:672
A concept that checks whether a type T (that should be a Element) has the AdjacentFaces component (in...
Definition adjacent_faces.h:686
HasRightNumberOfAdjacentFaces concept.
Definition adjacent_faces.h:702
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:719