LCOV - code coverage report
Current view: top level - geom - TDSurfaceOverlap.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 1 54 1.9 %
Date: 2020-06-30 00:58:45 Functions: 2 7 28.6 %
Branches: 2 86 2.3 %

           Branch data     Line data    Source code
       1                 :            : // TDSurfaceOverlap.cpp
       2                 :            : 
       3                 :            : #include "TDSurfaceOverlap.hpp"
       4                 :            : #include "GMem.hpp"
       5                 :            : #include "RefFace.hpp"
       6                 :            : #include "SurfaceOverlapFacet.hpp"
       7                 :            : 
       8                 :          0 : TDSurfaceOverlap::TDSurfaceOverlap( RefFace *ref_face_ptr,
       9                 :            :                                     unsigned short ang_facet_tol, double abs_facet_tol,
      10 [ #  # ][ #  # ]:          0 :                                     double gap_max )
      11                 :            : {
      12                 :          0 :   refFacePtr = ref_face_ptr;
      13                 :          0 :   aTree = NULL;
      14                 :          0 :   marked = 0;
      15                 :          0 :   bodiesRetrieved = 0;
      16                 :          0 :   angFacetTol = ang_facet_tol;
      17                 :          0 :   absFacetTol = abs_facet_tol;
      18                 :          0 :   gapMax = gap_max;
      19                 :          0 : }
      20                 :            : 
      21 [ #  # ][ #  # ]:          0 : TDSurfaceOverlap::~TDSurfaceOverlap()
      22                 :            : {
      23 [ #  # ][ #  # ]:          0 :   while( facetList.size() ) delete facetList.pop();
         [ #  # ][ #  # ]
                 [ #  # ]
      24         [ #  # ]:          0 :   if( aTree )
      25 [ #  # ][ #  # ]:          0 :     delete aTree;
      26         [ #  # ]:          0 : }
      27                 :            : 
      28                 :            : DLIList<SurfaceOverlapFacet*> *
      29                 :          0 : TDSurfaceOverlap::get_facet_list()
      30                 :            : {
      31 [ #  # ][ #  # ]:          0 :   if( facetList.size() )
      32                 :          0 :     return &facetList;
      33                 :            : 
      34 [ #  # ][ #  # ]:          0 :   GMem *gmem_ptr = new GMem;
      35         [ #  # ]:          0 :   CubitStatus stat = refFacePtr->get_graphics( *gmem_ptr, angFacetTol, absFacetTol );
      36                 :            : 
      37         [ #  # ]:          0 :   if( !stat )
      38                 :            :   {
      39 [ #  # ][ #  # ]:          0 :     delete gmem_ptr;
      40                 :          0 :     return NULL;
      41                 :            :   }
      42                 :            : 
      43         [ #  # ]:          0 :   GPoint* plist = gmem_ptr->point_list();
      44         [ #  # ]:          0 :   int* facet_list = gmem_ptr->facet_list();
      45                 :            : 
      46                 :            :   int i;
      47                 :            :    
      48                 :            :   GPoint p[3];
      49         [ #  # ]:          0 :   for (i = 0; i < gmem_ptr->fListCount; )
      50                 :            :   {
      51                 :          0 :     int sides = facet_list[i++];
      52         [ #  # ]:          0 :     if (sides != 3)
      53                 :            :     {
      54 [ #  # ][ #  # ]:          0 :       PRINT_WARNING("Skipping n-sided polygone in triangle list"
                 [ #  # ]
      55         [ #  # ]:          0 :                     " in TDSurfaceOverlap.\n");
      56                 :          0 :       i += sides;
      57                 :            :     }
      58                 :            :     else
      59                 :            :     {
      60                 :          0 :       p[0] = plist[facet_list[i++]];
      61                 :          0 :       p[1] = plist[facet_list[i++]];
      62                 :          0 :       p[2] = plist[facet_list[i++]];
      63                 :            :    
      64 [ #  # ][ #  # ]:          0 :       SurfaceOverlapFacet *facet = new SurfaceOverlapFacet( p );
      65         [ #  # ]:          0 :       facetList.append( facet );
      66                 :            :     }
      67                 :            :   }
      68                 :            : 
      69 [ #  # ][ #  # ]:          0 :   delete gmem_ptr;
      70                 :            : 
      71                 :          0 :   return &facetList;
      72                 :            : }
      73                 :            : 
      74                 :            : AbstractTree<SurfaceOverlapFacet*> *
      75                 :          0 : TDSurfaceOverlap::get_facet_rtree()
      76                 :            : {
      77 [ #  # ][ #  # ]:          0 :   if( !aTree && !get_facet_list() )
                 [ #  # ]
      78                 :          0 :     return NULL;
      79                 :            : 
      80         [ #  # ]:          0 :   if( !aTree )
      81                 :            :   {
      82         [ #  # ]:          0 :     aTree = new RTree<SurfaceOverlapFacet*>( gapMax );
      83                 :            : 
      84                 :            :     int i;
      85         [ #  # ]:          0 :     for( i=facetList.size(); i--; )
      86                 :            :     {
      87                 :          0 :       SurfaceOverlapFacet *facet_ptr = facetList.get_and_step();
      88                 :          0 :       aTree->add( facet_ptr );
      89                 :            :     }
      90                 :            :   }
      91                 :            : 
      92                 :          0 :   return aTree;
      93                 :            : }
      94                 :            : 
      95                 :            : DLIList<Body*> *
      96                 :          0 : TDSurfaceOverlap::get_body_list()
      97                 :            : {
      98         [ #  # ]:          0 :   if( bodiesRetrieved )
      99                 :          0 :     return &bodyList;
     100                 :            : 
     101                 :          0 :   refFacePtr->bodies( bodyList );
     102                 :          0 :   bodiesRetrieved = 1;
     103                 :          0 :   return &bodyList;
     104 [ +  - ][ +  - ]:       6540 : }

Generated by: LCOV version 1.11