47 #include "../Core/TopologyKernel.hh" 48 #include "StatusAttrib.hh" 52 StatusAttrib::StatusAttrib(TopologyKernel& _kernel) :
54 v_status_(_kernel.request_vertex_property<OpenVolumeMeshStatus>(
"vertex_status")),
55 e_status_(_kernel.request_edge_property<OpenVolumeMeshStatus>(
"edge_status")),
56 he_status_(_kernel.request_halfedge_property<OpenVolumeMeshStatus>(
"halfedge_status")),
57 f_status_(_kernel.request_face_property<OpenVolumeMeshStatus>(
"face_status")),
58 hf_status_(_kernel.request_halfface_property<OpenVolumeMeshStatus>(
"halfface_status")),
59 c_status_(_kernel.request_cell_property<OpenVolumeMeshStatus>(
"cell_status")),
60 m_status_(_kernel.request_mesh_property<OpenVolumeMeshStatus>(
"mesh_status")) {
66 StatusAttrib::~StatusAttrib() {
72 void StatusAttrib::mark_higher_dim_entities() {
75 if(kernel_.has_vertex_bottom_up_incidences()) {
77 for(VertexIter v_it = kernel_.vertices_begin(); v_it != kernel_.vertices_end(); ++v_it) {
78 if(v_status_[*v_it].deleted()) {
79 for(VertexOHalfEdgeIter voh_it = kernel_.voh_iter(*v_it);
80 voh_it.valid(); ++voh_it) {
81 e_status_[kernel_.edge_handle(*voh_it)].set_deleted(
true);
87 for(EdgeIter e_it = kernel_.edges_begin(); e_it != kernel_.edges_end(); ++e_it) {
88 if(v_status_[kernel_.edge(*e_it).from_vertex()].deleted() ||
89 v_status_[kernel_.edge(*e_it).to_vertex()].deleted()) {
90 e_status_[*e_it].set_deleted(
true);
96 if(kernel_.has_edge_bottom_up_incidences()) {
98 for(EdgeIter e_it = kernel_.edges_begin(); e_it != kernel_.edges_end(); ++e_it) {
99 if(e_status_[*e_it].deleted()) {
100 for(HalfEdgeHalfFaceIter hehf_it = kernel_.hehf_iter(kernel_.halfedge_handle(*e_it, 0));
101 hehf_it.valid(); ++hehf_it) {
102 f_status_[kernel_.face_handle(*hehf_it)].set_deleted(
true);
108 for(FaceIter f_it = kernel_.faces_begin(); f_it != kernel_.faces_end(); ++f_it) {
110 const std::vector<HalfEdgeHandle>& hes = kernel_.face(*f_it).halfedges();
111 for(std::vector<HalfEdgeHandle>::const_iterator he_it = hes.begin(),
112 he_end = hes.end(); he_it != he_end; ++he_it) {
113 if(e_status_[kernel_.edge_handle(*he_it)].deleted()) {
114 f_status_[*f_it].set_deleted(
true);
122 if(kernel_.has_face_bottom_up_incidences()) {
124 for(FaceIter f_it = kernel_.faces_begin(); f_it != kernel_.faces_end(); ++f_it) {
125 if(f_status_[*f_it].deleted()) {
126 CellHandle c0 = kernel_.incident_cell(kernel_.halfface_handle(*f_it, 0));
127 CellHandle c1 = kernel_.incident_cell(kernel_.halfface_handle(*f_it, 1));
129 c_status_[c0].set_deleted(
true);
132 c_status_[c1].set_deleted(
true);
138 for(CellIter c_it = kernel_.cells_begin(); c_it != kernel_.cells_end(); ++c_it) {
140 const std::vector<HalfFaceHandle>& hfs = kernel_.cell(*c_it).halffaces();
141 for(std::vector<HalfFaceHandle>::const_iterator hf_it = hfs.begin(),
142 hf_end = hfs.end(); hf_it != hf_end; ++hf_it) {
143 if(f_status_[kernel_.face_handle(*hf_it)].deleted()) {
144 c_status_[*c_it].set_deleted(
true);
155 std::vector<VertexHandle*> vh_empty;
156 std::vector<HalfEdgeHandle*> hh_empty;
157 std::vector<HalfFaceHandle*> hfh_empty;
158 std::vector<CellHandle*> ch_empty;
160 garbage_collection(vh_empty, hh_empty, hfh_empty, ch_empty, _preserveManifoldness);
void garbage_collection(bool _preserveManifoldness=false)
Delete all entities that have been marked as deleted.