File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,7 +128,9 @@ class MeshTetInterface
128128 MISSING_BACKLINK = 4 , // an element neighbor isn't linked back to it
129129 BAD_NEIGHBOR_NODES = 5 , // an element neighbor isn't linked to expected nodes
130130 NON_ORIENTED = 6 , // an element neighbor has inconsistent orientation
131- BAD_NEIGHBOR_LINKS = 7 // an element neighbor has other inconsistent links
131+ BAD_NEIGHBOR_LINKS = 7 , // an element neighbor has other inconsistent links
132+ DEGENERATE_ELEMENT = 8 , // an element has zero area
133+ DEGENERATE_MESH = 9 // the mesh clearly bounds zero volume
132134 };
133135
134136 /* *
Original file line number Diff line number Diff line change @@ -346,6 +346,19 @@ std::set<MeshTetInterface::SurfaceIntegrity> MeshTetInterface::check_hull_integr
346346
347347 std ::set < MeshTetInterface ::SurfaceIntegrity > returnval ;
348348
349+ const BoundingBox bb = MeshTools ::create_bounding_box (this -> _mesh );
350+ const Point extents = bb .max () - bb .min ();
351+ if (extents (0 ) == 0 ||
352+ extents (1 ) == 0 ||
353+ extents (2 ) == 0 )
354+ returnval .insert (DEGENERATE_MESH );
355+
356+ // Figure a area to use for relative tolerances when detecting
357+ // degenerate elements
358+ const Real ref_area = std ::abs (extents (0 ) * extents (1 )) +
359+ std ::abs (extents (0 ) * extents (2 )) +
360+ std ::abs (extents (1 ) * extents (2 ));
361+
349362 for (auto & elem : this -> _mesh .element_ptr_range ())
350363 {
351364 // Check for proper element type
@@ -356,6 +369,14 @@ std::set<MeshTetInterface::SurfaceIntegrity> MeshTetInterface::check_hull_integr
356369 returnval .insert (NON_TRI3 );
357370 }
358371
372+ // Make sure it's a decent element.
373+ if (elem -> volume () < ref_area * TOLERANCE * TOLERANCE )
374+ {
375+ if (this -> _verbosity >= 50 )
376+ std ::cerr << "Degenerate element: " << elem -> get_info () << std ::endl ;
377+ returnval .insert (DEGENERATE_ELEMENT );
378+ }
379+
359380 for (auto s : elem -> side_index_range ())
360381 {
361382 const Elem * const neigh = elem -> neighbor_ptr (s );
You can’t perform that action at this time.
0 commit comments