47 #include "StatusAttrib.hh"
51 StatusAttrib::StatusAttrib(TopologyKernel& _kernel) :
53 v_status_(_kernel.request_vertex_property<OpenVolumeMeshStatus>(
"vertex_status")),
54 e_status_(_kernel.request_edge_property<OpenVolumeMeshStatus>(
"edge_status")),
55 he_status_(_kernel.request_halfedge_property<OpenVolumeMeshStatus>(
"halfedge_status")),
56 f_status_(_kernel.request_face_property<OpenVolumeMeshStatus>(
"face_status")),
57 hf_status_(_kernel.request_halfface_property<OpenVolumeMeshStatus>(
"halfface_status")),
58 c_status_(_kernel.request_cell_property<OpenVolumeMeshStatus>(
"cell_status")),
59 m_status_(_kernel.request_mesh_property<OpenVolumeMeshStatus>(
"mesh_status")) {
65 StatusAttrib::~StatusAttrib() {
71 void StatusAttrib::mark_higher_dim_entities() {
74 if(kernel_.has_vertex_bottom_up_incidences()) {
76 for(VertexIter v_it = kernel_.vertices_begin(); v_it != kernel_.vertices_end(); ++v_it) {
77 if(v_status_[v_it->idx()].deleted()) {
78 for(VertexOHalfEdgeIter voh_it = kernel_.voh_iter(*v_it);
79 voh_it.valid(); ++voh_it) {
80 e_status_[kernel_.
edge_handle(*voh_it).idx()].set_deleted(
true);
86 for(EdgeIter e_it = kernel_.edges_begin(); e_it != kernel_.edges_end(); ++e_it) {
87 if(v_status_[kernel_.
edge(*e_it).from_vertex().idx()].deleted() ||
88 v_status_[kernel_.
edge(*e_it).to_vertex().idx()].deleted()) {
89 e_status_[e_it->idx()].set_deleted(
true);
95 if(kernel_.has_edge_bottom_up_incidences()) {
97 for(EdgeIter e_it = kernel_.edges_begin(); e_it != kernel_.edges_end(); ++e_it) {
98 if(e_status_[e_it->idx()].deleted()) {
99 for(HalfEdgeHalfFaceIter hehf_it = kernel_.hehf_iter(kernel_.
halfedge_handle(*e_it, 0));
100 hehf_it.valid(); ++hehf_it) {
101 f_status_[kernel_.face_handle(*hehf_it).idx()].set_deleted(
true);
107 for(FaceIter f_it = kernel_.faces_begin(); f_it != kernel_.faces_end(); ++f_it) {
109 const std::vector<HalfEdgeHandle>& hes = kernel_.
face(*f_it).halfedges();
110 for(std::vector<HalfEdgeHandle>::const_iterator he_it = hes.begin(),
111 he_end = hes.end(); he_it != he_end; ++he_it) {
112 if(e_status_[kernel_.
edge_handle(*he_it)].deleted()) {
113 f_status_[*f_it].set_deleted(
true);
121 if(kernel_.has_face_bottom_up_incidences()) {
123 for(FaceIter f_it = kernel_.faces_begin(); f_it != kernel_.faces_end(); ++f_it) {
124 if(f_status_[f_it->idx()].deleted()) {
128 c_status_[c0].set_deleted(
true);
131 c_status_[c1].set_deleted(
true);
137 for(CellIter c_it = kernel_.cells_begin(); c_it != kernel_.cells_end(); ++c_it) {
139 const std::vector<HalfFaceHandle>& hfs = kernel_.
cell(*c_it).halffaces();
140 for(std::vector<HalfFaceHandle>::const_iterator hf_it = hfs.begin(),
141 hf_end = hfs.end(); hf_it != hf_end; ++hf_it) {
142 if(f_status_[kernel_.face_handle(*hf_it)].deleted()) {
143 c_status_[*c_it].set_deleted(
true);
154 std::vector<VertexHandle*> vh_empty;
155 std::vector<HalfEdgeHandle*> hh_empty;
156 std::vector<HalfFaceHandle*> hfh_empty;
157 std::vector<CellHandle*> ch_empty;
const Face & face(const FaceHandle &_faceHandle) const
Get face with handle _faceHandle.
void garbage_collection(bool _preserveManifoldness=false)
Delete all entities that have been marked as deleted.
CellHandle incident_cell(const HalfFaceHandle &_halfFaceHandle) const
Get cell that is incident to the given halfface.
const Cell & cell(const CellHandle &_cellHandle) const
Get cell with handle _cellHandle.
const Edge & edge(const EdgeHandle &_edgeHandle) const
Get edge with handle _edgeHandle.
static HalfEdgeHandle halfedge_handle(const EdgeHandle &_h, const unsigned char _subIdx)
Conversion function.
static HalfFaceHandle halfface_handle(const FaceHandle &_h, const unsigned char _subIdx)
Conversion function.
static EdgeHandle edge_handle(const HalfEdgeHandle &_h)
Handle conversion.