Visual Computing Library
Loading...
Searching...
No Matches
face_container.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_CONTAINERS_FACE_CONTAINER_H
24#define VCL_CONCEPTS_MESH_CONTAINERS_FACE_CONTAINER_H
25
26#include <vclib/concepts/const_correctness.h>
27#include <vclib/concepts/iterators.h>
28#include <vclib/concepts/ranges/range.h>
29
30#include <vector>
31
32namespace vcl {
33namespace mesh {
34
43template<typename T>
44concept HasFaceContainer = requires (
45 T&& obj,
46 typename RemoveRef<T>::FaceType f,
47 typename RemoveRef<T>::FaceType* fP,
48 typename RemoveRef<T>::FaceType& fR,
49 typename RemoveRef<T>::FaceType::VertexType* vP,
50 std::vector<uint> vecU,
51 std::vector<typename RemoveRef<T>::FaceType::VertexType*> vecV) {
52 typename RemoveRef<T>::FaceType;
53 typename RemoveRef<T>::FaceIterator;
54 typename RemoveRef<T>::ConstFaceIterator;
55
56 { obj.face(uint()) } -> std::convertible_to<decltype(f)>;
57 { obj.faceNumber() } -> std::same_as<uint>;
58 { obj.faceContainerSize() } -> std::same_as<uint>;
59 { obj.deletedFaceNumber() } -> std::same_as<uint>;
60
61 { obj.faceIndexIfCompact(uint()) } -> std::same_as<uint>;
62 { obj.faceCompactIndices() } -> std::same_as<decltype(vecU)>;
63
64 { obj.faceBegin() } -> InputIterator<decltype(f)>;
65 { obj.faceEnd() } -> InputIterator<decltype(f)>;
66 { obj.faces() } -> InputRange<decltype(f)>;
67 { obj.faces(bool()) } -> InputRange<decltype(f)>;
68
69 // non const requirements
70 requires IsConst<T> || requires {
71 { obj.face(uint()) } -> std::same_as<decltype(fR)>;
72
73 { obj.addFace() } -> std::same_as<uint>;
74 { obj.addFace(uint(), uint(), uint()) } -> std::same_as<uint>;
75 { obj.addFace(vP, vP, vP) } -> std::same_as<uint>;
76 { obj.addFace(vecU) } -> std::same_as<uint>;
77 { obj.addFace(vecV) } -> std::same_as<uint>;
78 { obj.addFaces(uint()) } -> std::same_as<uint>;
79 { obj.clearFaces() } -> std::same_as<void>;
80 { obj.resizeFaces(uint()) } -> std::same_as<void>;
81 { obj.reserveFaces(uint()) } -> std::same_as<void>;
82 { obj.compactFaces() } -> std::same_as<void>;
83 { obj.deleteFace(uint()) } -> std::same_as<void>;
84 { obj.deleteFace(fP) } -> std::same_as<void>;
85 { obj.updateFaceIndices(vecU) } -> std::same_as<void>;
86
87 { obj.faceBegin() } -> OutputIterator<decltype(f)>;
88 { obj.faceEnd() } -> OutputIterator<decltype(f)>;
89 { obj.faces() } -> OutputRange<decltype(f)>;
90 { obj.faces(bool()) } -> OutputRange<decltype(f)>;
91
92 { obj.enableAllPerFaceOptionalComponents() } -> std::same_as<void>;
93 { obj.disableAllPerFaceOptionalComponents() } -> std::same_as<void>;
94 };
95};
96
97} // namespace mesh
98
132template<typename... Args>
134
135} // namespace vcl
136
137#endif // VCL_CONCEPTS_MESH_CONTAINERS_FACE_CONTAINER_H
HasFaces concepts is satisfied when at least one of its template types is (or inherits from) a vcl::m...
Definition face_container.h:133
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
The OutputIterator concept is satisfied if T is an output iterator that implements the operator* retu...
Definition iterators.h:60
Utility concept that is evaluated true the Range R is an Output Range and has a value_type that is T.
Definition range.h:113
The HasFaceContainer concept is satisfied only if a container class provides the types and member fun...
Definition face_container.h:44