LCOV - code coverage report
Current view: top level - geom/cgm - GeometryQueryTool.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 21 33 63.6 %
Date: 2020-06-30 00:58:45 Functions: 7 12 58.3 %
Branches: 4 8 50.0 %

           Branch data     Line data    Source code
       1                 :            : /**
       2                 :            :  * \file GeometryQueryTool.hpp
       3                 :            :  *
       4                 :            :  * \brief This class provides the interface for all the query-only geometry
       5                 :            :  *        related operations to the outside.
       6                 :            :  *
       7                 :            :  * This class is implemented using the Singleton pattern.
       8                 :            :  *
       9                 :            :  * \author Tim Tautges
      10                 :            :  *
      11                 :            :  * \date 2/2001
      12                 :            :  *
      13                 :            :  */
      14                 :            : 
      15                 :            : 
      16                 :            : #ifndef GEOMETRYQUERYTOOL_HPP
      17                 :            : #define GEOMETRYQUERYTOOL_HPP
      18                 :            : 
      19                 :            : #include <stdio.h>
      20                 :            : #include <typeinfo>
      21                 :            : #include <list>
      22                 :            : #include <set>
      23                 :            : 
      24                 :            : #include "GeometryDefines.h"
      25                 :            : #include "DLIList.hpp"
      26                 :            : #include "GeometryQueryEngine.hpp"
      27                 :            : #include "IntermediateGeomEngine.hpp"
      28                 :            : #include "CGMHistory.hpp"
      29                 :            : 
      30                 :            : class RefGroup;
      31                 :            : class Body;
      32                 :            : class BodySM;
      33                 :            : class Lump;
      34                 :            : class Shell;
      35                 :            : class ShellSM;
      36                 :            : class Loop;
      37                 :            : class LoopSM;
      38                 :            : class Chain;
      39                 :            : class Surface;
      40                 :            : class Curve;
      41                 :            : class TopologyBridge;
      42                 :            : class CoEdgeSM;
      43                 :            : 
      44                 :            : class GeometryEntity;
      45                 :            : 
      46                 :            : class RefGroup;
      47                 :            : 
      48                 :            : class TopologyEntity;
      49                 :            : class TopologyBridge;
      50                 :            : 
      51                 :            : class RefEntity ;
      52                 :            : class RefVolume ;
      53                 :            : class RefFace ;
      54                 :            : class RefEdge ;
      55                 :            : class CoEdge;
      56                 :            : class RefVertex ;
      57                 :            : 
      58                 :            : class SenseEntity;
      59                 :            : class BasicTopologyEntity;
      60                 :            : class RefVolume ;
      61                 :            : class RefFace ;
      62                 :            : class RefEdge ;
      63                 :            : class RefVertex ;
      64                 :            : class TBPoint;
      65                 :            : class CubitEntity;
      66                 :            : class CoEdgeSM;
      67                 :            : 
      68                 :            : class GeometryQueryEngine;
      69                 :            : 
      70                 :            : class CubitPlane ;
      71                 :            : class CubitBox;
      72                 :            : class CubitVector;
      73                 :            : class CubitTransformMatrix;
      74                 :            : class TBOwner;
      75                 :            : 
      76                 :            : #ifdef PROE
      77                 :            : class RefPart;
      78                 :            : class RefAssembly;
      79                 :            : #endif
      80                 :            : 
      81                 :            : //! Interface class for querying geometry. 
      82                 :            : class CUBIT_GEOM_EXPORT GeometryQueryTool
      83                 :            : {
      84                 :            : public :
      85                 :            : 
      86                 :            :   friend class GeometryModifyTool;
      87                 :            :    
      88                 :            :   bool ige_is_composite(TBOwner *bridge_owner);
      89                 :            :   bool ige_is_composite(TopologyBridge *bridge);
      90                 :            :   bool ige_is_partition(TBOwner *bridge_owner);
      91                 :            : 
      92                 :            : 
      93                 :            :   void ige_remove_modified(DLIList<Surface*> &all_surfs,
      94                 :            :                                             DLIList<Curve*> &all_curves,
      95                 :            :                                             DLIList<TBPoint*> &all_points);
      96                 :            : 
      97                 :            :   static GeometryQueryTool* instance( GeometryQueryEngine* gqePtr = NULL);
      98                 :            :   /**<
      99                 :            :     *  \return GeometryQueryTool* - Pointer to the singleton GeometryQueryTool object
     100                 :            :     *  \arg SMEPtr
     101                 :            :     *   Pointer to a GeometryQueryEngine object. The default value
     102                 :            :     *   is set to NULL.
     103                 :            :     *
     104                 :            :     *  Return a pointer to the only instance of the class with the default
     105                 :            :     *  geometric query engine set to the argument, if it is not NULL.
     106                 :            :     *  If the argument is NULL, return the pointer to the existing
     107                 :            :     *  instance without modifying the default SME. A valid GQEPtr *must*
     108                 :            :     *  be supplied at the time of the first call to this function.
     109                 :            :     *  Hence, this instance function should specifically be called at
     110                 :            :     *  startup with a valid non-NULL input GQEPtr.
     111                 :            :     */
     112                 :            : 
     113                 :            :   ~GeometryQueryTool();
     114                 :            :   ///<  Destructor.
     115                 :            : 
     116                 :            :   static void delete_instance();
     117                 :            :   
     118                 :            :   //!
     119                 :            :   //! \brief Estimates a good merge tolerance for the volumes passed in.
     120                 :            :   //!
     121                 :            :   double estimate_merge_tolerance(DLIList<RefVolume*> &vol_list,
     122                 :            :                                                     bool accurate_in = false,
     123                 :            :                                                     bool report_in = false,
     124                 :            :                                                     double lo_val_in = -1.0, 
     125                 :            :                                                     double hi_val_in = -1.0,
     126                 :            :                                                     int num_calculations_in = 10,
     127                 :            :                                                     bool return_calculations_in = false,
     128                 :            :                                                     DLIList<double> *merge_tols = NULL,
     129                 :            :                                                     DLIList<int> *num_proximities = NULL);
     130                 :            : 
     131                 :            :   //!
     132                 :            :   //! \brief Find all of the volumes that do not contain any merged entities.
     133                 :            :   //!
     134                 :            :   void find_floating_volumes(DLIList<RefVolume*> &vol_list,
     135                 :            :                              DLIList<RefVolume*> &floating_list);
     136                 :            : 
     137                 :            :   //!
     138                 :            :   //! \brief Find the nonmanifold curves in the passed-in volumes based on what is merged.
     139                 :            :   //!
     140                 :            :   void find_nonmanifold_curves(DLIList<RefVolume*> &vol_list, DLIList<RefEdge*> &curve_list);
     141                 :            : 
     142                 :            :   //!
     143                 :            :   //! \brief Find the nonmanifold vertices in the passed-in volumes based on what is merged.
     144                 :            :   //!
     145                 :            :   void find_nonmanifold_vertices(DLIList<RefVolume*> &vol_list, DLIList<RefVertex*> &vertex_list);
     146                 :            : 
     147                 :            :   CubitStatus register_intermediate_engine( IntermediateGeomEngine* engine );
     148                 :            :   void unregister_intermediate_engine( IntermediateGeomEngine* engine );
     149                 :            : 
     150                 :            :   void ige_remove_imprint_attributes_after_modify(DLIList<BodySM*> &old_sms,
     151                 :            :                                               DLIList<BodySM*> &new_sms);
     152                 :            :   void ige_push_imprint_attributes_before_modify
     153                 :            :                                 ( DLIList<BodySM*> &geom_list );
     154                 :            :   void ige_push_named_attributes_to_curves_and_points
     155                 :            :                                 ( DLIList<TopologyBridge*> &tb_list, const char *name_in );
     156                 :            :   void ige_export_geom( DLIList<TopologyBridge*> &geom_list );
     157                 :            :   void ige_import_geom( DLIList<TopologyBridge*> &geom_list );
     158                 :            :   void ige_remove_attributes( DLIList<TopologyBridge*> &geom_list );
     159                 :            :   void ige_attribute_after_imprinting(DLIList<TopologyBridge*> &tb_list,
     160                 :            :                                       DLIList<Body*> &old_bodies);
     161                 :            :   void ige_remove_attributes_from_unmodifed_virtual(DLIList<TopologyBridge*> &bridges);
     162                 :            :   
     163                 :            :   //Using the source_bridge, finds all bridges that actually have a BridgeManager the owner.
     164                 :            :   //This is for obtaining the real TopologyBridge when all you have is a  TopologyBridge 
     165                 :            :   //that is Partition Entity.
     166                 :            :   void get_tbs_with_bridge_manager_as_owner( TopologyBridge *source_bridge, 
     167                 :            :                                              DLIList<TopologyBridge*> &tbs );
     168                 :            : 
     169                 :            :   /*! <HR><H1> global-list-functions Global entity list functions </H1>*/
     170                 :            : 
     171                 :            :   //
     172                 :            :   // Returns ref entities in a generic cubit entity list (overwrites list).
     173                 :            :   // returns CUBIT_FAILURE if keyword is not a ref entity name, and
     174                 :            :   // optionally prints error message
     175                 :            :   //
     176                 :            :   //CubitStatus cubit_entity_list( const char* keyword,
     177                 :            :   //                               DLIList<CubitEntity*> &entity_list,
     178                 :            :   //                               const CubitBoolean print_errors = CUBIT_TRUE);
     179                 :            : 
     180                 :            :   //!
     181                 :            :   //! \brief Return ref entities in entity_list (overwrites list).
     182                 :            :   //! returns CUBIT_FAILURE if keyword is not a ref entity name,
     183                 :            :   //! and optionally prints error message
     184                 :            :   //!  
     185                 :            : 
     186                 :            :   CubitStatus ref_entity_list( char const* keyword,
     187                 :            :                                DLIList<RefEntity*> &entity_list,
     188                 :            :                                const CubitBoolean print_errors = CUBIT_TRUE);
     189                 :            : 
     190                 :            :   //! \brief Returns the bounding box of the model.  Include free entities.
     191                 :            :   CubitBox model_bounding_box();
     192                 :            : 
     193                 :            :   /*! Returns the bounding box of all bodies in the model. Excludes
     194                 :            :   free entities.*/
     195                 :            :   //! \brief Returns the bounding box of all bodies in the model. 
     196                 :            :   CubitBox bounding_box_of_bodies();
     197                 :            : 
     198                 :            : 
     199                 :            :   //! \brief Returns all the bodies in the current session. 
     200                 :            :   void bodies (DLIList<Body*> &bodies);
     201                 :            : 
     202                 :            :   //! \brief Returns all volumes in the current session. 
     203                 :            :   void ref_volumes (DLIList<RefVolume*> &ref_volumes);
     204                 :            : 
     205                 :            :   //! \brief Returns all groups in the current session. 
     206                 :            :   void ref_groups (DLIList<RefGroup*> &ref_groups);
     207                 :            : 
     208                 :            :   //! \brief Returns all surfaces in the current session. 
     209                 :            :   void ref_faces (DLIList<RefFace*> &ref_faces);
     210                 :            : 
     211                 :            :   //! \brief Returns all curves in the current session. 
     212                 :            :   void ref_edges (DLIList<RefEdge*> &ref_edges);
     213                 :            : 
     214                 :            :   //! \brief Returns all the vertices in the current session. 
     215                 :            :   void ref_vertices (DLIList<RefVertex*> &ref_vertices);
     216                 :            : 
     217                 :            :   void get_ordered_loops(RefFace* face, DLIList<Loop*> &loop_list);
     218                 :            : 
     219                 :            : #ifdef PROE
     220                 :            :   void ref_parts (DLIList<RefPart*> &ref_parts);
     221                 :            :   void ref_assemblies (DLIList<RefAssembly*> &ref_assemblies);
     222                 :            : #endif //PROE
     223                 :            :   ///< Append global lists to arguments
     224                 :            : 
     225                 :            :   //! \brief Number of bodies in current session.
     226                 :            :   int num_bodies() const;
     227                 :            : 
     228                 :            :   //! \brief Number of volumes in current session.
     229                 :            :   int num_ref_volumes() const;
     230                 :            : 
     231                 :            :   //! \brief Number of groups in current session.
     232                 :            :   int num_ref_groups() const;
     233                 :            : 
     234                 :            :   //! \brief Number of surfaces in current session.
     235                 :            :   int num_ref_faces() const;
     236                 :            : 
     237                 :            :   //! \brief Number of curves in current session.
     238                 :            :   int num_ref_edges() const;
     239                 :            : 
     240                 :            :   //! \brief Number of vertices in current session.
     241                 :            :   int num_ref_vertices() const;
     242                 :            : 
     243                 :            :   //! \brief Get RefEntity by type name and id.
     244                 :            :   RefEntity *get_ref_entity (const char *type, int id);
     245                 :            : 
     246                 :            :   //! \brief Get a RefEntity of the specified type and id.
     247                 :            :   RefEntity *get_ref_entity (const std::type_info& type, int id);
     248                 :            : 
     249                 :            :   //! \brief Get entity by id.
     250                 :            :   Body *get_body ( int id );
     251                 :            : 
     252                 :            :   //! \brief Get entity by id.
     253                 :            :   RefVolume *get_ref_volume ( int id );
     254                 :            : 
     255                 :            :   //! \brief Get entity by id.
     256                 :            :   RefGroup *get_ref_group ( int id );
     257                 :            : 
     258                 :            :   //! \brief Get entity by id.
     259                 :            :   RefFace *get_ref_face ( int id );
     260                 :            : 
     261                 :            :   //! \brief Get entity by id.
     262                 :            :   RefEdge *get_ref_edge ( int id );
     263                 :            : 
     264                 :            :   //! \brief Get entity by id.
     265                 :            :   RefVertex *get_ref_vertex ( int id );
     266                 :            :   
     267                 :            : 
     268                 :            :   //! \brief Get the first entity in the global list of the specified type
     269                 :            :   Body *get_first_body ();
     270                 :            :   //! \brief Get the first entity in the global list of the specified type
     271                 :            :   RefVolume *get_first_ref_volume ();
     272                 :            :   //! \brief Get the first entity in the global list of the specified type
     273                 :            :   RefGroup *get_first_ref_group ();
     274                 :            :   //! \brief Get the first entity in the global list of the specified type
     275                 :            :   RefFace *get_first_ref_face ();
     276                 :            :   //! \brief Get the first entity in the global list of the specified type
     277                 :            :   RefEdge *get_first_ref_edge ();
     278                 :            :   //! \brief Get the first entity in the global list of the specified type
     279                 :            :   RefVertex *get_first_ref_vertex ();
     280                 :            : 
     281                 :            :   //! \brief Get the next entity in the global list of the specified type
     282                 :            :   Body *get_next_body ();
     283                 :            :   //! \brief Get the next entity in the global list of the specified type
     284                 :            :   RefVolume *get_next_ref_volume ();
     285                 :            :   //! \brief Get the next entity in the global list of the specified type
     286                 :            :   RefGroup *get_next_ref_group ();
     287                 :            :   //! \brief Get the next entity in the global list of the specified type
     288                 :            :   RefFace *get_next_ref_face ();
     289                 :            :   //! \brief Get the next entity in the global list of the specified type
     290                 :            :   RefEdge *get_next_ref_edge ();
     291                 :            :   //! \brief Get the next entity in the global list of the specified type
     292                 :            :   RefVertex *get_next_ref_vertex ();
     293                 :            : 
     294                 :            :   ///! \brief Get the last entity in the global list of the specified type
     295                 :            :   Body *get_last_body ();
     296                 :            :   ///! \brief Get the last entity in the global list of the specified type
     297                 :            :   RefVolume *get_last_ref_volume ();
     298                 :            :   ///! \brief Get the last entity in the global list of the specified type
     299                 :            :   RefGroup *get_last_ref_group ();
     300                 :            :   ///! \brief Get the last entity in the global list of the specified type
     301                 :            :   RefFace *get_last_ref_face ();
     302                 :            :   ///! \brief Get the last entity in the global list of the specified type
     303                 :            :   RefEdge *get_last_ref_edge ();
     304                 :            :   ///! \brief Get the last entity in the global list of the specified type
     305                 :            :   RefVertex *get_last_ref_vertex ();
     306                 :            :   
     307                 :            :   
     308                 :            :   //! \brief Get all free surfaces, curves, and vertices 
     309                 :            :   CubitStatus get_free_ref_entities(DLIList<RefEntity*> &free_entities);
     310                 :            : 
     311                 :            :   //! \brief Get the free entities connected to, but not necessarily
     312                 :            :   //! vertically related to, the entity.  - If merge_option, then take
     313                 :            :   //! into account the fact that the model may be merged (it's slower
     314                 :            :   //! that way).
     315                 :            :   void get_connected_free_ref_entities(
     316                 :            :     RefEntity *entity,
     317                 :            :     const int merge_option,
     318                 :            :     DLIList<Body*> &body_list,
     319                 :            :     DLIList<RefFace*> &ref_face_list,
     320                 :            :     DLIList<RefEdge*> &ref_edge_list,
     321                 :            :     DLIList<RefVertex*> &ref_vertex_list );
     322                 :            : 
     323                 :            :   void validate_geometry_database();
     324                 :            : 
     325                 :            :   //! \brief Saves out a temporary geometry file containing specified entities
     326                 :            :   //! that are of the same geometry engine. 
     327                 :            :   CubitStatus save_temp_geom_files( DLIList<RefEntity*>& ref_entity_list,
     328                 :            :                                   const char* filename,
     329                 :            :                                   const CubitString &cubit_version,
     330                 :            :                                   std::list<CubitString> &files_written,
     331                 :            :                                   std::list<CubitString> &types_written);
     332                 :            : 
     333                 :            : 
     334                 :            :   //!
     335                 :            :   //! * Export entities to a solid model file.
     336                 :            :   //!  *  \arg ref_entity_list
     337                 :            :   //!  *  A list of RefEntities to be exported or saved to a file.
     338                 :            :   //!  *  \arg file_name
     339                 :            :   //!  *  The name of the file to write to.
     340                 :            :   //!  *  \arg file_type
     341                 :            :   //!  *  An optional type of file.
     342                 :            :   //!  *  \arg logfile_name
     343                 :            :   //!  *  Optional - name of logfile.
     344                 :            :   //!  *   \return  CubitStatus - success/failure
     345                 :            :   //!  *
     346                 :            :   //!  *  Export the current CUBIT geometry (everything in the Model) to a
     347                 :            :   //!  *  solid model format. Valid file types are:
     348                 :            :   //!  *
     349                 :            :   //!  *     "IGES"        --  IGES file
     350                 :            :   //!  *     "STEP"        --  STEP file
     351                 :            :   //!  No logfile gets created for SAB/SAT files, but for IGES and
     352                 :            :   //!  STEP file a logfile always gets created.  Default filenames
     353                 :            :   //!  are assigned if one is not given (iges_export.log, step_export.log).
     354                 :            :   //!  
     355                 :            :   //!  The function returns CUBIT_FAILURE if anything goes wrong with
     356                 :            :   //!  export - improper file type, inaccessible file, mismatch between
     357                 :            :   //!  the underlying representation and file type. It returns
     358                 :            :   //!  CUBIT_SUCCESS if everything goes well.
     359                 :            :   //!  
     360                 :            :   //!  NOTE: if the ref_entity_list is empty, GeometryQueryTool gets the list of
     361                 :            :   //!  all entities in the current model, including free ref entities
     362                 :            :   //! \brief Save a geometry file containing specified entities
     363                 :            :   //! that are of the same geometry engine. 
     364                 :            :   CubitStatus export_solid_model( DLIList<RefEntity*>& ref_entity_list,
     365                 :            :                                   const char* filename,
     366                 :            :                                   Model_File_Type filetype,
     367                 :            :                                   int &num_ents_exported,
     368                 :            :                                   const CubitString &cubit_version,
     369                 :            :                                   ModelExportOptions &export_options );
     370                 :            : 
     371                 :            :   /*!
     372                 :            :     Import all or specified entities in a solid model file.
     373                 :            :     *  \arg file_ptr
     374                 :            :     *  A pointer to the file to read (can be NULL for IGES and STEP files).
     375                 :            :     *  \arg file_type
     376                 :            :     *  Type of file.
     377                 :            :     *  \arg heal_step - auto-healing of step bodies on import.  This is recommended
     378                 :            :     *     because they always need it.
     379                 :            :     *  \arg import_bodies (etc...)
     380                 :            :     *  Should bodies be import.
     381                 :            :     *   \return  CubitStatus - success/failure
     382                 :            :     *
     383                 :            :     *  Reads in geometry and creates the necessary Reference entities
     384                 :            :     *  associated with the input geometry.
     385                 :            :     *  Valid file types are:
     386                 :            :     *
     387                 :            :     *     "IGES"        --  IGES file
     388                 :            :     *     "STEP"        --  STEP file
     389                 :            :     *
     390                 :            :     *  Function can selectively import solid bodies, free surfaces, free
     391                 :            :     *  curves, or free vertices.  For example, the user may not want
     392                 :            :     *  to import any free entities.
     393                 :            :     *
     394                 :            :     *  The function returns CUBIT_FAILURE if anything goes wrong with
     395                 :            :     *  import - improper file type, inaccessible file, mismatch between
     396                 :            :     *  the underlying representation and file type. It returns
     397                 :            :     *  CUBIT_SUCCESS if everything goes well.
     398                 :            :     */
     399                 :            : 
     400                 :            :   CubitStatus export_solid_model(DLIList<RefEntity*>& ref_entity_list,
     401                 :            :                                  char*& p_buffer,
     402                 :            :                                  int& n_buffer_size,
     403                 :            :                                  bool b_export_buffer);
     404                 :            :   /**<
     405                 :            :    * Import all or specified entities in a solid model file.
     406                 :            :     *  \arg file_ptr
     407                 :            :     *  A pointer to the file to read (can be NULL for IGES and STEP files).
     408                 :            :     *  \arg file_type
     409                 :            :     *  Type of file.
     410                 :            :     *  \arg heal_step - auto-healing of step bodies on import.  This is recommended
     411                 :            :     *     because they always need it.
     412                 :            :     *  \arg import_bodies (etc...)
     413                 :            :     *  Should bodies be import.
     414                 :            :     *   \return  CubitStatus - success/failure
     415                 :            :     *
     416                 :            :     *  Reads in geometry and creates the necessary Reference entities
     417                 :            :     *  associated with the input geometry.
     418                 :            :     *  Valid file types are:
     419                 :            :     *
     420                 :            :     *     "IGES"        --  IGES file
     421                 :            :     *     "STEP"        --  STEP file
     422                 :            :     *
     423                 :            :     *  Function can selectively import solid bodies, free surfaces, free
     424                 :            :     *  curves, or free vertices.  For example, the user may not want
     425                 :            :     *  to import any free entities.
     426                 :            :     *
     427                 :            :     *  The function returns CUBIT_FAILURE if anything goes wrong with
     428                 :            :     *  import - improper file type, inaccessible file, mismatch between
     429                 :            :     *  the underlying representation and file type. It returns
     430                 :            :     *  CUBIT_SUCCESS if everything goes well.
     431                 :            :     */
     432                 :            : 
     433                 :            :   //! \brief Import a geometry file. 
     434                 :            :   CubitStatus import_solid_model(const char* file_name,
     435                 :            :                                  Model_File_Type file_type,
     436                 :            :                                  ModelImportOptions &import_options,
     437                 :            :                                  DLIList<RefEntity*> *imported_entities = NULL );
     438                 :            : 
     439                 :            : 
     440                 :            :     // import entities in a solid model buffer
     441                 :            :   CubitStatus import_solid_model(DLIList<RefEntity*> *imported_entities,
     442                 :            :                                  const char* pBuffer,
     443                 :            :                                  const int n_buffer_size);
     444                 :            : 
     445                 :            :   /*!
     446                 :            :    * Fire a ray at entities, passing back distances of hits and entities hit
     447                 :            :     * \arg origin
     448                 :            :     * origin of ray
     449                 :            :     * \arg direction
     450                 :            :     * direction of ray
     451                 :            :     * \arg at_entity_list
     452                 :            :     * entities to fire ray at
     453                 :            :     * \arg ray_params
     454                 :            :     * returned array of parameters (distances) along ray at which entities were hit
     455                 :            :     * \arg max_hits
     456                 :            :     * maximum number of hits to return, 0 = unlimited (default)
     457                 :            :     * \arg ray_radius
     458                 :            :     * radius of ray to use for intersecting entities, 0 = use engine default
     459                 :            :     * \arg hit_entity_list (pointer)
     460                 :            :     * entities hit by ray (list length same as ray_params), default NULL
     461                 :            :     * \return - error flag
     462                 :            :     *
     463                 :            :     *  Fire a ray at specified entities, returning the parameters (distances)
     464                 :            :     *  along the ray and optionally the entities hit; return CUBIT_FAILURE if
     465                 :            :     *  error.  Returned lists are appended to.
     466                 :            :     */
     467                 :            : 
     468                 :            :   //! \brief Fire a ray at entities, passing back distances of hits and entities hit
     469                 :            :   CubitStatus fire_ray( CubitVector &origin,
     470                 :            :                         CubitVector &direction,
     471                 :            :                         DLIList<RefEntity*> &at_entity_list,
     472                 :            :                         DLIList<double> &ray_params,
     473                 :            :                         int max_hits = 0,
     474                 :            :                         double ray_radius = 0.0,
     475                 :            :                         DLIList<RefEntity*> *hit_entity_list_ptr = 0 );
     476                 :            : 
     477                 :            :   /*!
     478                 :            :    * Fire a ray at entities, passing back distances of hits and entities hit
     479                 :            :     * \arg origin
     480                 :            :     * origin of ray
     481                 :            :     * \arg direction
     482                 :            :     * direction of ray
     483                 :            :     * \arg at_entity_list
     484                 :            :     * entities to fire ray at
     485                 :            :     * \arg ray_params
     486                 :            :     * returned array of parameters (distances) along ray at which entities were hit
     487                 :            :     * \arg max_hits
     488                 :            :     * maximum number of hits to return, 0 = unlimited (default)
     489                 :            :     * \arg ray_radius
     490                 :            :     * radius of ray to use for intersecting entities, 0 = use engine default
     491                 :            :     * \arg hit_entity_list (pointer)
     492                 :            :     * entities hit by ray (list length same as ray_params), default NULL
     493                 :            :     * \return - error flag
     494                 :            :     *
     495                 :            :     *  Fire a ray at specified entities, returning the parameters (distances)
     496                 :            :     *  along the ray and optionally the entities hit; return CUBIT_FAILURE if
     497                 :            :     *  error.  Returned lists are appended to.  NOTE: ALL ENTITIES MUST BE FROM
     498                 :            :     *  THE SAME GEOMETRY ENGINE. 
     499                 :            :     */
     500                 :            :   //! \brief Fire a ray at entities, passing back distances of hits and entities hit
     501                 :            :   CubitStatus fire_ray( CubitVector &origin,
     502                 :            :                         CubitVector &direction,
     503                 :            :                         DLIList<TopologyEntity*> &at_entity_list,
     504                 :            :                         DLIList<double> &ray_params,
     505                 :            :                         int max_hits = 0,
     506                 :            :                         double ray_radius = 0.0,
     507                 :            :                         DLIList<TopologyEntity*> *hit_entity_list_ptr = 0 );
     508                 :            :   
     509                 :            :   //! \brief Debugging function.
     510                 :            :   static void geom_debug( DLIList<TopologyEntity*> );
     511                 :            : 
     512                 :            :   //! \brief Set facet box flag
     513                 :          0 :   static void set_facet_bbox( CubitBoolean pass_flag )
     514                 :          0 :       {useFacetBBox = pass_flag;}
     515                 :            : 
     516                 :            :   //! \brief Get facet box flag
     517                 :          0 :   static CubitBoolean get_facet_bbox()
     518                 :          0 :       {return useFacetBBox;}
     519                 :            : 
     520                 :            :   //! \brief Calls engine version of the active geometry engine.
     521                 :            :   CubitString get_engine_version_string();
     522                 :            : 
     523                 :            :   //! \brief Set the major/minor version of the active geometry engine.
     524                 :            :   CubitStatus set_export_allint_version(int version);
     525                 :            : 
     526                 :            :   //! \brief Get the major/minor version of the active geometry engine.
     527                 :            :   int get_allint_version();
     528                 :            : 
     529                 :            :   //! \brief Returns a string with the versions of the active geometry engine.
     530                 :            :   CubitStatus list_engine_versions(CubitString &versions);
     531                 :            : 
     532                 :            :   //! \brief Gets solid modeler's resolution absolute tolerance
     533                 :            :   double get_sme_resabs_tolerance();
     534                 :            : 
     535                 :            :   //! \brief Sets solid modeler's resolution absolute tolerance
     536                 :            :   double set_sme_resabs_tolerance( double new_resabs );
     537                 :            : 
     538                 :            :   //! \brief Set solid modeler integer option.
     539                 :            :   CubitStatus set_sme_int_option( const char* opt_name, int val );
     540                 :            :   //! \brief Set solid modeler double option.
     541                 :            :   CubitStatus set_sme_dbl_option( const char* opt_name, double val );
     542                 :            :   //! \brief Set solid modeler string option.
     543                 :            :   CubitStatus set_sme_str_option( const char* opt_name, const char* val );
     544                 :            : 
     545                 :            : 
     546                 :            :   ///< <HR><H3>Topology/geometry creation functions</H3>
     547                 :            :   Body* make_Body(BodySM *bodysm_ptr) const;
     548                 :            :   RefFace* make_RefFace(Surface* surface_ptr ) const;
     549                 :            :   RefEdge* make_RefEdge(Curve* curve_ptr) const;
     550                 :            :   RefVertex* make_RefVertex(TBPoint* point_ptr) const;
     551                 :            : 
     552                 :            :   static CubitSense relative_sense( Surface* surface1, Surface* surface2 );
     553                 :            : 
     554                 :            :   RefFace* make_free_RefFace(Surface *surface_ptr, bool is_free_surface) const;
     555                 :            :   RefEdge* make_free_RefEdge(Curve *curve_ptr ) const;
     556                 :            :   RefVertex* make_free_RefVertex(TBPoint *point_ptr) const;
     557                 :            :   /**<  These functions can be used to create free ref-entities
     558                 :            :     *  from a geometry engine.  Just call populate_topology_
     559                 :            :     *  bridges to create the sm_ptr of the desired type, then pass
     560                 :            :     *  that to the appropriate function here.
     561                 :            :     */
     562                 :            : 
     563                 :            : 
     564                 :            :   ///<HR><H3>Topology and geometry deletion</H3>
     565                 :            : 
     566                 :            :   /*! \brief  Deletes all Bodies in the input list from the model. Their
     567                 :            :     associated Solid Model entities are deleted as well, if they exist,
     568                 :            :     and if remove_solid_model_entities is CUBIT_TRUE.
     569                 :            :     */
     570                 :            :   void delete_Body( DLIList<Body*>& body_list );
     571                 :            : 
     572                 :            :   /**<  Deletes the input Body from the model.
     573                 :            :     *  Its associated Solid Model entities are deleted as well, if
     574                 :            :     *  they exist, and if remove_solid_model_entities is CUBIT_TRUE.
     575                 :            :     *  If all went well, the input Body* reference will be set to NULL
     576                 :            :     *  as the Body itself has been deleted.
     577                 :            :     *  Returns CUBIT_SUCCESS if all went well, otherwise, CUBIT_FAILURE.
     578                 :            :     */
     579                 :            :   //! \brief Deletes a body.
     580                 :            :   CubitStatus delete_Body( Body* body_ptr );
     581                 :            : 
     582                 :            :   /*! Behaves exactly as delete_Body, but in addition checks to see if
     583                 :            :     *  children of Body are merged.  In some cases, 2 entities can be
     584                 :            :     *  forced-merged, where they are not spatially equal.  This regenerates
     585                 :            :     *  the graphics on merged entities so they look correct after a partner
     586                 :            :     *  has been deleted.
     587                 :            :     */
     588                 :            :   //! \brief Deletes a body.
     589                 :            :   CubitStatus delete_single_Body( Body* body_ptr );
     590                 :            : 
     591                 :            :   //! \brief Deletes free RefEnties
     592                 :            :   CubitStatus delete_RefEntity( RefEntity* ref_entity_ptr );
     593                 :            :   
     594                 :            :   //! \brief Deletes the RefFace if it is free
     595                 :            :   CubitStatus delete_RefFace( RefFace* ref_face_ptr );
     596                 :            : 
     597                 :            :   //! \brief Deletes the RefEdge if it is free
     598                 :            :   CubitStatus delete_RefEdge( RefEdge* ref_edge_ptr );
     599                 :            : 
     600                 :            :   //! \brief Deletes the RefVertex if it is free
     601                 :            :   CubitStatus delete_RefVertex( RefVertex* ref_vertex_ptr );
     602                 :            : 
     603                 :            :   void cleanout_deactivated_geometry();
     604                 :            :   void cleanout_temporary_geometry ();
     605                 :            :   
     606                 :            :   //! \brief Deletes all geometry.
     607                 :            :   void delete_geometry();
     608                 :            : 
     609                 :            :   
     610                 :            :   /*! \brief  Creates a list of vectors the length of the number_points that
     611                 :            :       interpolate between vector_1 and vector_2.  All of the points
     612                 :            :       will lie on the underlying equation of the refface.
     613                 :            :   */
     614                 :            :   CubitStatus interpolate_along_surface( CubitVector *vector_1,
     615                 :            :                                          CubitVector *vector_2,
     616                 :            :                                          DLIList<CubitVector*> &vector_list,
     617                 :            :                                          RefFace* ref_face_ptr,
     618                 :            :                                          int number_points ) const;
     619                 :            :   /*!  \return  CubitBoolean
     620                 :            :     \return - CUBIT_TRUE/CUBIT_FALSE
     621                 :            :     \arg Vec1
     622                 :            :     A reference to the first vector.
     623                 :            :     \arg Vec2
     624                 :            :     A reference to the second vector.
     625                 :            :     \arg tolerance_factor
     626                 :            :     Factor by which the absolute internal tolerance shall be
     627                 :            :     multiplied.
     628                 :            :     *  Returns CUBIT_TRUE if the input Vec1 and Vec2 are spatially
     629                 :            :     equivalent within a tolerance.  The internal spatial tolerance
     630                 :            :     value is multiplied by tolerance_factor before the (spatial)
     631                 :            :     test is done. Else, returns CUBIT_FALSE.
     632                 :            :     */
     633                 :            :   //! \brief Compares two positions for coincidence.
     634                 :            :   CubitBoolean about_spatially_equal (const CubitVector& Vec1,
     635                 :            :                                       const CubitVector& Vec2,
     636                 :            :                                       double tolerance_factor = 1.0);
     637                 :            : 
     638                 :            :   //! \brief Compares two vertices for coincidence.
     639                 :            :   CubitBoolean about_spatially_equal (RefVertex* refVertex1,
     640                 :            :                                       RefVertex* refVertex2,
     641                 :            :                                       double tolerance_factor = 1.0);
     642                 :            : 
     643                 :            :   /*! \brief Calculates internal surface angles given 2 refedges on the
     644                 :            :    * surface.  CoEdge version correctly handles curves in a surface
     645                 :            :    * twice. */
     646                 :            :   double geometric_angle(RefEdge* ref_edge_1,
     647                 :            :                          RefEdge* ref_edge_2,
     648                 :            :                          RefFace* ref_face );
     649                 :            : 
     650                 :            :   /*! \brief Calculates internal surface angles given 2 refedges on the
     651                 :            :    surface.  This version correctly handles curves in a surface twice. */
     652                 :            :   double geometric_angle(CoEdge* co_edge_1,
     653                 :            :                          CoEdge* co_edge_2 );
     654                 :            : 
     655                 :            :   /*! \brief Calculate dihedral angle at curve between two surfaces of the
     656                 :            :     volume. */
     657                 :            :   double surface_angle( RefFace *ref_face_1, RefFace *ref_face_2,
     658                 :            :                         RefEdge *ref_edge = NULL,
     659                 :            :                         RefVolume *ref_volume = NULL,
     660                 :            :                         double frac = 0.5);
     661                 :            : 
     662                 :            :   /*!  Finds the intersections between a curve and a line  If the bounded flag 
     663                 :            :     *  is true, it finds only those intersections within the parameter range
     664                 :            :     *  of the curve; otherwise it uses the extensions of the curve.  The
     665                 :            :     *  closest option is currently valid only if the curve is straight,
     666                 :            :     *  in which case it will return the 2 closest intersection locations,
     667                 :            :     *  if the straight lines don't actually intersect. The function allocates 
     668                 :            :     *  allocates the CubitVectors in the returned list, so be sure to free them.
     669                 :            :     */
     670                 :            :   //! \brief Finds the intersections of a straight line and a curve.  
     671                 :            :   CubitStatus get_intersections( RefEdge* ref_edge1,
     672                 :            :                                  CubitVector& point1,
     673                 :            :                                  CubitVector& point2,
     674                 :            :                                  DLIList<CubitVector>& intersection_list,
     675                 :            :                                  CubitBoolean bounded = CUBIT_FALSE,
     676                 :            :                                  CubitBoolean closest = CUBIT_FALSE);
     677                 :            :  
     678                 :            :   /*!  Finds the intersections of the two curves.  If the bounded flag is
     679                 :            :     *  true, it finds only those intersections within the parameter range
     680                 :            :     *  of both curves; otherwise it uses the extensions of the curves.  The
     681                 :            :     *  closest option is currently valid only if both curves are straight,
     682                 :            :     *  in which case it will return the 2 closest intersection locations,
     683                 :            :     *  if the straight lines don't actually intersect.  So far, other than
     684                 :            :     *  for straight lines, this function only works if both curves are
     685                 :            :     *  curves, unless both curves are linear.  The function allocates the
     686                 :            :     *  CubitVectors in the returned list, so be sure to free them.
     687                 :            :     */
     688                 :            :   //! \brief Finds the intersections of two curves.  
     689                 :            :   CubitStatus get_intersections( RefEdge* ref_edge1, RefEdge* ref_edge2,
     690                 :            :                                  DLIList<CubitVector>& intersection_list,
     691                 :            :                                  CubitBoolean bounded = CUBIT_FALSE,
     692                 :            :                                  CubitBoolean closest = CUBIT_FALSE );
     693                 :            : 
     694                 :            :   /*! Finds the intersections of the curve and surface.  The curve is extended
     695                 :            :     * if the bounded flag is not false.  The function allocates the CubitVectors
     696                 :            :     * in the returned list, so be sure to free them.
     697                 :            :   */
     698                 :            :   //! \brief Finds the intersections of the curve and surface.  
     699                 :            :   CubitStatus get_intersections( RefEdge* ref_edge, RefFace* ref_face,
     700                 :            :                                  DLIList<CubitVector>& intersection_list,
     701                 :            :                                  CubitBoolean bounded = CUBIT_FALSE );
     702                 :            : 
     703                 :            :   //! Gets the intersection of a curve a plane.  The extended_percent
     704                 :            :   //! extends the plane by a percentage value.
     705                 :            :   CubitStatus get_intersections( RefEdge* ref_edge, CubitPlane plane,
     706                 :            :                                  DLIList<CubitVector>& intersection_list,
     707                 :            :                                  CubitBoolean bounded = CUBIT_FALSE,
     708                 :            :                                  double extended_percent = 0.0);
     709                 :            : 
     710                 :            : 
     711                 :            :   /*! Gets the extrema position along the first given direction. If there
     712                 :            :     * is more than one extrema position, the other directions will be used
     713                 :            :     * to determine a unique position.  Directions 2 and 3 can be NULL.
     714                 :            :     * Entities supported include bodies, volumes, surfaces, curves and
     715                 :            :     * vertices.  
     716                 :            :     */
     717                 :            :   //! \brief Gets extrema position on an entity.
     718                 :            :   CubitStatus entity_extrema( RefEntity *ref_entity_ptr,
     719                 :            :                               const CubitVector *dir1,
     720                 :            :                               const CubitVector *dir2,
     721                 :            :                               const CubitVector *dir3,
     722                 :            :                               CubitVector &extrema,
     723                 :            :                               RefEntity *&extrema_entity_ptr );
     724                 :            : 
     725                 :            :   /*! Gets the extrema position along the first given direction. If there
     726                 :            :     * is more than one extrema position, the other directions will be used
     727                 :            :     * to determine a unique position.  Directions 2 and 3 can be NULL.
     728                 :            :     * Entities supported include bodies, volumes, surfaces, curves and
     729                 :            :     * vertices.  The entity the extrema is found on is also returned.
     730                 :            :     */
     731                 :            :   //! \brief Gets extrema position on a list of entities.
     732                 :            :   CubitStatus entity_extrema( DLIList<RefEntity*> &ref_entity_list,
     733                 :            :                               const CubitVector *dir1,
     734                 :            :                               const CubitVector *dir2,
     735                 :            :                               const CubitVector *dir3,
     736                 :            :                               CubitVector &extrema,
     737                 :            :                               RefEntity *&extrema_entity_ptr );
     738                 :            : 
     739                 :            :   /*! Gets the minimum distance between two entities and the closest positions
     740                 :            :     * on those entities. Supports vertices, curves, surfaces, volumes and bodies.
     741                 :            :   */
     742                 :            :   //! \brief Get the minimum distance between two entities.
     743                 :            :   CubitStatus entity_entity_distance( GeometryEntity *ge1,
     744                 :            :                                       GeometryEntity *ge2,
     745                 :            :                                       CubitVector &pos1, CubitVector &pos2,
     746                 :            :                                       double &distance );
     747                 :            : 
     748                 :            :   /*! Gets the minimum distance between two entities and the closest positions
     749                 :            :     on those entities. Supports vertices, curves, surfaces, volumes and bodies.
     750                 :            :   */
     751                 :            :   //! \brief Get the minimum distance between two entities. (CGM internal use)
     752                 :            :   CubitStatus entity_entity_distance( RefEntity *ref_entity_ptr1,
     753                 :            :                                       RefEntity *ref_entity_ptr2,
     754                 :            :                                       CubitVector &pos1, CubitVector &pos2,
     755                 :            :                                       double &distance );
     756                 :            : 
     757                 :            : 
     758                 :            :   //! \brief Resets geometry factor back to 500.0
     759                 :            :   static void reset_geometry_factor();
     760                 :            :   
     761                 :            :   //! \brief Sets geometry factor. 
     762                 :            :   static void set_geometry_factor( double fac );
     763                 :            : 
     764                 :            :   //! \brief Gets geometry factor. 
     765                 :            :   static double get_geometry_factor();
     766                 :            : 
     767                 :            :   //! \brief Sets bboxMergeTest variable.
     768                 :            :   static void set_merge_test_bbox(CubitBoolean tof);
     769                 :            : 
     770                 :            :   //! \brief Gets bboxMergeTest variable.
     771                 :            :   static CubitBoolean get_merge_test_bbox();
     772                 :            : 
     773                 :            :   static void set_merge_test_internal(int tof);
     774                 :            :   static int get_merge_test_internal();
     775                 :            :   static void set_sliver_curve_cleanup_tolerance( double tol );
     776                 :            :   static void set_sliver_surface_cleanup_tolerance( double tol );
     777                 :            :   static double get_sliver_curve_cleanup_tolerance(); 
     778                 :            :   static double get_sliver_surface_cleanup_tolerance(); 
     779                 :            : 
     780                 :            :   //! \brief Initializes all settings of this class
     781                 :            :   static void initialize_settings();
     782                 :            : 
     783                 :            :   //! \brief Causes attributes hanging on entities to be applied.
     784                 :            :   static CubitStatus import_actuate( DLIList<RefEntity*> &entity_list );
     785                 :            : 
     786                 :            :   /*! \brief Returns CUBIT_TRUE if all the entities have the same geometric query engine and
     787                 :            :     if that is the same one as the default. */
     788                 :            :   CubitBoolean same_query_engine(DLIList<TopologyEntity*> &topo_list) const;
     789                 :            : 
     790                 :            :   /*!  \return GeometryQueryEngine*
     791                 :            :     *   A GeometryQueryEngine common at least one
     792                 :            :     *   TopologyBridge of each of the passed TopologyEntities, or
     793                 :            :     *   NULL if no common geometry engine is found.
     794                 :            :     *   \arg topology_list
     795                 :            :     *   The input list of TopologyEntities
     796                 :            :     *   \arg engine_bridges
     797                 :            :     *   Pass back the list of TopolgyBridges associated with each
     798                 :            :     *   of the passed TopologyEntities (topology_list) and owned
     799                 :            :     *   by the returned geometry engine.
     800                 :            :     *   \arg allow_virtual_engine
     801                 :            :     *   Return VirtualGeometryEngine::instance() if no common
     802                 :            :     *   geometry enginge can be found.
     803                 :            :     *
     804                 :            :     *   Look for a common geometry engine other than the
     805                 :            :     *   VirtualGeometryEngine.  If no common geometry engine other
     806                 :            :     *   than VGE can be found and allow_virtual_engine is FALSE,
     807                 :            :     *   NULL is returned.  If allow_virtual_engine is TRUE, and no
     808                 :            :     *   common geometry engine is found, VGE will be returned, and
     809                 :            :     *   engine_bridges will be populated with any virtual geometry
     810                 :            :     *   if possible, otherwise with the first topology bridge attached
     811                 :            :     *   to each of the passed TopologyEntities.
     812                 :            :     */
     813                 :            :   //! \brief Gets geometry beloning to a common modeling engine. 
     814                 :            :   GeometryQueryEngine* common_query_engine(
     815                 :            :     DLIList<TopologyEntity*>& topology_list,
     816                 :            :     DLIList<TopologyBridge*>& engine_bridges,
     817                 :            :     CubitBoolean allow_default_engine
     818                 :            :     = CUBIT_FALSE ) const;
     819                 :            : 
     820                 :            :   //! \brief Determine if any of the input entities contain the given query engine
     821                 :            :   CubitBoolean does_geom_contain_query_engine(DLIList<TopologyEntity*> &topo_list,
     822                 :            :                                               GeometryQueryEngine *engine) const;
     823                 :            : 
     824                 :            :   //! \brief Determine if any of the input entities contain the given query engine
     825                 :            :   CubitBoolean does_geom_contain_query_engine(DLIList<RefEntity*> &ref_entity_list,
     826                 :            :                                               GeometryQueryEngine *engine,
     827                 :            :                                               CubitBoolean children_too = CUBIT_FALSE) const;
     828                 :            : 
     829                 :            :   //! \brief Retrieves the TopologyEntity from the underlying TopologyBridge
     830                 :            :   TopologyEntity* entity_from_bridge( TopologyBridge* bridge_ptr ) const;
     831                 :            : 
     832                 :            :   //! \brief Adds a geometry query engine to the list
     833                 :            :   void add_gqe(GeometryQueryEngine *gqe_ptr);
     834                 :            : 
     835                 :            :   /*! \brief Removes a geometry query engine from the list. Returns CUBIT_FAILURE
     836                 :            :      if it wasn't in the list */
     837                 :            :   CubitStatus remove_gqe(GeometryQueryEngine *gqe_ptr);
     838                 :            : 
     839                 :            :   //! \brief Return the list of GeometryQureyEngines.
     840                 :            :   void get_gqe_list(DLIList<GeometryQueryEngine*> &gqe_list);
     841                 :            : 
     842                 :            :   //! \brief Returns the first gqe on the list.
     843                 :            :   GeometryQueryEngine *get_gqe();
     844                 :            : 
     845                 :            :   //! \brief Set the default GeometryQueryEngine.
     846                 :            :   CubitStatus set_default_gqe(GeometryQueryEngine* gqe);
     847                 :            : 
     848                 :            :   bool contains_intermediate_geometry(RefEntity*) const;
     849                 :            :   bool contains_intermediate_geometry(DLIList<RefEntity*>& ref_entitylist) const;
     850                 :            :   bool is_intermediate_geometry(RefEntity*) const;
     851                 :            :   bool is_intermediate_geometry(TopologyBridge*) const;
     852                 :            : 
     853                 :            :   /*!- Remove this entity and any dead children where
     854                 :            :   a dead child a) has no parent entities and b) has no topology_bridges. */
     855                 :            :   CubitStatus destroy_dead_entity( TopologyEntity* topo_ent, bool top = true ) const;
     856                 :            : 
     857                 :            :   //! \brief Translate a Body some delta.
     858                 :            :   CubitStatus translate( DLIList<Body*> &bodies,
     859                 :            :                          const CubitVector& delta,
     860                 :            :                          DLIList<Body*> *bodies_translated = NULL,
     861                 :            :                          bool check_to_transform = true,
     862                 :            :                          bool preview = false );
     863                 :            : 
     864                 :            :   //! \brief Translate a BasicTopologyEntity some delta.
     865                 :            :   CubitStatus translate( DLIList<BasicTopologyEntity*> &btes,
     866                 :            :                          const CubitVector& delta,
     867                 :            :                          DLIList<BasicTopologyEntity*> *btes_translated = NULL,
     868                 :            :                          bool check_to_transform = true,
     869                 :            :                          bool preview = false );
     870                 :            : 
     871                 :            :   void translate( DLIList<RefEntity*> &entities_to_transform,
     872                 :            :           double x, double y, double z,
     873                 :            :           bool check_before_transforming,
     874                 :            :           DLIList<RefEntity*> &entities_transformed,
     875                 :            :           bool preview = false );
     876                 :            : 
     877                 :            :   //! \brief Rotate a Body an angle about an axis. 
     878                 :            :   CubitStatus rotate( DLIList<Body*> &bodies,
     879                 :            :                       const CubitVector& axis,
     880                 :            :                       double degrees,
     881                 :            :                       DLIList<Body*> *bodies_rotated = NULL,
     882                 :            :                       bool check_to_transform = true,
     883                 :            :                       bool preview = false );
     884                 :            : 
     885                 :            :   //! \brief Rotate a Body an angle about an axis, defined by a point and a 
     886                 :            :   //! direction.
     887                 :            :   CubitStatus rotate( DLIList<Body*> &bodies,
     888                 :            :                       const CubitVector& point,
     889                 :            :                       const CubitVector& normal,
     890                 :            :                       double degrees,
     891                 :            :                       DLIList<Body*> *bodies_rotated = NULL,
     892                 :            :                       bool check_to_transform = true,
     893                 :            :                       bool preview = false);
     894                 :            : 
     895                 :            :   CubitStatus rotate( DLIList<RefEntity*> &entities_to_transform,  
     896                 :            :                       const CubitVector& point,
     897                 :            :                       const CubitVector& normal,
     898                 :            :                       double degrees,
     899                 :            :                       bool check_to_transform, 
     900                 :            :                       DLIList<RefEntity*> &entities_transformed,
     901                 :            :                       bool preview = false);
     902                 :            : 
     903                 :            :   //! \brief Rotate a BacisTopologyEntity an angle about an axis.
     904                 :            :   CubitStatus rotate( DLIList<BasicTopologyEntity*> &btes,
     905                 :            :                       const CubitVector& axis, 
     906                 :            :                       double degrees,
     907                 :            :                       DLIList<BasicTopologyEntity*> *btes_rotated = NULL,
     908                 :            :                       bool check_to_transform = true,
     909                 :            :                       bool preview = false);
     910                 :            : 
     911                 :            :   CubitStatus rotate( DLIList<BasicTopologyEntity*> &btes,
     912                 :            :                       const CubitVector& point,
     913                 :            :                       const CubitVector& normal,
     914                 :            :                       double degrees,
     915                 :            :                       DLIList<BasicTopologyEntity*> *btes_rotated = NULL,
     916                 :            :                       bool check_to_transform = true,
     917                 :            :                       bool preview = false);
     918                 :            : 
     919                 :            :   //! \brief Scale a Body.
     920                 :            :   CubitStatus scale( Body* entity,const CubitVector& point, double factor, bool check_to_transform = true, bool preview = false);
     921                 :            : 
     922                 :            :   //! \brief Scale a Body different factors in x, y, and z.
     923                 :            :   CubitStatus scale( Body* entity,const CubitVector& point, const CubitVector& factors, bool check_to_transform = true, bool preview = false);
     924                 :            : 
     925                 :            :   //! \brief Scale a BasicTopologyEntity. 
     926                 :            :   CubitStatus scale( BasicTopologyEntity* entity,const CubitVector& point, double factor, bool check_to_transform = true, bool preview = false);
     927                 :            : 
     928                 :            :   //! \brief Scale a BasicTopologyEntity different factors in x, y, and z.
     929                 :            :   CubitStatus scale( BasicTopologyEntity* entity,const CubitVector& point, const CubitVector& factors,bool check_to_transform = true,
     930                 :            :                      bool preview = false);
     931                 :            : 
     932                 :            :   void scale( DLIList<RefEntity*> &entities_to_transform, 
     933                 :            :               const CubitVector& point,
     934                 :            :               double scale_x, double scale_y, double scale_z, 
     935                 :            :               bool check_to_transform, 
     936                 :            :               DLIList<RefEntity*> &entities_scaled,
     937                 :            :               bool preview = false);
     938                 :            : 
     939                 :            :   //! \brief Reflect a list of bodies about a plane defined by an axis.
     940                 :            :   CubitStatus reflect( DLIList<Body*> &bodies,
     941                 :            :                        const CubitVector& point,
     942                 :            :                        const CubitVector& axis,
     943                 :            :                        DLIList<Body*> *bodies_reflected = NULL,
     944                 :            :                        bool preview = false );
     945                 :            : 
     946                 :            :   //! \brief Reflect a BasicTopologyEntity about a plane defined by an axis.
     947                 :            :   CubitStatus reflect( DLIList<BasicTopologyEntity*> &btes,
     948                 :            :                        const CubitVector& point,
     949                 :            :                        const CubitVector& axis,
     950                 :            :                        DLIList<BasicTopologyEntity*> *btes_reflected = NULL,
     951                 :            :                        bool check_to_transform = true,
     952                 :            :                        bool preview = false);
     953                 :            : 
     954                 :            :   void reflect( DLIList<RefEntity*> &entities_to_transform,
     955                 :            :                             const CubitVector& point,
     956                 :            :                             const CubitVector& axis,
     957                 :            :                             bool check_before_transforming,
     958                 :            :                             DLIList<RefEntity*> &entities_transformed,
     959                 :            :                             bool preview = false);
     960                 :            : 
     961                 :            :   //! \brief Need to deprecate.
     962                 :            :   CubitStatus restore_transform( Body* body );
     963                 :            : 
     964                 :            :   /*! Query to determine if volumes intersect, share common volume.
     965                 :            :   Returns CUBIT_TRUE if the two volumes overlap, CUBIT_FALSE if they don't
     966                 :            :   overlap.  If the volumes are touching the function should return CUBIT_FALSE.
     967                 :            :   volume_1, 
     968                 :            :   volume_2
     969                 :            :   The two volume pointers that are being tested for overlap.
     970                 :            :   The function uses the intersect call to test if the volumes 
     971                 :            :   are overlaping.  The full intersect Boolean is needed to see if
     972                 :            :   the volumes actually overlap and don't just touch. */
     973                 :            :   //! \brief Query to determine if volumes intersect, share common volume.
     974                 :            :   CubitBoolean volumes_overlap( RefVolume *volume_1, RefVolume *volume_2);
     975                 :            : 
     976                 :            :   /*! Query to determine if bodies intersect, share common volume.
     977                 :            :   Returns CUBIT_TRUE if the two bodies overlap, CUBIT_FALSE if they don't
     978                 :            :   overlap.  If the bodies are touching the function should return CUBIT_FALSE.
     979                 :            :   body_ptr_1, body_ptr_2
     980                 :            :   The two body pointers that are being tested for overlap.
     981                 :            :   The function uses the intersect call to test if the bodies
     982                 :            :   are overlaping.  The full intersect Boolean is needed to see if
     983                 :            :   the bodies actually overlap and don't just touch. */
     984                 :            :   //! \brief Query to determine if bodies intersect, share common volume.
     985                 :            :   CubitBoolean bodies_overlap( Body *body_ptr_1, Body *body_ptr_2 );
     986                 :            : 
     987                 :            :   //! Given a list of TB's, construct ref entities for them; if the 2nd list pointer is
     988                 :            :   //! non-NULL, pass back the list of ref entities in that list
     989                 :            :   CubitStatus construct_refentities(DLIList<TopologyBridge*> &topology_bridges,
     990                 :            :                                     DLIList<RefEntity*> *imported_entities = NULL);
     991                 :            : 
     992                 :            :   /*! When importing a cub file, embedded in the cub file is how many 
     993                 :            :       geometry entities it is supposed to restore.  If geometry that 
     994                 :            :       you are improrting is merged with geometry already in the session, 
     995                 :            :       you need to keep track of how many geometry entieies get 'merged-away' 
     996                 :            :       like this so that import does not fail.  Taking into account 
     997                 :            :       the 'merged-away' geometry allows CUBIT to successfully import 
     998                 :            :       when you have geometry that will merge-away. */
     999                 :            :   /*! \brief Variable needed when importing geometry that will be 
    1000                 :            :     merged-away with already existing geometry in the session */
    1001                 :            :   static CubitBoolean trackMergedAwayEnts;
    1002                 :            :   static CubitBoolean importingSolidModel;
    1003                 :            : 
    1004                 :            :   //Before calling import_solid_model, normally we want to clear out the 
    1005                 :            :   //map in CAUniqueId, but not when we are importing a cub file.
    1006                 :            :   static CubitBoolean clearUidMapBeforeImport; 
    1007                 :            : 
    1008                 :            :   //variable defining scope of merge...if true, 
    1009                 :            :   //merge entities you are importing with any entity (i.e.
    1010                 :            :   //entities already in the cubit session), otherwise 
    1011                 :            :   //only merge entities that are importing with other entities 
    1012                 :            :   //that are importing 
    1013                 :            :   static CubitBoolean mergeGloballyOnImport;
    1014                 :            : 
    1015                 :            :   static DLIList<int> uidsOfImportingEnts;
    1016                 :            :   static int entitiesMergedAway; 
    1017                 :            : 
    1018                 :            :   CGMHistory& history();
    1019                 :            : 
    1020                 :            :   CubitStatus get_graphics( Body *body, 
    1021                 :            :                             GMem *g_mem,
    1022                 :            :                             std::vector<RefFace*> &face_to_facet_vector,
    1023                 :            :                             std::vector<RefEntity*> &facet_point_ownership_vector,
    1024                 :            :                             std::vector<std::pair<RefEntity*, std::pair<int,int> > > &facetedges_on_refedges,
    1025                 :            :                             unsigned short normal_tolerance, 
    1026                 :            :                             double distance_tolerance, 
    1027                 :            :                             double max_edge_length );
    1028                 :            : 
    1029                 :            :   CubitStatus get_graphics( RefFace *ref_face,
    1030                 :            :                             GMem *gmem,
    1031                 :            :                             std::vector<RefEntity*> &facet_point_ownership_vector,
    1032                 :            :                             std::vector<std::pair< RefEntity*, std::pair<int,int> > > &facetedges_on_refedges,
    1033                 :            :                             unsigned short normal_tolerance = 15, 
    1034                 :            :                             double distance_tolerance = 0.0, 
    1035                 :            :                             double max_edge_length = 0.0 );
    1036                 :            : 
    1037                 :            :   CubitStatus get_point_containment( DLIList<Body*> &body_list,
    1038                 :            :                                      DLIList<CubitVector> &point_list,
    1039                 :            :                                      double tolerance,
    1040                 :            :                                      bool allow_pts_in_multiple_bodies,
    1041                 :            :                                      std::vector< std::pair<Body*, std::vector<int> > > &body_to_pt_indices );
    1042                 :            : 
    1043                 :            : protected :
    1044                 :            : 
    1045                 :            :   GeometryQueryTool(GeometryQueryEngine* GQEPtr);
    1046                 :            :   /**<  Constructor for the (singleton) GeometryQueryTool object
    1047                 :            :     */
    1048                 :            : 
    1049                 :            : private :
    1050                 :            : 
    1051                 :            :   CubitBoolean okay_to_transform( Body* body ) const;
    1052                 :            :   CubitBoolean okay_to_transform( BasicTopologyEntity* bte ) const;
    1053                 :            :   void notify_observers_of_transform(RefEntity* ref_entity,  const CubitTransformMatrix *transform = NULL ) const;
    1054                 :            :   void notify_observers_of_transform(DLIList<RefEntity*> &ref_ents,
    1055                 :            :                                      const CubitTransformMatrix *xform = NULL) const;
    1056                 :            : 
    1057                 :            :   CubitStatus notify_intermediate_of_transform( TopologyEntity* bte,
    1058                 :            :                                              const CubitTransformMatrix& xform
    1059                 :            :                                              ) const;
    1060                 :            : 
    1061                 :            :   Shell* make_Shell(ShellSM *shellsm_ptr, bool& shell_modified ) const;
    1062                 :            :   RefVolume* make_RefVolume( Lump* lump_ptr, bool& vol_modified ) const;
    1063                 :            : 
    1064                 :            :   CubitStatus make_merged_RefFace( Surface* surface_ptr ) const;
    1065                 :            :     // Helper function for make_RefFace(Surface*)
    1066                 :            :     // For a merged RefFace, check if the passed surface topology
    1067                 :            :     // is still compatible.  If so, remerge any unmerged child
    1068                 :            :     // entities and return CUBIT_SUCCESS.  If not, return CUBIT_FAILURE.
    1069                 :            : 
    1070                 :            :   RefEntity *check_mergeable_refentity(GeometryEntity *bridge) const;
    1071                 :            :     // check for mergeable ref entity, indicated by a merge attribute on the
    1072                 :            :     // bridge
    1073                 :            : 
    1074                 :            :   CoEdgeSM *find_merged_coedgesm( Surface* on_this_surface,
    1075                 :            :                                   CoEdgeSM* merged_with_this ) const;
    1076                 :            :     // check for mergeable sense entity, which is a child of the entity pointed
    1077                 :            :     // to by a merge attribute on bridge, which corresponds to re_ptr
    1078                 :            : 
    1079                 :            :   
    1080                 :            :   void get_merged_away_free_entities( DLIList<RefEntity*> &ref_ents,
    1081                 :            :                                       DLIList<TopologyBridge*> &free_ents );
    1082                 :            : 
    1083                 :            : 
    1084                 :            :   CubitStatus straightline_intersections( RefEdge* ref_edge1,
    1085                 :            :                                  CubitVector & origin2,
    1086                 :            :                                  CubitVector & dir2,
    1087                 :            :                                  DLIList<CubitVector>& intersection_list,
    1088                 :            :                                  CubitBoolean bounded = CUBIT_FALSE,
    1089                 :            :                                  CubitBoolean closest = CUBIT_FALSE);
    1090                 :            : 
    1091                 :            :   //! static pointer to the unique instance of this class.
    1092                 :            :   static GeometryQueryTool* instance_;
    1093                 :            : 
    1094                 :            :   //! For use in calculating a bounding box, you can do it based on
    1095                 :            :   //! a set of facets, rather than what default modeling engine  uses.
    1096                 :            :   static CubitBoolean useFacetBBox;
    1097                 :            : 
    1098                 :            :   //! The list of geometry query engines
    1099                 :            :   DLIList<GeometryQueryEngine*> gqeList;
    1100                 :            : 
    1101                 :            :   struct IGEComp : public std::binary_function<IntermediateGeomEngine*,
    1102                 :            :                                               IntermediateGeomEngine*,
    1103                 :            :                                               bool> {
    1104                 :       1682 :     bool operator() ( const IntermediateGeomEngine* ptr1,
    1105                 :            :                       const IntermediateGeomEngine* ptr2 ) const
    1106                 :       1682 :       { return ptr1->level() < ptr2->level(); }
    1107                 :            :   };
    1108                 :            :   typedef std::set<IntermediateGeomEngine*,IGEComp> IGESet;
    1109                 :            :   IGESet igeSet;
    1110                 :            : 
    1111                 :            :   //! \brief The default geometry query engine
    1112                 :            :   GeometryQueryEngine *default_gqe;
    1113                 :            : 
    1114                 :            :   //! After imprinting, an attempt at removing sliver curves is made.
    1115                 :            :   //! Curves less than this tolerance will be removed.
    1116                 :            :   static double curveSliverCleanUpTolerance;
    1117                 :            : 
    1118                 :            :   //! After imprinting, an attempt at removing sliver surfaces is made.
    1119                 :            :   //! Removes sliver surfaces whose maximum gap distance among the long 
    1120                 :            :   //! edges is smaller than the tolerance and who have at most three long edges. 
    1121                 :            :   static double surfaceSliverCleanUpTolerance;
    1122                 :            : 
    1123                 :            :   //!  This factor is the the multiplier for the  resabs
    1124                 :            :   //!  when comparingcurves.  ALWAYS when using a multiplier
    1125                 :            :   //!  use this factor for consistancy.
    1126                 :            :   static double geometryToleranceFactor;
    1127                 :            : 
    1128                 :            :   static CubitBoolean bboxMergeTest;
    1129                 :            : 
    1130                 :            :   //! Options for refface merging.
    1131                 :            :   //! 0=off, 1=all, 2=splines only
    1132                 :            :   static int internalSurfaceMergeTest; 
    1133                 :            : 
    1134                 :            :   int maxPersistentBodyId;
    1135                 :            :   int maxPersistentRefVolumeId;
    1136                 :            :   int maxPersistentRefGroupId;
    1137                 :            :   int maxPersistentRefFaceId;
    1138                 :            :   int maxPersistentRefEdgeId;
    1139                 :            :   int maxPersistentRefVertexId;
    1140                 :            : 
    1141                 :            :   CGMHistory mHistory;
    1142                 :            : };
    1143                 :            : 
    1144                 :            : inline void GeometryQueryTool::reset_geometry_factor()
    1145                 :            : {
    1146                 :            :   geometryToleranceFactor = DEFAULT_GEOM_FACTOR;
    1147                 :            : }
    1148                 :            : 
    1149                 :          2 : inline void GeometryQueryTool::set_geometry_factor( double factor )
    1150                 :            : {
    1151         [ -  + ]:          2 :   if ( factor < .0099999999999 )
    1152                 :          0 :     return;
    1153                 :            :   else
    1154                 :          2 :     geometryToleranceFactor = factor;
    1155                 :            : }
    1156                 :       6072 : inline double GeometryQueryTool::get_geometry_factor()
    1157                 :            : {
    1158                 :       6072 :   return geometryToleranceFactor;
    1159                 :            : }
    1160                 :            : 
    1161                 :            : inline void GeometryQueryTool::set_sliver_surface_cleanup_tolerance( double tol )
    1162                 :            : {
    1163                 :            :   surfaceSliverCleanUpTolerance = tol;
    1164                 :            : }
    1165                 :            : 
    1166                 :            : inline void GeometryQueryTool::set_sliver_curve_cleanup_tolerance( double tol )
    1167                 :            : {
    1168                 :            :   curveSliverCleanUpTolerance = tol;
    1169                 :            : }
    1170                 :            : 
    1171                 :            : inline double GeometryQueryTool::get_sliver_curve_cleanup_tolerance()
    1172                 :            : {
    1173                 :            :   return curveSliverCleanUpTolerance; 
    1174                 :            : }
    1175                 :            : 
    1176                 :            : inline double GeometryQueryTool::get_sliver_surface_cleanup_tolerance()
    1177                 :            : {
    1178                 :            :   return surfaceSliverCleanUpTolerance; 
    1179                 :            : }
    1180                 :            : 
    1181                 :       5012 : inline CubitBoolean GeometryQueryTool::get_merge_test_bbox()
    1182                 :       5012 : {return bboxMergeTest;}
    1183                 :       5012 : inline int GeometryQueryTool::get_merge_test_internal()
    1184                 :       5012 : {return internalSurfaceMergeTest;}
    1185                 :          0 : inline void GeometryQueryTool::set_merge_test_bbox(CubitBoolean tof)
    1186                 :          0 : {bboxMergeTest = tof;}
    1187                 :          0 : inline void GeometryQueryTool::set_merge_test_internal(int tof)
    1188                 :          0 : {internalSurfaceMergeTest = tof;}
    1189                 :            : 
    1190                 :       1715 : inline void GeometryQueryTool::add_gqe(GeometryQueryEngine *gqe_ptr)
    1191                 :            : {
    1192         [ -  + ]:       1715 :   assert(gqe_ptr != 0);
    1193         [ +  - ]:       1715 :   if (!gqeList.move_to(gqe_ptr)) gqeList.append(gqe_ptr);
    1194                 :       1715 : }
    1195                 :            :   /**< add a geometry query engine to the list
    1196                 :            :    */
    1197                 :            : 
    1198                 :            : inline CubitStatus GeometryQueryTool::remove_gqe(GeometryQueryEngine *gqe_ptr)
    1199                 :            : {
    1200                 :            :   assert(gqe_ptr != 0);
    1201                 :            :   CubitStatus status = CUBIT_FAILURE;
    1202                 :            :   if (gqeList.move_to(gqe_ptr)) {
    1203                 :            :     gqeList.remove();
    1204                 :            :     status = CUBIT_SUCCESS;
    1205                 :            :   }
    1206                 :            :   return status;
    1207                 :            : }
    1208                 :            : 
    1209                 :          0 : inline void GeometryQueryTool::get_gqe_list(DLIList<GeometryQueryEngine*> &gqe_list)
    1210                 :            : {
    1211                 :          0 :   gqe_list += gqeList;
    1212                 :          0 : }
    1213                 :            :   /**< return the list of gqe's
    1214                 :            :    */
    1215                 :            : 
    1216                 :         11 : inline GeometryQueryEngine *GeometryQueryTool::get_gqe()
    1217                 :            : {
    1218                 :         11 :   GeometryQueryEngine *gqe = NULL;
    1219         [ +  - ]:         11 :   if (gqeList.size()) {
    1220                 :         11 :     gqeList.reset();
    1221                 :         11 :     gqe = gqeList.get();
    1222                 :            :   }
    1223                 :         11 :   return gqe;
    1224                 :            : }
    1225                 :            : 
    1226                 :            :   /**< Return the VirtualGeometryEngine if it exists.  Otherwise return null.
    1227                 :            :    */
    1228                 :            : 
    1229                 :            : #endif
    1230                 :            : 
    1231                 :            : 
    1232                 :            : 

Generated by: LCOV version 1.11