43 #include "ResourceManager.hh" 47 ResourceManager::ResourceManager() {
50 ResourceManager::~ResourceManager() {
53 clearVec(vertex_props_);
54 clearVec(edge_props_);
55 clearVec(halfedge_props_);
56 clearVec(face_props_);
57 clearVec(halfface_props_);
58 clearVec(cell_props_);
59 clearVec(mesh_props_);
64 resize_props(vertex_props_, _nv);
69 resize_props(edge_props_, _ne);
70 resize_props(halfedge_props_, _ne*2u);
75 resize_props(face_props_, _nf);
76 resize_props(halfface_props_, _nf*2u);
81 resize_props(cell_props_, _nc);
84 void ResourceManager::vertex_deleted(
const VertexHandle& _h) {
86 entity_deleted(vertex_props_, _h);
89 void ResourceManager::edge_deleted(
const EdgeHandle& _h) {
91 entity_deleted(edge_props_, _h);
96 void ResourceManager::face_deleted(
const FaceHandle& _h) {
98 entity_deleted(face_props_, _h);
103 void ResourceManager::cell_deleted(
const CellHandle& _h) {
105 entity_deleted(cell_props_, _h);
110 swap_property_elements(cell_props_begin(), cell_props_end(), _h1, _h2);
115 swap_property_elements(face_props_begin(), face_props_end(), _h1, _h2);
120 swap_property_elements(halfface_props_begin(), halfface_props_end(), _h1, _h2);
125 swap_property_elements(edge_props_begin(), edge_props_end(), _h1, _h2);
130 swap_property_elements(halfedge_props_begin(), halfedge_props_end(), _h1, _h2);
135 swap_property_elements(vertex_props_begin(), vertex_props_end(), _h1, _h2);
140 remove_property(vertex_props_, _handle.idx());
145 remove_property(edge_props_, _handle.idx());
150 remove_property(halfedge_props_, _handle.idx());
155 remove_property(face_props_, _handle.idx());
160 remove_property(halfface_props_, _handle.idx());
165 remove_property(cell_props_, _handle.idx());
170 remove_property(mesh_props_, _handle.idx());
173 void ResourceManager::delete_multiple_vertex_props(
const std::vector<bool>& _tags) {
175 Properties::iterator vp_it = vertex_props_.begin();
176 Properties::iterator vp_end = vertex_props_.end();
177 for(; vp_it != vp_end; ++vp_it) {
178 (*vp_it)->delete_multiple_entries(_tags);
182 void ResourceManager::delete_multiple_edge_props(
const std::vector<bool>& _tags) {
184 Properties::iterator ep_it = edge_props_.begin();
185 Properties::iterator ep_end = edge_props_.end();
186 for(; ep_it != ep_end; ++ep_it) {
187 (*ep_it)->delete_multiple_entries(_tags);
190 std::vector<bool> hetags;
191 for(std::vector<bool>::const_iterator t_it = _tags.begin(),
192 t_end = _tags.end(); t_it != t_end; ++t_it) {
193 hetags.push_back(*t_it);
194 hetags.push_back(*t_it);
196 Properties::iterator hep_it = halfedge_props_.begin();
197 Properties::iterator hep_end = halfedge_props_.end();
198 for(; hep_it != hep_end; ++hep_it) {
199 (*hep_it)->delete_multiple_entries(hetags);
203 void ResourceManager::delete_multiple_face_props(
const std::vector<bool>& _tags) {
205 Properties::iterator fp_it = face_props_.begin();
206 Properties::iterator fp_end = face_props_.end();
207 for(; fp_it != fp_end; ++fp_it) {
208 (*fp_it)->delete_multiple_entries(_tags);
211 std::vector<bool> hftags;
212 for(std::vector<bool>::const_iterator t_it = _tags.begin(),
213 t_end = _tags.end(); t_it != t_end; ++t_it) {
214 hftags.push_back(*t_it);
215 hftags.push_back(*t_it);
217 Properties::iterator hfp_it = halfface_props_.begin();
218 Properties::iterator hfp_end = halfface_props_.end();
219 for(; hfp_it != hfp_end; ++hfp_it) {
220 (*hfp_it)->delete_multiple_entries(hftags);
224 void ResourceManager::delete_multiple_cell_props(
const std::vector<bool>& _tags) {
226 Properties::iterator cp_it = cell_props_.begin();
227 Properties::iterator cp_end = cell_props_.end();
228 for(; cp_it != cp_end; ++cp_it) {
229 (*cp_it)->delete_multiple_entries(_tags);
void resize_cprops(size_t _nc)
Change size of stored cell properties.
void resize_vprops(size_t _nv)
Change size of stored vertex properties.
void resize_eprops(size_t _ne)
Change size of stored edge properties.
void resize_fprops(size_t _nf)
Change size of stored face properties.