LCOV - code coverage report
Current view: top level - geom/virtual/cgm - CompositeTool.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 0 2 0.0 %
Date: 2020-06-30 00:58:45 Functions: 0 1 0.0 %
Branches: 0 4 0.0 %

           Branch data     Line data    Source code
       1                 :            : #ifndef COMPOSITE_TOOL_HPP
       2                 :            : #define COMPOSITE_TOOL_HPP
       3                 :            : 
       4                 :            : #include "CubitDefines.h"
       5                 :            : #include "BasicTopologyEntity.hpp"
       6                 :            : #include "GeometryEntity.hpp"
       7                 :            : 
       8                 :            : #include "CompositeSurface.hpp"
       9                 :            : #include "CompositeCurve.hpp"
      10                 :            : #include "CompositePoint.hpp"
      11                 :            : 
      12                 :            : class RefEdge;
      13                 :            : class RefFace;
      14                 :            : class RefEdge;
      15                 :            : class RefFace;
      16                 :            : template <class X> class DLIList;
      17                 :            : class Loop;
      18                 :            : 
      19                 :            : class CompositeTool
      20                 :            : {
      21                 :            :   friend class PartitionTool;
      22                 :            :   public:
      23                 :            :   
      24                 :            :     static CompositeTool* instance();
      25                 :            :     
      26                 :            :     virtual ~CompositeTool();
      27                 :            :     
      28                 :            :     virtual RefEdge*   composite( DLIList<RefEdge*>& list,
      29                 :            :                                   RefVertex* keep_vertex = NULL,
      30                 :            :                                   RefEdge* survivor = NULL );
      31                 :            :     virtual RefFace*   composite( DLIList<RefFace*>& list,
      32                 :            :                                   RefFace* survivor = NULL );
      33                 :            :     virtual RefVolume* composite( DLIList<RefVolume*>& list,
      34                 :            :                                   Body** composite_body = 0 );
      35                 :            :     virtual Body*      composite( DLIList<Body*>& list );
      36                 :            :     //R- the composite, or NULL if error
      37                 :            :     //I list
      38                 :            :     //I- The list of entities to composite
      39                 :            :     //I keep_vertex
      40                 :            :     //I- vertex to keep if list forms a closed loop of curves
      41                 :            :     //I composite_body
      42                 :            :     //I- If non-null, a composite body will be created if necessary,
      43                 :            :     //I- and composite_body will be set to point to the new body.
      44                 :            :     //- create a composite
      45                 :            :     //-
      46                 :            :     //- NOTE: The 'survivor' argument is provided to meet
      47                 :            :     //- special requirenments in supporting pre-version-8 save
      48                 :            :     //- files.  Once support for pre-version-8 save files has
      49                 :            :     //- been dropped, this argument will be removed. 
      50                 :            :     
      51                 :            :     
      52                 :            :     
      53                 :            :     virtual CubitStatus uncomposite( RefEdge* composite_edge, 
      54                 :            :                                      DLIList<RefEdge*>* restored_edges = NULL );
      55                 :            :     virtual CubitStatus uncomposite( RefFace* composite_face,
      56                 :            :                                      DLIList<RefFace*>* restored_faces = NULL,
      57                 :            :                                      bool force_unmerge = false );
      58                 :            :     virtual CubitStatus uncomposite( RefVolume* composite_vol,
      59                 :            :                                      DLIList<RefVolume*>* restored_vols = NULL );
      60                 :            :     virtual CubitStatus uncomposite( Body* composite_body,
      61                 :            :                                      DLIList<Body*>* restored_bodies = NULL );
      62                 :            :     //Remove a composite entity.
      63                 :            :                              
      64                 :            :     CubitBoolean isComposite( const BasicTopologyEntity* bte_ptr ) const;
      65                 :            :     CubitBoolean isComposite( const GeometryEntity* ge_ptr ) const;
      66                 :            :     
      67                 :            :     CubitStatus composite( DLIList<RefEdge*>& edges_to_composite, 
      68                 :            :                            DLIList<RefEdge*>& new_edge_list,
      69                 :            :                            DLIList<RefVertex*>* vertices_to_keep = NULL,
      70                 :            :                            double max_angle = 3.15 );
      71                 :            :      //R CubitStatus
      72                 :            :     //I edges_to_composite
      73                 :            :     //I- The list of RefEdges to composite.
      74                 :            :     //O new_edge_list
      75                 :            :     //O- The list of Composite RefEdges created.
      76                 :            :     //I vertices_to_keep
      77                 :            :     //I- If this list is passed, no composites will be created which
      78                 :            :     //I- would result in the removal of any of these vertices.  Or
      79                 :            :     //I- if the curves to be composited form a closed loop, this may
      80                 :            :     //I- be used to specify which vertex is kept.
      81                 :            :     //I max_angle
      82                 :            :     //I- The maximum angle between tangents at the point of intersection
      83                 :            :     //I- for which curves can be composited.  The default value (3.15) will
      84                 :            :     //I- result in all possible curves being composited.  A value of 0.0
      85                 :            :     //I- will result in only C1-continous curves being composited.
      86                 :            :     //- Create all possible composites from the passed list of RefEdges,
      87                 :            :     //- within the constraints of topological validity, the list of
      88                 :            :     //- vertices to keep, and the specified angle.
      89                 :            :     
      90                 :            :     CubitStatus composite( DLIList<RefFace*>& faces_to_composite,
      91                 :            :                            DLIList<RefFace*>& result_faces,
      92                 :            :                            double max_angle = 4.0 /*radians*/);
      93                 :            :     //R CubitStatus
      94                 :            :     //R- CUBIT_SUCCESS/CUBIT_FAILURE
      95                 :            :     //I facets_to_composite
      96                 :            :     //I- A list of RefFaces to create composites from.
      97                 :            :     //O result_facets
      98                 :            :     //O- The resulting composite surfaces.
      99                 :            :     //I max_angle
     100                 :            :     //I- The largest angle between surfaces to composite over.
     101                 :            :     //- Create all possible composites from the passed list of RefFaces,
     102                 :            :     //- within the constraints of toopologal validity, and the
     103                 :            :     //- specified angle.
     104                 :            :     
     105                 :            :     
     106                 :            :     RefFace* composite( DLIList<RefFace*>& faces_to_composite,
     107                 :            :                         DLIList<RefEdge*>& result_edges,
     108                 :            :                         DLIList<RefVertex*>* vertices_to_keep = NULL,
     109                 :            :                         double max_vertex_angle = 0.26 /*radians*/ );
     110                 :            :     //R RefFace*
     111                 :            :     //R- The resulting composite, or NULL if an error was encountered.
     112                 :            :     //I faces_to_composite
     113                 :            :     //I- The list of connected surfaces to composite.
     114                 :            :     //O result_edges
     115                 :            :     //O- The list of curves composited with the surface.
     116                 :            :     //I vertices_to_keep
     117                 :            :     //I- The list of vertices that should not be composited over when
     118                 :            :     //I- creating composite curves.
     119                 :            :     //I max_vertex_angle
     120                 :            :     //I- The maximum angle between curves at their common vertex, for
     121                 :            :     //I- which the vertex can be composited over.
     122                 :            :     //- Create a single composite surface, and as many composite curves
     123                 :            :     //- as possible on the boundary of that surface.
     124                 :            :     
     125                 :            :     CubitStatus composite( DLIList<RefFace*>& faces_to_composite,
     126                 :            :                            DLIList<RefFace*>& result_faces,
     127                 :            :                             DLIList<RefEdge*>& result_edges,
     128                 :            :                            double max_curve_angle = 2.0 /*radians*/,
     129                 :            :                            DLIList<RefVertex*>* vertices_to_keep = NULL,
     130                 :            :                            double max_vtx_angle = 0.26 /*radians*/ );
     131                 :            :     //R CubitStatus
     132                 :            :     //R- CUBIT_SUCCESS/CUBIT_FAILURE
     133                 :            :     //I facets_to_composite
     134                 :            :     //I- The list of surfaces to create composites from.
     135                 :            :     //O result_faces
     136                 :            :     //O- The composite surfaces created.
     137                 :            :     //O result_edges
     138                 :            :     //O- The composite curves created.
     139                 :            :     //I max_curve_angle
     140                 :            :     //I- The largest angle between surfaces (at a curve) that can
     141                 :            :     //I- be composited over.
     142                 :            :     //I vertices_to_keep
     143                 :            :     //I- The list of vertices that should not be composited over
     144                 :            :     //I- when creating composite curves.
     145                 :            :     //I max_vtx_angle
     146                 :            :     //I- The largest angle between curves (at a vertex) that can
     147                 :            :     //I- be composited over.
     148                 :            :     //- Create composite surfaces and curves.
     149                 :            :     
     150                 :            :     
     151                 :            :     CubitBoolean okayToComposite( DLIList<BasicTopologyEntity*>& bte_list,
     152                 :            :                                   DLIList<BasicTopologyEntity*>* boundary = NULL,
     153                 :            :                                   DLIList<BasicTopologyEntity*>* internal = NULL,
     154                 :            :                                   bool print_errors = true,
     155                 :            :                                   bool force_same_parent = false ) const;
     156                 :            :     //This function is public because it is also used in PartitionTool, 
     157                 :            :     //and because it is only a series of queries anyway.
     158                 :            :     
     159                 :            :     static CubitStatus classify_children( DLIList<BasicTopologyEntity*>& bte_list,
     160                 :            :                                   DLIList<BasicTopologyEntity*>& boundary_children,
     161                 :            :                                   DLIList<BasicTopologyEntity*>& internal_children,
     162                 :            :                                   DLIList<BasicTopologyEntity*>& unknown_children );
     163                 :            :     
     164                 :            :     RefEdge* remove_vertex( RefVertex* vertex, 
     165                 :            :                             bool remove_partitions = false,
     166                 :            :                             bool update_dag = true,
     167                 :            :                             RefEdge* survivor = NULL );
     168                 :            :     RefFace* remove_edge( RefEdge* edge, 
     169                 :            :                           bool remove_partitions = false,
     170                 :            :                           bool update_dag = true,
     171                 :            :                           RefFace* survivor = NULL );
     172                 :            :     
     173                 :            :     RefVolume* remove_face( RefFace* face,
     174                 :            :                             bool remove_partitions = false,
     175                 :            :                             bool update_dag = true );
     176                 :            :     
     177                 :            :   protected:
     178                 :            :   
     179                 :            :     // These functions do nothing as implemented in CompositeTool.
     180                 :            :     // They are provided for CompositeToolMesh to overload with 
     181                 :            :     // mesh-handling code.
     182                 :            :     virtual CubitStatus update_combined_vols( RefVolume* keep, RefVolume* dead );
     183                 :            :     virtual CubitStatus update_combined_faces( RefFace* keep, RefEdge* dead, RefFace* delete_face );
     184                 :            :     virtual CubitStatus update_combined_edges( RefEdge* keep, RefEdge* dead,int keep_interval,double keep_size,FirmnessType keep_interval_type,SizeIntervalType keep_size_type);
     185                 :            :     virtual CubitStatus determine_combined_edges_interval_or_size( RefEdge* edge_1, RefEdge* edge_2,int& result_interval,double& result_size,FirmnessType& interval_keep_type,SizeIntervalType& size_keep_type); 
     186                 :            : 
     187                 :            :     CompositeTool();
     188                 :            :     
     189                 :            :     //CubitStatus make_mergeable( GeometryEntity* bridge1, GeometryEntity* bridge2 );
     190                 :            :     
     191                 :            :     CubitStatus removeOldTopology( BasicTopologyEntity* composite );
     192                 :            :     
     193                 :            :     CubitVector tangent( RefEdge* edge_ptr, RefVertex* vtx_ptr ) const;
     194                 :            :     //R CubitVector
     195                 :            :     //R- The tangent vector
     196                 :            :     //I edge_ptr
     197                 :            :     //I- The RefEdge to get the tangent of.
     198                 :            :     //I vtx_ptr
     199                 :            :     //I- The RefVertex to get the tangent at.
     200                 :            :     //- Return the tangent of the passed RefEdge at the location of
     201                 :            :     //- the passed RefVertex.  The tanget is reversed if the passed
     202                 :            :     //- RefVertex is the end vertex of the RefEdge, such that the 
     203                 :            :     //- resulting tangent vector points along the edge away from the
     204                 :            :     //- vertex.
     205                 :            :     
     206                 :            : 
     207                 :            :     CubitStatus fast_edge_sort( DLIList<RefEdge*>& edge_list,
     208                 :            :                                 bool valence2_vertices ) const;
     209                 :            :     //R CubitStatus
     210                 :            :     //R- CUBIT_SUCCESS if all edges form a single chain.
     211                 :            :     //R- CUBIT_FAILURE otherwise
     212                 :            :     //I edge_list
     213                 :            :     //I- The list of edges to sort
     214                 :            :     //O edge_list
     215                 :            :     //O- The sorted list of edges
     216                 :            :     //- This function sorts edges by common vertices.  The result
     217                 :            :     //- will be several consecutive sorted sets of edges, if all
     218                 :            :     //- edges do not form a single chain.  
     219                 :            :     
     220                 :            :     
     221                 :            :     CubitStatus restore_merged_point( TBPoint* point, 
     222                 :            :                                       DLIList<RefFace*>& update,
     223                 :            :                                       bool force = false );
     224                 :            :     
     225                 :            :     CubitStatus stitch_points( TBPoint* pt1, TBPoint* pt2 );
     226                 :            :     CubitStatus stitch_curves( Curve* cv1, Curve* cv2 );
     227                 :            :                           
     228                 :            :     static CompositeTool* instance_;
     229                 :            :     
     230                 :            :   private:
     231                 :            :   
     232                 :            : };
     233                 :            : 
     234                 :          0 : inline CompositeTool* CompositeTool::instance()
     235                 :            : {
     236 [ #  # ][ #  # ]:          0 :   return (instance_ != NULL ) ? instance_ : instance_ = new CompositeTool();
     237                 :            : }
     238                 :            : 
     239                 :            : inline CubitBoolean CompositeTool::
     240                 :            :   isComposite( const GeometryEntity* ge_ptr ) const
     241                 :            : {
     242                 :            :   if( dynamic_cast<const CompositeSurface*>(ge_ptr) ||
     243                 :            :       dynamic_cast<const CompositeCurve*>(ge_ptr) ||
     244                 :            :       dynamic_cast<const CompositePoint*>(ge_ptr) )
     245                 :            :     return CUBIT_TRUE;
     246                 :            :   return CUBIT_FALSE;
     247                 :            : }
     248                 :            : 
     249                 :            : inline CubitBoolean CompositeTool::
     250                 :            :   isComposite( const BasicTopologyEntity* bte_ptr ) const
     251                 :            : {
     252                 :            :   return bte_ptr ? isComposite(bte_ptr->get_geometry_entity_ptr()) : CUBIT_FALSE;
     253                 :            : }
     254                 :            : 
     255                 :            : 
     256                 :            : #endif

Generated by: LCOV version 1.11