Developer Documentation
BaseEntities.hh
1#pragma once
2/*===========================================================================*\
3 * *
4 * OpenVolumeMesh *
5 * Copyright (C) 2011 by Computer Graphics Group, RWTH Aachen *
6 * www.openvolumemesh.org *
7 * *
8 *---------------------------------------------------------------------------*
9 * This file is part of OpenVolumeMesh. *
10 * *
11 * OpenVolumeMesh is free software: you can redistribute it and/or modify *
12 * it under the terms of the GNU Lesser General Public License as *
13 * published by the Free Software Foundation, either version 3 of *
14 * the License, or (at your option) any later version with the *
15 * following exceptions: *
16 * *
17 * If other files instantiate templates or use macros *
18 * or inline functions from this file, or you compile this file and *
19 * link it with other files to produce an executable, this file does *
20 * not by itself cause the resulting executable to be covered by the *
21 * GNU Lesser General Public License. This exception does not however *
22 * invalidate any other reasons why the executable file might be *
23 * covered by the GNU Lesser General Public License. *
24 * *
25 * OpenVolumeMesh is distributed in the hope that it will be useful, *
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
28 * GNU Lesser General Public License for more details. *
29 * *
30 * You should have received a copy of the GNU LesserGeneral Public *
31 * License along with OpenVolumeMesh. If not, *
32 * see <http://www.gnu.org/licenses/>. *
33 * *
34\*===========================================================================*/
35
36
37#include <vector>
38
39#include <OpenVolumeMesh/Config/Export.hh>
40#include <OpenVolumeMesh/Core/Handles.hh>
41
42namespace OpenVolumeMesh {
43
44class OVM_EXPORT OpenVolumeMeshEdge {
45friend class TopologyKernel;
46public:
47 OpenVolumeMeshEdge(const VertexHandle& _fromVertex,
48 const VertexHandle& _toVertex) :
49 fromVertex_(_fromVertex),
50 toVertex_(_toVertex) {
51 }
52
53 const VertexHandle from_vertex() const {
54 return fromVertex_;
55 }
56 const VertexHandle to_vertex() const {
57 return toVertex_;
58 }
59
60protected:
61
62 void set_from_vertex(const VertexHandle& _vertex) {
63 fromVertex_ = _vertex;
64 }
65 void set_to_vertex(const VertexHandle& _vertex) {
66 toVertex_ = _vertex;
67 }
68
69private:
70 VertexHandle fromVertex_;
71 VertexHandle toVertex_;
72};
73
74// Stream operator for edges
75std::ostream& operator<<(std::ostream& _os, const OpenVolumeMeshEdge& _edge);
76
77//***************************************************************************
78
79class OVM_EXPORT OpenVolumeMeshFace {
80friend class TopologyKernel;
81public:
82 explicit OpenVolumeMeshFace(std::vector<HalfEdgeHandle> _halfedges) :
83 halfedges_(std::move(_halfedges)) {
84 }
85
86 const std::vector<HalfEdgeHandle>& halfedges() const & {
87 return halfedges_;
88 }
89
90 const std::vector<HalfEdgeHandle>& halfedges() const && = delete;
91 std::vector<HalfEdgeHandle> halfedges() && {
92 return std::move(halfedges_);
93 }
94
95protected:
96
97 void set_halfedges(const std::vector<HalfEdgeHandle>& _halfedges) {
98 halfedges_ = _halfedges;
99 }
100
101private:
102 std::vector<HalfEdgeHandle> halfedges_;
103};
104
105// Stream operator for faces
106std::ostream& operator<<(std::ostream& _os, const OpenVolumeMeshFace& _face);
107
108//***************************************************************************
109
110class OVM_EXPORT OpenVolumeMeshCell {
111friend class TopologyKernel;
112public:
113 explicit OpenVolumeMeshCell(std::vector<HalfFaceHandle> _halffaces) :
114 halffaces_(std::move(_halffaces)) {
115 }
116
117 const std::vector<HalfFaceHandle>& halffaces() const & {
118 return halffaces_;
119 }
120
121 const std::vector<HalfFaceHandle>& halffaces() const && = delete;
122 std::vector<HalfFaceHandle> halffaces() && {
123 return std::move(halffaces_);
124 }
125
126protected:
127
128 void set_halffaces(const std::vector<HalfFaceHandle>& _halffaces) {
129 halffaces_ = _halffaces;
130 }
131
132private:
133 std::vector<HalfFaceHandle> halffaces_;
134};
135
136// Stream operator for cells
137std::ostream& operator<<(std::ostream& _os, const OpenVolumeMeshCell& _cell);
138
139} // namespace OpenVolumeMesh