Commit 2782a7ef authored by Max Lyon's avatar Max Lyon

Merge branch 'fixes' into 'master'

Fixes

See merge request !20
parents 3cf0d296 44f95107
Pipeline #10928 passed with stage
in 7 minutes and 35 seconds
......@@ -16,6 +16,8 @@ Version X (?/?/?)
- Made property handle constructors explicit
- Enable range iterators on MSVC
- Fix mesh copying by implementing copy constructors and clone methods
- Fix bug in edge split of tetrahedral meshes
- Ensure that halfface iterators start with a boundary halffaces when cells are deleted
......
......@@ -314,7 +314,11 @@ void TopologyKernel::reorder_incident_halffaces(const EdgeHandle& _eh) {
cur_hf = adjacent_halfface_in_cell(cur_hf, cur_he);
if(cur_hf != InvalidHalfFaceHandle)
{
if (is_deleted(incident_cell(cur_hf)))
break; // pretend we ran into a boundary
cur_hf = opposite_halfface_handle(cur_hf);
}
// End when we're through
if(cur_hf == start_hf) break;
......@@ -1229,6 +1233,8 @@ FaceIter TopologyKernel::delete_face_core(const FaceHandle& _h) {
std::remove(incident_hfs_per_he_[opposite_halfedge_handle(*he_it).idx()].begin(),
incident_hfs_per_he_[opposite_halfedge_handle(*he_it).idx()].end(),
halfface_handle(h, 1)), incident_hfs_per_he_[opposite_halfedge_handle(*he_it).idx()].end());
reorder_incident_halffaces(edge_handle(*he_it));
}
}
......@@ -1389,6 +1395,15 @@ CellIter TopologyKernel::delete_cell_core(const CellHandle& _h) {
if (incident_cell_per_hf_[hf_it->idx()] == h)
incident_cell_per_hf_[hf_it->idx()] = InvalidCellHandle;
}
std::set<EdgeHandle> edges;
for(std::vector<HalfFaceHandle>::const_iterator hf_it = hfs.begin(),
hf_end = hfs.end(); hf_it != hf_end; ++hf_it) {
const auto& hf = halfface(*hf_it);
for (const auto& heh : hf.halfedges())
edges.insert(edge_handle(heh));
}
for (auto eh : edges)
reorder_incident_halffaces(eh);
}
if (deferred_deletion_enabled())
......@@ -2074,7 +2089,7 @@ OpenVolumeMeshFace TopologyKernel::halfface(const HalfFaceHandle& _halfFaceHandl
assert((size_t)_halfFaceHandle.idx() < (faces_.size() * 2));
assert(_halfFaceHandle.idx() >= 0);
// In case the handle is not even, just return the corresponding face
// In case the handle is even, just return the corresponding face
// Otherwise return the opposite halfface via opposite()
if(_halfFaceHandle.idx() % 2 == 0)
return faces_[(int)(_halfFaceHandle.idx() / 2)];
......
......@@ -406,19 +406,24 @@ void TetrahedralMeshTopologyKernel::split_edge(HalfEdgeHandle _heh, VertexHandle
if (!deferred_deletion_tmp)
enable_deferred_deletion(true);
std::vector<HalfFaceHandle> incident_halffaces_with_cells;
for (HalfEdgeHalfFaceIter hehf_it = hehf_iter(_heh); hehf_it.valid(); ++hehf_it)
{
CellHandle ch = incident_cell(*hehf_it);
if (ch.is_valid())
{
std::vector<VertexHandle> vertices = get_cell_vertices(*hehf_it, _heh);
incident_halffaces_with_cells.push_back(*hehf_it);
}
delete_cell(ch);
for (auto hfh : incident_halffaces_with_cells)
{
CellHandle ch = incident_cell(hfh);
add_cell(vertices[0], _vh, vertices[2], vertices[3]);
add_cell(_vh, vertices[1], vertices[2], vertices[3]);
}
std::vector<VertexHandle> vertices = get_cell_vertices(hfh, _heh);
delete_cell(ch);
add_cell(vertices[0], _vh, vertices[2], vertices[3]);
add_cell(_vh, vertices[1], vertices[2], vertices[3]);
}
delete_edge(edge_handle(_heh));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment