cgma
|
00001 00017 #ifndef CHOLLAENGINE_HPP 00018 #define CHOLLAENGINE_HPP 00019 00020 #include <set> 00021 #include <map> 00022 #include <vector> 00023 #include "DLIList.hpp" 00024 00025 #define FACET_ENTITY_UNINITIALIZED -1 00026 00027 class FacetEntity; 00028 class ChollaVolume; 00029 class ChollaCurve; 00030 class ChollaSurface; 00031 class ChollaPoint; 00032 class CubitPoint; 00033 class CubitFacetEdge; 00034 class CubitFacet; 00035 class GMem; 00036 class ChollaEntity; 00037 class FacetEvalTool; 00038 class ChollaMesh; 00039 00040 class ChollaEngine 00041 { 00042 public: 00044 ChollaEngine( ); 00046 ChollaEngine(DLIList<FacetEntity*> &face_list, 00047 DLIList<FacetEntity*> &edge_list, 00048 DLIList<FacetEntity*> &point_list ); 00050 ChollaEngine(DLIList<CubitFacet*> &facet_list, 00051 DLIList<CubitFacetEdge*> &edge_list, 00052 DLIList<CubitPoint*> &point_list ); 00053 00055 ChollaEngine(DLIList<CubitFacet*> &facet_list, 00056 DLIList<CubitFacetEdge*> &edge_list, 00057 DLIList<CubitPoint*> &point_list, 00058 DLIList<ChollaVolume *> &cholla_volumes, 00059 DLIList<ChollaSurface *> &cholla_surfaces, 00060 DLIList<ChollaCurve *> &cholla_curves, 00061 DLIList<ChollaPoint *> &cholla_points ); 00062 00064 ~ChollaEngine(); 00065 void delete_me(); 00066 00068 CubitStatus create_geometry (CubitBoolean use_feature_angle = CUBIT_TRUE, 00069 double angle = 135.0, 00070 int interp_order = 0, 00071 CubitBoolean smooth_non_manifold = CUBIT_TRUE, 00072 CubitBoolean split_surfaces = CUBIT_FALSE); 00073 00074 void get_volumes( DLIList<ChollaVolume *> & cholla_volume_list ) 00075 { cholla_volume_list += chollaVolumeList; } 00076 void get_surfaces( DLIList<ChollaSurface *> & cholla_surface_list ) 00077 { cholla_surface_list += chollaSurfaceList; } 00078 void get_curves( DLIList<ChollaCurve *> & cholla_curve_list ) 00079 { cholla_curve_list += chollaCurveList; } 00080 void get_points( DLIList<ChollaPoint *> & cholla_point_list ) 00081 { cholla_point_list += chollaPointList; } 00082 00083 void delete_eval_tools(); 00085 void delete_eval_tools_but_not_facets(); 00086 00087 00088 // collapses a cholla curve 00089 CubitStatus collapse_curve( ChollaCurve *cholla_curve, ChollaPoint *point_to_keep ); 00090 00091 // disassociate cholla surface 00092 CubitStatus disassociate_surface( ChollaSurface *cholla_surf ); 00093 00094 // collase a cholla surface 00095 CubitStatus collapse_surface( ChollaSurface *cholla_surface ); 00096 00097 // remove functions to update facet entities 00098 CubitStatus remove_facet_entity( CubitFacet *facet, ChollaSurface *cholla_surf = NULL ); 00099 CubitStatus remove_facet_entity( CubitFacetEdge *facet_edge, ChollaCurve *cholla_curve = NULL); 00100 CubitStatus remove_facet_entity( CubitPoint *facet_pnt, ChollaPoint *cholla_point = NULL ); 00101 CubitStatus remove_facet_entity( CubitFacet *facet, std::set<ChollaEntity *> &cholla_surfs ); 00102 CubitStatus remove_facet_entity( CubitFacetEdge *facet_edge, std::set<ChollaEntity *> &cholla_curves ); 00103 CubitStatus remove_facet_entity( CubitPoint *facet_pnt, std::set<ChollaEntity *> &cholla_points ); 00104 00105 // replace funcctions to update facet entities in cholla entities 00106 CubitStatus replace_facet_entity( CubitFacetEdge *remove_edge, CubitFacetEdge *replace_edge, std::set<ChollaEntity *> cholla_curves ); 00107 00108 00111 00112 static CubitStatus make_features( DLIList<CubitFacetEdge *> &feature_edge_list, 00113 CubitBoolean split_surfaces ); 00114 00115 #ifdef ALPHA_CABLE 00116 CubitStatus split_surface_at_edges( ChollaSurface* owning_surface, 00117 DLIList<CubitFacetEdge *> &feature_edge_list, 00118 DLIList<ChollaCurve*> &cholla_curves, 00119 DLIList<ChollaSurface*> &cholla_surfaces); 00120 // given a list of edges, crack the surface. 00121 #endif 00122 00123 00124 00125 static void mark_features (DLIList<CubitPoint*> &feature_points); 00126 static void mark_features (DLIList<CubitFacetEdge*> &feature_edges); 00127 00129 static CubitStatus fix_geometry( CubitBoolean smooth_non_manifold, 00130 CubitBoolean split_surfaces, 00131 CubitBoolean use_feature_angle, 00132 double min_dot, 00133 DLIList <CubitFacetEdge *> &feature_edge_list ); 00134 00136 //Cubit is not using this anymore. 00137 static CubitStatus check_all_facet_orientations( DLIList <CubitFacet*> &facet_list, 00138 CubitBoolean do_flip = CUBIT_FALSE); 00139 00141 static CubitStatus determine_curve_orientation( ChollaSurface *chsurf_ptr, 00142 ChollaCurve *chcurv_ptr, 00143 CubitSense & orientation ); 00144 00145 static CubitStatus get_facets(GMem& gmem, DLIList<CubitFacet*> &facet_list, 00146 DLIList<CubitPoint*> &dl_point_list, 00147 bool insert_null_facets = false); 00148 00149 //set the ChollaEngine to actually flip facets, or to just set a flag 00150 // when facets need to be reoriented 00151 void set_flip_flag(CubitBoolean flip){ doFlip = flip; } 00152 00153 void print_me(); 00154 void dump( const char *filename, double angle ); 00155 00156 // create cholla curve 00157 //CubitStatus create_curve( int block_id, ChollaPoint *new_ch_pnt0, ChollaPoint *new_ch_pnt1, ChollaCurve *&new_ch_curve ); 00158 CubitStatus create_curve( int block_id, 00159 ChollaPoint *new_ch_pnt0, 00160 ChollaPoint *new_ch_pnt1, 00161 ChollaCurve *&new_ch_curve 00162 ); 00163 00164 00165 00166 CubitStatus create_point( CubitPoint *pnt, ChollaPoint *&new_ch_pnt ); 00167 00168 CubitStatus create_surface( int block_id, 00169 ChollaSurface *&new_ch_surf ); 00170 00171 // disassoicate ch_curve from ch_points, ch_curve, ch_surf, and ch_engine 00172 CubitStatus disassociate_curve( ChollaCurve *ch_curve, 00173 bool disassociate_with_vert = true, 00174 bool disassociate_with_surf = true, 00175 bool disassociate_with_model = true ); 00176 // remove a cholla sub-entities 00177 void remove_curve( ChollaCurve *ch_curve ){ chollaCurveList.remove( ch_curve ); } 00178 void remove_surface( ChollaSurface *ch_surface ){ chollaSurfaceList.remove( ch_surface ); } 00179 void remove_point( ChollaPoint *ch_pnt ){ chollaPointList.remove( ch_pnt ); } 00180 00181 // Create independent manifold volumes from the non-manifold set 00182 CubitStatus detach_volumes(); 00183 00186 CubitStatus build_surface_and_curve_eval_tools( DLIList<ChollaSurface*> &cholla_surface_list, 00187 int interp_order, double min_dot); 00188 00189 CubitStatus rebuild_surface_and_curve_eval_tools(DLIList<ChollaSurface*> &cholla_surface_list, 00190 int interp_order, double min_dot); 00191 00192 // verify the connectivity between points and curves 00193 CubitStatus verify_points_to_curves(); 00194 00195 //calls private build_eval_tools function 00196 CubitStatus build_eval_tools(); 00197 00198 // merges two points 00199 CubitStatus merge_two_points( ChollaPoint *point_to_keep, ChollaPoint *point_to_del ); 00200 00201 private: 00202 00203 DLIList<FacetEntity*> faceList; 00204 DLIList<FacetEntity*> edgeList; 00205 DLIList<FacetEntity*> pointList; 00206 DLIList<ChollaVolume*> chollaVolumeList; 00207 DLIList<ChollaSurface*> chollaSurfaceList; 00208 DLIList<ChollaCurve*> chollaCurveList; 00209 DLIList<ChollaPoint*> chollaPointList; 00210 00211 DLIList<ChollaCurve*> *hashCurveArray; 00212 int hashCurveSize; 00213 DLIList<ChollaPoint*> *hashPointArray; 00214 int hashPointSize; 00215 //boolean to determine whether flip the facets (when needed) or set 00216 // the isBackwards flag. 00217 CubitBoolean doFlip; 00218 00219 void set_up_tool_datas( ); 00220 void delete_tool_datas( ); 00221 00223 int facet_dimension(FacetEntity *facet_ptr); 00224 00226 CubitStatus create_volume_boundaries( DLIList<ChollaSurface*> &facet_surface_sheets, 00227 CubitBoolean use_feature_angle, 00228 double min_dot, 00229 CubitBoolean split_surfaces ); 00230 00232 CubitStatus create_surface_boundaries( DLIList<ChollaSurface*> &cholla_surface_list, 00233 DLIList<ChollaCurve*> &cholla_curve_list, 00234 CubitBoolean use_feature_angle, 00235 double min_dot ); 00236 00238 CubitStatus create_curve_boundaries( DLIList<ChollaCurve*> &cholla_curve_list, 00239 DLIList<ChollaPoint*> &cholla_point_list ); 00240 00243 CubitStatus classify_edge( FacetEntity *edge_ptr, 00244 DLIList<ChollaCurve*> &cholla_curve_list, 00245 ChollaSurface *fsm_ptr ); 00246 00249 CubitStatus classify_point(CubitPoint *point_ptr, 00250 DLIList<ChollaPoint*> &cholla_point_list, 00251 ChollaCurve *fcm_ptr ); 00252 00254 CubitStatus build_eval_tools( DLIList<ChollaSurface*> &cholla_surface_list, 00255 DLIList<ChollaCurve*> &cholla_curve_list, 00256 int interp_order, 00257 CubitBoolean use_feature_angle, 00258 double min_dot, 00259 CubitBoolean smooth_non_manifold , 00260 CubitBoolean split_surfaces ); 00263 CubitStatus build_curve_eval_tools( DLIList<ChollaCurve*> &cholla_curve_list, 00264 int interp_order ); 00265 00266 00268 CubitStatus init_hash_curves( ); 00269 void delete_hash_curves( ); 00270 int get_curve_hash_key( DLIList<ChollaSurface*> *bsm_list_ptr ); 00271 00273 CubitStatus init_hash_points( ); 00274 void delete_hash_points( ); 00275 int get_point_hash_key( DLIList<ChollaCurve*> *bsm_list_ptr ); 00276 00279 CubitStatus clean_geometry( CubitBoolean smooth_non_manifold, 00280 CubitBoolean split_surfaces, 00281 CubitBoolean use_feature_angle, 00282 double min_dot, 00283 DLIList <ChollaCurve *> &cholla_curve_list ); 00284 00285 00287 static CubitStatus check_facet_orientation( CubitFacet *facet, 00288 CubitBoolean do_flip, 00289 int &nfacets, int mydebug = 0 ); 00290 00293 static CubitStatus crack_open_point( CubitPoint *point_ptr, int mydebug ); 00294 00298 static CubitStatus insert_discontinuity_at_point( CubitPoint *point_ptr ); 00299 00302 static CubitStatus get_facets_at_point( CubitPoint *point_ptr, 00303 CubitFacet *facet_ptr, 00304 DLIList<CubitFacet *> &facet_list, 00305 DLIList<CubitFacetEdge *> &feature_edge_list ); 00307 static CubitStatus fix_edge( CubitFacetEdge *edge_ptr, 00308 DLIList<CubitFacet *> &update_facet_list ); 00309 static CubitStatus fix_split_edge( CubitFacetEdge *edge_ptr, 00310 DLIList<CubitFacet *> &update_facet_list ); 00311 00314 static CubitStatus fix_split_non_manifold_edge( CubitFacetEdge *edge_ptr, 00315 double min_dot, 00316 DLIList <CubitPoint *> &changed_points ); 00317 static CubitStatus fix_non_manifold_edge( CubitFacetEdge *edge_ptr, 00318 double min_dot, 00319 DLIList <CubitPoint *> &changed_points ); 00320 00323 static CubitStatus update_edges_at_points( CubitBoolean split_surfaces, 00324 DLIList<CubitPoint *> &point_list, 00325 DLIList<CubitFacet *> &facet_update_list, 00326 double mindot ); 00328 static CubitStatus merge_normals( CubitPoint *pt0, CubitPoint *pt1); 00329 00330 00331 // given a non-manifold surface in a cholla model, create a copy and update child entities 00332 CubitStatus detach_surfaces(DLIList<ChollaSurface*> &chsurfs, 00333 DLIList<ChollaCurve*> &chcurves, 00334 ChollaVolume *detaching_volume, 00335 std::map<ChollaSurface *, ChollaSurface *> &surf_map, 00336 std::map<ChollaCurve *, ChollaCurve *> &curve_map, 00337 std::map<ChollaPoint *, ChollaPoint *> &point_map); 00338 00339 CubitStatus detach_curves( DLIList<ChollaCurve*> &curves, 00340 ChollaVolume *detaching_volume, 00341 std::map<ChollaCurve *, ChollaCurve *> &curve_map, 00342 std::map<ChollaPoint *, ChollaPoint *> &point_map ); 00343 00344 CubitStatus detach_curve(ChollaCurve *chcurv_ptr, 00345 DLIList<ChollaSurface*> &new_surfs, 00346 ChollaVolume *chvol2_ptr, 00347 std::map<ChollaCurve*, ChollaCurve*> &curve_map, 00348 std::map<ChollaPoint*, ChollaPoint*> &point_map ); 00349 00350 CubitStatus detach_point(ChollaPoint *chpt_ptr, 00351 ChollaVolume *chvol2_ptr, 00352 std::map<ChollaPoint*, ChollaPoint*> &point_map, 00353 std::map<ChollaCurve*, ChollaCurve*> &curve_map ); 00354 00355 // Create independent manifold volumes from the non-manifold set 00356 CubitStatus detach_facets( DLIList<ChollaSurface*> &chsurfs, 00357 DLIList<ChollaCurve*> &chcurves, 00358 ChollaVolume *chvol, 00359 std::map<ChollaSurface *, ChollaSurface *> &surf_map, 00360 std::map<ChollaCurve *, ChollaCurve *> &curve_map, 00361 std::map<ChollaPoint *, ChollaPoint *> &point_map); 00362 00363 CubitStatus detach_facet_edges(DLIList<ChollaCurve*> &chcurves, 00364 ChollaVolume *detaching_volume, 00365 std::map<ChollaCurve *, ChollaCurve *> &curve_map, 00366 std::map<ChollaPoint *, ChollaPoint *> &point_map); 00367 00368 CubitStatus copy_facets_at_interface(DLIList<ChollaSurface*> &chsurfs, 00369 DLIList<ChollaCurve*> &chcurves, 00370 std::vector<CubitPoint *> &new_points, 00371 std::vector<CubitFacetEdge *> &new_edges, 00372 std::map<ChollaSurface *, ChollaSurface *> &surf_map, 00373 std::map<ChollaCurve *, ChollaCurve *> &curve_map, 00374 std::map<ChollaPoint *, ChollaPoint *> &point_map); 00375 00376 CubitStatus copy_facet_edges_at_interface(DLIList<ChollaCurve*> &chcurves, 00377 std::vector<CubitPoint *> &new_points, 00378 std::vector<CubitFacetEdge *> &new_edges, 00379 std::map<ChollaCurve *, ChollaCurve *> &curve_map, 00380 std::map<ChollaPoint *, ChollaPoint *> &point_map); 00381 00382 CubitStatus copy_points_at_interface(DLIList<FacetEntity *> &facet_list, 00383 std::vector<CubitPoint *> &new_points, 00384 std::map<ChollaSurface *, ChollaSurface *> &surf_map, 00385 std::map<ChollaCurve *, ChollaCurve *> &curve_map, 00386 std::map<ChollaPoint *, ChollaPoint *> &point_map); 00387 CubitStatus copy_edges_at_interface(DLIList<FacetEntity *> &facet_list, 00388 std::vector<CubitPoint *> &new_points, 00389 std::vector<CubitFacetEdge *> &new_edges, 00390 std::map<ChollaSurface *, ChollaSurface *> &surf_map, 00391 std::map<ChollaCurve *, ChollaCurve *> &curve_map, 00392 std::map<ChollaPoint *, ChollaPoint *> &point_map); 00393 00394 // detach the facets from original points and edges and reattach to new copy 00395 CubitStatus connect_facets_at_interface(DLIList<ChollaSurface*> &chsurfs, 00396 DLIList<ChollaCurve*> &churves, 00397 ChollaVolume *chvol_ptr, 00398 std::vector<CubitPoint *> &new_points, 00399 std::vector<CubitFacetEdge *> &new_edges); 00400 CubitStatus connect_points_at_interface(ChollaCurve *chcurv_ptr, 00401 ChollaVolume *chvol_ptr, 00402 std::vector<CubitPoint *> &new_points); 00403 CubitStatus connect_edges_at_interface(ChollaCurve *chcurv_ptr, 00404 ChollaVolume *chvol_ptr, 00405 std::vector<CubitFacetEdge *> &new_edges); 00406 00407 // update the ownenrship of the new detached facet entity based uponthe map set up in detach_volumes 00408 CubitStatus set_new_facet_owners(int type, //0, 1, or 2 based on dimension of facet entity 00409 FacetEntity *fe_ptr, FacetEntity *newfe_ptr, 00410 std::map<ChollaSurface *, ChollaSurface *> &surf_map, 00411 std::map<ChollaCurve *, ChollaCurve *> &curve_map, 00412 std::map<ChollaPoint *, ChollaPoint *> &point_map ); 00413 00414 // set the end points of the curves that are adjacent to the interface surface 00415 CubitStatus set_curve_endpoints(std::map<ChollaPoint*, ChollaPoint*> &point_map, 00416 std::map<ChollaCurve*, ChollaCurve*> &curve_map ); 00417 00418 }; 00419 00420 #endif 00421 00422