LCOV - code coverage report
Current view: top level - geom/cgm - MergeTool.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 7 18 38.9 %
Date: 2020-06-30 00:58:45 Functions: 2 4 50.0 %
Branches: 3 8 37.5 %

           Branch data     Line data    Source code
       1                 :            : //- Class:       MergeTool
       2                 :            : //- Description: Location of all Merge and Unmerge functionality
       3                 :            : //- Owner:       Steven Jankovich
       4                 :            : //- Created: 27 April 1998
       5                 :            : //- Checked By:  
       6                 :            : //- Version: $Id: 
       7                 :            : 
       8                 :            : #ifndef MERGETOOL_HPP
       9                 :            : #define MERGETOOL_HPP 
      10                 :            : 
      11                 :            : #include "CubitDefines.h"
      12                 :            : #include "GeometryDefines.h"
      13                 :            : #include "CpuTimer.hpp"
      14                 :            : #include "DLIList.hpp"
      15                 :            : #include "CGMGeomConfigure.h"
      16                 :            : 
      17                 :            : #include <typeinfo>
      18                 :            : 
      19                 :            : class MergeToolAssistant;
      20                 :            : 
      21                 :            : class RefEntity;
      22                 :            : class TopologyEntity;
      23                 :            : class BasicTopologyEntity;
      24                 :            : class GroupingEntity;
      25                 :            : class SenseEntity;
      26                 :            : class TopologyBridge;
      27                 :            : class GeometryEntity;
      28                 :            : 
      29                 :            : class RefFace;
      30                 :            : class RefEdge;
      31                 :            : class RefVertex;
      32                 :            : class Loop;
      33                 :            : class CoEdge;
      34                 :            : 
      35                 :            : class BodySM;
      36                 :            : class Body;
      37                 :            : class RefEntity;
      38                 :            : class RefVolume;
      39                 :            : class RefFace;
      40                 :            : class RefEdge;
      41                 :            : class RefVertex;
      42                 :            : class RefGroup;
      43                 :            : //template <class X> class DLIList;
      44                 :            : class GeometryEntity;
      45                 :            : class CAMergePartner;
      46                 :            : class UnMergeEvent;
      47                 :            : 
      48                 :            : class Surface;
      49                 :            : class Curve;
      50                 :            : class TBPoint;
      51                 :            : class LoopSM;
      52                 :            : class CoEdgeSM;
      53                 :            : 
      54                 :            : 
      55                 :            : 
      56                 :            : class CUBIT_GEOM_EXPORT MergeTool
      57                 :            : {
      58                 :            :    friend class CAMergePartner;
      59                 :            :    friend class OldUnmergeCode;
      60                 :            :    public :
      61                 :            :     
      62                 :            :    bool displayProgress;
      63                 :            :     // Show progress meter when merging
      64                 :            :    
      65                 :            :    static MergeTool* instance();
      66                 :            :      // Returns a static pointer to unique instance of this class.
      67                 :            :    
      68                 :            :    ~MergeTool();
      69                 :            :      //- Destructor.
      70                 :            :    
      71                 :        322 :     static void delete_instance()
      72                 :            :     {
      73         [ +  + ]:        322 :       if(instance_)
      74         [ +  - ]:         31 :         delete instance_;
      75                 :        322 :       instance_ = NULL;
      76                 :        322 :     }
      77                 :            :      
      78                 :            :     void imprint_merge_solutions_for_overlapping_surfaces(
      79                 :            :                                           RefFace *face1,
      80                 :            :                                           RefFace *face2,
      81                 :            :                                           bool execute,
      82                 :            :                                           DLIList<CubitString> &display_strings,
      83                 :            :                                           DLIList<CubitString> &command_strings,
      84                 :            :                                           DLIList<CubitString> &preview_strings );
      85                 :            : 
      86                 :            :    void merge_with_auto_imprint(RefFace *surf1, RefFace *surf2);
      87                 :            : 
      88                 :            :   //! Tests the entities in the list of bodies to see if they 
      89                 :            :   //! have been merged with other entities and result in
      90                 :            :   //! of multiple volumes.  This returns CUBIT_TRUE at the first
      91                 :            :   //! lower entity that shares two volumes.
      92                 :            :   CubitBoolean contains_merged_entities( DLIList<Body*> &bodies );
      93                 :            :   
      94                 :            :   //! Determines if the specified body conatins child entities that are merged.
      95                 :            :   CubitBoolean contains_merged_children( Body *body,
      96                 :            :                                          DLIList<RefEntity*> &merged_children );
      97                 :            : 
      98                 :            :   //! Tests the entities in the list to see if they or their descendents
      99                 :            :   //! have been merged with other entities
     100                 :            :   //! If merged_ref_ents is not NULL, fill it will all the merged ref entities. 
     101                 :            :   CubitBoolean contains_merged_entities( DLIList<RefEntity*> &ref_entities, 
     102                 :            :                                          DLIList<RefEntity*> *merged_ref_ents = NULL );
     103                 :            :   
     104                 :            :   //! Tests the entities in the list to see if their ANY children of ancestors 
     105                 :            :   //! have been merged with other entities
     106                 :            :   CubitBoolean parents_contain_merged_entities( DLIList<RefEntity*> &ref_entities);
     107                 :            :    
     108                 :            :   //! Takes a RefEntity, makes sure it is not a volume, and
     109                 :            :   //! checks to see if it has more than one volume.
     110                 :            :   CubitBoolean entity_merged( TopologyEntity *entity );
     111                 :            :    
     112                 :            :   //! Compare all RefFaces, RefEdges, and RefVertices in the
     113                 :            :   //! model and merge the matches
     114                 :            :   CubitStatus merge_all_bodies();
     115                 :            :    
     116                 :            :   //! Compare all RefFaces, RefEdges, and RefVertices in 
     117                 :            :   //! refbody_list and merge the matches
     118                 :            :   CubitStatus merge_bodies( DLIList<Body*>& refbody_list );
     119                 :            :    
     120                 :            :   //! Compare all RefFaces, RefEdges, and RefVertices in 
     121                 :            :   //! vol_list and merge the matches
     122                 :            :   CubitStatus merge_volumes( DLIList<RefVolume*>& vol_list,
     123                 :            :                              CubitBoolean print_info = CUBIT_TRUE );
     124                 :            :    
     125                 :            :   //! Compare all RefFaces in the model and merge the matches.
     126                 :            :   CubitStatus merge_all_reffaces();
     127                 :            :    
     128                 :            :   //! Compare all input RefFaces and merge the matches.
     129                 :            :   CubitStatus merge_reffaces_old( DLIList<RefFace*>& refface_list,
     130                 :            :                                CubitBoolean print_info = CUBIT_TRUE);
     131                 :            :    
     132                 :            :   //! Compare all input RefFaces and merge the matches.
     133                 :            :   //! Uses AbstractTree rather than O(nlogn) comparisons.
     134                 :            :   CubitStatus merge_reffaces( DLIList<RefFace*>& refface_list,
     135                 :            :                                CubitBoolean print_info = CUBIT_TRUE);
     136                 :            : 
     137                 :            :   //! Compare all RefEdges in the model and merge the matches.
     138                 :            :   CubitStatus merge_all_refedges();
     139                 :            :   
     140                 :            :   //! Merges specified curves.  List should contains max 20 curves.
     141                 :            :   CubitStatus old_merge_refedges( DLIList<RefEdge*>& refedge_list,
     142                 :            :                                CubitBoolean should_clean_out = CUBIT_TRUE,
     143                 :            :                                CubitBoolean print_info = CUBIT_TRUE);
     144                 :            : 
     145                 :            :   //! Compare all input RefEdges and merge the matches
     146                 :            :   //! BE CAREFUL with the should_clean_out flag.  If you set
     147                 :            :   //! it to false, then YOU (the caller) are responsible for
     148                 :            :   //! cleaning out the deactivated geometry.
     149                 :            :   //! Merges specified curves.  If list contains < 20 curves, use old_merge_ref_edges.
     150                 :            :   CubitStatus merge_refedges( DLIList<RefEdge*>& refedge_list,
     151                 :            :                                CubitBoolean should_clean_out = CUBIT_TRUE,
     152                 :            :                                CubitBoolean print_info = CUBIT_TRUE);
     153                 :            :    
     154                 :            :   //! Compare all RefVertices in the model and merge the matches
     155                 :            :   CubitStatus merge_all_refvertices();
     156                 :            :   
     157                 :            :   //! Compare all input RefVertices and merge the matches. For lists < 20
     158                 :            :   CubitStatus old_merge_refvertices( DLIList<RefVertex*>& refvertex_list,
     159                 :            :                                      CubitBoolean print_info = CUBIT_TRUE );
     160                 :            : 
     161                 :            :   //! Compare all input RefVertices and merge the matches.
     162                 :            :   CubitStatus merge_refvertices( DLIList<RefVertex*>& refvertex_list,
     163                 :            :                                  CubitBoolean print_info = CUBIT_TRUE );
     164                 :            :    
     165                 :            :   //! merge the entities in list; asserts if they're not all the same type
     166                 :            :   CubitStatus merge_entities( DLIList<RefEntity*>& entity_list,
     167                 :            :                                CubitBoolean should_clean_out = CUBIT_TRUE,
     168                 :            :                                CubitBoolean print_info = CUBIT_TRUE);
     169                 :            :    
     170                 :            :   //! Unmerge everything.
     171                 :            :   CubitStatus unmerge_all();
     172                 :            :    
     173                 :            :   //! Unmerge entities in list.
     174                 :            :   //! If decend is true, will decend topology graph, unmerging child topology
     175                 :            :   //! of the passed topology.  If decend is false, a.) passing bodies or volumes
     176                 :            :   //! in entity list will have no effect and b.) when a surface is unmerged
     177                 :            :   //! its child curves will not be unmerged, and the child vertices will not be 
     178                 :            :   //! unmerged when an edge is unmerged.
     179                 :            :   CubitStatus unmerge( DLIList<RefEntity*>& entity_list, CubitBoolean descend = CUBIT_TRUE );
     180                 :            :    
     181                 :            :   //@{
     182                 :            :   //! Unmerge the passed entity.  All parents must already be
     183                 :            :   //! unmerged.  
     184                 :            :   //! If decend is true, will decend topology graph, unmerging child topology
     185                 :            :   //! of the passed topology.  If decend is false, a.) passing bodies or volumes
     186                 :            :   //! in entity list will have no effect and b.) when a surface is unmerged
     187                 :            :   //! its child curves will not be unmerged, and the child vertices will not be 
     188                 :            :   //! unmerged when an edge is unmerged.
     189                 :            :   CubitStatus unmerge( RefEntity* entity_ptr, CubitBoolean descend = CUBIT_TRUE );
     190                 :            :   CubitStatus unmerge( RefFace*   face_ptr,   CubitBoolean descend = CUBIT_TRUE, DLIList<RefFace*> *new_faces = NULL );
     191                 :            :   CubitStatus unmerge( RefEdge*   edge_ptr,   CubitBoolean descend = CUBIT_TRUE, DLIList<RefEdge*> *new_curves = NULL );
     192                 :            :   CubitStatus unmerge( Body*      body_ptr   );
     193                 :            :   CubitStatus unmerge( RefVolume* vol_ptr    );
     194                 :            :   CubitStatus unmerge( RefVertex* vertex_ptr, DLIList<RefVertex*> *new_verts = NULL );
     195                 :            :   //@}
     196                 :            :      
     197                 :            :   //! Return number of entities unmerged in last call to one
     198                 :            :   //! of the unmerge methods.  If an entity list is passed,
     199                 :            :   //! it will be populated with unmerged entities.
     200                 :            :   int unmerged_entities( DLIList<RefEntity*>* entities = NULL ) const;
     201                 :            :      
     202                 :            :   //! Unmerge such that the group of entities in
     203                 :            :   //! separate_list share no topology with the entities
     204                 :            :   //! in from_list, or if from_list is is null, any other
     205                 :            :   //! entities.
     206                 :            :   CubitStatus separate_bodies( DLIList<Body*>& separate_list,
     207                 :            :                                  DLIList<Body*>* from_list = NULL );
     208                 :            :   
     209                 :            :   //@{
     210                 :            :   //! Unmerge such that the group of entities in
     211                 :            :   //! separate_list share no topology with the entities
     212                 :            :   //! in from_list, or if from_list is is null, any other
     213                 :            :   //! entities.
     214                 :            :   CubitStatus separate_volumes( DLIList<RefVolume*>& separate_list,
     215                 :            :                                 DLIList<RefVolume*>* from_list = NULL );
     216                 :            :   //@}
     217                 :            :   
     218                 :            :   //@{
     219                 :            :   //! Unmerge such that the group of entities in
     220                 :            :   //! separate_list share no topology with the entities
     221                 :            :   //! in from_list, or if from_list is is null, any other
     222                 :            :   //! entities.
     223                 :            :   CubitStatus separate_faces( DLIList<RefFace*>& separate_list,
     224                 :            :                               DLIList<RefFace*>* from_list = NULL );
     225                 :            :   //@}
     226                 :            :  
     227                 :            :   //@{
     228                 :            :   //! Unmerge such that the group of entities in
     229                 :            :   //! separate_list share no topology with the entities
     230                 :            :   //! in from_list, or if from_list is is null, any other
     231                 :            :   //! entities.
     232                 :            :   CubitStatus separate_edges( DLIList<RefEdge*>& separate_list,
     233                 :            :                               DLIList<RefEdge*>* from_list = NULL );
     234                 :            :   //@}
     235                 :            :   
     236                 :            :   //@{
     237                 :            :   //! Force the merging of entities.  
     238                 :            :   //! Entities must have like topology though, i.e, 
     239                 :            :   //! two surfaces must have the same number of vertices and curves.
     240                 :            :   RefFace* force_merge( RefFace* face1, RefFace* face2 );
     241                 :            :   RefEdge* force_merge( RefEdge* edge1, RefEdge* edge2 );
     242                 :            :   RefVertex* force_merge( RefVertex* vtx1, RefVertex* vtx2 );
     243                 :            :   RefEntity* force_merge( RefEntity* ent1, RefEntity* ent2 );
     244                 :            :   RefEntity* force_merge( const DLIList<RefEntity*>& list );
     245                 :            :   
     246                 :            :   //! Tells us to group the results or not.
     247                 :            :   static void group_results( CubitBoolean t_or_f );
     248                 :            :   
     249                 :            :   //@{
     250                 :            :   //! Get/Sets flag for producing new ids when unmerging.
     251                 :            :   static void set_new_ids_on_unmerge( CubitBoolean value );
     252                 :            :   static CubitBoolean get_new_ids_on_unmerge();
     253                 :            :   //@}
     254                 :            : 
     255                 :            :   //! Resets all member variables in this calls to defaults.
     256                 :            :   static void initialize_settings();
     257                 :            :   
     258                 :            :   //! Notifies MergeTool about comparisons found and put on ref entities
     259                 :            :   void compare_notify(RefEntity *entity);
     260                 :            :   
     261                 :            :   //! Remove TDCompares from RefEntities.
     262                 :            :   void remove_compare_data();
     263                 :            :     
     264                 :            :   void add_merge_tool_assistant( MergeToolAssistant* mta_ptr );
     265                 :            :   void remove_merge_tool_assistant( MergeToolAssistant* mta_ptr );
     266                 :            :   MergeToolAssistant* find_merge_tool_assistant( const std::type_info& type );
     267                 :            :   
     268                 :       1880 :   static void destroy_dead_geometry( CubitBoolean yes_no )
     269                 :       1880 :     { destroyDeadGeometry = yes_no; }
     270                 :            : 
     271                 :            :   //! This function is to be used only right
     272                 :            :   //! after merging is called.  It is a way to
     273                 :            :   //! access the groups that are created during the
     274                 :            :   //! merge.  Note the groups can be destroyed
     275                 :            :   //! and these pointers can be stale if the
     276                 :            :   //! function is not called immediatly following merging...
     277                 :            :   RefGroup* get_group_last_merged_surfs()
     278                 :            :   {
     279                 :            :       //clear this out once this function has been called.
     280                 :            :     RefGroup *temp = lastSurfsMerged;
     281                 :            :     lastSurfsMerged = NULL;
     282                 :            :     return temp;
     283                 :            :   }
     284                 :            : 
     285                 :            : 
     286                 :            :   //! This function is to be used only right
     287                 :            :   //! after merging is called.  It is a way to
     288                 :            :   //! access the groups that are created during the
     289                 :            :   //! merge.  Note the groups can be destroyed
     290                 :            :   //! and these pointers can be stale if the
     291                 :            :   //! function is not called immediatly following merging...
     292                 :            :   RefGroup* get_group_last_merged_curvs()
     293                 :            :   {
     294                 :            :     //clear this out once this function has been called.
     295                 :            :     RefGroup *temp = lastCurvsMerged;
     296                 :            :     lastCurvsMerged = NULL;
     297                 :            :     return temp;
     298                 :            :   }
     299                 :            : 
     300                 :            :   //! This function is to be used only right
     301                 :            :   //! after merging is called.  It is a way to
     302                 :            :   //! access the groups that are created during the
     303                 :            :   //! merge.  Note the groups can be destroyed
     304                 :            :   //! and these pointers can be stale if the
     305                 :            :   //! function is not called immediatly following merging...
     306                 :            :   RefGroup* get_group_last_merged_verts()
     307                 :            :   {
     308                 :            :       //clear this out once this function has been called.
     309                 :            :     RefGroup *temp = lastVertsMerged;
     310                 :            :     lastVertsMerged = NULL;
     311                 :            :     return temp;
     312                 :            :   }
     313                 :            : 
     314                 :            : 
     315                 :            :   //! From the specified list of entities, find mergeable surfaces, curves,
     316                 :            :   //! and vertices.  If two surfaces are found to be mergeable, their mergeable 
     317                 :            :   //! children, i.e, curves and vertices, are not included reported. 
     318                 :            :   //! Note:  The caller of the following 4 functions is responsible to 
     319                 :            :   //! delete the DLIList*s that are returned.
     320                 :            :   CubitStatus find_mergeable_refentities( DLIList<RefEntity*> &entities,
     321                 :            :               DLIList< DLIList<RefFace*>*> &lists_of_mergeable_ref_faces,
     322                 :            :               DLIList< DLIList<RefEdge*>*> &lists_of_mergeable_ref_edges,
     323                 :            :               DLIList< DLIList<RefVertex*>*> &lists_of_mergeable_ref_vertices);
     324                 :            : 
     325                 :            :   //! From the specified list of entities, find mergeable surfaces.
     326                 :            :   //! Note:  The caller of this function responsible for  
     327                 :            :   //! deleting the DLIList*s that are returned.
     328                 :            :   CubitStatus find_mergeable_reffaces( DLIList<RefEntity*> &entities,
     329                 :            :               DLIList< DLIList<RefFace*>*> &lists_of_mergeable_ref_faces,
     330                 :            :               bool clean_up_compare_data = true );
     331                 :            : 
     332                 :            :   //! From the specified list of entities, find mergeable curves.
     333                 :            :   //! Note:  The caller of this function responsible for  
     334                 :            :   //! deleting the DLIList*s that are returned.
     335                 :            :   CubitStatus find_mergeable_refedges( DLIList<RefEntity*> &entities,
     336                 :            :               DLIList< DLIList<RefEdge*>*> &lists_of_mergeable_ref_edges,
     337                 :            :               bool clean_up_compare_data = true );
     338                 :            : 
     339                 :            :   //! From the specified list of entities, find mergeable vertices.
     340                 :            :   //! Note:  The caller of this function responsible for  
     341                 :            :   //! deleting the DLIList*s that are returned.
     342                 :            :   CubitStatus find_mergeable_refvertices( DLIList<RefEntity*> &entities,
     343                 :            :               DLIList< DLIList<RefVertex*>*> &lists_of_mergeable_ref_vertices,
     344                 :            :               bool clean_up_compare_data = true );
     345                 :            : 
     346                 :            :  
     347                 :            :   //@{
     348                 :            :   //! Faster comparison that only checks for mergeable RefEdge 
     349                 :            :   //! or curves between bodies, surfaces, or curves.  
     350                 :            :   //! It reports all edges, even if the owning faces are mergeable
     351                 :            :   CubitStatus find_only_mergeable_curves( DLIList<Surface*> &surf_list, 
     352                 :            :                  DLIList< DLIList<Curve*>*> &lists_of_mergeable_curves, double input_tol = -1.0 );
     353                 :            :   CubitStatus find_only_mergeable_curves( DLIList<Curve*> &all_curves, 
     354                 :            :                  DLIList< DLIList<Curve*>*> &lists_of_mergeable_curves, double input_tol = -1.0 );
     355                 :            :   CubitStatus find_only_mergeable_curves( DLIList<BodySM*> &body_list, 
     356                 :            :                  DLIList< DLIList<Curve*>*> &lists_of_mergeable_curves, double input_tol = -1.0 );
     357                 :            :    CubitStatus find_only_mergeable_refedges( DLIList<Body*> &body_list, 
     358                 :            :                   DLIList< DLIList<RefEdge*>*> &lists_of_mergeable_ref_edges );
     359                 :            :   //@}
     360                 :            : 
     361                 :            :   //! Faster comparison that only checks for mergeable surfaces. 
     362                 :            :   CubitStatus find_only_mergeable_surfaces( DLIList<BodySM*> &body_list, 
     363                 :            :                  DLIList< DLIList<Surface*>*> &lists_of_mergeable_surfaces);
     364                 :            : 
     365                 :            :   //! Faster comparison that only checks for mergeable surfaces. 
     366                 :            :   CubitStatus find_only_mergeable_surfaces( DLIList<BodySM*> &body_list, 
     367                 :            :                  DLIList< DLIList<Surface*>*> &lists_of_mergeable_surfaces, const double tol );
     368                 :            : 
     369                 :            : 
     370                 :            :   //! Check for mergeability of two surfaces. 
     371                 :            :   CubitBoolean about_spatially_equal( Surface *surf_1, Surface *surf_2,
     372                 :            :                                       double tolerance_factor );
     373                 :            : 
     374                 :            :   //! Check for mergeability of two loops. 
     375                 :            :   CubitBoolean about_spatially_equal( LoopSM *loop_1, LoopSM *loop_2, 
     376                 :            :                                       CubitSense relative_sense, double tolerance_factor );
     377                 :            : 
     378                 :            :   //! Check for mergeability of two coedges. 
     379                 :            :   CubitBoolean about_spatially_equal( CoEdgeSM *coedge_1, CoEdgeSM *coedge_2, 
     380                 :            :                                       CubitSense relative_sense, double tolerance_factor );
     381                 :            : 
     382                 :            :   //! Check for mergeability of two curves. 
     383                 :            :   CubitBoolean about_spatially_equal( Curve *curve_1, Curve *curve_2, 
     384                 :            :                                       CubitSense &relative_sense, double tolerance_factor );
     385                 :            : 
     386                 :            :   //! Check for mergeability of two points. 
     387                 :            :   CubitBoolean about_spatially_equal( TBPoint *point_1, TBPoint *point_2, 
     388                 :            :                                       double tolerance_factor );
     389                 :            :   
     390                 :            :   protected :
     391                 :            :    
     392                 :            :   //! Common implementation for public separate() functions.
     393                 :            :   //! All passed entities must be of the same type.
     394                 :            :   //! Unmerge such that the group of entities in
     395                 :            :   //! separate_list share no topology with the entities
     396                 :            :   //! in from_list, or if from_list is is null, any other
     397                 :            :   //! entities.
     398                 :            :   CubitStatus separate_entities( DLIList<TopologyEntity*>& separate_list,
     399                 :            :                                  DLIList<TopologyEntity*>* from_list = NULL );
     400                 :            :  
     401                 :            :   //! Check if the passed list of bridges can be unmerged and if
     402                 :            :   //! so, return their owning BTE.  If check_parents is false, skip
     403                 :            :   //! check for merged parents.
     404                 :            :   BasicTopologyEntity* can_separate( DLIList<TopologyBridge*>& bridge_list,
     405                 :            :                                      bool check_parents );
     406                 :            :   
     407                 :            :   //! Split a merged entity into two such that the returned, new
     408                 :            :   //! entity contains the passed list of bridges.  If descend
     409                 :            :   //! is false, skip attempt to unmerge child entities.
     410                 :            :   RefFace* separate_face( DLIList<Surface*>& bridges, bool descend );
     411                 :            :   
     412                 :            :   //! Split a merged entity into two such that the returned, new
     413                 :            :   //! entity contains the passed list of bridges.  If descend
     414                 :            :   //! is false, skip attempt to unmerge child entities.
     415                 :            :   RefEdge* separate_edge( DLIList<Curve*>& bridges, bool descend );
     416                 :            :    
     417                 :            :    RefVertex* separate_vertex( DLIList<TBPoint*>& bridges );
     418                 :            :     //- Split a merged entity into two such that the returned, new
     419                 :            :     //- entity contains the passed list of bridges. 
     420                 :            :     
     421                 :            :    void cleanup_unmerge();
     422                 :            :     //- Does post-processing for unmerge (sending events and such.)
     423                 :            :     
     424                 :            :    CubitStatus check_saved_id( BasicTopologyEntity* bte );
     425                 :            :     //- Used as part of unmerging.  If the original geometry
     426                 :            :     //- entity corresponding to the ID of the passed BTE has
     427                 :            :     //- been removed/unmerged from the BTE, assign the BTE a
     428                 :            :     //- new ID from it's current entities so that the new,
     429                 :            :     //- unmerged entity can be assigned the current ID.
     430                 :            : 
     431                 :            :     
     432                 :            :    private :
     433                 :            :    
     434                 :            :    static void warn_about_refface_sense( RefFace* face_ptr_1,
     435                 :            :                                          RefFace* face_ptr_2,
     436                 :            :                                          bool faces_reversed );
     437                 :            :    
     438                 :            :    static CubitBoolean destroyDeadGeometry;
     439                 :            :    
     440                 :            :    static MergeTool* instance_;
     441                 :            :      // Static pointer to unique instance of this class
     442                 :            :    
     443                 :            : 
     444                 :            :   RefGroup *lastSurfsMerged;
     445                 :            :   RefGroup *lastCurvsMerged;
     446                 :            :   RefGroup *lastVertsMerged;
     447                 :            :     ///
     448                 :            :     /// Contains pointers to the groups storing the most
     449                 :            :     /// recently merged surfaces, curves and vertices.
     450                 :            :     ///
     451                 :            :   
     452                 :            :   DLIList<MergeToolAssistant*> assistant_list_;
     453                 :            :     //- List of helper objects to handle updates outside the realm
     454                 :            :     //- of CGM, like updating mesh.
     455                 :            : 
     456                 :            :    static CubitBoolean groupResults;
     457                 :            :     //- Tells the tool to group the merging results.
     458                 :            :    
     459                 :            :   DLIList<RefEntity*>  compareEntityList;
     460                 :            :     //- A list containing entities that have found partners with
     461                 :            :     //- whom they compare.
     462                 :            : 
     463                 :            :   DLIList<RefEntity*>  mergeSurvivorEntityList;
     464                 :            :     //- A list containing entities that were involved in a merge
     465                 :            :     //- operation and survived.  
     466                 :            :     
     467                 :            :   DLIList<RefEntity*> new_unmerged;
     468                 :            :   DLIList<RefEntity*> old_unmerged;
     469                 :            :   CubitBoolean unmerged_list_in_use;
     470                 :            :      //- A list new entities created by unmerging, and a list of
     471                 :            :      //- existing entities that were unmerged, and a flag set by the highest
     472                 :            :      //- level method called to begin an unmerge.  The flag signifies
     473                 :            :      //- that lower-level methods should not clear the list when
     474                 :            :      //- starting/finishing, and should not try to update the graphics.
     475                 :            :      //-
     476                 :            :      //- Any method that sets unmerged_list_in_use to true MUST
     477                 :            :      //- set it to false before returning.
     478                 :            :      
     479                 :            :   CubitBoolean start_unmerge();
     480                 :            :   void end_unmerge( CubitBoolean top );
     481                 :            :      //- Handle setting unmerged_list_in_use, clearing lists,
     482                 :            :      //- and calling cleanup_unmerge().
     483                 :            : 
     484                 :            :    MergeTool();
     485                 :            :      //- Constructor for the MergeTool object
     486                 :            :    
     487                 :            :    CubitStatus merge_BTE( BasicTopologyEntity* keeper_entity,
     488                 :            :                           BasicTopologyEntity* dead_entity );
     489                 :            :      //R CubitStatus
     490                 :            :      //R- CUBIT_SUCCESS/FAILURE
     491                 :            :      //I keeper_entity, dead_entity
     492                 :            :      //I- The BasicTopologyEntities that are to be merged.
     493                 :            :      //- This function merges the two BasicTopologyEntities
     494                 :            : 
     495                 :            :    CubitBoolean compare_BTE( BasicTopologyEntity * keeper_entity,
     496                 :            :                              BasicTopologyEntity * dead_entity ) const;
     497                 :            :      //R CubitBoolean
     498                 :            :      //R- CUBIT_TRUE/CUBIT_FALSE
     499                 :            :      //I basicTopoEntityPtr
     500                 :            :      //I- The BTE that "this" BTE must be "compared" to.
     501                 :            :      //- This function compares "this" BasicTopologyEntity with
     502                 :            :      //- the input BasicTopologyEntity.  This is a spatial comparison.
     503                 :            :      //- IMPORTANT NOTE:
     504                 :            :      //- The actual spatial comparison of the underlying GeometricEntities 
     505                 :            :      //- is NOT done in this routine.  Before this routine is called,
     506                 :            :      //- the SolidModelingEngine compare routines would have to be called.
     507                 :            :      //- If matches are found there, the matching pairs of BTE's are tagged
     508                 :            :      //- with TDCompare objects (containing doubly-linked pointers).  This
     509                 :            :      //- function merely checks to see if these TD objects exist on the
     510                 :            :      //- "this" and basicTopoEntityPtr objects.  If they do, the function
     511                 :            :      //- checks their pointers to make sure they point to each other.
     512                 :            :      //- Returns CUBIT_SUCCESS if the comparison was successful.
     513                 :            :    
     514                 :            :    CubitStatus merge_GE( GroupingEntity* keeper_entity,
     515                 :            :                          GroupingEntity* dead_entity );
     516                 :            :      //R CubitStatus
     517                 :            :      //R- CUBIT_SUCCESS/CUBIT_FAILURE
     518                 :            :      //I keeper_entity, dead_entity
     519                 :            :      //I- The GroupingEntities that are to be merged.
     520                 :            :      //- This function merges the two GroupingEntities
     521                 :            : 
     522                 :            :    CubitBoolean compare_GE( GroupingEntity* keeper_entity,
     523                 :            :                             GroupingEntity* dead_entity );
     524                 :            :      //R CubitBoolean
     525                 :            :      //R- CUBIT_TRUE/CUBIT_FALSE
     526                 :            :      //I dead_GroupingEntityPtr
     527                 :            :      //I- This GroupingEntity with which comparision is to be done.
     528                 :            :      //- This function patially compares this GroupingEntity to the input 
     529                 :            :      //- GroupingEntity. The function returns CUBIT_TRUE if the two
     530                 :            :      //- objects are spatially equal, CUBIT_FALSE otherwise.
     531                 :            :      //- MJP NOTE:
     532                 :            :      //- The first trial check that is done is to make sure that the
     533                 :            :      //- GroupingEntities have the same number of SenseEntities.
     534                 :            :      //- If they do not, then we ASSUME that the GroupingEntities
     535                 :            :      //- are not spatially equal.  This is not strictly a good
     536                 :            :      //- assumption, but we don't have a more exact algorithm
     537                 :            :      //- that takes care of the case where, for example, the number 
     538                 :            :      //- of RefEdges associated with two Loops are different, but
     539                 :            :      //- the Loops themselves are spatialy equal.  Consider the case
     540                 :            :      //- of 2 Loops representing the exact same square -- one can
     541                 :            :      //- have 4 RefEdges and the other could have 5 (just bisect one
     542                 :            :      //- of the previous ones...)   
     543                 :            :    
     544                 :            :    CubitStatus compare_and_merge( CubitBoolean merge_flag,
     545                 :            :                                   GroupingEntity* keeper_entity,
     546                 :            :                                   GroupingEntity* dead_entity );
     547                 :            :      //R CubitStatus
     548                 :            :      //R- the result of spatial comparison if if_merge is CUBIT_FALSE,
     549                 :            :      //R- or the result of merge if if_merge is CUBIT_TRUE
     550                 :            :      //I if_merge
     551                 :            :      //I- If this flag is CUBIT_TRUE, whenever find the matching SenseEntities,
     552                 :            :      //I do the merge. otherwise, skip the merge block.
     553                 :            :      //- This private function always do the spatially comparison of "this"
     554                 :            :      //- GroupingEntity with the input GroupingEntity, by comparing the
     555                 :            :      //- associated SenseEntities of "this" and input GroupingEntity. If all
     556                 :            :      //- the SenseEntites associated with "this" GroupingEntity have matching
     557                 :            :      //- SenseEntity associated with the input GroupingEntity, then "this" and
     558                 :            :      //- the input GroupingEntity are spatially equal. 
     559                 :            :      //- SPECIAL NOTES : 
     560                 :            :      //  Merging the OSME's and merging links are done in merge()
     561                 :            :      //  function. In this function, ONLY the matching SenseEntities
     562                 :            :      //  can be merged when asked to merge them ( i.e., if_merge
     563                 :            :      //  flag is set to CUBIT_TRUE ).
     564                 :            :    
     565                 :            :    CubitStatus merge_SE( SenseEntity* keeper_entity,
     566                 :            :                          SenseEntity* dead_entity );
     567                 :            :      //R CubitStatus
     568                 :            :      //R- CUBIT_SUCCESS/CUBIT_FAILURE
     569                 :            :      //I dead_SenseEntityPtr
     570                 :            :      //I- A pointer to a SenseEntity which is about to be merged 
     571                 :            :      //I- with "this".
     572                 :            :      //- This function merges the input dead_SenseEntityPtr with this 
     573                 :            :      //- SenseEntity. If the operation can fail if the two entitys are
     574                 :            :      //- of different types (derived types.) At the end of a successful
     575                 :            :      //- operation, the dead_SenseEntityPtr is an entity that is 
     576                 :            :      //- dangling in space with no connection to any other entity. The
     577                 :            :      //- return value is CUBIT_SUCCESS when a successful merge occurs,
     578                 :            :      //- CUBIT_FAILURE otherwise.
     579                 :            : 
     580                 :            :    CubitBoolean compare_SE( SenseEntity* keeper_entity,
     581                 :            :                             SenseEntity* dead_entity );
     582                 :            :      //R CubitBoolean
     583                 :            :      //R- CUBIT_TRUE/CUBIT_FALSE
     584                 :            :      //I dead_SenseEntityPtr
     585                 :            :      //I- This SenseEntity with which comparision is to be done.
     586                 :            :      //- This function patially compares this SenseEntity to the input 
     587                 :            :      //- SenseEntity. The function returns CUBIT_TRUE if the two
     588                 :            :      //- objects are spatially equal, CUBIT_FALSE otherwise.
     589                 :            : 
     590                 :            :   void complete_merge();
     591                 :            :     //- completed or abort a merge; clean up TDs and lists
     592                 :            : 
     593                 :            :   void test_r_tree(DLIList<RefFace*> &refface_list);
     594                 :            :   void test_r_star_tree(DLIList<RefFace*> &refface_list);
     595                 :            :   void test_no_tree(DLIList<RefFace*> &refface_list);
     596                 :            :     //- temp timing functions for testing with and without and r-tree.
     597                 :            :   
     598                 :            : };
     599                 :            : inline void MergeTool::group_results(CubitBoolean t_or_f)
     600                 :            : {groupResults = t_or_f;}
     601                 :            : 
     602                 :            : 
     603                 :            : //-------------------------------------------------------------------------
     604                 :            : // Purpose       : Start/stop unmerge
     605                 :            : //
     606                 :            : // Special Notes : 
     607                 :            : //
     608                 :            : // Creator       : Jason Kraftcheck
     609                 :            : //
     610                 :            : // Creation Date : 01/18/01
     611                 :            : //-------------------------------------------------------------------------
     612                 :          0 : inline CubitBoolean MergeTool::start_unmerge()
     613                 :            : { 
     614         [ #  # ]:          0 :   if( unmerged_list_in_use ) return CUBIT_FALSE;
     615                 :          0 :   new_unmerged.clean_out();
     616                 :          0 :   old_unmerged.clean_out();
     617                 :          0 :   unmerged_list_in_use = CUBIT_TRUE;
     618                 :          0 :   return CUBIT_TRUE;
     619                 :            : }
     620                 :          0 : inline void MergeTool::end_unmerge( CubitBoolean top )
     621                 :            : {
     622         [ #  # ]:          0 :   if( top )
     623                 :            :   {
     624                 :          0 :     unmerged_list_in_use = CUBIT_FALSE;
     625                 :          0 :     cleanup_unmerge();
     626                 :            :   }
     627                 :          0 : } 
     628                 :            : 
     629                 :            : #endif
     630                 :            : 

Generated by: LCOV version 1.11