cgma
GeometryHealerTool.cpp
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 // Filename      : GeometryHealerTool.cpp
00003 //
00004 // Purpose       : Define the healer interface for all solid modeling engines.
00005 //
00006 // Special Notes : This is a singleton pattern class for the healer functions.
00007 //
00008 // Creator       : Tyronne Lim (CAT)
00009 //
00010 // Creation Date : 7/21/03
00011 //
00012 // Owner         : 
00013 //-----------------------------------------------------------------------------
00014 
00015 // *** BEGIN INCLUDES *** //
00016 
00017 #include "GeometryHealerTool.hpp"
00018 
00019 #include "GeometryHealerEngine.hpp"
00020 
00021 #include "Body.hpp"
00022 
00023 #include "RefEntityFactory.hpp"
00024 #include "TopologyEntity.hpp"
00025 
00026 #include "CastTo.hpp"
00027 #include "CubitMessage.hpp"
00028 #include "RefFace.hpp"
00029 #include "AppUtil.hpp"
00030 #include "CubitOperationEvent.hpp"
00031 
00032 #include "MergeTool.hpp"
00033 
00034 // *** END INCLUDES *** //
00035 
00036 GeometryHealerTool* GeometryHealerTool::instance_ = 0;
00037 
00038 // *** BEGIN PUBLIC FUNCTIONS *** //
00039 
00040 //-----------------------------------------------------------------------------
00041 // Purpose       : Controls access/creation of the sole instance of this class.
00042 //
00043 // Creator       : Tyronne Lim (CAT)
00044 //
00045 // Creation Date : 07/21/03
00046 //-----------------------------------------------------------------------------
00047 GeometryHealerTool* GeometryHealerTool::instance( GeometryHealerEngine *GHEPtr )
00048 {
00049    // Check to see if we have created an instance of the class;
00050    // if not, proceed to create one.
00051    if (instance_ == 0) 
00052    {
00053       // When creating the instance, we should always have a valid
00054       // ghePtr. If not, complain.
00055       instance_ = new GeometryHealerTool(GHEPtr);
00056 
00057       // Check to make sure there's a ref entity factory extant:
00058       // RefEntityFactory *factory = 
00059       RefEntityFactory::instance();
00060    }
00061    // If there is an existing instance of the class, check if there
00062    // is a request to set the default engine. If so, do so.
00063    else if ( GHEPtr != NULL && !instance_->gheList.move_to(GHEPtr) )
00064    {
00065       delete instance_->gheList.remove();
00066       instance_->gheList.insert(GHEPtr);
00067    }
00068 
00069    // Return the a pointer to the instance of the class.
00070    return instance_;
00071 }
00072 
00073 //-----------------------------------------------------------------------------
00074 // Purpose       : Destructor.
00075 //
00076 // Creator       : Tyronne Lim (CAT)
00077 //
00078 // Creation Date : 07/21/03
00079 //-----------------------------------------------------------------------------
00080 GeometryHealerTool::~GeometryHealerTool()
00081 {
00082    for (int i = gheList.size(); i > 0; i--) 
00083       delete gheList.get_and_step();
00084 
00085    gheList.clean_out();
00086    instance_ = NULL;
00087 }
00088 
00089 // *** BEGIN ENGINE OPERATIONS *** //
00090 /*
00091 //-----------------------------------------------------------------------------
00092 // Purpose       : Sets the default engine.
00093 //
00094 // Creator       : Tyronne Lim (CAT)
00095 //
00096 // Creation Date : 07/21/03
00097 //-----------------------------------------------------------------------------
00098 void GeometryHealerTool::set_default_engine( GeometryHealerEngine *ghe_ptr )
00099 {
00100    default_ghe = ghe_ptr;
00101 }
00102 */
00103 //-----------------------------------------------------------------------------
00104 // Purpose       : Adds a healer engine to the list.
00105 //
00106 // Creator       : Tyronne Lim (CAT)
00107 //
00108 // Creation Date : 07/21/03
00109 //-----------------------------------------------------------------------------
00110 void GeometryHealerTool::add_ghe( GeometryHealerEngine *ghe_ptr )
00111 {
00112    assert(ghe_ptr != 0);
00113 
00114    // for now, GeometryHealerTool is only set up for a single healer engine
00115    // so if more than one healer is being added all the code for this class needs
00116    // to be reviewed - Byron 08/12/2003
00117    assert(gheList.size() == 0);
00118 
00119    if (!gheList.move_to(ghe_ptr))
00120       gheList.append(ghe_ptr);
00121 }
00122 /*
00123 //-----------------------------------------------------------------------------
00124 // Purpose       : Removes a healer engine from the list.
00125 //
00126 // Creator       : Tyronne Lim (CAT)
00127 //
00128 // Creation Date : 07/21/03
00129 //-----------------------------------------------------------------------------
00130 CubitStatus GeometryHealerTool::remove_ghe( GeometryHealerEngine *ghe_ptr )
00131 {
00132    assert(ghe_ptr != 0);
00133    CubitStatus status = CUBIT_FAILURE;
00134 
00135    if (gheList.move_to(ghe_ptr))
00136    {
00137       gheList.remove();
00138       status = CUBIT_SUCCESS;
00139    }
00140 
00141    return status;
00142 }
00143 
00144 //-----------------------------------------------------------------------------
00145 // Purpose       : Gets the list of healer engines.
00146 //
00147 // Creator       : Tyronne Lim (CAT)
00148 //
00149 // Creation Date : 07/21/03
00150 //-----------------------------------------------------------------------------
00151 void GeometryHealerTool::get_ghe_list( DLIList<GeometryHealerEngine*> &ghe_list )
00152 {
00153    ghe_list += gheList;
00154 }
00155 
00156 //-----------------------------------------------------------------------------
00157 // Purpose       : Gets the current healer engine (first in the list).
00158 //
00159 // Creator       : Tyronne Lim (CAT)
00160 //
00161 // Creation Date : 07/21/03
00162 //-----------------------------------------------------------------------------
00163 GeometryHealerEngine *GeometryHealerTool::get_ghe()
00164 {
00165    GeometryHealerEngine *ghe = NULL;
00166 
00167    if (gheList.size())
00168    {
00169       gheList.reset();
00170       ghe = gheList.get();
00171    }
00172 
00173    return ghe;
00174 }
00175 */
00176 //-----------------------------------------------------------------------------
00177 // Purpose       : Returns the healer engine of an entity.
00178 //
00179 // Creator       : Tyronne Lim (CAT)
00180 //
00181 // Creation Date : 08/01/03
00182 //-----------------------------------------------------------------------------
00183 GeometryHealerEngine* GeometryHealerTool::get_engine( TopologyBridge *tb_ptr ) const
00184 {
00185   GeometryHealerEngine *ghe;
00186 
00187   for (int i = 0; i < gheList.size(); i++)
00188   {
00189     ghe = gheList.next(i);
00190     if (ghe->is_healer_engine(tb_ptr))
00191        return ghe;
00192   }
00193 
00194   return NULL;
00195 }
00196 
00197 //-----------------------------------------------------------------------------
00198 // Purpose       : Returns the healer engine of an entity.
00199 //
00200 // Creator       : Tyronne Lim (CAT)
00201 //
00202 // Creation Date : 08/01/03
00203 //-----------------------------------------------------------------------------
00204 GeometryHealerEngine* GeometryHealerTool::get_engine( TopologyEntity *te_ptr ) const
00205 {
00206   GeometryHealerEngine *ghe;
00207 
00208   TopologyBridge *tb_ptr = te_ptr->bridge_manager()->topology_bridge();
00209   
00210   for (int i = 0; i < gheList.size(); i++)
00211   {
00212     ghe = gheList.next(i);
00213     if (ghe->is_healer_engine(tb_ptr))
00214        return ghe;
00215   }
00216   
00217   return NULL;
00218 }
00219 
00220 //-----------------------------------------------------------------------------
00221 // Purpose       : Determines if entities are from the same engine.
00222 //
00223 // Creator       : Tyronne Lim (CAT)
00224 //
00225 // Creation Date : 08/01/03
00226 //-----------------------------------------------------------------------------
00227 CubitBoolean GeometryHealerTool::same_healer_engine( DLIList<RefEntity*> &ref_entity_list,
00228                                                            CubitBoolean check_children ) const
00229 {
00230    DLIList<RefEntity*> complete_entity_list;
00231 
00232    //Check the check_children option and check all the children if necessary
00233    if (check_children)
00234    {
00235       //Make a complete list of all the RefEntities and their children
00236       DLIList<RefEntity*> temp = ref_entity_list;
00237       RefEntity* ref_entity_ptr;
00238 
00239       for (int i = 0; i < ref_entity_list.size(); i++)
00240       {
00241          ref_entity_ptr = ref_entity_list.get_and_step();
00242          complete_entity_list.clean_out();
00243          ref_entity_ptr->get_all_child_ref_entities(complete_entity_list);
00244          temp += complete_entity_list;
00245       }
00246 
00247       complete_entity_list.clean_out();
00248       complete_entity_list.merge_unique(temp);
00249    }
00250 
00251    //Now make sure all the RefEntities are from the same geometry engine
00252    DLIList<TopologyEntity*> te_list;
00253    CAST_LIST(complete_entity_list, te_list, TopologyEntity);
00254    return same_healer_engine(te_list);
00255 }
00256 
00257 //-----------------------------------------------------------------------------
00258 // Purpose       : Determines if entities are from the same engine.
00259 //
00260 // Creator       : Tyronne Lim (CAT)
00261 //
00262 // Creation Date : 08/01/03
00263 //-----------------------------------------------------------------------------
00264 CubitBoolean GeometryHealerTool::same_healer_engine( DLIList<TopologyEntity*> &topo_list ) const
00265 {
00266    GeometryHealerEngine *gePtr1 = get_engine(topo_list.get_and_step());
00267    GeometryHealerEngine *gePtr2;
00268 
00269    for (int i = 1; i < topo_list.size(); i++)
00270    {
00271       gePtr2 = get_engine(topo_list.get_and_step());
00272       if (gePtr1 != gePtr2)
00273       {
00274          return CUBIT_FALSE;   
00275       }
00276    }
00277    return CUBIT_TRUE;
00278 }
00279 
00280 // *** END ENGINE OPERATIONS *** //
00281 
00282 // *** BEGIN HEALER FUNCTIONS *** //
00283 
00284 CubitStatus GeometryHealerTool::auto_heal_bodies( DLIList<Body*> &body_list, 
00285                                                   DLIList<Body*> &new_body_list,
00286                                                   DLIList<TopologyEntity*> &bad_geometry,
00287                                                   CubitBoolean rebuild, CubitBoolean keep_old,
00288                                                   CubitBoolean make_tolerant, FILE* logfile_ptr )
00289 {
00290    DLIList<RefEntity*> ref_entity_list;
00291    CAST_LIST_TO_PARENT(body_list, ref_entity_list);
00292 
00293    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00294    {
00295       PRINT_ERROR("HEALING bodies from different\n"
00296                   "       geometry engines is not allowed.\n");
00297       return CUBIT_FAILURE;
00298    }
00299 
00300    if(rebuild && !keep_old)
00301    {
00302      MergeTool::instance()->unmerge(ref_entity_list);
00303    }
00304 
00305    GeometryHealerEngine* GHEPtr = get_engine(body_list.get());
00306    if (GHEPtr)
00307    {
00308       CubitStatus healer_status = GHEPtr->auto_heal_bodies(body_list, new_body_list, bad_geometry,
00309                                       rebuild, keep_old, make_tolerant, logfile_ptr);
00310 
00311      // if( healer_status == CUBIT_SUCCESS )
00312       AppUtil::instance()->send_event(CubitOperationEvent(CubitOperationEvent::HEALER_COMPLETED));
00313 
00314       return healer_status;
00315    }
00316    else
00317       PRINT_ERROR( "Bodies are of a geometry engine without a healer\n"
00318                    "         and cannot be healed.\n");
00319    return CUBIT_FAILURE;
00320 }
00321 
00322 CubitStatus GeometryHealerTool::heal_bodies( DLIList<Body*> &body_list, 
00323                                              DLIList<Body*> &new_body_list,
00324                                              DLIList<TopologyEntity*> &bad_geometry,
00325                                              CubitBoolean rebuild, CubitBoolean keep_old,
00326                                              CubitBoolean make_tolerant, FILE* logfile_ptr )
00327 {
00328    DLIList<RefEntity*> ref_entity_list;
00329    CAST_LIST_TO_PARENT(body_list, ref_entity_list);
00330 
00331    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00332    {
00333       PRINT_ERROR("HEALING bodies from different\n"
00334                   "       geometry engines is not allowed.\n");
00335       return CUBIT_FAILURE;
00336    }
00337 
00338    GeometryHealerEngine* GHEPtr = get_engine(body_list.get());
00339    if (GHEPtr)
00340       return GHEPtr->heal_bodies(body_list, new_body_list, bad_geometry,
00341                                  rebuild, keep_old, make_tolerant, logfile_ptr);
00342    else
00343       PRINT_ERROR( "Bodies are of a geometry engine without a healer\n"
00344                    "         and cannot be healed.\n");
00345    return CUBIT_FAILURE;
00346 }
00347 
00348 CubitStatus GeometryHealerTool::analyze_badgeom( DLIList<Body*> &body_list, 
00349                                                  DLIList<TopologyEntity*> &bad_geometry,
00350                                                  FILE* logfile)
00351 {
00352    DLIList<RefEntity*> ref_entity_list;
00353    CAST_LIST_TO_PARENT(body_list, ref_entity_list);
00354 
00355    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00356    {
00357       PRINT_ERROR("HEALING bodies from different\n"
00358                   "       geometry engines is not allowed.\n");
00359       return CUBIT_FAILURE;
00360    }
00361 
00362    GeometryHealerEngine* GHEPtr = get_engine(body_list.get());
00363    if (GHEPtr)
00364       return GHEPtr->analyze_badgeom(body_list, bad_geometry, logfile);
00365    else
00366       PRINT_ERROR( "Bodies are of a geometry engine without a healer\n"
00367                    "         and cannot be healed.\n");
00368    return CUBIT_FAILURE;
00369 }
00370 
00371 CubitStatus GeometryHealerTool::get_badgeom( DLIList<Body*> &body_list,
00372                                              DLIList<TopologyEntity*> &bad_geometry )
00373 {
00374    DLIList<RefEntity*> ref_entity_list;
00375    CAST_LIST_TO_PARENT(body_list, ref_entity_list);
00376 
00377    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00378    {
00379       PRINT_ERROR("HEALING bodies from different\n"
00380                   "       geometry engines is not allowed.\n");
00381       return CUBIT_FAILURE;
00382    }
00383 
00384    GeometryHealerEngine* GHEPtr = get_engine(body_list.get());
00385    if (GHEPtr)
00386       return GHEPtr->get_badgeom(body_list, bad_geometry);
00387    else
00388       PRINT_ERROR( "Bodies are of a geometry engine without a healer\n"
00389                    "         and cannot be healed.\n");
00390    return CUBIT_FAILURE;
00391 }
00392 
00393 CubitStatus GeometryHealerTool::get_tcurves( DLIList<Body*> &body_list,
00394                                               DLIList<RefEdge*> &t_curves )
00395 {
00396    DLIList<RefEntity*> ref_entity_list;
00397    CAST_LIST_TO_PARENT(body_list, ref_entity_list);
00398 
00399    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00400    {
00401       PRINT_ERROR("HEALING bodies from different\n"
00402                   "       geometry engines is not allowed.\n");
00403       return CUBIT_FAILURE;
00404    }
00405 
00406    GeometryHealerEngine* GHEPtr = get_engine(body_list.get());
00407    if (GHEPtr)
00408       return GHEPtr->get_tcurves(body_list, t_curves);
00409    else
00410       PRINT_ERROR( "Bodies are of a geometry engine without a healer\n"
00411                    "         and cannot be healed.\n");
00412    return CUBIT_FAILURE;
00413 }
00414 
00415 CubitStatus GeometryHealerTool::heal_incremental( DLIList<Body*> &body_list, 
00416                                                   DLIList<Body*> &new_bodies,
00417                                                   DLIList<TopologyEntity*> &bad_geometry,
00418                                                   double simplify_tol, double stitch_min_tol,
00419                                                   double stitch_max_tol, double geombuild_tol,
00420                                                   double analytic_tol, double isospline_tol,
00421                                                   double reblend_classify_tol, double reblend_tol,
00422                                                   CubitBoolean keep_old, CubitBoolean make_tolerant,
00423                                                   FILE* logfile_ptr )
00424 {
00425    DLIList<RefEntity*> ref_entity_list;
00426    CAST_LIST_TO_PARENT(body_list, ref_entity_list);
00427 
00428    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00429    {
00430       PRINT_ERROR("HEALING bodies from different\n"
00431                   "       geometry engines is not allowed.\n");
00432       return CUBIT_FAILURE;
00433    }
00434 
00435    GeometryHealerEngine* GHEPtr = get_engine(body_list.get());
00436    if (GHEPtr)
00437       return GHEPtr->heal_incremental(body_list, new_bodies, bad_geometry, simplify_tol, 
00438                                           stitch_min_tol, stitch_max_tol, geombuild_tol,
00439                                           analytic_tol, isospline_tol, reblend_classify_tol,
00440                                           reblend_tol, keep_old, make_tolerant, logfile_ptr);
00441    else
00442       PRINT_ERROR( "Bodies are of a geometry engine without a healer\n"
00443                    "         and cannot be healed.\n");
00444    return CUBIT_FAILURE;
00445 }
00446 
00447 void GeometryHealerTool::list_incremental()
00448 {
00449    gheList.get()->list_incremental();
00450 }
00451 
00452 void GeometryHealerTool::list_tolerances( DLIList<Body*> &body_list )
00453 {
00454    DLIList<RefEntity*> ref_entity_list;
00455    CAST_LIST_TO_PARENT(body_list, ref_entity_list);
00456 
00457    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00458    {
00459       PRINT_ERROR("HEALING bodies from different\n"
00460                   "       geometry engines is not allowed.\n");
00461    }
00462 
00463    GeometryHealerEngine* GHEPtr = get_engine(body_list.get());
00464    if (GHEPtr)
00465       GHEPtr->list_tolerances(body_list);
00466    else
00467       PRINT_ERROR( "Bodies are of a geometry engine without a healer\n"
00468                    "         and cannot be healed.\n");
00469 }
00470 
00471 double GeometryHealerTool::get_default_simplify_tol()
00472 {
00473    return gheList.get()->get_default_simplify_tol();
00474 }
00475 
00476 void GeometryHealerTool::set_default_simplify_tol( double tol )
00477 {
00478    gheList.get()->set_default_simplify_tol(tol);
00479 }
00480 
00481 double GeometryHealerTool::get_default_stitch_min_tol()
00482 {
00483    return gheList.get()->get_default_stitch_min_tol();
00484 }
00485 
00486 void GeometryHealerTool::set_default_stitch_min_tol( double tol )
00487 {
00488    gheList.get()->set_default_stitch_min_tol(tol);
00489 }
00490 
00491 double GeometryHealerTool::get_default_stitch_max_tol()
00492 {
00493    return gheList.get()->get_default_stitch_max_tol();
00494 }
00495 
00496 void GeometryHealerTool::set_default_stitch_max_tol( double tol )
00497 {
00498    gheList.get()->set_default_stitch_max_tol(tol);
00499 }
00500 
00501 double GeometryHealerTool::get_default_geombuild_tol()
00502 {
00503    return gheList.get()->get_default_geombuild_tol();
00504 }
00505 
00506 void GeometryHealerTool::set_default_geombuild_tol( double tol )
00507 {
00508    gheList.get()->set_default_geombuild_tol(tol);
00509 }
00510 
00511 double GeometryHealerTool::get_default_analytic_tol()
00512 {
00513    return gheList.get()->get_default_analytic_tol();
00514 }
00515 
00516 void GeometryHealerTool::set_default_analytic_tol( double tol )
00517 {
00518    gheList.get()->set_default_analytic_tol(tol);
00519 }
00520 
00521 double GeometryHealerTool::get_default_isospline_tol()
00522 {
00523    return gheList.get()->get_default_isospline_tol();
00524 }
00525 
00526 void GeometryHealerTool::set_default_isospline_tol( double tol )
00527 {
00528    gheList.get()->set_default_isospline_tol(tol);
00529 }
00530 
00531 double GeometryHealerTool::get_default_reblend_classify_tol()
00532 {
00533    return gheList.get()->get_default_reblend_classify_tol();
00534 }
00535 
00536 void GeometryHealerTool::set_default_reblend_classify_tol( double tol )
00537 {
00538    gheList.get()->set_default_reblend_classify_tol(tol);
00539 }
00540 
00541 double GeometryHealerTool::get_default_reblend_tol()
00542 {
00543    return gheList.get()->get_default_reblend_tol();
00544 }
00545 
00546 void GeometryHealerTool::set_default_reblend_tol( double tol )
00547 {
00548    gheList.get()->set_default_reblend_tol(tol);
00549 }
00550 
00551 void GeometryHealerTool::reset_default_tolerances()
00552 {
00553    gheList.get()->reset_default_tolerances();
00554 }
00555 
00556 void GeometryHealerTool::list_default_tolerances()
00557 {
00558    gheList.get()->list_default_tolerances();
00559 }
00560 
00561 void GeometryHealerTool::clean_attributes( DLIList<Body*>& body_list )
00562 {
00563    DLIList<RefEntity*> ref_entity_list;
00564    CAST_LIST_TO_PARENT(body_list, ref_entity_list);
00565 
00566    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00567    {
00568       PRINT_ERROR("HEALING bodies from different\n"
00569                   "       geometry engines is not allowed.\n");
00570    }
00571 
00572    GeometryHealerEngine* GHEPtr = get_engine(body_list.get());
00573    if (GHEPtr)
00574       GHEPtr->clean_attributes(body_list);
00575    else
00576       PRINT_ERROR( "Bodies are of a geometry engine without a healer\n"
00577                    "         and cannot be healed.\n");
00578 }
00579 
00580 CubitBoolean GeometryHealerTool::get_cleanatt_flg()
00581 {
00582    return gheList.get()->get_cleanatt_flg();
00583 }
00584 
00585 void GeometryHealerTool::set_cleanatt_flg( CubitBoolean flg )
00586 {
00587    gheList.get()->set_cleanatt_flg(flg);
00588 }
00589 
00590 int GeometryHealerTool::get_show_method()
00591 {
00592    return gheList.get()->get_show_method();
00593 }
00594 
00595 void GeometryHealerTool::set_show_method( int method )
00596 {
00597    gheList.get()->set_show_method(method);
00598 }
00599 
00600 CubitBoolean GeometryHealerTool::get_show_summary_flg()
00601 {
00602    return gheList.get()->get_show_summary_flg();
00603 }
00604 
00605 void GeometryHealerTool::set_show_summary_flg( CubitBoolean flg )
00606 {
00607    gheList.get()->set_show_summary_flg(flg);
00608 }
00609 
00610 CubitBoolean GeometryHealerTool::get_show_details_flg()
00611 {
00612    return gheList.get()->get_show_details_flg();
00613 }
00614 
00615 void GeometryHealerTool::set_show_details_flg( CubitBoolean flg )
00616 {
00617    gheList.get()->set_show_details_flg(flg);
00618 }
00619 
00620 CubitBoolean GeometryHealerTool::get_show_on_heal_flg()
00621 {
00622    return gheList.get()->get_show_on_heal_flg();
00623 }
00624 
00625 void GeometryHealerTool::set_show_on_heal_flg( CubitBoolean flg )
00626 {
00627    gheList.get()->set_show_on_heal_flg(flg);
00628 }
00629 
00630 CubitBoolean GeometryHealerTool::get_check_vol_on_heal_flg()
00631 {
00632    return gheList.get()->get_check_vol_on_heal_flg();
00633 }
00634 
00635 void GeometryHealerTool::set_check_vol_on_heal_flg( CubitBoolean flg )
00636 {
00637    gheList.get()->set_check_vol_on_heal_flg(flg);
00638 }
00639 
00640 double GeometryHealerTool::get_vol_on_heal_limit()
00641 {
00642    return gheList.get()->get_vol_on_heal_limit();
00643 }
00644 
00645 void GeometryHealerTool::set_vol_on_heal_limit( double limit )
00646 {
00647    gheList.get()->set_vol_on_heal_limit(limit);
00648 }
00649 
00650 CubitBoolean GeometryHealerTool::get_check_surf_on_heal_flg()
00651 {
00652    return gheList.get()->get_check_surf_on_heal_flg();
00653 }
00654 
00655 void GeometryHealerTool::set_check_surf_on_heal_flg( CubitBoolean flg )
00656 {
00657    gheList.get()->set_check_surf_on_heal_flg(flg);
00658 }
00659 
00660 double GeometryHealerTool::get_surf_on_heal_limit()
00661 {
00662    return gheList.get()->get_surf_on_heal_limit();
00663 }
00664 
00665 void GeometryHealerTool::set_surf_on_heal_limit( double limit )
00666 {
00667    gheList.get()->set_surf_on_heal_limit(limit);
00668 }
00669 
00670 CubitBoolean GeometryHealerTool::get_check_curve_on_heal_flg()
00671 {
00672    return gheList.get()->get_check_curve_on_heal_flg();
00673 }
00674 
00675 void GeometryHealerTool::set_check_curve_on_heal_flg( CubitBoolean flg )
00676 {
00677    gheList.get()->set_check_curve_on_heal_flg(flg);
00678 }
00679 
00680 double GeometryHealerTool::get_curve_on_heal_limit()
00681 {
00682    return gheList.get()->get_curve_on_heal_limit();
00683 }
00684 
00685 void GeometryHealerTool::set_curve_on_heal_limit( double limit )
00686 {
00687    gheList.get()->set_curve_on_heal_limit(limit);
00688 }
00689 
00690 CubitBoolean GeometryHealerTool::get_show_bad_vertices_flg()
00691 {
00692    return gheList.get()->get_show_bad_vertices_flg();
00693 }
00694 
00695 void GeometryHealerTool::set_show_bad_vertices_flg( CubitBoolean flg )
00696 {
00697    gheList.get()->set_show_bad_vertices_flg(flg);
00698 }
00699 
00700 CubitBoolean GeometryHealerTool::get_show_bad_curves_flg()
00701 {
00702    return gheList.get()->get_show_bad_curves_flg();
00703 }
00704 
00705 void GeometryHealerTool::set_show_bad_curves_flg( CubitBoolean flg )
00706 {
00707    gheList.get()->set_show_bad_curves_flg(flg);
00708 }
00709 
00710 CubitBoolean GeometryHealerTool::get_show_bad_coedges_flg()
00711 {
00712    return gheList.get()->get_show_bad_coedges_flg();
00713 }
00714 
00715 void GeometryHealerTool::set_show_bad_coedges_flg( CubitBoolean flg )
00716 {
00717    gheList.get()->set_show_bad_coedges_flg(flg);
00718 }
00719 
00720 CubitBoolean GeometryHealerTool::get_show_bad_loops_flg()
00721 {
00722    return gheList.get()->get_show_bad_loops_flg();
00723 }
00724 
00725 void GeometryHealerTool::set_show_bad_loops_flg( CubitBoolean flg )
00726 {
00727    gheList.get()->set_show_bad_loops_flg(flg);
00728 }
00729 
00730 CubitBoolean GeometryHealerTool::get_show_bad_surfaces_flg()
00731 {
00732    return gheList.get()->get_show_bad_surfaces_flg();
00733 }
00734 
00735 void GeometryHealerTool::set_show_bad_surfaces_flg( CubitBoolean flg )
00736 {
00737    gheList.get()->set_show_bad_surfaces_flg(flg);
00738 }
00739 
00740 CubitBoolean GeometryHealerTool::get_show_bad_shells_flg()
00741 {
00742    return gheList.get()->get_show_bad_shells_flg();
00743 }
00744 
00745 void GeometryHealerTool::set_show_bad_shells_flg( CubitBoolean flg )
00746 {
00747    gheList.get()->set_show_bad_shells_flg(flg);
00748 }
00749 
00750 CubitBoolean GeometryHealerTool::get_show_bad_volumes_flg()
00751 {
00752    return gheList.get()->get_show_bad_volumes_flg();
00753 }
00754 
00755 void GeometryHealerTool::set_show_bad_volumes_flg( CubitBoolean flg )
00756 {
00757    gheList.get()->set_show_bad_volumes_flg(flg);
00758 }
00759 
00760 CubitBoolean GeometryHealerTool::get_show_bad_bodies_flg()
00761 {
00762    return gheList.get()->get_show_bad_bodies_flg();
00763 }
00764 
00765 void GeometryHealerTool::set_show_bad_bodies_flg( CubitBoolean flg )
00766 {
00767    gheList.get()->set_show_bad_bodies_flg(flg);
00768 }
00769 
00770 void GeometryHealerTool::list_onshow_flgs()
00771 {
00772    gheList.get()->list_onshow_flgs();
00773 }
00774 
00775 CubitBoolean GeometryHealerTool::get_inc_preprocess_flg()
00776 {
00777    return gheList.get()->get_inc_preprocess_flg();
00778 }
00779 
00780 void GeometryHealerTool::set_inc_preprocess_flg( CubitBoolean flg )
00781 {
00782    gheList.get()->set_inc_preprocess_flg(flg);
00783 }
00784 
00785 CubitBoolean GeometryHealerTool::get_inc_simplify_flg()
00786 {
00787    return gheList.get()->get_inc_simplify_flg();
00788 }
00789 
00790 void GeometryHealerTool::set_inc_simplify_flg( CubitBoolean flg )
00791 {
00792    gheList.get()->set_inc_simplify_flg(flg);
00793 }
00794 
00795 CubitBoolean GeometryHealerTool::get_inc_stitch_flg()
00796 {
00797    return gheList.get()->get_inc_stitch_flg();
00798 }
00799 
00800 void GeometryHealerTool::set_inc_stitch_flg( CubitBoolean flg )
00801 {
00802    gheList.get()->set_inc_stitch_flg(flg);
00803 }
00804 
00805 CubitBoolean GeometryHealerTool::get_inc_geombuild_flg()
00806 {
00807    return gheList.get()->get_inc_geombuild_flg();
00808 }
00809 
00810 void GeometryHealerTool::set_inc_geombuild_flg( CubitBoolean flg )
00811 {
00812    gheList.get()->set_inc_geombuild_flg(flg);
00813 }
00814 
00815 CubitBoolean GeometryHealerTool::get_inc_analytic_flg()
00816 {
00817    return gheList.get()->get_inc_analytic_flg();
00818 }
00819 
00820 void GeometryHealerTool::set_inc_analytic_flg( CubitBoolean flg )
00821 {
00822    gheList.get()->set_inc_analytic_flg(flg);
00823 }
00824 
00825 CubitBoolean GeometryHealerTool::get_inc_isospline_flg()
00826 {
00827    return gheList.get()->get_inc_isospline_flg();
00828 }
00829 
00830 void GeometryHealerTool::set_inc_isospline_flg( CubitBoolean flg )
00831 {
00832    gheList.get()->set_inc_isospline_flg(flg);
00833 }
00834 
00835 CubitBoolean GeometryHealerTool::get_inc_reblend_flg()
00836 {
00837    return gheList.get()->get_inc_reblend_flg();
00838 }
00839 
00840 void GeometryHealerTool::set_inc_reblend_flg( CubitBoolean flg )
00841 {
00842    gheList.get()->set_inc_reblend_flg(flg);
00843 }
00844 
00845 CubitBoolean GeometryHealerTool::get_inc_sharpedge_flg()
00846 {
00847    return gheList.get()->get_inc_sharpedge_flg();
00848 }
00849 
00850 void GeometryHealerTool::set_inc_sharpedge_flg( CubitBoolean flg )
00851 {
00852    gheList.get()->set_inc_sharpedge_flg(flg);
00853 }
00854 
00855 CubitBoolean GeometryHealerTool::get_inc_genericspline_flg()
00856 {
00857    return gheList.get()->get_inc_genericspline_flg();
00858 }
00859 
00860 void GeometryHealerTool::set_inc_genericspline_flg( CubitBoolean flg )
00861 {
00862    gheList.get()->set_inc_genericspline_flg(flg);
00863 }
00864 
00865 CubitBoolean GeometryHealerTool::get_inc_wrapup_flg()
00866 {
00867    return gheList.get()->get_inc_wrapup_flg();
00868 }
00869 
00870 void GeometryHealerTool::set_inc_wrapup_flg( CubitBoolean flg )
00871 {
00872    gheList.get()->set_inc_wrapup_flg(flg);
00873 }
00874 
00875 CubitBoolean GeometryHealerTool::get_inc_postprocess_flg()
00876 {
00877    return gheList.get()->get_inc_postprocess_flg();
00878 }
00879 
00880 void GeometryHealerTool::set_inc_postprocess_flg( CubitBoolean flg )
00881 {
00882    gheList.get()->set_inc_postprocess_flg(flg);
00883 }
00884 
00885 CubitStatus GeometryHealerTool::force_simplify_to_plane( DLIList<RefFace*> &ref_face_list, 
00886                                                          DLIList<Body*>& new_body_list, 
00887                                                          CubitBoolean keep )
00888 {
00889    ref_face_list.reset();
00890    DLIList<RefEntity*> ref_entity_list(ref_face_list.size());
00891    CAST_LIST_TO_PARENT( ref_face_list, ref_entity_list );
00892 
00893    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00894    {
00895       PRINT_ERROR("HEALING faces from different\n"
00896                   "       geometry engines is not allowed.\n");
00897       return CUBIT_FAILURE;
00898    }
00899 
00900    ref_face_list.reset();
00901    GeometryHealerEngine* GHEPtr = get_engine((TopologyEntity*)(ref_face_list.get()));
00902    if (GHEPtr)
00903       return GHEPtr->force_simplify_to_plane(ref_face_list, new_body_list, keep);
00904    else
00905       PRINT_ERROR( "Faces are of a geometry engine without a healer\n"
00906                    "         and cannot be healed.\n");
00907    return CUBIT_FAILURE;
00908 }
00909 
00910 CubitStatus GeometryHealerTool::force_simplify_to_cylinder( DLIList<RefFace*> &ref_face_list, 
00911                                                             DLIList<Body*>& new_body_list, 
00912                                                             CubitBoolean keep )
00913 {
00914    ref_face_list.reset();
00915    DLIList<RefEntity*> ref_entity_list(ref_face_list.size());
00916    CAST_LIST_TO_PARENT( ref_face_list, ref_entity_list );
00917 
00918    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00919    {
00920       PRINT_ERROR("HEALING faces from different\n"
00921                   "       geometry engines is not allowed.\n");
00922       return CUBIT_FAILURE;
00923    }
00924 
00925    ref_face_list.reset();
00926    GeometryHealerEngine* GHEPtr = get_engine((TopologyEntity*)(ref_face_list.get()));
00927    if (GHEPtr)
00928       return GHEPtr->force_simplify_to_cylinder(ref_face_list, new_body_list, keep);
00929    else
00930       PRINT_ERROR( "Faces are of a geometry engine without a healer\n"
00931                    "         and cannot be healed.\n");
00932    return CUBIT_FAILURE;
00933 }
00934 
00935 CubitStatus GeometryHealerTool::force_simplify_to_cone( DLIList<RefFace*> &ref_face_list, 
00936                                                         DLIList<Body*>& new_body_list, 
00937                                                         CubitBoolean keep )
00938 {
00939    ref_face_list.reset();
00940    DLIList<RefEntity*> ref_entity_list(ref_face_list.size());
00941    CAST_LIST_TO_PARENT( ref_face_list, ref_entity_list );
00942 
00943    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00944    {
00945       PRINT_ERROR("HEALING faces from different\n"
00946                   "       geometry engines is not allowed.\n");
00947       return CUBIT_FAILURE;
00948    }
00949 
00950    ref_face_list.reset();
00951    GeometryHealerEngine* GHEPtr = get_engine((TopologyEntity*)(ref_face_list.get()));
00952    if (GHEPtr)
00953       return GHEPtr->force_simplify_to_cone(ref_face_list, new_body_list, keep);
00954    else
00955       PRINT_ERROR( "Faces are of a geometry engine without a healer\n"
00956                    "         and cannot be healed.\n");
00957    return CUBIT_FAILURE;
00958 }
00959 
00960 CubitStatus GeometryHealerTool::force_simplify_to_sphere( DLIList<RefFace*> &ref_face_list, 
00961                                                           DLIList<Body*>& new_body_list, 
00962                                                           CubitBoolean keep )
00963 {
00964    ref_face_list.reset();
00965    DLIList<RefEntity*> ref_entity_list(ref_face_list.size());
00966    CAST_LIST_TO_PARENT( ref_face_list, ref_entity_list );
00967 
00968    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00969    {
00970       PRINT_ERROR("HEALING faces from different\n"
00971                   "       geometry engines is not allowed.\n");
00972       return CUBIT_FAILURE;
00973    }
00974 
00975    ref_face_list.reset();
00976    GeometryHealerEngine* GHEPtr = get_engine((TopologyEntity*)(ref_face_list.get()));
00977    if (GHEPtr)
00978       return GHEPtr->force_simplify_to_sphere(ref_face_list, new_body_list, keep);
00979    else
00980       PRINT_ERROR( "Faces are of a geometry engine without a healer\n"
00981                    "         and cannot be healed.\n");
00982    return CUBIT_FAILURE;
00983 }
00984 
00985 CubitStatus GeometryHealerTool::force_simplify_to_torus( DLIList<RefFace*> &ref_face_list, 
00986                                                          DLIList<Body*>& new_body_list, 
00987                                                          CubitBoolean keep )
00988 {
00989    ref_face_list.reset();
00990    DLIList<RefEntity*> ref_entity_list(ref_face_list.size());
00991    CAST_LIST_TO_PARENT( ref_face_list, ref_entity_list );
00992 
00993    if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
00994    {
00995       PRINT_ERROR("HEALING faces from different\n"
00996                   "       geometry engines is not allowed.\n");
00997       return CUBIT_FAILURE;
00998    }
00999 
01000    ref_face_list.reset();
01001    GeometryHealerEngine* GHEPtr = get_engine((TopologyEntity*)(ref_face_list.get()));
01002    if (GHEPtr)
01003       return GHEPtr->force_simplify_to_torus(ref_face_list, new_body_list, keep);
01004    else
01005       PRINT_ERROR( "Faces are of a geometry engine without a healer\n"
01006                    "         and cannot be healed.\n");
01007    return CUBIT_FAILURE;
01008 }
01009 
01010 // *** END HEALER FUNCTIONS *** //
01011 
01012 // *** END PUBLIC FUNCTIONS *** //
01013 
01014 // *** BEGIN PROTECTED FUNCTIONS *** //
01015 
01016 //-----------------------------------------------------------------------------
01017 // Purpose       : Constructor.
01018 //
01019 // Creator       : Tyronne Lim (CAT)
01020 //
01021 // Creation Date : 07/21/03
01022 //-----------------------------------------------------------------------------
01023 GeometryHealerTool::GeometryHealerTool( GeometryHealerEngine* GHEPtr )
01024 {
01025   if (GHEPtr != NULL)
01026      add_ghe(GHEPtr);
01027 }
01028 
01029 // *** END PROTECTED FUNCTIONS *** //
01030 
01031 // *** BEGIN PRIVATE FUNCTIONS *** //
01032 
01033 // *** END PRIVATE FUNCTIONS *** //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines