cgma
|
00001 //- Class: TDFacetBoundaryEdge 00002 //- Description: Tool data for storing additional information at 00003 //- the boundary of a facet set 00004 //- Owner: Steve Owen 00005 //- Checked by: 00006 //- Version: 00007 00008 #ifndef TD_FACET_BOUNDARY_EDGE_HPP 00009 00010 00011 #define TD_FACET_BOUNDARY_EDGE_HPP 00012 00013 #include "CubitDefines.h" 00014 #include "ToolData.hpp" 00015 #include "DLIList.hpp" 00016 #include "CubitVector.hpp" 00017 #include "MemoryManager.hpp" 00018 #include "CastTo.hpp" 00019 class CubitFacetEdge; 00020 class CubitFacet; 00021 class CubitPoint; 00022 00023 typedef struct BoundaryEdgeData 00024 { 00025 CubitVector bezierCtrlPts[3]; 00026 CubitFacet *adjFacet; 00027 int surfID; 00028 int computed; 00029 } BoundaryEdgeData; 00030 00031 class TDFacetBoundaryEdge : public ToolData 00032 { 00033 private: 00034 00035 static MemoryManager memoryManager; 00036 //- memory management object 00037 00038 CubitFacetEdge *edgePtr; 00039 //Because non-manifold geometry complicates things a little, if 00040 // we are using a represenation that is of a higher order than 00041 // linear. We figure out which edges edgePtr should be C1 with 00042 // along a curve... The two edges (if exist) are store in nextEdgePtr 00043 // (if it is the edge across node(1)) or prevEdgePtr (if it is the 00044 // edge across node(0)). 00045 CubitFacetEdge *nextEdgePtr; 00046 CubitFacetEdge *prevEdgePtr; 00047 DLIList <BoundaryEdgeData *> edgeDataList; 00048 00049 public: 00050 00051 TDFacetBoundaryEdge(); 00052 //- constructor 00053 00054 ~TDFacetBoundaryEdge(); 00055 00056 static int is_facet_boundary_edge(const ToolData* td) 00057 {return (CAST_TO(const_cast<ToolData*>(td), TDFacetBoundaryEdge) != NULL);} 00058 00059 void add_surf(int new_id); 00060 00061 CubitFacetEdge *get_edge() 00062 { return edgePtr; } 00063 00064 void set_edge( CubitFacetEdge *edge_ptr ) 00065 { edgePtr = edge_ptr; } 00066 00067 CubitFacetEdge *get_next_edge() 00068 { return nextEdgePtr; } 00069 00070 void set_next_edge( CubitFacetEdge *edge_ptr ) 00071 { nextEdgePtr = edge_ptr; } 00072 00073 CubitFacetEdge *get_prev_edge() 00074 { return prevEdgePtr; } 00075 00076 void set_prev_edge( CubitFacetEdge *edge_ptr ) 00077 { prevEdgePtr = edge_ptr; } 00078 00079 00080 SetDynamicMemoryAllocation(memoryManager) 00081 //- class specific new and delete operators 00082 00083 static void set_memory_allocation_increment(int increment = 0) 00084 {memoryManager.set_memory_allocation_increment(increment);} 00085 //- set block memory size increment 00086 00087 static void destroy_memory() 00088 {memoryManager.destroy_memory();} 00089 //- destroy all memory allocted to this object 00090 00091 static CubitStatus add_facet_boundary_edge(CubitFacetEdge *edge_ptr); 00092 static TDFacetBoundaryEdge* get_facet_boundary_edge(CubitFacetEdge *edge_ptr); 00093 00094 int control_points( CubitVector *ctrl_pts, int surf_id ); 00095 //- get the control points (return the order) 00096 void control_points( CubitVector *ctrl_pts, int order, int surf_id ); 00097 //- set the bezier control points on the edge. 00098 //- end points are assumed to be the first and last 00099 //- ctrl pt so they are not passed in. Pass in order-1 00100 //- control points (max order = 4) 00101 CubitStatus control_points( CubitFacet *facet, CubitVector *ctrl_pts ); 00102 // return the control pons on the edge of a facet based 00103 // on its edge use direction 00104 void get_control_points( CubitPoint *point_ptr, CubitVector ctrl_pts[3], 00105 int surf_id ); 00106 void set_control_points( CubitPoint *point_ptr, CubitVector ctrl_pts[3], 00107 int surf_id ); 00108 // get and set control points oriented with respect to the 00109 // point_ptr (ie. point_ptr is the first control point on the edge) 00110 // Note: only gets and sets the middle three control points. The 00111 // other 2 are the edge vertices. 00112 00113 void add_surf_facet( DLIList<CubitFacet *> &facet_list ); 00114 // add facet representing a new surface adjacent this edge 00115 00116 void set_surf_id( CubitFacet *facet_ptr, int surf_id ); 00117 // set id of surface defined by facet_ptr 00118 00119 CubitBoolean is_internal_edge(); 00120 // return whether this edge is internal to a surface 00121 00122 CubitStatus init_control_points( double min_dot ); 00123 // initialize control points on boundary edge 00124 00125 CubitStatus merge_control_points(); 00126 // find aerage of control points and set on edge 00127 00128 CubitStatus compute_curve_tangent( int surf_id, 00129 CubitFacetEdge *edge, 00130 double min_dot, 00131 CubitVector &T0, 00132 CubitVector &T3 ); 00133 // compute the tangents to the endpoints of a feature edge. 00134 00135 CubitFacetEdge *next_feature_edge( int surf_id, 00136 CubitFacetEdge *this_edge, 00137 CubitPoint *p0 ); 00138 // given a facet boundary edge and one of its nodes, find the 00139 // next edge on the same surface 00140 00141 CubitBoolean is_at_surf( int surf_id ); 00142 // return whether the given edge has one of its adjacent 00143 // faces on the given surface 00144 }; 00145 00146 00147 #endif // TD_FACET_BOUNDARY_EDGE_HPP 00148 00149