@@ -619,6 +619,11 @@ TriangulatorInterface::MeshedHole::MeshedHole(const MeshBase & mesh,
619619 Real twice_outer_area = 0 ,
620620 abs_twice_outer_area = 0 ;
621621
622+ #ifdef DEBUG
623+ // Area and edge type, for error reporting
624+ std ::vector < std ::pair < Real , int >> areas ;
625+ #endif
626+
622627 while (!hole_edge_map .empty ()) {
623628 auto [hole_points , edge_type ] = extract_edge_vector ();
624629
@@ -649,11 +654,15 @@ TriangulatorInterface::MeshedHole::MeshedHole(const MeshBase & mesh,
649654 auto abs_twice_this_area = std ::abs (twice_this_area );
650655
651656 if (((abs_twice_this_area == twice_this_area ) && edge_type == 2 ) ||
652- (edge_type == 1 ))
657+ (( abs_twice_this_area != twice_this_area ) && edge_type == 1 ))
653658 ++ n_positive_areas ;
654659 else
655660 ++ n_negative_areas ;
656661
662+ #ifdef DEBUG
663+ areas .push_back ({twice_this_area /2 ,edge_type });
664+ #endif
665+
657666 if (abs_twice_this_area > abs_twice_outer_area )
658667 {
659668 twice_outer_area = twice_this_area ;
@@ -677,21 +686,40 @@ TriangulatorInterface::MeshedHole::MeshedHole(const MeshBase & mesh,
677686 if (twice_outer_area > 0 )
678687 std ::reverse (_points .begin (), _points .end ());
679688
689+ #ifdef DEBUG
690+ auto print_areas = [areas ](){
691+ libMesh ::out << "Found boundary areas:\n" ;
692+ static const std ::vector < std ::string > edgenames {"E" ,"CW" ,"CCW" };
693+ for (auto area : areas )
694+ libMesh ::out << '(' << edgenames [area .second ] << ' ' <<
695+ area .first << ')' ;
696+ libMesh ::out << std ::endl ;
697+ };
698+ #else
699+ auto print_areas = [](){};
700+ #endif
701+
680702 if (((twice_outer_area > 0 ) && outer_edge_type == 2 ) ||
681703 outer_edge_type == 1 )
682704 {
683705 if (n_positive_areas > 1 )
684- report_error ("MeshedHole found " +
685- std ::to_string (n_positive_areas ) +
686- " counter-clockwise boundaries and cannot choose one!" );
706+ {
707+ print_areas ();
708+ report_error ("MeshedHole found " +
709+ std ::to_string (n_positive_areas ) +
710+ " counter-clockwise boundaries and cannot choose one!" );
711+ }
687712
688713 }
689714 else if (outer_edge_type != 0 )
690715 {
691716 if (n_negative_areas > 1 )
692- report_error ("MeshedHole found " +
693- std ::to_string (n_positive_areas ) +
694- " clockwise boundaries and cannot choose one!" );
717+ {
718+ print_areas ();
719+ report_error ("MeshedHole found " +
720+ std ::to_string (n_positive_areas ) +
721+ " clockwise boundaries and cannot choose one!" );
722+ }
695723
696724 }
697725
0 commit comments