Visual Computing Library
Loading...
Searching...
No Matches
adjacent_edges.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_EDGES_H
24#define VCL_CONCEPTS_MESH_COMPONENTS_ADJACENT_EDGES_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 HasAdjacentEdges = requires (
52 T&& obj,
53 typename RemoveRef<T>::AdjacentEdgeType e,
54 typename RemoveRef<T>::AdjacentEdgeIterator it,
55 typename RemoveRef<T>::ConstAdjacentEdgeIterator cIt,
56 typename RemoveRef<T>::ConstAdjacentEdgeIndexIterator cIIt,
57 typename RemoveRef<T>::AdjacentEdgeType* eP,
58 const typename RemoveRef<T>::AdjacentEdgeType* cEP,
59 std::vector<typename RemoveRef<T>::AdjacentEdgeType*> vec) {
60 RemoveRef<T>::ADJ_EDGE_NUMBER;
61 typename RemoveRef<T>::AdjacentEdgeType;
62 typename RemoveRef<T>::AdjacentEdgeIterator;
63 typename RemoveRef<T>::ConstAdjacentEdgeIterator;
64 typename RemoveRef<T>::ConstAdjacentEdgeIndexIterator;
65
66 { obj.adjEdgesNumber() } -> std::same_as<uint>;
67
68 { obj.adjEdge(uint()) } -> std::convertible_to<decltype(cEP)>;
69 { obj.adjEdgeIndex(uint()) } -> std::same_as<uint>;
70 { obj.adjEdgeMod(int()) } -> std::convertible_to<decltype(cEP)>;
71 { obj.adjEdgeIndexMod(uint()) } -> std::same_as<uint>;
72
73 { obj.containsAdjEdge(&e) } -> std::same_as<bool>;
74 { obj.containsAdjEdge(uint()) } -> std::same_as<bool>;
75 { obj.indexOfAdjEdge(&e) } -> std::same_as<uint>;
76 { obj.indexOfAdjEdge(uint()) } -> std::same_as<uint>;
77
78 { obj.adjEdgeBegin() } -> InputIterator<decltype(cEP)>;
79 { obj.adjEdgeEnd() } -> InputIterator<decltype(cEP)>;
80
81 { obj.adjEdgeIndexBegin() } -> InputIterator<uint>;
82 { obj.adjEdgeIndexEnd() } -> InputIterator<uint>;
83
84 { obj.adjEdges() } -> InputRange<decltype(cEP)>;
85 { obj.adjEdgeIndices() } -> InputRange<uint>;
86
87 // non const requirements
88 requires IsConst<T> || requires {
89 { obj.adjEdge(uint()) } -> std::same_as<decltype(eP)>;
90 { obj.adjEdgeMod(int()) } -> std::same_as<decltype(eP)>;
91
92 { obj.setAdjEdge(uint(), &e) } -> std::same_as<void>;
93 { obj.setAdjEdge(uint(), uint()) } -> std::same_as<void>;
94 { obj.setAdjEdge(it, &e) } -> std::same_as<void>;
95 { obj.setAdjEdge(it, uint()) } -> std::same_as<void>;
96 { obj.setAdjEdge(cIt, &e) } -> std::same_as<void>;
97 { obj.setAdjEdge(cIt, uint()) } -> std::same_as<void>;
98 { obj.setAdjEdge(cIIt, &e) } -> std::same_as<void>;
99 { obj.setAdjEdge(cIIt, uint()) } -> std::same_as<void>;
100 { obj.setAdjEdgeMod(int(), &e) } -> std::same_as<void>;
101 { obj.setAdjEdgeMod(int(), uint()) } -> std::same_as<void>;
102 { obj.setAdjEdges(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.adjEdgeBegin() } -> InputIterator<decltype(eP)>;
111 { obj.adjEdgeEnd() } -> InputIterator<decltype(eP)>;
112
113 { obj.adjEdges() } -> InputRange<decltype(eP)>;
114 };
115};
116
124template<typename T>
128
140template<typename T>
143 RemoveRef<T>::VERTEX_NUMBER == RemoveRef<T>::ADJ_EDGE_NUMBER;
144
157template<typename T>
160
161} // namespace vcl::comp
162
163#endif // VCL_CONCEPTS_MESH_COMPONENTS_ADJACENT_EDGES_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
HasAdjacentEdges concept is satisfied only if a Element class provides the types and member functions...
Definition adjacent_edges.h:51
HasOptionalAdjacentEdges concept is satisfied only if a class satisfies the vcl::comp::HasAdjacentEdg...
Definition adjacent_edges.h:125
HasRightNumberOfAdjacentEdges concept.
Definition adjacent_edges.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
SanityCheckAdjacentEdges concept.
Definition adjacent_edges.h:158