LCOV - code coverage report
Current view: top level - geom/facet - FacetPoint.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 34 114 29.8 %
Date: 2020-06-30 00:58:45 Functions: 14 25 56.0 %
Branches: 16 172 9.3 %

           Branch data     Line data    Source code
       1                 :            : //-------------------------------------------------------------------------
       2                 :            : // Filename      : FacetPoint.cpp
       3                 :            : //
       4                 :            : // Purpose       : 
       5                 :            : //
       6                 :            : // Special Notes :
       7                 :            : //
       8                 :            : // Creator       : Steven J. Owen
       9                 :            : //
      10                 :            : // Creation Date : 07/15/00
      11                 :            : //
      12                 :            : // Owner         : Steven J. Owen
      13                 :            : //-------------------------------------------------------------------------
      14                 :            : 
      15                 :            : // ********** BEGIN STANDARD INCLUDES      **********
      16                 :            : #include <assert.h>
      17                 :            : // ********** END STANDARD INCLUDES        **********
      18                 :            : 
      19                 :            : // ********** BEGIN CUBIT INCLUDES         **********
      20                 :            : #include "CubitMessage.hpp"
      21                 :            : #include "FacetPoint.hpp"
      22                 :            : #include "FacetAttrib.hpp"
      23                 :            : #include "CubitPoint.hpp"
      24                 :            : #include "CubitPointData.hpp"
      25                 :            : #include "RefVertex.hpp"
      26                 :            : #include "FacetQueryEngine.hpp"
      27                 :            : #include "CastTo.hpp"
      28                 :            : #include "Curve.hpp"
      29                 :            : 
      30                 :            : 
      31                 :            : #include "FacetBody.hpp"
      32                 :            : #include "FacetLump.hpp"
      33                 :            : #include "FacetShell.hpp"
      34                 :            : #include "FacetSurface.hpp"
      35                 :            : #include "FacetLoop.hpp"
      36                 :            : #include "FacetCoEdge.hpp"
      37                 :            : #include "FacetCurve.hpp"
      38                 :            : 
      39                 :            : // ********** END CUBIT INCLUDES           **********
      40                 :            : 
      41                 :            : // ********** BEGIN STATIC DECLARATIONS    **********
      42                 :            : // ********** END STATIC DECLARATIONS      **********
      43                 :            : 
      44                 :            : // ********** BEGIN PUBLIC FUNCTIONS       **********
      45                 :            : 
      46                 :            : //-------------------------------------------------------------------------
      47                 :            : // Purpose       : The constructor with a pointer to the associated VERTEX . 
      48                 :            : //
      49                 :            : // Special Notes :
      50                 :            : //
      51                 :            : // Creator       : Steve Owen
      52                 :            : //
      53                 :            : // Creation Date : 07/16/00
      54                 :            : //-------------------------------------------------------------------------
      55 [ #  # ][ #  # ]:          0 : FacetPoint::FacetPoint( const CubitVector &location, DLIList<Curve*> &curves )
      56                 :            : {
      57 [ #  # ][ #  # ]:          0 :   myPoint = (CubitPoint *) new CubitPointData( location );
      58         [ #  # ]:          0 :   myCurves += curves;
      59                 :          0 :   iCreated = CUBIT_TRUE;
      60                 :          0 : }
      61                 :            : 
      62                 :            : //-------------------------------------------------------------------------
      63                 :            : // Purpose       : The constructor with a pointer to the associated CubitPoint . 
      64                 :            : //
      65                 :            : // Special Notes :
      66                 :            : //
      67                 :            : // Creator       : Steve Owen
      68                 :            : //
      69                 :            : // Creation Date : 12/28/00
      70                 :            : //-------------------------------------------------------------------------
      71 [ +  - ][ +  - ]:        836 : FacetPoint::FacetPoint( CubitPoint *thePoint, DLIList<Curve*> &curves )
      72                 :            : {
      73                 :        418 :   myPoint = thePoint;
      74         [ +  - ]:        418 :   myCurves += curves;
      75                 :        418 :   iCreated = CUBIT_FALSE;
      76                 :        418 : }
      77                 :            : 
      78                 :            : //-------------------------------------------------------------------------
      79                 :            : // Purpose       : The constructor with a pointer to the associated CubitPoint . 
      80                 :            : //
      81                 :            : // Special Notes : Was make especially for save/restore
      82                 :            : //
      83                 :            : // Creator       : Corey Ernst 
      84                 :            : //
      85                 :            : // Creation Date : 02/03/03
      86                 :            : //-------------------------------------------------------------------------
      87 [ +  - ][ +  - ]:        352 : FacetPoint::FacetPoint( CubitPoint *thePoint ) 
      88                 :            : {
      89                 :        176 :   myPoint = thePoint;
      90                 :        176 :   iCreated = CUBIT_FALSE;
      91                 :        176 : }
      92                 :            : 
      93                 :            : //-------------------------------------------------------------------------
      94                 :            : // Purpose       : The destructor. 
      95                 :            : //
      96                 :            : // Special Notes :
      97                 :            : //
      98                 :            : // Creator       : Steve Owen
      99                 :            : //
     100                 :            : // Creation Date : 07/16/00
     101                 :            : //-------------------------------------------------------------------------
     102 [ #  # ][ #  # ]:          0 : FacetPoint::~FacetPoint() 
     103                 :            : {
     104 [ #  # ][ #  # ]:          0 :   if (iCreated && myPoint != NULL)
     105                 :            :   {
     106 [ #  # ][ #  # ]:          0 :     delete myPoint;
     107                 :            :   }
     108                 :          0 :   myPoint = NULL;
     109         [ #  # ]:          0 : }
     110                 :            : 
     111                 :            : //-------------------------------------------------------------------------
     112                 :            : // Purpose       : The purpose of this function is to append a
     113                 :            : //                 attribute to the GE. The name is attached to the 
     114                 :            : //                 underlying solid model entity this one points to.
     115                 :            : //
     116                 :            : //
     117                 :            : // Special Notes : 
     118                 :            : //
     119                 :            : // Creator       : Steve Owen
     120                 :            : //
     121                 :            : // Creation Date : 07/16/00
     122                 :            : //-------------------------------------------------------------------------
     123                 :        616 : void FacetPoint::append_simple_attribute_virt(const CubitSimpleAttrib &csa)
     124                 :        616 :   { attribSet.append_attribute(csa); }
     125                 :            : 
     126                 :            : //-------------------------------------------------------------------------
     127                 :            : // Purpose       : The purpose of this function is to remove a simple 
     128                 :            : //                 attribute attached to this geometry entity. The name is 
     129                 :            : //                 removed from the underlying BODY this points to.
     130                 :            : //
     131                 :            : // Special Notes : 
     132                 :            : //
     133                 :            : // Creator       : Steve Owen
     134                 :            : //
     135                 :            : // Creation Date : 07/16/00
     136                 :            : //-------------------------------------------------------------------------
     137                 :       3520 : void FacetPoint::remove_simple_attribute_virt(const CubitSimpleAttrib &csa)
     138                 :       3520 :   { attribSet.remove_attribute(csa); }
     139                 :            : 
     140                 :            : //-------------------------------------------------------------------------
     141                 :            : // Purpose       : The purpose of this function is to remove all simple 
     142                 :            : //                 attributes attached to this geometry entity.  Also
     143                 :            : //                 removes lingering GTC attributes.
     144                 :            : //
     145                 :            : //
     146                 :            : // Special Notes : 
     147                 :            : //
     148                 :            : // Creator       : Steve Owen
     149                 :            : //
     150                 :            : // Creation Date : 07/16/00
     151                 :            : //-------------------------------------------------------------------------
     152                 :       1078 : void FacetPoint::remove_all_simple_attribute_virt()
     153                 :       1078 :   { attribSet.remove_all_attributes(); }
     154                 :            : 
     155                 :            : //-------------------------------------------------------------------------
     156                 :            : // Purpose       : The purpose of this function is to get the  
     157                 :            : //                 attributes attached to this geometry entity. The name is 
     158                 :            : //                 attached to the underlying BODY this points to.
     159                 :            : //
     160                 :            : // Special Notes : 
     161                 :            : //
     162                 :            : // Creator       : Steve Owen
     163                 :            : //
     164                 :            : // Creation Date : 07/16/00
     165                 :            : //-------------------------------------------------------------------------
     166                 :        550 : CubitStatus FacetPoint::get_simple_attribute(DLIList<CubitSimpleAttrib>&
     167                 :            :                                                csa_list)
     168                 :        550 :   { return attribSet.get_attributes(csa_list); }
     169                 :       2376 : CubitStatus FacetPoint::get_simple_attribute(const CubitString& name,
     170                 :            :                                      DLIList<CubitSimpleAttrib>& csa_list )
     171                 :       2376 :   { return attribSet.get_attributes( name, csa_list ); }
     172                 :            : 
     173                 :        330 : CubitStatus FacetPoint::save_attribs( FILE *file_ptr )
     174                 :        330 :   { return attribSet.save_attributes(file_ptr); }
     175                 :            : 
     176                 :        176 : CubitStatus FacetPoint::restore_attribs( FILE *file_ptr, unsigned int endian )
     177                 :        176 :   { return attribSet.restore_attributes(file_ptr, endian); }
     178                 :            : 
     179                 :            : 
     180                 :            : //-------------------------------------------------------------------------
     181                 :            : // Purpose       : Returns the coordinates of this Point. 
     182                 :            : //
     183                 :            : // Special Notes :
     184                 :            : //
     185                 :            : // Creator       : Steve Owen
     186                 :            : //
     187                 :            : // Creation Date : 07/16/00
     188                 :            : //-------------------------------------------------------------------------
     189                 :       2640 : CubitVector FacetPoint::coordinates() const
     190                 :            : {
     191                 :       2640 :   return myPoint->coordinates();
     192                 :            : }
     193                 :            : 
     194                 :            : //-------------------------------------------------------------------------
     195                 :            : // Purpose       : Get geometry modeling engine: FacetGeometryEngine
     196                 :            : //
     197                 :            : // Special Notes :
     198                 :            : //
     199                 :            : // Creator       : Steve Owen
     200                 :            : //
     201                 :            : // Creation Date : 07/16/00
     202                 :            : //-------------------------------------------------------------------------
     203                 :          0 : GeometryQueryEngine* FacetPoint::get_geometry_query_engine() const
     204                 :            : {
     205                 :          0 :   return FacetQueryEngine::instance();
     206                 :            : }                 
     207                 :            : 
     208                 :            : //-------------------------------------------------------------------------
     209                 :            : // Purpose       : Get the bounding box of the object.
     210                 :            : //
     211                 :            : // Special Notes :
     212                 :            : //
     213                 :            : // Creator       : Steve Owen
     214                 :            : //
     215                 :            : // Creation Date : 07/16/00
     216                 :            : //-------------------------------------------------------------------------
     217                 :          0 : CubitBox FacetPoint::bounding_box() const 
     218                 :            : {
     219         [ #  # ]:          0 :   CubitVector temp_vector = this->coordinates();
     220         [ #  # ]:          0 :   CubitBox temp_box(temp_vector);
     221                 :          0 :   return temp_box;
     222                 :            : }
     223                 :            : 
     224                 :            : 
     225                 :            : /*
     226                 :            : void FacetPoint::bodysms(DLIList<BodySM*> &bodies)
     227                 :            : {
     228                 :            :   int ii;
     229                 :            :   for ( ii = myCurves.size(); ii > 0; ii-- )
     230                 :            :   {
     231                 :            :     myCurves.get_and_step()->bodysms(bodies);
     232                 :            :   }
     233                 :            : }
     234                 :            : 
     235                 :            : void FacetPoint::lumps(DLIList<Lump*> &lumps)
     236                 :            : {
     237                 :            :   int ii;
     238                 :            :   for ( ii = myCurves.size(); ii > 0; ii-- )
     239                 :            :   {
     240                 :            :     myCurves.get_and_step()->lumps(lumps);
     241                 :            :   }
     242                 :            : }
     243                 :            : 
     244                 :            : void FacetPoint::shellsms(DLIList<ShellSM*> &shellsms)
     245                 :            : {
     246                 :            :   int ii;
     247                 :            :   for ( ii = myCurves.size(); ii > 0; ii-- )
     248                 :            :   {
     249                 :            :     myCurves.get_and_step()->shellsms(shellsms);
     250                 :            :   }
     251                 :            : }
     252                 :            : 
     253                 :            : void FacetPoint::surfaces(DLIList<Surface*> &surfaces)
     254                 :            : {
     255                 :            :   int ii;
     256                 :            :   for ( ii = myCurves.size(); ii > 0; ii-- )
     257                 :            :   {
     258                 :            :     myCurves.get_and_step()->surfaces(surfaces);
     259                 :            :   }
     260                 :            : }
     261                 :            : 
     262                 :            : void FacetPoint::loopsms(DLIList<LoopSM*> &loopsms)
     263                 :            : {
     264                 :            :   int ii;
     265                 :            :   for ( ii = myCurves.size(); ii > 0; ii-- )
     266                 :            :   {
     267                 :            :     myCurves.get_and_step()->loopsms(loopsms);
     268                 :            :   }
     269                 :            : }
     270                 :            : 
     271                 :            : void FacetPoint::coedgesms(DLIList<CoEdgeSM*> &coedgesms)
     272                 :            : {
     273                 :            :   int ii;
     274                 :            :   for ( ii = myCurves.size(); ii > 0; ii-- )
     275                 :            :   {
     276                 :            :      myCurves.get_and_step()->coedgesms(coedgesms);
     277                 :            :   }
     278                 :            : }
     279                 :            : 
     280                 :            : 
     281                 :            : void FacetPoint::curves(DLIList<Curve*> &curves)
     282                 :            : {
     283                 :            :   int ii;
     284                 :            :   for ( ii = myCurves.size(); ii > 0; ii-- )
     285                 :            :   {
     286                 :            :     curves.append_unique( myCurves.get_and_step() );
     287                 :            :   }
     288                 :            : }
     289                 :            : 
     290                 :            : void FacetPoint::points(DLIList<Point*> &points)
     291                 :            : {
     292                 :            :   points.append_unique( this );
     293                 :            : }
     294                 :            : */
     295                 :            : 
     296                 :            : 
     297                 :        264 : void FacetPoint::get_parents_virt( DLIList<TopologyBridge*>& parents ) 
     298 [ +  - ][ +  + ]:       1056 :   { CAST_LIST_TO_PARENT( myCurves, parents ); }
     299                 :          0 : void FacetPoint::get_children_virt( DLIList<TopologyBridge*>& ) 
     300                 :          0 :   {  }
     301                 :            : 
     302                 :            : 
     303                 :          0 : void FacetPoint::get_lumps( DLIList<FacetLump*>& result_list )
     304                 :            : {
     305         [ #  # ]:          0 :   DLIList<FacetShell*> shell_list;
     306         [ #  # ]:          0 :   get_shells( shell_list );
     307         [ #  # ]:          0 :   shell_list.reset();
     308 [ #  # ][ #  # ]:          0 :   for ( int i = shell_list.size(); i--; )
     309                 :            :   {
     310         [ #  # ]:          0 :     FacetShell* shell = shell_list.get_and_step();
     311         [ #  # ]:          0 :     shell->get_lumps( result_list );
     312 [ #  # ][ #  # ]:          0 :     FacetLump* lump = dynamic_cast<FacetLump*>(shell->get_lump());
     313         [ #  # ]:          0 :     if (lump)
     314         [ #  # ]:          0 :       result_list.append_unique(lump);
     315         [ #  # ]:          0 :   }
     316                 :          0 : }
     317                 :            : 
     318                 :          0 : void FacetPoint::get_shells( DLIList<FacetShell*>& result_list )
     319                 :            : {
     320         [ #  # ]:          0 :   DLIList<FacetSurface*> surface_list;
     321 [ #  # ][ #  # ]:          0 :   DLIList<FacetShell*> temp_list;
     322         [ #  # ]:          0 :   get_surfaces( surface_list );
     323         [ #  # ]:          0 :   surface_list.reset();
     324 [ #  # ][ #  # ]:          0 :   for ( int i = surface_list.size(); i--; )
     325                 :            :   {
     326         [ #  # ]:          0 :     FacetSurface* surface = surface_list.get_and_step();
     327         [ #  # ]:          0 :     temp_list.clean_out();
     328         [ #  # ]:          0 :     surface->get_shells( temp_list );
     329         [ #  # ]:          0 :     result_list.merge_unique( temp_list );
     330         [ #  # ]:          0 :   }
     331                 :          0 : }
     332                 :            : 
     333                 :          0 : void FacetPoint::get_surfaces( DLIList<FacetSurface*>& result_list )
     334                 :            : {
     335         [ #  # ]:          0 :   DLIList<FacetLoop*> loop_list;
     336         [ #  # ]:          0 :   get_loops( loop_list );
     337         [ #  # ]:          0 :   loop_list.reset();
     338 [ #  # ][ #  # ]:          0 :   for ( int i = loop_list.size(); i--; )
     339                 :            :   {
     340         [ #  # ]:          0 :     FacetLoop* loop = loop_list.get_and_step();
     341 [ #  # ][ #  # ]:          0 :     FacetSurface* surface = dynamic_cast<FacetSurface*>(loop->get_surface());
     342         [ #  # ]:          0 :     if (surface)
     343         [ #  # ]:          0 :       result_list.append_unique(surface);
     344         [ #  # ]:          0 :   }
     345                 :          0 : }
     346                 :            : 
     347                 :          0 : void FacetPoint::get_loops( DLIList<FacetLoop*>& result_list )
     348                 :            : {
     349         [ #  # ]:          0 :   DLIList<FacetCoEdge*> coedge_list;
     350         [ #  # ]:          0 :   get_coedges( coedge_list );
     351         [ #  # ]:          0 :   coedge_list.reset();
     352 [ #  # ][ #  # ]:          0 :   for ( int i = coedge_list.size(); i--; )
     353                 :            :   {
     354         [ #  # ]:          0 :     FacetCoEdge* coedge = coedge_list.get_and_step();
     355 [ #  # ][ #  # ]:          0 :     FacetLoop* loop = dynamic_cast<FacetLoop*>(coedge->get_loop());
     356         [ #  # ]:          0 :     if (loop)
     357         [ #  # ]:          0 :       result_list.append_unique(loop);
     358         [ #  # ]:          0 :   }
     359                 :          0 : }
     360                 :            : 
     361                 :          0 : void FacetPoint::get_coedges( DLIList<FacetCoEdge*>& result_list )
     362                 :            : {
     363         [ #  # ]:          0 :   DLIList<FacetCurve*> curve_list;
     364         [ #  # ]:          0 :   get_curves( curve_list );
     365         [ #  # ]:          0 :   curve_list.reset();
     366 [ #  # ][ #  # ]:          0 :   for ( int i = curve_list.size(); i--; )
     367 [ #  # ][ #  # ]:          0 :     curve_list.get_and_step()->get_coedges( result_list );
                 [ #  # ]
     368                 :          0 : }
     369                 :            : 
     370                 :        176 : void FacetPoint::get_curves( DLIList<FacetCurve*>& result_list )
     371                 :            : {
     372                 :        176 :   myCurves.reset();
     373         [ +  + ]:        704 :   for ( int i = 0; i < myCurves.size(); i++ )
     374 [ +  - ][ -  + ]:        528 :     if ( FacetCurve* curve = dynamic_cast<FacetCurve*>(myCurves.next(i)) )
                 [ +  - ]
     375         [ +  - ]:        528 :       result_list.append(curve);
     376                 :        176 : }
     377                 :            : 
     378                 :            : //-------------------------------------------------------------------------
     379                 :            : // Purpose       : Tear down topology
     380                 :            : //
     381                 :            : // Special Notes : 
     382                 :            : //
     383                 :            : // Creator       : Jason Kraftcheck
     384                 :            : //
     385                 :            : // Creation Date : 09/29/03
     386                 :            : //-------------------------------------------------------------------------
     387                 :          0 : CubitStatus FacetPoint::disconnect_curve (FacetCurve* curve)
     388                 :            : {
     389 [ #  # ][ #  # ]:          0 :   if (!myCurves.move_to(curve))
     390                 :          0 :     return CUBIT_FAILURE;
     391                 :          0 :   myCurves.remove();
     392                 :            :   
     393         [ #  # ]:          0 :   if (curve->start_point() == this)
     394                 :          0 :     curve->remove_start_point();
     395                 :            :   
     396         [ #  # ]:          0 :   if (curve->end_point() == this)
     397                 :          0 :     curve->remove_end_point();
     398                 :            :   
     399                 :          0 :   return CUBIT_SUCCESS;
     400 [ +  - ][ +  - ]:       6540 : }
     401                 :            :   
     402                 :            : 
     403                 :            : // ********** END PUBLIC FUNCTIONS         **********
     404                 :            : 
     405                 :            : // ********** BEGIN PROTECTED FUNCTIONS    **********
     406                 :            : // ********** END PROTECTED FUNCTIONS      **********
     407                 :            : 
     408                 :            : // ********** BEGIN PRIVATE FUNCTIONS      **********
     409                 :            : // ********** END PRIVATE FUNCTIONS        **********
     410                 :            : 
     411                 :            : // ********** BEGIN HELPER CLASSES         **********
     412                 :            : // ********** END HELPER CLASSES           **********
     413                 :            : 
     414                 :            : // ********** BEGIN EXTERN FUNCTIONS       **********
     415                 :            : // ********** END EXTERN FUNCTIONS         **********
     416                 :            : 
     417                 :            : // ********** BEGIN STATIC FUNCTIONS       **********
     418                 :            : // ********** END STATIC FUNCTIONS         **********

Generated by: LCOV version 1.11