cgma
ChollaCurve.hpp
Go to the documentation of this file.
00001 
00010 #ifndef ChollaCurve_HPP
00011 #define ChollaCurve_HPP
00012 
00013 #define MYLENGTH_UNINITIALIZED -1.0
00014 
00015 #include "DLIList.hpp"
00016 #include "ChollaEntity.hpp"
00017 
00018 class CubitVector;
00019 class CubitFacetEdge;
00020 class CubitPoint;
00021 class ChollaPoint;
00022 class ChollaSurface;
00023 class ChollaVolume;
00024 class FacetEntity;
00025 class CurveFacetEvalTool;
00026 
00027 class ChollaCurve : public ChollaEntity
00028 {
00029 private:
00030 
00031   DLIList<ChollaSurface*> surfaceList;
00032   DLIList<FacetEntity*> curveEdgeList;
00033   void *myCurve;
00034   CurveFacetEvalTool *myEvalTool;
00035   CubitPoint *startPoint;
00036   CubitPoint *endPoint;
00037   DLIList<ChollaPoint*> pointList;
00038   int flag;
00039   int blockID;
00040   int id;
00041   double myLength;
00042   ChollaCurve *myMergePartner;
00043 
00044   CubitStatus determine_ends();
00045     //- determine the end nodes for the curve (once the curvEdgeList is full)
00046 
00047   CubitFacetEdge *next_edge( CubitPoint *node_ptr, CubitFacetEdge *edge_ptr );
00048     //- return the next edge on the curve (NULL if at end)
00049   
00050   
00051 public:
00052 
00053 
00054   ChollaCurve( int block_id );
00055     //- default constructor
00056 
00057   ~ChollaCurve();
00058     // destructor
00059 
00060   int get_block_id()
00061   { return blockID; }
00062 
00063   void remove_td_associativity( ChollaSurface *fsm_ptr );
00064     // delete the asociativity of this curve with all edge's tool datas
00065 
00066   void add_facet(FacetEntity *exterior_edge)
00067     {myLength = MYLENGTH_UNINITIALIZED;
00068     curveEdgeList.append(exterior_edge);}
00069     //- add an edge to the curve
00070 
00071   int add_facet_unique(FacetEntity *exterior_edge)
00072   {myLength = MYLENGTH_UNINITIALIZED;
00073   return curveEdgeList.append_unique(exterior_edge);}
00074     //- add an edge to this curve - check to see if it already there before adding
00075 
00076   void remove_facet( FacetEntity *facet_edge )
00077   {myLength = MYLENGTH_UNINITIALIZED;
00078   curveEdgeList.remove( facet_edge ); }
00079     //- remove a facet_edge from underlying backing
00080 
00081   CubitStatus replace_facet( FacetEntity *remove_edge, FacetEntity *replace_edge );
00082     //- replace a facet_edge from underlying backing
00083 
00084   
00085   CubitStatus insert_facet( FacetEntity *old_edge, FacetEntity *new_edge );
00086     //- inserts new_edge after old_edge
00087     
00088   CubitStatus is_contain( FacetEntity *edge );
00089   //- check to see if an edge is in the list
00090 
00091   DLIList<FacetEntity*> &get_facet_list()
00092     {return curveEdgeList;}
00093     //- get the list of edges that make up this curve
00094   DLIList<FacetEntity*> *get_facet_list_ptr()
00095     {return &curveEdgeList;}
00096   
00097   //- return the length of the curve
00098   double length();
00099   
00100   int num_edges() {return curveEdgeList.size();}
00101     //- return the number of edges in the curve
00102 
00103   void add_surface( ChollaSurface *fsm_ptr )
00104     {surfaceList.append_unique( fsm_ptr );}
00105     //- associate a surface with this curve
00106 
00107   inline void remove_surface( ChollaSurface *fsm_ptr)
00108     {surfaceList.remove(fsm_ptr);}
00109     //- remove a suface from the curve
00110 
00111   DLIList<ChollaSurface*> &get_surfaces()
00112     {return surfaceList;}
00113   void get_surfaces( DLIList<ChollaSurface *> &surf_list )
00114     { surf_list += surfaceList; }
00115     //- get the list of surfaces attached to this curve
00116 
00117   DLIList<ChollaSurface*> *get_surface_list_ptr()
00118     {return &surfaceList;} 
00119 
00120   void add_point( ChollaPoint *fpm_ptr )
00121     {pointList.append_unique( fpm_ptr );}
00122     //- associate a point with this curve
00123    
00124   inline void remove_point( ChollaPoint *fpm_ptr)
00125     {pointList.remove(fpm_ptr);}
00126     //- remove a point from the curve
00127 
00128   DLIList<ChollaPoint*> &get_points()
00129     {return pointList;}
00130     //- get the list of points attached to this curve
00131   
00132   void get_facet_points( DLIList<CubitPoint *> &point_list, CubitBoolean inclusive);
00133     //- return the facet points on this chollacurve
00134   
00135   CubitBoolean is_in_volume( ChollaVolume *chvol_ptr );
00136     //- return whether this curve is contained within the specified volume
00137   
00138   CubitBoolean is_in_surface( ChollaSurface *chsurf_ptr );
00139     //- return whether this surface is contained within the specified surface
00140 
00141   void assign_geometric_curve(void *curv)
00142     {myCurve = curv;}
00143     //- set the geometric curve associated with the ChollaCurve
00144     //- myCurve is void * so we can deal with any type of geometry engine
00145 
00146   void* get_geometric_curve()
00147     {return myCurve;}
00148     //- return the geometric curve associated with the ChollaCurve
00149 
00150   void assign_eval_tool(CurveFacetEvalTool *curv_eval_tool)
00151     {myEvalTool = curv_eval_tool;}
00152     //- set the curve facet eval tool associated with the ChollaCurve
00153 
00154   CurveFacetEvalTool* get_eval_tool()
00155     {return myEvalTool;}
00156     //- return the curve facet eval tool associated with the ChollaCurve
00157 
00158   CubitStatus get_ends( CubitVector &start, CubitVector &end );
00159     //- return the end node locations
00160   CubitStatus get_ends( CubitPoint *&start_ptr, CubitPoint *&end_ptr );
00161     //- return the end nodes
00162 
00163   void set_start( CubitPoint *start_pt )
00164     { startPoint = start_pt; }
00165     // set the start point on the curve
00166 
00167   void set_end( CubitPoint *end_pt )
00168     { endPoint = end_pt; }
00169     //- set the end point on the curve
00170 
00171   CubitStatus split_curve( DLIList<ChollaCurve*> &facet_curve_list );
00172     //- split this curve into multiple ChollaCurve where there are
00173     //- discontinuous strings of edges.  Define start end end points
00174     //- for each curve while we are at it.
00175   
00176   CubitStatus build_curve_from_edges(CubitPoint *start_point,
00177                                      int periodic, int max_edges,
00178                                      CubitFacetEdge *start_edge_ptr,
00179                                      ChollaCurve *parent_curve);
00180 
00181   CubitStatus order_edges();
00182     //- put the current edges in the curve's list in order from start to end
00183 
00184   CubitStatus feature_angle( double min_dot );
00185     //- compute angles at nodes on the curve to see if we need to split
00186     //- the curve.  Mark the node tooldata hitflag if the node will
00187     //- break the curve (this is refernced in next_edge) 
00188 
00189   //  disassociate from cholla points
00190   CubitStatus disassociate_from_points( void );
00191   
00192   // disassociate from cholla surface
00193   CubitStatus disassociate_from_surfaces( void);
00194 
00195   // build a new curve_facet_eval_tool and assign it to ChollaCurve
00196   CubitStatus build_curve_facet_eval_tool( void );
00197 
00198   int get_flag( ) { return flag; }
00199   void set_flag( int flg ) { flag = flg; }
00200   int get_id() {return id;}
00201   void debug_draw();
00202   void print();
00203 
00204   // find adjacent edges at a point that lie on the curve
00205   bool adj_facet_edges( CubitPoint *cubit_pnt, CubitFacetEdge *&adj_edge1, CubitFacetEdge *&adj_edge2 );
00206   
00207   // return whether the curve contains the point
00208   CubitBoolean has_point( ChollaPoint *pt );
00209   
00210   // verify that all points on this curve have this curve as an adjacency
00211   CubitStatus verify_points();
00212   
00213   // clear the edge list
00214   void clean_out_edges(){ curveEdgeList.clean_out(); }
00215 
00216   int num_volumes();
00217 
00218   ChollaCurve *merge_partner(){ return myMergePartner; }
00219 
00220   void set_merge_partner( ChollaCurve *merge_partner )
00221     { myMergePartner = merge_partner;}  
00222 
00223 };
00224 
00225 template <> struct DLIListSorter<ChollaCurve*>
00226 {
00227   bool operator()(ChollaCurve* a, ChollaCurve* b) { return a->get_id() < b->get_id(); }
00228 };
00229 
00230 #endif
00231 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines