diff --git a/libsrc/meshing/boundarylayer.cpp b/libsrc/meshing/boundarylayer.cpp index 72924f25..0ad93b9b 100644 --- a/libsrc/meshing/boundarylayer.cpp +++ b/libsrc/meshing/boundarylayer.cpp @@ -358,7 +358,7 @@ namespace netgen void MergeAndAddSegments( Mesh & mesh, FlatArray new_segments) { - INDEX_2_HASHTABLE already_added( 2*new_segments.Size() ); + INDEX_2_HASHTABLE already_added( mesh.LineSegments().Size() + 2*new_segments.Size() ); for(auto & seg : mesh.LineSegments()) { diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index a5595b23..51e6017d 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -5221,7 +5221,37 @@ namespace netgen auto & el = volelements[ei]; if(el.IsCurved() && curvedelems->IsElementCurved(ei)) + { + // add edge/face midpoints to box + auto eltype = el.GetType(); + const auto verts = topology.GetVertices(eltype); + + + const auto edges = FlatArray(topology.GetNEdges(eltype), topology.GetEdges0(eltype)); + for (const auto & edge: edges) { + netgen::Point<3> lam = netgen::Point<3>(0.5* (verts[edge[0]] + verts[edge[1]])); + auto p = netgen::Point<3>(0.0); + curvedelems->CalcElementTransformation(lam,ei,p); + box.Add(p); + } + + const auto faces = FlatArray(topology.GetNFaces(eltype), topology.GetFaces0(eltype)); + for (const auto & face: faces) { + netgen::Vec<3> lam = netgen::Vec<3>(verts[face[0]] + verts[face[1]] + verts[face[2]]); + if(face[3] != -1) { + lam += netgen::Vec<3>(verts[face[3]]); + lam *= 0.25; + } + else + lam *= 1.0/3; + auto p = netgen::Point<3>(0.0); + curvedelems->CalcElementTransformation(netgen::Point<3>(lam),ei,p); + box.Add(p); + } + + box.Scale(1.2); + } elementsearchtree -> Insert (box, ei+1);