Visual Computing Library
Loading...
Searching...
No Matches
adjacent_faces.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_CONCEPTS_MESH_COMPONENTS_ADJACENT_FACES_H
24#define VCL_CONCEPTS_MESH_COMPONENTS_ADJACENT_FACES_H
25
26#include "component.h"
27
28#include <vclib/concepts/const_correctness.h>
29#include <vclib/concepts/iterators.h>
30#include <vclib/concepts/ranges/range.h>
31
32#include <vector>
33
34namespace vcl::comp {
35
50template<typename T>
51concept HasAdjacentFaces = requires (
52 T&& obj,
53 typename RemoveRef<T>::AdjacentFaceType f,
54 typename RemoveRef<T>::AdjacentFaceIterator it,
55 typename RemoveRef<T>::ConstAdjacentFaceIterator cIt,
56 typename RemoveRef<T>::ConstAdjacentFaceIndexIterator cIIt,
57 typename RemoveRef<T>::AdjacentFaceType* fP,
58 const typename RemoveRef<T>::AdjacentFaceType* cFP,
59 std::vector<typename RemoveRef<T>::AdjacentFaceType*> vec) {
60 RemoveRef<T>::ADJ_FACE_NUMBER;
61 typename RemoveRef<T>::AdjacentFaceType;
62 typename RemoveRef<T>::AdjacentFaceIterator;
63 typename RemoveRef<T>::ConstAdjacentFaceIterator;
64 typename RemoveRef<T>::ConstAdjacentFaceIndexIterator;
65
66 { obj.adjFacesNumber() } -> std::same_as<uint>;
67
68 { obj.adjFace(uint()) } -> std::convertible_to<decltype(cFP)>;
69 { obj.adjFaceIndex(uint()) } -> std::same_as<uint>;
70 { obj.adjFaceMod(int()) } -> std::convertible_to<decltype(cFP)>;
71 { obj.adjFaceIndexMod(uint()) } -> std::same_as<uint>;
72
73 { obj.containsAdjFace(&f) } -> std::same_as<bool>;
74 { obj.containsAdjFace(uint()) } -> std::same_as<bool>;
75 { obj.indexOfAdjFace(&f) } -> std::same_as<uint>;
76 { obj.indexOfAdjFace(uint()) } -> std::same_as<uint>;
77
78 { obj.adjFaceBegin() } -> InputIterator<decltype(cFP)>;
79 { obj.adjFaceEnd() } -> InputIterator<decltype(cFP)>;
80
81 { obj.adjFaceIndexBegin() } -> InputIterator<uint>;
82 { obj.adjFaceIndexEnd() } -> InputIterator<uint>;
83
84 { obj.adjFaces() } -> InputRange<decltype(cFP)>;
85 { obj.adjFaceIndices() } -> InputRange<uint>;
86
87 // non const requirements
88 requires IsConst<T> || requires {
89 { obj.adjFace(uint()) } -> std::same_as<decltype(fP)>;
90 { obj.adjFaceMod(int()) } -> std::same_as<decltype(fP)>;
91
92 { obj.setAdjFace(uint(), &f) } -> std::same_as<void>;
93 { obj.setAdjFace(uint(), uint()) } -> std::same_as<void>;
94 { obj.setAdjFace(it, &f) } -> std::same_as<void>;
95 { obj.setAdjFace(it, uint()) } -> std::same_as<void>;
96 { obj.setAdjFace(cIt, &f) } -> std::same_as<void>;
97 { obj.setAdjFace(cIt, uint()) } -> std::same_as<void>;
98 { obj.setAdjFace(cIIt, &f) } -> std::same_as<void>;
99 { obj.setAdjFace(cIIt, uint()) } -> std::same_as<void>;
100 { obj.setAdjFaceMod(int(), &f) } -> std::same_as<void>;
101 { obj.setAdjFaceMod(int(), uint()) } -> std::same_as<void>;
102 { obj.setAdjFaces(vec) } -> std::same_as<void>;
103
104 // for references components, the iterators returned by begin() and
105 // end() are input iterators because they do not allow to modify the
106 // content of the container (the only way to do that is by using the set
107 // member functions). However, they allow to modify the elements
108 // pointed by the iterators (const references components allow to
109 // iterate only trough const pointers instead).
110 { obj.adjFaceBegin() } -> InputIterator<decltype(fP)>;
111 { obj.adjFaceEnd() } -> InputIterator<decltype(fP)>;
112
113 { obj.adjFaces() } -> InputRange<decltype(fP)>;
114 };
115};
116
124template<typename T>
128
140template<typename T>
143 RemoveRef<T>::VERTEX_NUMBER == RemoveRef<T>::ADJ_FACE_NUMBER;
144
157template<typename T>
160
161} // namespace vcl::comp
162
163#endif // VCL_CONCEPTS_MESH_COMPONENTS_ADJACENT_FACES_H
The InputIterator concept is satisfied if T is an input iterator that implements the operator* return...
Definition iterators.h:46
Utility concept that is evaluated true the Range R is an Input Range and has a value_type that is con...
Definition range.h:89
The IsConst concept is satisfied if T satisfies one of the following conditions:
Definition const_correctness.h:43
HasAdjacentFaces concept is satisfied only if a Element class provides the types and member functions...
Definition adjacent_faces.h:51
HasOptionalAdjacentFaces concept is satisfied only if a class satisfies the vcl::comp::HasAdjacentFac...
Definition adjacent_faces.h:125
HasRightNumberOfAdjacentFaces concept.
Definition adjacent_faces.h:141
Evaluates to true if the type T is a component that is stored vertically in its element container,...
Definition component.h:72
Evaluates to true if the type T is tied to the number of vertices in the face.
Definition component.h:124
SanityCheckAdjacentFaces concept.
Definition adjacent_faces.h:158