Visual Computing Library
Loading...
Searching...
No Matches
type_name.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_ALGORITHMS_MESH_TYPE_NAME_H
24#define VCL_ALGORITHMS_MESH_TYPE_NAME_H
25
26#include <vclib/concepts/mesh.h>
27
28namespace vcl {
29
36template<MeshConcept MeshType>
37constexpr std::string meshTypeName()
38{
39 using ScalarType = MeshType::VertexType::CoordType::ScalarType;
40
41 std::string name;
42
43 if constexpr (!HasFaces<MeshType> && !HasEdges<MeshType>) {
44 name = "PointCloud";
45 }
46 else {
47 if constexpr (vcl::HasTriangles<MeshType>)
48 name = "Tri";
49 else if constexpr (vcl::HasQuads<MeshType>)
50 name = "Quad";
51 else
52 name = "Poly";
53
54 if constexpr (vcl::HasEdges<MeshType>)
55 name += "Edge";
56
57 name += "Mesh";
58
59 if constexpr (HasFaces<MeshType>) {
60 if constexpr (MeshType::FaceType::INDEXED) {
61 name += "Indexed";
62 }
63 }
64 if constexpr (HasEdges<MeshType>) {
65 if constexpr (MeshType::EdgeType::INDEXED) {
66 name += "Indexed";
67 }
68 }
69 }
70
71 if constexpr (std::same_as<ScalarType, float>)
72 name += "f";
73
74 return name;
75}
76
77} // namespace vcl
78
79#endif // VCL_ALGORITHMS_MESH_TYPE_NAME_H
HasEdges concepts is satisfied when at least one of its template types is (or inherits from) a vcl::m...
Definition edge_container.h:131
HasFaces concepts is satisfied when at least one of its template types is (or inherits from) a vcl::m...
Definition face_container.h:133
Definition per_face.h:44
Definition per_face.h:40
constexpr std::string meshTypeName()
Returns the name of the mesh type as a string.
Definition type_name.h:37