cgma
FacetorUtil.hpp
Go to the documentation of this file.
00001 //- Class: FacetorUtil
00002 //- Description: Utility functions used by FactorTool and available to other classes.
00003 //               FacetorUtil uses template functions that accepts both CubitNode, CubitTri, CubitEdge classes 
00004 //-              and CubitPoint, CubitFacet, CubitFacetEdge classes.  CubitPoint, CubitFacet, and 
00005 //-              CubitFacetEdge classes have been modified to account for the difference between the mdb
00006 //=              entities and geometric entities.
00007 //-------------------------------------------------------------------------
00008 // Filename      : FacetorTool.hpp
00009 //
00010 // Purpose       : 2D Delaunay Mesher
00011 //
00012 // Creator       : Christopher Hynes
00013 //
00014 // Creation Date : 5/31/2002
00015 //
00016 // Owner         : Steve Owen
00017 //-------------------------------------------------------------------------
00018 
00019 #ifndef FACETOR_UTIL_HPP
00020 #define FACETOR_UTIL_HPP
00021 
00022 
00023 #include "CubitDefines.h"
00024 class ParamTool;
00025 
00026 template<class SURF, class TRI, class EDGE, class NODE, class TRICHILD, class NODECHILD, class SIZEFUNC>
00027 class FacetorUtil
00028 {
00029 public:
00030   FacetorUtil(){}
00031   ~FacetorUtil(){}
00032 
00033     //- Insert one node into a Delaunay mesh
00034   static CubitStatus insert_node(NODE *node_ptr,
00035                                  DLIList<TRI*>& facet_list,
00036                                  SURF* surface_ptr,
00037                                  int& curr_visit_flag,
00038                                  TRI*& last_tri);
00039 
00040     // Insert a node at the circumcenter of a tri
00041   static CubitStatus insert_at_circumcenter(TRI *tri_ptr,
00042                                             DLIList<TRI*>& facet_list,
00043                                             TRI*& start_tri,
00044                                             int& curr_visit_flag,
00045                                             SURF* surface_ptr,
00046                                             DLIList<TRI*>* sorted_lists,
00047                                             const int num_lists,
00048                                             const double interval,
00049                                             const double quality_angle,
00050                                             SIZEFUNC* sizing_function,
00051                                             ParamTool* p_tool);
00052 
00053     // Compute the angles at the triangle vertices and classify
00054     // by its worst triangle
00055   static CubitStatus classify_tri_by_angle(TRI* tri_ptr,
00056                                            DLIList<TRI*>* sorted_lists,
00057                                            const int num_lists,
00058                                            const double interval,
00059                                            const double quality_angle);
00060 
00061 private:
00062 
00063     //Get the tri_visited flag.
00064   static CubitBoolean tri_visited(TRI *tri_ptr,
00065                                   int curr_visit_flag);
00066 
00067     //Set the tri_visited flag.
00068   static void tri_visited(TRI *tri_ptr,
00069                           CubitBoolean visited,
00070                           int curr_visit_flag);
00071   
00072     //Search every TRI until the one that the_point is in
00073     //is found.
00074   static CubitStatus exhaustive_locate_point(CubitVector& the_point,
00075                                              DLIList<TRI*>& facet_list,
00076                                              TRI*& tri_ptr);
00077 
00078   static CubitStatus point_in_circumcircle(CubitVector& the_point,
00079                                            TRI* tri_ptr,
00080                                            DLIList<TRI*>& tri_list,
00081                                            SURF* surface_ptr,
00082                                            int curr_visit_flag);
00083 
00084     //Find the TRI in facet_list that the_point is in.
00085     //If starting_tri is not NULL the search will begin
00086     //with it.
00087   static CubitStatus locate_point(CubitVector& the_point,
00088                                   DLIList<TRI*>& facet_list,
00089                                   TRI* starting_tri,
00090                                   SURF* owning_surface,
00091                                   TRI*& tri_ptr);
00092 
00093     //check the void created in Bowyer-Watson to ensure the boundary
00094     //seems valid.  
00095   static CubitStatus valid_void( NODE * /*point_ptr*/,
00096                                  DLIList<TRI *> &tri_list,
00097                                  SURF* surface_ptr,
00098                                  int curr_visit_flag);
00099 
00100   static CubitStatus natural_neighbor_tris(CubitVector& the_point,
00101                                            DLIList<TRI*>& facet_list,
00102                                            TRI*& start_tri,
00103                                            SURF* surface_ptr,
00104                                            int& curr_visit_flag,
00105                                            DLIList<TRI*>& tri_list);
00106 
00107    //- Bowyer-Watson insertion into an existing Delaunay Mesh
00108   static CubitStatus bowyer_watson_insert(NODE* point_ptr,
00109                                           DLIList<TRI*>& tri_list,
00110                                           DLIList<TRI*>& facet_list,
00111                                           int& curr_visit_flag,
00112                                           SURF* surf_ptr,
00113                                           TRI*& last_tri);
00114 
00115     //Return true if all three points in tri_ptr are colinear.
00116     //Return false otherwise.
00117   static CubitBoolean are_nodes_colinear(TRI* tri_ptr);
00118 
00119   static CubitVector& circumcenter(TRI* tri_ptr);
00120 
00121   static double get_size(CubitVector &cc, TRI *tri_ptr);
00122 
00123     // get and set the tri sort array index that this tri is in
00124   static void tri_sort_list( TRI *tri_ptr, int sort_list_index );
00125   static int tri_sort_list( TRI *tri_ptr );
00126 
00127   static double radius(TRI* tri_ptr);  
00128 };
00129 
00130 #include "FacetorUtil.cpp"
00131 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines