cgma
GeometryQueryTool.hpp
Go to the documentation of this file.
00001 
00016 #ifndef GEOMETRYQUERYTOOL_HPP
00017 #define GEOMETRYQUERYTOOL_HPP
00018 
00019 #include <stdio.h>
00020 #include <typeinfo>
00021 #include <list>
00022 #include <set>
00023 
00024 #include "GeometryDefines.h"
00025 #include "DLIList.hpp"
00026 #include "GeometryQueryEngine.hpp"
00027 #include "IntermediateGeomEngine.hpp"
00028 #include "CGMHistory.hpp"
00029 
00030 class RefGroup;
00031 class Body;
00032 class BodySM;
00033 class Lump;
00034 class Shell;
00035 class ShellSM;
00036 class Loop;
00037 class LoopSM;
00038 class Chain;
00039 class Surface;
00040 class Curve;
00041 class TopologyBridge;
00042 class CoEdgeSM;
00043 
00044 class GeometryEntity;
00045 
00046 class RefGroup;
00047 
00048 class TopologyEntity;
00049 class TopologyBridge;
00050 
00051 class RefEntity ;
00052 class RefVolume ;
00053 class RefFace ;
00054 class RefEdge ;
00055 class CoEdge;
00056 class RefVertex ;
00057 
00058 class SenseEntity;
00059 class BasicTopologyEntity;
00060 class RefVolume ;
00061 class RefFace ;
00062 class RefEdge ;
00063 class RefVertex ;
00064 class TBPoint;
00065 class CubitEntity;
00066 class CoEdgeSM;
00067 
00068 class GeometryQueryEngine;
00069 
00070 class CubitPlane ;
00071 class CubitBox;
00072 class CubitVector;
00073 class CubitTransformMatrix;
00074 class TBOwner;
00075 
00076 #ifdef PROE
00077 class RefPart;
00078 class RefAssembly;
00079 #endif
00080 
00082 class CUBIT_GEOM_EXPORT GeometryQueryTool
00083 {
00084 public :
00085 
00086   friend class GeometryModifyTool;
00087    
00088   bool ige_is_composite(TBOwner *bridge_owner);
00089   bool ige_is_composite(TopologyBridge *bridge);
00090   bool ige_is_partition(TBOwner *bridge_owner);
00091 
00092 
00093   void ige_remove_modified(DLIList<Surface*> &all_surfs,
00094                                             DLIList<Curve*> &all_curves,
00095                                             DLIList<TBPoint*> &all_points);
00096 
00097   static GeometryQueryTool* instance( GeometryQueryEngine* gqePtr = NULL);
00113   ~GeometryQueryTool();
00115 
00116   static void delete_instance();
00117   
00121   double estimate_merge_tolerance(DLIList<RefVolume*> &vol_list,
00122                                                     bool accurate_in = false,
00123                                                     bool report_in = false,
00124                                                     double lo_val_in = -1.0, 
00125                                                     double hi_val_in = -1.0,
00126                                                     int num_calculations_in = 10,
00127                                                     bool return_calculations_in = false,
00128                                                     DLIList<double> *merge_tols = NULL,
00129                                                     DLIList<int> *num_proximities = NULL);
00130 
00134   void find_floating_volumes(DLIList<RefVolume*> &vol_list,
00135                              DLIList<RefVolume*> &floating_list);
00136 
00140   void find_nonmanifold_curves(DLIList<RefVolume*> &vol_list, DLIList<RefEdge*> &curve_list);
00141 
00145   void find_nonmanifold_vertices(DLIList<RefVolume*> &vol_list, DLIList<RefVertex*> &vertex_list);
00146 
00147   CubitStatus register_intermediate_engine( IntermediateGeomEngine* engine );
00148   void unregister_intermediate_engine( IntermediateGeomEngine* engine );
00149 
00150   void ige_remove_imprint_attributes_after_modify(DLIList<BodySM*> &old_sms,
00151                                               DLIList<BodySM*> &new_sms);
00152   void ige_push_imprint_attributes_before_modify
00153                                 ( DLIList<BodySM*> &geom_list );
00154   void ige_push_named_attributes_to_curves_and_points
00155                                 ( DLIList<TopologyBridge*> &tb_list, const char *name_in );
00156   void ige_export_geom( DLIList<TopologyBridge*> &geom_list );
00157   void ige_import_geom( DLIList<TopologyBridge*> &geom_list );
00158   void ige_remove_attributes( DLIList<TopologyBridge*> &geom_list );
00159   void ige_attribute_after_imprinting(DLIList<TopologyBridge*> &tb_list,
00160                                       DLIList<Body*> &old_bodies);
00161   void ige_remove_attributes_from_unmodifed_virtual(DLIList<TopologyBridge*> &bridges);
00162   
00163   //Using the source_bridge, finds all bridges that actually have a BridgeManager the owner.
00164   //This is for obtaining the real TopologyBridge when all you have is a  TopologyBridge 
00165   //that is Partition Entity.
00166   void get_tbs_with_bridge_manager_as_owner( TopologyBridge *source_bridge, 
00167                                              DLIList<TopologyBridge*> &tbs );
00168 
00171   //
00172   // Returns ref entities in a generic cubit entity list (overwrites list).
00173   // returns CUBIT_FAILURE if keyword is not a ref entity name, and
00174   // optionally prints error message
00175   //
00176   //CubitStatus cubit_entity_list( const char* keyword,
00177   //                               DLIList<CubitEntity*> &entity_list,
00178   //                               const CubitBoolean print_errors = CUBIT_TRUE);
00179 
00185 
00186   CubitStatus ref_entity_list( char const* keyword,
00187                                DLIList<RefEntity*> &entity_list,
00188                                const CubitBoolean print_errors = CUBIT_TRUE);
00189 
00191   CubitBox model_bounding_box();
00192 
00195 
00196   CubitBox bounding_box_of_bodies();
00197 
00198 
00200   void bodies (DLIList<Body*> &bodies);
00201 
00203   void ref_volumes (DLIList<RefVolume*> &ref_volumes);
00204 
00206   void ref_groups (DLIList<RefGroup*> &ref_groups);
00207 
00209   void ref_faces (DLIList<RefFace*> &ref_faces);
00210 
00212   void ref_edges (DLIList<RefEdge*> &ref_edges);
00213 
00215   void ref_vertices (DLIList<RefVertex*> &ref_vertices);
00216 
00217   void get_ordered_loops(RefFace* face, DLIList<Loop*> &loop_list);
00218 
00219 #ifdef PROE
00220   void ref_parts (DLIList<RefPart*> &ref_parts);
00221   void ref_assemblies (DLIList<RefAssembly*> &ref_assemblies);
00222 #endif //PROE
00223 
00224 
00226   int num_bodies() const;
00227 
00229   int num_ref_volumes() const;
00230 
00232   int num_ref_groups() const;
00233 
00235   int num_ref_faces() const;
00236 
00238   int num_ref_edges() const;
00239 
00241   int num_ref_vertices() const;
00242 
00244   RefEntity *get_ref_entity (const char *type, int id);
00245 
00247   RefEntity *get_ref_entity (const std::type_info& type, int id);
00248 
00250   Body *get_body ( int id );
00251 
00253   RefVolume *get_ref_volume ( int id );
00254 
00256   RefGroup *get_ref_group ( int id );
00257 
00259   RefFace *get_ref_face ( int id );
00260 
00262   RefEdge *get_ref_edge ( int id );
00263 
00265   RefVertex *get_ref_vertex ( int id );
00266   
00267 
00269   Body *get_first_body ();
00271   RefVolume *get_first_ref_volume ();
00273   RefGroup *get_first_ref_group ();
00275   RefFace *get_first_ref_face ();
00277   RefEdge *get_first_ref_edge ();
00279   RefVertex *get_first_ref_vertex ();
00280 
00282   Body *get_next_body ();
00284   RefVolume *get_next_ref_volume ();
00286   RefGroup *get_next_ref_group ();
00288   RefFace *get_next_ref_face ();
00290   RefEdge *get_next_ref_edge ();
00292   RefVertex *get_next_ref_vertex ();
00293 
00295   Body *get_last_body ();
00297   RefVolume *get_last_ref_volume ();
00299   RefGroup *get_last_ref_group ();
00301   RefFace *get_last_ref_face ();
00303   RefEdge *get_last_ref_edge ();
00305   RefVertex *get_last_ref_vertex ();
00306   
00307   
00309   CubitStatus get_free_ref_entities(DLIList<RefEntity*> &free_entities);
00310 
00315   void get_connected_free_ref_entities(
00316     RefEntity *entity,
00317     const int merge_option,
00318     DLIList<Body*> &body_list,
00319     DLIList<RefFace*> &ref_face_list,
00320     DLIList<RefEdge*> &ref_edge_list,
00321     DLIList<RefVertex*> &ref_vertex_list );
00322 
00323   void validate_geometry_database();
00324 
00327   CubitStatus save_temp_geom_files( DLIList<RefEntity*>& ref_entity_list,
00328                                   const char* filename,
00329                                   const CubitString &cubit_version,
00330                                   std::list<CubitString> &files_written,
00331                                   std::list<CubitString> &types_written);
00332 
00333 
00364   CubitStatus export_solid_model( DLIList<RefEntity*>& ref_entity_list,
00365                                   const char* filename,
00366                                   Model_File_Type filetype,
00367                                   int &num_ents_exported,
00368                                   const CubitString &cubit_version,
00369                                   ModelExportOptions &export_options );
00370 
00400   CubitStatus export_solid_model(DLIList<RefEntity*>& ref_entity_list,
00401                  char*& p_buffer,
00402                  int& n_buffer_size,
00403                  bool b_export_buffer);
00433 
00434   CubitStatus import_solid_model(const char* file_name,
00435                                  Model_File_Type file_type,
00436                                  ModelImportOptions &import_options,
00437                  DLIList<RefEntity*> *imported_entities = NULL );
00438 
00439 
00440     // import entities in a solid model buffer
00441   CubitStatus import_solid_model(DLIList<RefEntity*> *imported_entities,
00442                  const char* pBuffer,
00443                  const int n_buffer_size);
00444 
00468 
00469   CubitStatus fire_ray( CubitVector &origin,
00470                         CubitVector &direction,
00471                         DLIList<RefEntity*> &at_entity_list,
00472                         DLIList<double> &ray_params,
00473                         int max_hits = 0,
00474                         double ray_radius = 0.0,
00475                         DLIList<RefEntity*> *hit_entity_list_ptr = 0 );
00476 
00500 
00501   CubitStatus fire_ray( CubitVector &origin,
00502                         CubitVector &direction,
00503                         DLIList<TopologyEntity*> &at_entity_list,
00504                         DLIList<double> &ray_params,
00505                         int max_hits = 0,
00506                         double ray_radius = 0.0,
00507                         DLIList<TopologyEntity*> *hit_entity_list_ptr = 0 );
00508   
00510   static void geom_debug( DLIList<TopologyEntity*> );
00511 
00513   static void set_facet_bbox( CubitBoolean pass_flag )
00514       {useFacetBBox = pass_flag;}
00515 
00517   static CubitBoolean get_facet_bbox()
00518       {return useFacetBBox;}
00519 
00521   CubitString get_engine_version_string();
00522 
00524   CubitStatus set_export_allint_version(int version);
00525 
00527   int get_allint_version();
00528 
00530   CubitStatus list_engine_versions(CubitString &versions);
00531 
00533   double get_sme_resabs_tolerance();
00534 
00536   double set_sme_resabs_tolerance( double new_resabs );
00537 
00539   CubitStatus set_sme_int_option( const char* opt_name, int val );
00541   CubitStatus set_sme_dbl_option( const char* opt_name, double val );
00543   CubitStatus set_sme_str_option( const char* opt_name, const char* val );
00544 
00545 
00547   Body* make_Body(BodySM *bodysm_ptr) const;
00548   RefFace* make_RefFace(Surface* surface_ptr ) const;
00549   RefEdge* make_RefEdge(Curve* curve_ptr) const;
00550   RefVertex* make_RefVertex(TBPoint* point_ptr) const;
00551 
00552   static CubitSense relative_sense( Surface* surface1, Surface* surface2 );
00553 
00554   RefFace* make_free_RefFace(Surface *surface_ptr, bool is_free_surface) const;
00555   RefEdge* make_free_RefEdge(Curve *curve_ptr ) const;
00556   RefVertex* make_free_RefVertex(TBPoint *point_ptr) const;
00564 
00565 
00570   void delete_Body( DLIList<Body*>& body_list );
00571 
00579 
00580   CubitStatus delete_Body( Body* body_ptr );
00581 
00588 
00589   CubitStatus delete_single_Body( Body* body_ptr );
00590 
00592   CubitStatus delete_RefEntity( RefEntity* ref_entity_ptr );
00593   
00595   CubitStatus delete_RefFace( RefFace* ref_face_ptr );
00596 
00598   CubitStatus delete_RefEdge( RefEdge* ref_edge_ptr );
00599 
00601   CubitStatus delete_RefVertex( RefVertex* ref_vertex_ptr );
00602 
00603   void cleanout_deactivated_geometry();
00604   void cleanout_temporary_geometry ();
00605   
00607   void delete_geometry();
00608 
00609   
00614   CubitStatus interpolate_along_surface( CubitVector *vector_1,
00615                                          CubitVector *vector_2,
00616                                          DLIList<CubitVector*> &vector_list,
00617                                          RefFace* ref_face_ptr,
00618                                          int number_points ) const;
00633 
00634   CubitBoolean about_spatially_equal (const CubitVector& Vec1,
00635                                       const CubitVector& Vec2,
00636                                       double tolerance_factor = 1.0);
00637 
00639   CubitBoolean about_spatially_equal (RefVertex* refVertex1,
00640                                       RefVertex* refVertex2,
00641                                       double tolerance_factor = 1.0);
00642 
00646   double geometric_angle(RefEdge* ref_edge_1,
00647                          RefEdge* ref_edge_2,
00648                          RefFace* ref_face );
00649 
00652   double geometric_angle(CoEdge* co_edge_1,
00653                          CoEdge* co_edge_2 );
00654 
00657   double surface_angle( RefFace *ref_face_1, RefFace *ref_face_2,
00658                         RefEdge *ref_edge = NULL,
00659                         RefVolume *ref_volume = NULL,
00660                         double frac = 0.5);
00661 
00670 
00671   CubitStatus get_intersections( RefEdge* ref_edge1,
00672                                  CubitVector& point1,
00673                                  CubitVector& point2,
00674                                  DLIList<CubitVector>& intersection_list,
00675                                  CubitBoolean bounded = CUBIT_FALSE,
00676                                  CubitBoolean closest = CUBIT_FALSE);
00677  
00688 
00689   CubitStatus get_intersections( RefEdge* ref_edge1, RefEdge* ref_edge2,
00690                                  DLIList<CubitVector>& intersection_list,
00691                                  CubitBoolean bounded = CUBIT_FALSE,
00692                                  CubitBoolean closest = CUBIT_FALSE );
00693 
00698 
00699   CubitStatus get_intersections( RefEdge* ref_edge, RefFace* ref_face,
00700                                  DLIList<CubitVector>& intersection_list,
00701                                  CubitBoolean bounded = CUBIT_FALSE );
00702 
00705   CubitStatus get_intersections( RefEdge* ref_edge, CubitPlane plane,
00706                                  DLIList<CubitVector>& intersection_list,
00707                                  CubitBoolean bounded = CUBIT_FALSE,
00708                                  double extended_percent = 0.0);
00709 
00710 
00717 
00718   CubitStatus entity_extrema( RefEntity *ref_entity_ptr,
00719                               const CubitVector *dir1,
00720                               const CubitVector *dir2,
00721                               const CubitVector *dir3,
00722                               CubitVector &extrema,
00723                               RefEntity *&extrema_entity_ptr );
00724 
00731 
00732   CubitStatus entity_extrema( DLIList<RefEntity*> &ref_entity_list,
00733                               const CubitVector *dir1,
00734                               const CubitVector *dir2,
00735                               const CubitVector *dir3,
00736                               CubitVector &extrema,
00737                               RefEntity *&extrema_entity_ptr );
00738 
00742 
00743   CubitStatus entity_entity_distance( GeometryEntity *ge1,
00744                                       GeometryEntity *ge2,
00745                                       CubitVector &pos1, CubitVector &pos2,
00746                                       double &distance );
00747 
00751 
00752   CubitStatus entity_entity_distance( RefEntity *ref_entity_ptr1,
00753                                       RefEntity *ref_entity_ptr2,
00754                                       CubitVector &pos1, CubitVector &pos2,
00755                                       double &distance );
00756 
00757 
00759   static void reset_geometry_factor();
00760   
00762   static void set_geometry_factor( double fac );
00763 
00765   static double get_geometry_factor();
00766 
00768   static void set_merge_test_bbox(CubitBoolean tof);
00769 
00771   static CubitBoolean get_merge_test_bbox();
00772 
00773   static void set_merge_test_internal(int tof);
00774   static int get_merge_test_internal();
00775   static void set_sliver_curve_cleanup_tolerance( double tol );
00776   static void set_sliver_surface_cleanup_tolerance( double tol );
00777   static double get_sliver_curve_cleanup_tolerance(); 
00778   static double get_sliver_surface_cleanup_tolerance(); 
00779 
00781   static void initialize_settings();
00782 
00784   static CubitStatus import_actuate( DLIList<RefEntity*> &entity_list );
00785 
00788   CubitBoolean same_query_engine(DLIList<TopologyEntity*> &topo_list) const;
00789 
00813 
00814   GeometryQueryEngine* common_query_engine(
00815     DLIList<TopologyEntity*>& topology_list,
00816     DLIList<TopologyBridge*>& engine_bridges,
00817     CubitBoolean allow_default_engine
00818     = CUBIT_FALSE ) const;
00819 
00821   CubitBoolean does_geom_contain_query_engine(DLIList<TopologyEntity*> &topo_list,
00822                                               GeometryQueryEngine *engine) const;
00823 
00825   CubitBoolean does_geom_contain_query_engine(DLIList<RefEntity*> &ref_entity_list,
00826                                               GeometryQueryEngine *engine,
00827                                               CubitBoolean children_too = CUBIT_FALSE) const;
00828 
00830   TopologyEntity* entity_from_bridge( TopologyBridge* bridge_ptr ) const;
00831 
00833   void add_gqe(GeometryQueryEngine *gqe_ptr);
00834 
00837   CubitStatus remove_gqe(GeometryQueryEngine *gqe_ptr);
00838 
00840   void get_gqe_list(DLIList<GeometryQueryEngine*> &gqe_list);
00841 
00843   GeometryQueryEngine *get_gqe();
00844 
00846   CubitStatus set_default_gqe(GeometryQueryEngine* gqe);
00847 
00848   bool contains_intermediate_geometry(RefEntity*) const;
00849   bool contains_intermediate_geometry(DLIList<RefEntity*>& ref_entitylist) const;
00850   bool is_intermediate_geometry(RefEntity*) const;
00851   bool is_intermediate_geometry(TopologyBridge*) const;
00852 
00855   CubitStatus destroy_dead_entity( TopologyEntity* topo_ent, bool top = true ) const;
00856 
00858   CubitStatus translate( DLIList<Body*> &bodies,
00859                          const CubitVector& delta,
00860                          DLIList<Body*> *bodies_translated = NULL,
00861                          bool check_to_transform = true,
00862                          bool preview = false );
00863 
00865   CubitStatus translate( DLIList<BasicTopologyEntity*> &btes,
00866                          const CubitVector& delta,
00867                          DLIList<BasicTopologyEntity*> *btes_translated = NULL,
00868                          bool check_to_transform = true,
00869                          bool preview = false );
00870 
00871   void translate( DLIList<RefEntity*> &entities_to_transform,
00872           double x, double y, double z,
00873           bool check_before_transforming,
00874           DLIList<RefEntity*> &entities_transformed,
00875           bool preview = false );
00876 
00878   CubitStatus rotate( DLIList<Body*> &bodies,
00879                       const CubitVector& axis,
00880                       double degrees,
00881                       DLIList<Body*> *bodies_rotated = NULL,
00882                       bool check_to_transform = true,
00883                       bool preview = false );
00884 
00887   CubitStatus rotate( DLIList<Body*> &bodies,
00888                       const CubitVector& point,
00889                       const CubitVector& normal,
00890                       double degrees,
00891                       DLIList<Body*> *bodies_rotated = NULL,
00892                       bool check_to_transform = true,
00893                       bool preview = false);
00894 
00895   CubitStatus rotate( DLIList<RefEntity*> &entities_to_transform,  
00896                       const CubitVector& point,
00897                       const CubitVector& normal,
00898                       double degrees,
00899                       bool check_to_transform, 
00900                       DLIList<RefEntity*> &entities_transformed,
00901                       bool preview = false);
00902 
00904   CubitStatus rotate( DLIList<BasicTopologyEntity*> &btes,
00905                       const CubitVector& axis, 
00906                       double degrees,
00907                       DLIList<BasicTopologyEntity*> *btes_rotated = NULL,
00908                       bool check_to_transform = true,
00909                       bool preview = false);
00910 
00911   CubitStatus rotate( DLIList<BasicTopologyEntity*> &btes,
00912                       const CubitVector& point,
00913                       const CubitVector& normal,
00914                       double degrees,
00915                       DLIList<BasicTopologyEntity*> *btes_rotated = NULL,
00916                       bool check_to_transform = true,
00917                       bool preview = false);
00918 
00920   CubitStatus scale( Body* entity,const CubitVector& point, double factor, bool check_to_transform = true, bool preview = false);
00921 
00923   CubitStatus scale( Body* entity,const CubitVector& point, const CubitVector& factors, bool check_to_transform = true, bool preview = false);
00924 
00926   CubitStatus scale( BasicTopologyEntity* entity,const CubitVector& point, double factor, bool check_to_transform = true, bool preview = false);
00927 
00929   CubitStatus scale( BasicTopologyEntity* entity,const CubitVector& point, const CubitVector& factors,bool check_to_transform = true,
00930                      bool preview = false);
00931 
00932   void scale( DLIList<RefEntity*> &entities_to_transform, 
00933               const CubitVector& point,
00934               double scale_x, double scale_y, double scale_z, 
00935               bool check_to_transform, 
00936               DLIList<RefEntity*> &entities_scaled,
00937               bool preview = false);
00938 
00940   CubitStatus reflect( DLIList<Body*> &bodies,
00941                        const CubitVector& point,
00942                        const CubitVector& axis,
00943                        DLIList<Body*> *bodies_reflected = NULL,
00944                        bool preview = false );
00945 
00947   CubitStatus reflect( DLIList<BasicTopologyEntity*> &btes,
00948                        const CubitVector& point,
00949                        const CubitVector& axis,
00950                        DLIList<BasicTopologyEntity*> *btes_reflected = NULL,
00951                        bool check_to_transform = true,
00952                        bool preview = false);
00953 
00954   void reflect( DLIList<RefEntity*> &entities_to_transform,
00955                             const CubitVector& point,
00956                             const CubitVector& axis,
00957                             bool check_before_transforming,
00958                             DLIList<RefEntity*> &entities_transformed,
00959                             bool preview = false);
00960 
00962   CubitStatus restore_transform( Body* body );
00963 
00973 
00974   CubitBoolean volumes_overlap( RefVolume *volume_1, RefVolume *volume_2);
00975 
00984 
00985   CubitBoolean bodies_overlap( Body *body_ptr_1, Body *body_ptr_2 );
00986 
00989   CubitStatus construct_refentities(DLIList<TopologyBridge*> &topology_bridges,
00990                                     DLIList<RefEntity*> *imported_entities = NULL);
00991 
01001   static CubitBoolean trackMergedAwayEnts;
01002   static CubitBoolean importingSolidModel;
01003 
01004   //Before calling import_solid_model, normally we want to clear out the 
01005   //map in CAUniqueId, but not when we are importing a cub file.
01006   static CubitBoolean clearUidMapBeforeImport; 
01007 
01008   //variable defining scope of merge...if true, 
01009   //merge entities you are importing with any entity (i.e.
01010   //entities already in the cubit session), otherwise 
01011   //only merge entities that are importing with other entities 
01012   //that are importing 
01013   static CubitBoolean mergeGloballyOnImport;
01014 
01015   static DLIList<int> uidsOfImportingEnts;
01016   static int entitiesMergedAway; 
01017 
01018   CGMHistory& history();
01019 
01020   CubitStatus get_graphics( Body *body, 
01021                             GMem *g_mem,
01022                             std::vector<RefFace*> &face_to_facet_vector,
01023                             std::vector<RefEntity*> &facet_point_ownership_vector,
01024                             std::vector<std::pair<RefEntity*, std::pair<int,int> > > &facetedges_on_refedges,
01025                             unsigned short normal_tolerance, 
01026                             double distance_tolerance, 
01027                             double max_edge_length );
01028 
01029   CubitStatus get_graphics( RefFace *ref_face,
01030                             GMem *gmem,
01031                             std::vector<RefEntity*> &facet_point_ownership_vector,
01032                             std::vector<std::pair< RefEntity*, std::pair<int,int> > > &facetedges_on_refedges,
01033                             unsigned short normal_tolerance = 15, 
01034                             double distance_tolerance = 0.0, 
01035                             double max_edge_length = 0.0 );
01036 
01037   CubitStatus get_point_containment( DLIList<Body*> &body_list,
01038                                      DLIList<CubitVector> &point_list,
01039                                      double tolerance,
01040                                      bool allow_pts_in_multiple_bodies,
01041                                      std::vector< std::pair<Body*, std::vector<int> > > &body_to_pt_indices );
01042 
01043 protected :
01044 
01045   GeometryQueryTool(GeometryQueryEngine* GQEPtr);
01049 private :
01050 
01051   CubitBoolean okay_to_transform( Body* body ) const;
01052   CubitBoolean okay_to_transform( BasicTopologyEntity* bte ) const;
01053   void notify_observers_of_transform(RefEntity* ref_entity,  const CubitTransformMatrix *transform = NULL ) const;
01054   void notify_observers_of_transform(DLIList<RefEntity*> &ref_ents,
01055                                      const CubitTransformMatrix *xform = NULL) const;
01056 
01057   CubitStatus notify_intermediate_of_transform( TopologyEntity* bte,
01058                                              const CubitTransformMatrix& xform
01059                                              ) const;
01060 
01061   Shell* make_Shell(ShellSM *shellsm_ptr, bool& shell_modified ) const;
01062   RefVolume* make_RefVolume( Lump* lump_ptr, bool& vol_modified ) const;
01063 
01064   CubitStatus make_merged_RefFace( Surface* surface_ptr ) const;
01065     // Helper function for make_RefFace(Surface*)
01066     // For a merged RefFace, check if the passed surface topology
01067     // is still compatible.  If so, remerge any unmerged child
01068     // entities and return CUBIT_SUCCESS.  If not, return CUBIT_FAILURE.
01069 
01070   RefEntity *check_mergeable_refentity(GeometryEntity *bridge) const;
01071     // check for mergeable ref entity, indicated by a merge attribute on the
01072     // bridge
01073 
01074   CoEdgeSM *find_merged_coedgesm( Surface* on_this_surface,
01075                                   CoEdgeSM* merged_with_this ) const;
01076     // check for mergeable sense entity, which is a child of the entity pointed
01077     // to by a merge attribute on bridge, which corresponds to re_ptr
01078 
01079   
01080   void get_merged_away_free_entities( DLIList<RefEntity*> &ref_ents,
01081                                       DLIList<TopologyBridge*> &free_ents );
01082 
01083 
01084   CubitStatus straightline_intersections( RefEdge* ref_edge1,
01085                                  CubitVector & origin2,
01086                                  CubitVector & dir2,
01087                                  DLIList<CubitVector>& intersection_list,
01088                                  CubitBoolean bounded = CUBIT_FALSE,
01089                                  CubitBoolean closest = CUBIT_FALSE);
01090 
01092   static GeometryQueryTool* instance_;
01093 
01096   static CubitBoolean useFacetBBox;
01097 
01099   DLIList<GeometryQueryEngine*> gqeList;
01100 
01101   struct IGEComp : public std::binary_function<IntermediateGeomEngine*,
01102                                               IntermediateGeomEngine*,
01103                                               bool> {
01104     bool operator() ( const IntermediateGeomEngine* ptr1,
01105                       const IntermediateGeomEngine* ptr2 ) const
01106       { return ptr1->level() < ptr2->level(); }
01107   };
01108   typedef std::set<IntermediateGeomEngine*,IGEComp> IGESet;
01109   IGESet igeSet;
01110 
01112   GeometryQueryEngine *default_gqe;
01113 
01116   static double curveSliverCleanUpTolerance;
01117 
01121   static double surfaceSliverCleanUpTolerance;
01122 
01126   static double geometryToleranceFactor;
01127 
01128   static CubitBoolean bboxMergeTest;
01129 
01132   static int internalSurfaceMergeTest; 
01133 
01134   int maxPersistentBodyId;
01135   int maxPersistentRefVolumeId;
01136   int maxPersistentRefGroupId;
01137   int maxPersistentRefFaceId;
01138   int maxPersistentRefEdgeId;
01139   int maxPersistentRefVertexId;
01140 
01141   CGMHistory mHistory;
01142 };
01143 
01144 inline void GeometryQueryTool::reset_geometry_factor()
01145 {
01146   geometryToleranceFactor = DEFAULT_GEOM_FACTOR;
01147 }
01148 
01149 inline void GeometryQueryTool::set_geometry_factor( double factor )
01150 {
01151   if ( factor < .0099999999999 )
01152     return;
01153   else
01154     geometryToleranceFactor = factor;
01155 }
01156 inline double GeometryQueryTool::get_geometry_factor()
01157 {
01158   return geometryToleranceFactor;
01159 }
01160 
01161 inline void GeometryQueryTool::set_sliver_surface_cleanup_tolerance( double tol )
01162 {
01163   surfaceSliverCleanUpTolerance = tol;
01164 }
01165 
01166 inline void GeometryQueryTool::set_sliver_curve_cleanup_tolerance( double tol )
01167 {
01168   curveSliverCleanUpTolerance = tol;
01169 }
01170 
01171 inline double GeometryQueryTool::get_sliver_curve_cleanup_tolerance()
01172 {
01173   return curveSliverCleanUpTolerance; 
01174 }
01175 
01176 inline double GeometryQueryTool::get_sliver_surface_cleanup_tolerance()
01177 {
01178   return surfaceSliverCleanUpTolerance; 
01179 }
01180 
01181 inline CubitBoolean GeometryQueryTool::get_merge_test_bbox()
01182 {return bboxMergeTest;}
01183 inline int GeometryQueryTool::get_merge_test_internal()
01184 {return internalSurfaceMergeTest;}
01185 inline void GeometryQueryTool::set_merge_test_bbox(CubitBoolean tof)
01186 {bboxMergeTest = tof;}
01187 inline void GeometryQueryTool::set_merge_test_internal(int tof)
01188 {internalSurfaceMergeTest = tof;}
01189 
01190 inline void GeometryQueryTool::add_gqe(GeometryQueryEngine *gqe_ptr)
01191 {
01192   assert(gqe_ptr != 0);
01193   if (!gqeList.move_to(gqe_ptr)) gqeList.append(gqe_ptr);
01194 }
01198 inline CubitStatus GeometryQueryTool::remove_gqe(GeometryQueryEngine *gqe_ptr)
01199 {
01200   assert(gqe_ptr != 0);
01201   CubitStatus status = CUBIT_FAILURE;
01202   if (gqeList.move_to(gqe_ptr)) {
01203     gqeList.remove();
01204     status = CUBIT_SUCCESS;
01205   }
01206   return status;
01207 }
01208 
01209 inline void GeometryQueryTool::get_gqe_list(DLIList<GeometryQueryEngine*> &gqe_list)
01210 {
01211   gqe_list += gqeList;
01212 }
01216 inline GeometryQueryEngine *GeometryQueryTool::get_gqe()
01217 {
01218   GeometryQueryEngine *gqe = NULL;
01219   if (gqeList.size()) {
01220     gqeList.reset();
01221     gqe = gqeList.get();
01222   }
01223   return gqe;
01224 }
01225 
01229 #endif
01230 
01231 
01232 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines