Visual Computing Library  devel
Loading...
Searching...
No Matches
edge.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_MESH_ELEMENTS_EDGE_H
24#define VCL_MESH_ELEMENTS_EDGE_H
25
26#include "base/element.h"
27#include "edge_components.h"
28
29namespace vcl {
30
45template<typename MeshType, comp::ComponentConcept... Comps>
46class Edge : public Element<ElemId::EDGE, MeshType, Comps...>
47{
48 // VertexPointers or VertexIndices component of the Edge
49 using VRefs = typename Edge::VertexReferences;
50
51public:
52 using VertexType = VRefs::VertexType;
53 using VRefs::setVertices;
54
62 Edge() = default;
63
70 void setVertices(VertexType* v0, VertexType* v1)
71 {
72 VRefs::setVertex(0u, v0);
73 VRefs::setVertex(1u, v1);
74 }
75
82 void setVertices(uint vi0, uint vi1)
83 {
84 VRefs::setVertex(0u, vi0);
85 VRefs::setVertex(1u, vi1);
86 }
87};
88
89template<typename MeshType, comp::ComponentConcept... Comps>
90class Edge<MeshType, TypeWrapper<Comps...>> : public Edge<MeshType, Comps...>
91{
92};
93
94/* Concepts */
95
110template<typename T>
111concept EdgeConcept =
112 IsDerivedFromSpecializationOfV<T, Edge> &&
113 RemoveRef<T>::ELEMENT_ID == ElemId::EDGE && edge::HasBitFlags<T> &&
114 edge::HasVertexReferences<T> && RemoveRef<T>::VERTEX_NUMBER == 2;
115
116} // namespace vcl
117
118#endif // VCL_MESH_ELEMENTS_EDGE_H
A class representing a box in N-dimensional space.
Definition box.h:46
The Edge class represents an Edge element of the vcl::Mesh class.
Definition edge.h:47
void setVertices(uint vi0, uint vi1)
Sets the vertices of the edge.
Definition edge.h:82
Edge()=default
Empty constructor.
void setVertices(VertexType *v0, VertexType *v1)
Sets the vertices of the edge.
Definition edge.h:70
The Element class.
Definition element.h:75
A concept that checks whether a class has (inherits from) an Edge class.
Definition edge.h:111
Definition edge_components.h:71
Definition edge_components.h:91
A simple structure that wraps a list of variadic templates, without instantiating anything....
Definition type_wrapper.h:39