ResourceManager.cc 5.42 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*===========================================================================*\
 *                                                                           *
 *                            OpenVolumeMesh                                 *
 *        Copyright (C) 2011 by Computer Graphics Group, RWTH Aachen         *
 *                        www.openvolumemesh.org                             *
 *                                                                           *
 *---------------------------------------------------------------------------*
 *  This file is part of OpenVolumeMesh.                                     *
 *                                                                           *
 *  OpenVolumeMesh is free software: you can redistribute it and/or modify   *
 *  it under the terms of the GNU Lesser General Public License as           *
 *  published by the Free Software Foundation, either version 3 of           *
 *  the License, or (at your option) any later version with the              *
 *  following exceptions:                                                    *
 *                                                                           *
 *  If other files instantiate templates or use macros                       *
 *  or inline functions from this file, or you compile this file and         *
 *  link it with other files to produce an executable, this file does        *
 *  not by itself cause the resulting executable to be covered by the        *
 *  GNU Lesser General Public License. This exception does not however       *
 *  invalidate any other reasons why the executable file might be            *
 *  covered by the GNU Lesser General Public License.                        *
 *                                                                           *
 *  OpenVolumeMesh is distributed in the hope that it will be useful,        *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
 *  GNU Lesser General Public License for more details.                      *
 *                                                                           *
 *  You should have received a copy of the GNU LesserGeneral Public          *
 *  License along with OpenVolumeMesh.  If not,                              *
 *  see <http://www.gnu.org/licenses/>.                                      *
 *                                                                           *
\*===========================================================================*/

/*===========================================================================*\
 *                                                                           *
 *   $Revision$                                                         *
 *   $Date$                    *
 *   $LastChangedBy$                                                *
 *                                                                           *
\*===========================================================================*/

#include "ResourceManager.hh"
#include "BaseProperty.hh"

namespace OpenVolumeMesh {

ResourceManager::ResourceManager() {
}

ResourceManager::~ResourceManager() {

53
54
55
56
57
58
59
60
    // Delete persistent props
    clearVec(vertex_props_);
    clearVec(edge_props_);
    clearVec(halfedge_props_);
    clearVec(face_props_);
    clearVec(halfface_props_);
    clearVec(cell_props_);
    clearVec(mesh_props_);
61
62
63
64
}

void ResourceManager::resize_vprops(unsigned int _nv) {

65
    resize_props(vertex_props_, _nv);
66
67
68
69
}

void ResourceManager::resize_eprops(unsigned int _ne) {

70
71
    resize_props(edge_props_, _ne);
    resize_props(halfedge_props_, _ne*2u);
72
73
74
75
}

void ResourceManager::resize_fprops(unsigned int _nf) {

76
77
    resize_props(face_props_, _nf);
    resize_props(halfface_props_, _nf*2u);
78
79
80
81
}

void ResourceManager::resize_cprops(unsigned int _nc) {

82
    resize_props(cell_props_, _nc);
83
84
85
86
}

void ResourceManager::vertex_deleted(const VertexHandle& _h) {

87
    entity_deleted(vertex_props_, _h);
88
89
90
91
}

void ResourceManager::edge_deleted(const EdgeHandle& _h) {

92
93
94
    entity_deleted(edge_props_, _h);
    entity_deleted(halfedge_props_, OpenVolumeMeshHandle(_h.idx()*2 + 1));
    entity_deleted(halfedge_props_, OpenVolumeMeshHandle(_h.idx()*2));
95
96
97
98
}

void ResourceManager::face_deleted(const FaceHandle& _h) {

99
100
101
    entity_deleted(face_props_, _h);
    entity_deleted(halfface_props_, OpenVolumeMeshHandle(_h.idx()*2 + 1));
    entity_deleted(halfface_props_, OpenVolumeMeshHandle(_h.idx()*2));
102
103
104
105
}

void ResourceManager::cell_deleted(const CellHandle& _h) {

106
    entity_deleted(cell_props_, _h);
107
108
}

109
void ResourceManager::release_property(VertexPropHandle _handle) {
110

111
    remove_property(vertex_props_, _handle.idx());
112
113
}

114
void ResourceManager::release_property(EdgePropHandle _handle) {
115

116
    remove_property(edge_props_, _handle.idx());
117
118
}

119
void ResourceManager::release_property(HalfEdgePropHandle _handle) {
120

121
    remove_property(halfedge_props_, _handle.idx());
122
123
}

124
void ResourceManager::release_property(FacePropHandle _handle) {
125

126
    remove_property(face_props_, _handle.idx());
127
128
}

129
void ResourceManager::release_property(HalfFacePropHandle _handle) {
130

131
    remove_property(halfface_props_, _handle.idx());
132
133
}

134
void ResourceManager::release_property(CellPropHandle _handle) {
135

136
    remove_property(cell_props_, _handle.idx());
137
138
}

139
void ResourceManager::release_property(MeshPropHandle _handle) {
140

141
    remove_property(mesh_props_, _handle.idx());
142
143
144
}

} // Namespace OpenVolumeMesh