cgma
TDSplitSurface.hpp
Go to the documentation of this file.
00001 //-Class: TDSplitSurface.hpp
00002 
00003 #ifndef TD_SPLIT_SURFACE_HPP
00004 #define TD_SPLIT_SURFACE_HPP
00005 
00006 #include "ToolData.hpp"
00007 #include "CastTo.hpp"
00008 #include "DLIList.hpp"
00009 #include "CubitVector.hpp"
00010 #include "Cubit2DPoint.hpp"
00011 #include "CGMGeomConfigure.h"
00012 
00013 class RefFace;
00014 class RefEdge;
00015 class RefVertex;
00016 class CoEdge;
00017 
00018 //================================================================================
00019 // Description: A trivial class to hold two parameter values so that they 
00020 //              can be stored in a DLIList.  They are the min and max parameter
00021 //              space along the composite curve. (Split Surface Param)
00022 // Author     : Steve Storm
00023 // Date       : 2/3/2004
00024 //================================================================================
00025 class CUBIT_GEOM_EXPORT SSParam
00026 {
00027 public:
00028 
00029   SSParam( double min, double max );
00030   ~SSParam();
00031 
00032   double umin();
00033   double umax();
00034 
00035 private:
00036 
00037   double uMin;
00038   double uMax;
00039 };
00040 
00041 inline double SSParam::umin()
00042 { return uMin; }
00043 
00044 inline double SSParam::umax()
00045 { return uMax; }
00046 
00047 //================================================================================
00048 // Description: This class (Split Surface Side) holds a chain of curves on one 
00049 //              side of the surface.  It is needed to handle queries using a 
00050 //              composite curve concept.
00051 // Author     : Steve Storm
00052 // Date       : 2/3/2004
00053 //================================================================================
00054 class CUBIT_GEOM_EXPORT SSSide
00055 {
00056 public:
00057 
00058   SSSide( RefFace *ref_face_ptr, DLIList<CoEdge*> &co_edges,
00059           const CubitVector *collapsed_loc_ptr = NULL );
00060   ~SSSide();
00061 
00062   CubitStatus position_from_u( double u_value,
00063                                CubitVector& output_position );
00064 
00065   CubitStatus u_from_position ( const CubitVector& input_position,
00066                                 double &u );
00067   CubitStatus u_from_position ( const CubitVector& input_position,
00068                                 CoEdge *co_edge_ptr, SSParam *param,
00069                                 double &u );
00070 
00071   CubitBoolean is_vertex_on( RefVertex *ref_vertex_ptr );
00072   //- Determines if the given vertex lies on this side spatially.
00073 
00074   double length();
00075   //- Return curve length of this side
00076 
00077   CubitStatus build_param_list_from_facets( double tolerance = 0.1 );
00078   //- This function builds paramList using the graphics facets.  The
00079   //- coordList will be filled during syncronization - syncronize_lists.
00080   //- The tolerance is used by the geometry engine as the allowable deviation 
00081   //- of the facets from the actual curve.
00082 
00083   CubitStatus build_param_list( double fraction, double distance, int num_segs,
00084                                 DLIList<RefVertex*> &through_vertex_list );
00085   //- This function fills the paramList and coordList with the 
00086   //- appropriate number of points for the A and C sides of the surface.
00087   //- This is typically one point at the 50% location; however it could 
00088   //- be at a specified fraction value, at a vertex location or multiple 
00089   //- points evenly spaced.
00090 
00091   CubitStatus syncronize_lists( SSSide *other_side,
00092                                 double param_tol=.1 );
00093   //- Update lists in "this" and other_side.  Parameter values from
00094   //- both lists will be merged so that paramList will be identical
00095   //- on both SSSides.  This also populates coordList.  Use this 
00096   //- function to syncronize the B-D sides.
00097 
00098   DLIList<CoEdge*> *co_edges();
00099   //- Returns a pointer to this side's CoEdge list
00100 
00101   int coord_list_size();
00102   //- Return size of coordList
00103   void coord_list_reset();
00104   //- Set coordList to start of list
00105   void coord_list_last();
00106   //- Set coordList to end of list
00107   CubitVector *coord_list_get();
00108   //- Return value of current item in coordList
00109   CubitVector *coord_list_get_and_step();
00110   //- Get and step on the coordList
00111   CubitVector *coord_list_get_and_back();
00112   //- Get and back on the coordList
00113 
00114   int param_list_size();
00115   //- Return size of paramList
00116   void param_list_reset();
00117   //- Set paramList to start of list
00118   void param_list_last();
00119   //- Set paramList to end of list
00120   double param_list_get();
00121   //- Return value of current item in paramList
00122   double param_list_get_and_step();
00123   //- Get and step on the paramList
00124   double param_list_get_and_back();
00125   //- Get and back on the paramList
00126 
00127   CubitBoolean is_collapsed();
00128   //- Return whether this side is collapsed or not
00129 
00130 private:
00131 
00132   RefFace *refFacePtr;
00133   DLIList<CoEdge*> coEdgeChain;
00134   double paramHigh; // Parameter space of chain goes from 0.0 to curve length
00135   DLIList<SSParam*> coEdgeParamList; // Holds low and high parameter on each CoEdge
00136   
00137   DLIList<CubitVector*> coordList; // Coordinates for determining split locations
00138   DLIList<double> paramList; // Parameters for determining split locations
00139   // Note: sideA and sideC just contain the interior locs, while sideB and sideD 
00140   //       contain interior plus end locs built from curve facetting
00141 
00142   CubitBoolean isCollapsed; // CUBIT_TRUE if edge is collapsed (just a point)
00143 };
00144 
00145 inline double SSSide::length()
00146 { return paramHigh; }
00147 
00148 inline DLIList<CoEdge*> *SSSide::co_edges()
00149 { return &coEdgeChain; }
00150 
00151 inline int SSSide::coord_list_size()
00152 { return coordList.size(); }
00153 inline void SSSide::coord_list_reset()
00154 { coordList.reset(); }
00155 inline void SSSide::coord_list_last()
00156 { coordList.last(); }
00157 inline CubitVector *SSSide::coord_list_get()
00158 { return coordList.get(); }
00159 inline CubitVector *SSSide::coord_list_get_and_step()
00160 { return coordList.get_and_step(); }
00161 inline CubitVector *SSSide::coord_list_get_and_back()
00162 { return coordList.get_and_back(); }
00163 
00164 inline int SSSide::param_list_size()
00165 { return paramList.size(); }
00166 inline void SSSide::param_list_reset()
00167 { paramList.reset(); }
00168 inline void SSSide::param_list_last()
00169 { paramList.last(); }
00170 inline double SSSide::param_list_get()
00171 { return paramList.get(); }
00172 inline double SSSide::param_list_get_and_step()
00173 { return paramList.get_and_step(); }
00174 inline double SSSide::param_list_get_and_back()
00175 { return paramList.get_and_back(); }
00176 
00177 inline CubitBoolean SSSide::is_collapsed()
00178 { return isCollapsed;}
00179 
00180 //================================================================================
00181 // Description: This class holds data on the surface defining the sides of
00182 //              the surface to be split.
00183 // Author     : Steve Storm
00184 // Date       : 2/3/2004
00185 //================================================================================
00186 class CUBIT_GEOM_EXPORT TDSplitSurface : public ToolData
00187 {
00188 public:
00189 
00190   TDSplitSurface( int vertex_type );
00191   //- Constructor if placed on a CoEdge
00192 
00193   TDSplitSurface( RefFace *ref_face_ptr );
00194   //- Constructor if placed on a RefFace
00195 
00196   ~TDSplitSurface();
00197   //- Destructor
00198 
00199   RefFace *ref_face_ptr();
00200   //- Return this TDSplitSurface's RefFace ptr
00201   
00202   void add_type( int type );
00203   int get_type();
00204   //- For CoEdges
00205 
00206   CubitStatus add_coedges( DLIList<CoEdge*> &co_edge_list,
00207                            int side_interval[] );
00208   CubitStatus add_a_coedges( DLIList<CoEdge*> &a_coedges,
00209                              RefVertex *start_vertex_ptr = NULL );
00210   CubitStatus add_b_coedges( DLIList<CoEdge*> &b_coedges, 
00211                              RefVertex *start_vertex_ptr = NULL );
00212   CubitStatus add_c_coedges( DLIList<CoEdge*> &c_coedges,
00213                              RefVertex *start_vertex_ptr = NULL );
00214   CubitStatus add_d_coedges( DLIList<CoEdge*> &d_coedges, 
00215                              RefVertex *start_vertex_ptr = NULL );
00216   //- Add the curves into SSSide.  Note any side could be collapsed because of
00217   //- a triangle, if that is true a vertex needs to be provided to give the 
00218   //- coordinate of the side.
00219 
00220   CubitStatus tessellate_sides( double tol, double fraction, double distance,
00221                                 int num_segs,
00222                                 DLIList<RefVertex*> &through_vertex_list );
00223   //- Tessellates curves on the sides to find boundary coordinates in preparation
00224   //- for the mapping algirithm.  To give a smooth mapping, the tessellations
00225   //- are matched across the sides (ie., all locations on either side are at the
00226   //- same parameter value along the side).  The through_vertex_list if optional -
00227   //- if specified, the split will pass through vertices in the through_vertex_list 
00228   //- that are on sides A or C spatially.
00229   
00230   RefVertex *start_vertex( CoEdge *co_edge_ptr );
00231   //- Get the starting vertex of the given CoEdge.
00232 
00233   DLIList<CoEdge*> *get_a_coedges();
00234   DLIList<CoEdge*> *get_b_coedges();
00235   DLIList<CoEdge*> *get_c_coedges();
00236   DLIList<CoEdge*> *get_d_coedges();
00237   //- Just return a pointer to the curves
00238 
00239   double length_a();
00240   double length_b();
00241   double length_c();
00242   double length_d();
00243   //- Return the length of the given side
00244 
00245   int coord_list_size_a();
00246   void coord_list_reset_a();
00247   void coord_list_last_a();
00248   CubitVector *coord_list_get_a();
00249   CubitVector *coord_list_get_and_step_a();
00250   CubitVector *coord_list_get_and_back_a();
00251   //- Used to traverse the coordinates on side A
00252 
00253   int coord_list_size_b();
00254   void coord_list_reset_b();
00255   void coord_list_last_b();
00256   CubitVector *coord_list_get_b();
00257   CubitVector *coord_list_get_and_step_b();
00258   CubitVector *coord_list_get_and_back_b();
00259   //- Used to traverse the coordinates on side B
00260 
00261   int coord_list_size_c();
00262   void coord_list_reset_c();
00263   void coord_list_last_c();
00264   CubitVector *coord_list_get_c();
00265   CubitVector *coord_list_get_and_step_c();
00266   CubitVector *coord_list_get_and_back_c();
00267   //- Used to traverse the coordinates on side C
00268 
00269   int coord_list_size_d();
00270   void coord_list_reset_d();
00271   void coord_list_last_d();
00272   CubitVector *coord_list_get_d();
00273   CubitVector *coord_list_get_and_step_d();
00274   CubitVector *coord_list_get_and_back_d();
00275   //- Used to traverse the coordinates on side D
00276 
00277   int param_list_size_a();
00278   void param_list_reset_a();
00279   void param_list_last_a();
00280   double param_list_get_a();
00281   double param_list_get_and_step_a();
00282   double param_list_get_and_back_a();
00283   //- Used to traverse the parameters on side A
00284 
00285   int param_list_size_b();
00286   void param_list_reset_b();
00287   void param_list_last_b();
00288   double param_list_get_b();
00289   double param_list_get_and_step_b();
00290   double param_list_get_and_back_b();
00291   //- Used to traverse the parameters on side B
00292 
00293   int param_list_size_c();
00294   void param_list_reset_c();
00295   void param_list_last_c();
00296   double param_list_get_c();
00297   double param_list_get_and_step_c();
00298   double param_list_get_and_back_c();
00299   //- Used to traverse the parameters on side C
00300 
00301   int param_list_size_d();
00302   void param_list_reset_d();
00303   void param_list_last_d();
00304   double param_list_get_d();
00305   double param_list_get_and_step_d();
00306   double param_list_get_and_back_d();
00307   //- Used to traverse the parameters on side D
00308 
00309   CubitBoolean is_a_collapsed();
00310   CubitBoolean is_b_collapsed();
00311   CubitBoolean is_c_collapsed();
00312   CubitBoolean is_d_collapsed();
00313   //- Return whether sides are collapsed or not
00314 
00315   static int is_split_surface(const ToolData* td)
00316      {return (CAST_TO(td, const TDSplitSurface) != NULL);}
00317 
00318 private:
00319 
00320   RefFace *refFacePtr;
00321 
00322   SSSide *sideA;
00323   SSSide *sideB;
00324   SSSide *sideC;
00325   SSSide *sideD;
00326 
00327   // For vertices
00328   int vertexType;
00329 };
00330 
00331 inline RefFace *TDSplitSurface::ref_face_ptr()
00332 { return refFacePtr; }
00333 
00334 inline int TDSplitSurface::get_type()
00335 { return vertexType; }
00336 
00337 inline double TDSplitSurface::length_a()
00338 { return sideA->length(); }
00339 inline double TDSplitSurface::length_b()
00340 { return sideB->length(); }
00341 inline double TDSplitSurface::length_c()
00342 { return sideC->length(); }
00343 inline double TDSplitSurface::length_d()
00344 { return sideD->length(); }
00345 
00346 inline int TDSplitSurface::coord_list_size_a()
00347 { return sideA->coord_list_size(); }
00348 inline void TDSplitSurface::coord_list_reset_a() 
00349 { sideA->coord_list_reset(); }
00350 inline CubitVector *TDSplitSurface::coord_list_get_and_step_a()
00351 { return sideA->coord_list_get_and_step(); }
00352 
00353 inline int TDSplitSurface::coord_list_size_b()
00354 { return sideB->coord_list_size(); }
00355 inline void TDSplitSurface::coord_list_reset_b() 
00356 { sideB->coord_list_reset(); }
00357 inline CubitVector *TDSplitSurface::coord_list_get_and_step_b()
00358 { return sideB->coord_list_get_and_step(); }
00359 
00360 inline int TDSplitSurface::coord_list_size_c()
00361 { return sideC->coord_list_size(); }
00362 inline void TDSplitSurface::coord_list_reset_c() 
00363 { sideC->coord_list_reset(); }
00364 inline void TDSplitSurface::coord_list_last_c()
00365 { sideC->coord_list_last(); }
00366 inline CubitVector *TDSplitSurface::coord_list_get_and_step_c()
00367 { return sideC->coord_list_get_and_step(); }
00368 inline CubitVector *TDSplitSurface::coord_list_get_and_back_c()
00369 { return sideC->coord_list_get_and_back(); }
00370 
00371 inline int TDSplitSurface::coord_list_size_d()
00372 { return sideD->coord_list_size(); }
00373 inline void TDSplitSurface::coord_list_reset_d() 
00374 { sideD->coord_list_reset(); }
00375 inline void TDSplitSurface::coord_list_last_d()
00376 { sideD->coord_list_last(); }
00377 inline CubitVector *TDSplitSurface::coord_list_get_and_step_d()
00378 { return sideD->coord_list_get_and_step(); }
00379 inline CubitVector *TDSplitSurface::coord_list_get_and_back_d()
00380 { return sideD->coord_list_get_and_back(); }
00381 
00382 inline void TDSplitSurface::param_list_reset_a() 
00383 { sideA->param_list_reset(); }
00384 inline void TDSplitSurface::param_list_last_a()
00385 { sideA->param_list_last(); }
00386 inline double TDSplitSurface::param_list_get_and_step_a()
00387 { return sideA->param_list_get_and_step(); }
00388 
00389 inline void TDSplitSurface::param_list_reset_b() 
00390 { sideB->param_list_reset(); }
00391 inline double TDSplitSurface::param_list_get_and_step_b()
00392 { return sideB->param_list_get_and_step(); }
00393 
00394 inline void TDSplitSurface::param_list_last_c()
00395 { sideC->param_list_last(); }
00396 inline double TDSplitSurface::param_list_get_and_back_c()
00397 { return sideC->param_list_get_and_back(); }
00398 
00399 inline void TDSplitSurface::param_list_last_d()
00400 { sideD->param_list_last(); }
00401 inline double TDSplitSurface::param_list_get_and_back_d()
00402 { return sideD->param_list_get_and_back(); }
00403 
00404 inline CubitBoolean TDSplitSurface::is_a_collapsed()
00405 { return sideA->is_collapsed(); }
00406 
00407 inline CubitBoolean TDSplitSurface::is_b_collapsed()
00408 { return sideB->is_collapsed(); }
00409 
00410 inline CubitBoolean TDSplitSurface::is_c_collapsed()
00411 { return sideC->is_collapsed(); }
00412 
00413 inline CubitBoolean TDSplitSurface::is_d_collapsed()
00414 { return sideD->is_collapsed(); }
00415 
00416 
00417 //================================================================================
00418 // Description: This class holds data on vertices for split across extend
00419 // Author     : Steve Storm
00420 // Date       : 10/7/2007
00421 //================================================================================
00422 class CUBIT_GEOM_EXPORT TDSplitSurfaceExtend : public ToolData
00423 {
00424 public:
00425 
00426   TDSplitSurfaceExtend();
00427   //- Constructor
00428 
00429   ~TDSplitSurfaceExtend();
00430   //- Destructor
00431 
00432   void set_success();
00433   //- This indicates we successfully extended from this vertex
00434 
00435   CubitBoolean is_success();
00436   //- Did we successfully extend from this vertex?
00437 
00438   static int is_split_surface_extend(const ToolData* td)
00439      {return (CAST_TO(td, const TDSplitSurfaceExtend) != NULL);}
00440 
00441 private:
00442 
00443   CubitBoolean successFlg;
00444 };
00445 
00446 inline void
00447 TDSplitSurfaceExtend::set_success()
00448 { successFlg = CUBIT_TRUE; }
00449 
00450 inline CubitBoolean
00451 TDSplitSurfaceExtend::is_success()
00452 { return successFlg; }
00453 #endif // TD_SPLIT_SURFACE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines