LCOV - code coverage report
Current view: top level - geom/facet/cgm - FacetCurve.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 9 14 64.3 %
Date: 2020-06-30 00:58:45 Functions: 5 9 55.6 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : //-------------------------------------------------------------------------
       2                 :            : // Filename      : FacetCurve.hpp
       3                 :            : //
       4                 :            : // Purpose       : 
       5                 :            : //
       6                 :            : // Special Notes :
       7                 :            : //
       8                 :            : // Creator       : Steven J. Owen
       9                 :            : //
      10                 :            : // Creation Date : 07/14/00
      11                 :            : //
      12                 :            : // Owner         : Steven J. Owen
      13                 :            : //-------------------------------------------------------------------------
      14                 :            : 
      15                 :            : #ifndef CURVE_FACET_HPP
      16                 :            : #define CURVE_FACET_HPP
      17                 :            : 
      18                 :            : // ********** BEGIN STANDARD INCLUDES      **********
      19                 :            : // ********** END STANDARD INCLUDES        **********
      20                 :            : 
      21                 :            : // ********** BEGIN CUBIT INCLUDES         **********
      22                 :            : #include "CubitDefines.h"
      23                 :            : #include "Curve.hpp"
      24                 :            : #include "FacetAttribSet.hpp"
      25                 :            : // ********** END CUBIT INCLUDES           **********
      26                 :            : 
      27                 :            : // ********** BEGIN FORWARD DECLARATIONS   **********
      28                 :            : class TopologyEntity;
      29                 :            : class CurveFacetEvalTool;
      30                 :            : class FacetEvalTool;
      31                 :            : class FacetAttrib;
      32                 :            : class CurveFacetEvalTool;
      33                 :            : class TBPoint;
      34                 :            : class CubitPoint;
      35                 :            : class CubitFacetEdge;
      36                 :            : class CubitFacetEdge;
      37                 :            : 
      38                 :            : class FacetBody;
      39                 :            : class FacetLump;
      40                 :            : class FacetShell;
      41                 :            : class FacetSurface;
      42                 :            : class FacetLoop;
      43                 :            : class FacetCoEdge;
      44                 :            : class FacetPoint;
      45                 :            : 
      46                 :            : // ********** END FORWARD DECLARATIONS     **********
      47                 :            : 
      48                 :            : class FacetCurve : public Curve
      49                 :            : {
      50                 :            : public :
      51                 :            :   
      52                 :            :   FacetCurve( CurveFacetEvalTool *curve_facet_tool,
      53                 :            :               TBPoint *fp0, TBPoint *fp1,
      54                 :            :               DLIList<CoEdgeSM*> &coedgelist );
      55                 :            :     //I- curve_facet_eval_tool_ptr pointer
      56                 :            :     //I- A pointer to the set of facet edges that define this curve.
      57                 :            :   
      58                 :            :   FacetCurve( CurveFacetEvalTool *curve_facet_tool,
      59                 :            :               TBPoint *fp0, TBPoint *fp1,
      60                 :            :               CubitSense sense );
      61                 :            :     //I- curve_facet_eval_tool_ptr pointer
      62                 :            :     //I- start and end points 
      63                 :            :     //I- Sense of curve 
      64                 :            :   
      65                 :            :   virtual ~FacetCurve() ;
      66                 :            :     //- The destructor
      67                 :            : 
      68                 :            :     
      69                 :            :   virtual void append_simple_attribute_virt(const CubitSimpleAttrib&);
      70                 :            :     //R void
      71                 :            :     //I 
      72                 :            :     //I- 
      73                 :            :     //I- that is to be appended to this OSME object.
      74                 :            :     //- The purpose of this function is to append a 
      75                 :            :     //- attribute to the OSME. The  is attached to each of the 
      76                 :            :     //- underlying solid model entities this one points to.
      77                 :            :   
      78                 :            :   virtual void remove_simple_attribute_virt(const CubitSimpleAttrib&);
      79                 :            :     //R void
      80                 :            :     //I CubitSimpleAttrib*
      81                 :            :     //I- A reference to a CubitSimpleAttrib object which is the object
      82                 :            :     //I- that is to be removed to this OSME object.
      83                 :            :     //- The purpose of this function is to remove a simple
      84                 :            :     //- attribute from the OSME. The attribute is attached to each of the
      85                 :            :     //- underlying solid model entities this one points to.
      86                 :            :   
      87                 :            :   virtual void remove_all_simple_attribute_virt();
      88                 :            :     //R void
      89                 :            :     //I-
      90                 :            :     //- The purpose of this function is to remove all simple
      91                 :            :     //- attributes from the OSME. 
      92                 :            :   
      93                 :            :   virtual CubitStatus get_simple_attribute(DLIList<CubitSimpleAttrib>&);
      94                 :            :   virtual CubitStatus get_simple_attribute(const CubitString& name,
      95                 :            :                                            DLIList<CubitSimpleAttrib>&);
      96                 :            :     //R CubitSimpleAttrib*
      97                 :            :     //R- the returned cubit simple attribute.
      98                 :            :     //- The purpose of this function is to get the attributes
      99                 :            :     //- of the geometry entity. The name is attached to the underlying solid
     100                 :            :     //- model entity(ies) this one points to.
     101                 :            :     //- MJP Note:
     102                 :            :     //- This is the code that implements the requirement that names
     103                 :            :     //- of VGI Entities propagate across solid model boolean
     104                 :            :     //- operations.  The success of this relies, of course, on the underlying
     105                 :            :     //- solid modeler being able to propagate attributes across
     106                 :            :     //- such operations on its entities. If it cannot, then "names"
     107                 :            :     //- of VGI entities will not propagate.
     108                 :            :   
     109                 :            :   virtual CubitBox bounding_box() const ;
     110                 :            :     //- see comments in GeometryEntity.hpp
     111                 :            :   
     112                 :            :   virtual GeometryQueryEngine* 
     113                 :            :   get_geometry_query_engine() const;
     114                 :            :     //R GeometryQueryEngine*
     115                 :            :     //R- A pointer to the geometric modeling engine associated with
     116                 :            :     //R- the object.
     117                 :            :     //- This function returns a pointer to the geometric modeling engine
     118                 :            :     //- associated with the object.
     119                 :            :   
     120                 :            :   virtual double measure();
     121                 :            :     //R double
     122                 :            :     //R- The numeric value of the measure (its units depend on the dimension
     123                 :            :     //R- of the RefEntity being "measured")
     124                 :            :     //- A generic geometric extent function.
     125                 :            :     //- Returns volume for Lump, area for Surface, length for Curve and 
     126                 :            :     //- 1.0 for Point
     127                 :            :     //-
     128                 :            :     //- If there is an error computing the length a value of -1.0 is
     129                 :            :     //- returned.
     130                 :            :   
     131                 :            :   virtual double length_from_u( double parameter1,
     132                 :            :                                 double parameter2 );
     133                 :            :     //R double
     134                 :            :     //R- Returned length value
     135                 :            :     //I parameter1
     136                 :            :     //I- The first parameter value
     137                 :            :     //I parameter2
     138                 :            :     //I- The second parameter value
     139                 :            :     //- This function returns the arc length along the Curve starting from
     140                 :            :     //- the point represented by the parameter1 going to the point represented
     141                 :            :     //- by parameter2.
     142                 :            :   
     143                 :            :   virtual CubitBoolean is_periodic( double& period);
     144                 :            :     //R CubitBoolean
     145                 :            :     //R- CUBIT_TRUE/CUBIT_FALSE
     146                 :            :     //O period
     147                 :            :     //O- Returned period value
     148                 :            :     //- This function determines whether the underlying geometry of the
     149                 :            :     //- Curve is periodic or not.  Returns CUBIT_TRUE if it is and 
     150                 :            :     //- CUBIT_FALSE if it is not.
     151                 :            :     //-
     152                 :            :     //- If it is periodic, then it returns the period in the input
     153                 :            :     //- reference variable, "period". This value is set to 0.0 if
     154                 :            :     //- the Curve is not periodic.
     155                 :            :     //- 
     156                 :            :   
     157                 :            :   virtual CubitBoolean get_param_range( double& lower_bound,
     158                 :            :                                         double& upper_bound );
     159                 :            :     //R CubitBoolean
     160                 :            :     //R- CUBIT_TRUE/CUBIT_FALSE
     161                 :            :     //O lower_bound
     162                 :            :     //O- The lower bound of the parametric range.
     163                 :            :     //O upper_bound
     164                 :            :     //O- The upper bound of the parametric range.
     165                 :            :     //- Returns the lower and upper parametric bounds of the 
     166                 :            :     //- Curve.
     167                 :            :     //-
     168                 :            :     //- IMPORTANT NOTE:
     169                 :            :     //- Note that the lower bound is the parameter value of the start
     170                 :            :     //- location of the RefEdge that uses this Curve and the upper
     171                 :            :     //- bound is the parameter value of the end location of the RefEdge
     172                 :            :     //- that uses this Curve.  This takes into account the sense of the
     173                 :            :     //- RefEdge with respect to the Curve (which could be REVERSED).
     174                 :            :     //- Hence, the numerical value of the lower parameter bound could be
     175                 :            :     //- greater than that of the upper parameter bound.
     176                 :            :   
     177                 :            :   virtual CubitStatus get_interior_extrema(DLIList<CubitVector*>& interior_points,
     178                 :            :                                            CubitSense& return_sense);
     179                 :            :     //- Finds the extrema along this RefEdge.  An extremum is defined as
     180                 :            :     //- a local min or max in the direction of one of the primary axial directions.
     181                 :            :     //- O-interior_points: list of coordinates where the extrema occur.
     182                 :            :     //- O-return_sense: Whether the interior extrema are ordered in the
     183                 :            :     //-                 FORWARD or REVERSED direction of this RefEdge.
     184                 :            :     //-
     185                 :            :     //- ***IMPORTANT!!!***
     186                 :            :     //-    This function dynamically allocates the CubitVectors appended to
     187                 :            :     //-    interior_points.  It is the responsibility of the calling code to
     188                 :            :     //-    delete these CubitVectors (or in the case of RefEdge, to make sure
     189                 :            :     //-    that *it's* calling code knows that it should delete the CubitVectors)!
     190                 :            :   
     191                 :            :   virtual CubitStatus closest_point( CubitVector const& location, 
     192                 :            :                                      CubitVector& closest_location,
     193                 :            :                                      CubitVector* tangent_ptr = NULL,
     194                 :            :                                      CubitVector* curvature_ptr = NULL,
     195                 :            :                                      double *param = NULL);
     196                 :            :     //R void
     197                 :            :     //I location
     198                 :            :     //I- The point to which the closest point on the Curve is desired.
     199                 :            :     //O closest_location
     200                 :            :     //O- The point on the Curve, closest to the input location which
     201                 :            :     //O- might not be on the Curve.  This is input as a reference 
     202                 :            :     //O- so that the function can modify its contents.
     203                 :            :     //O tangent_ptr
     204                 :            :     //O- The tangent to the Curve (output as a unit vector) at the 
     205                 :            :     //O- closest_location.
     206                 :            :     //O curvature_ptr
     207                 :            :     //O- The curvature of the Curve at the closest_location.
     208                 :            :     //- This function computes the point on the Curve closest to the input 
     209                 :            :     //- location.
     210                 :            :     //-
     211                 :            :     //- If the tangent and/or curvature is required, then the calling code
     212                 :            :     //- is responsible for allocating space for the CubitVector(s) and
     213                 :            :     //- sending in the relevant non-NULL pointers.  If either of these
     214                 :            :     //- pointers is NULL, the related quantity is not computed.
     215                 :            :     //-
     216                 :            :     //- Notes:
     217                 :            :     //- The tangent direction is always in the positive direction of the 
     218                 :            :     //- *owning RefEdge*, regardless of the positive direction of the
     219                 :            :     //- underlying solid model entities.
     220                 :            :   
     221                 :            :   virtual CubitStatus position_from_u (double u_value,
     222                 :            :                                        CubitVector& output_position);
     223                 :            :     //R CubitStatus
     224                 :            :     //R- CUBIT_SUCCESS/FAILURE
     225                 :            :     //I u_value
     226                 :            :     //I- The input u parameter value
     227                 :            :     //O output_position
     228                 :            :     //O- The output position
     229                 :            :     //- This function returns the coordinates of a point in the global
     230                 :            :     //- (world) space that corresponds to the input parametric position 
     231                 :            :     //- in the local space.
     232                 :            :     //-
     233                 :            :     //- If the input parameter value is not defined for the Curve, then 
     234                 :            :     //- the input CubitVector is not modified and CUBIT_FAILURE is
     235                 :            :     //- returned. Otherwise, position is appropriately modified and
     236                 :            :     //- CUBIT_SUCCESS is returned.
     237                 :            :     //-
     238                 :            :     //- If the curve is periodic, the input u_value is first "normalized"
     239                 :            :     //- to the fundamental period of the Curve before its position
     240                 :            :     //- in global space is determined.
     241                 :            :   
     242                 :            :   double u_from_position (const CubitVector& input_position);
     243                 :            :   
     244                 :            :   virtual double u_from_arc_length ( double root_param,
     245                 :            :                                      double arc_length );
     246                 :            :     //R double
     247                 :            :     //R- Returned parameter value
     248                 :            :     //I root_param
     249                 :            :     //I- The parameter value of the "root point"
     250                 :            :     //I arc_length
     251                 :            :     //I- A distance along the Curve
     252                 :            :     //- This function returns the parameter value of the point that is
     253                 :            :     //- "arc_length" away from the root point in the
     254                 :            :     //- positive sense direction of the owning RefEdge.
     255                 :            :     //-
     256                 :            :     //- If arc_length is negative, the new point (whose parameter value is
     257                 :            :     //- being computed) is in the negative sense direction (along the 
     258                 :            :     //- RefEdge) from the root point (whose parameter value is root_param).
     259                 :            :   
     260                 :            :   virtual CubitBoolean is_position_on( const CubitVector &test_position );
     261                 :            :     //R CubitBoolean
     262                 :            :     //R- CUBIT_TRUE/CUBIT_FALSE
     263                 :            :     //I CubitVector
     264                 :            :     //I- position, point where we want to test, whether or not it
     265                 :            :     //- is on the curve.
     266                 :            :   
     267                 :            :   GeometryType geometry_type();
     268                 :            :     //R GeometryType (enum)
     269                 :            :     //R- The enumerated type of the geometric representation
     270                 :            :   
     271                 :            :   CubitStatus get_point_direction( CubitVector& origin, CubitVector& direction );
     272                 :            :   //- Only valid for straight lines
     273                 :            :   //- Finds the underlying line's origin and direction unit vector
     274                 :            :   //- Returns CUBIT_FAILURE if curve is not a line
     275                 :            : 
     276                 :            :   CubitStatus get_center_radius( CubitVector& center, double& radius );
     277                 :            :   //- Only valid for arcs
     278                 :            :   //- Finds the underlying arc's center point and radius
     279                 :            :   //- Returns CUBIT_FAILURE if curve is not an arc
     280                 :            : 
     281                 :            :   virtual double start_param();
     282                 :            :     //R double parameter
     283                 :            :     //R- start parameter of curve with respect to refEdge.
     284                 :            :   
     285                 :            :   virtual double end_param();
     286                 :            :     //R double parameter
     287                 :            :     //R- start parameter of curve with respect to refEdge.
     288                 :            :     
     289                 :            :   virtual CubitBoolean G1_discontinuous( double param,
     290                 :            :                                          CubitVector* minus_tangent = NULL,
     291                 :            :                                          CubitVector* plus_tangent = NULL );
     292                 :            :   
     293                 :            :   virtual CubitPointContainment point_containment( const CubitVector &point );
     294                 :            :   virtual CubitPointContainment point_containment( double u, double v );
     295                 :            :   virtual CubitPointContainment point_containment( CubitVector &point, 
     296                 :            :                                                    double u, double v );
     297                 :            :     //R CubitPointContainment - is the point outside, inside or on the boundary?
     298                 :            :     //R- CUBIT_PNT_OUTSIDE, CUBIT_PNT_INSIDE, CUBIT_PNT_BOUNDARY, 
     299                 :            :     //   CUBIT_PNT_UNKNOWN
     300                 :            :     //I CubitVector
     301                 :            :     //I- position to check, known to be on the Surface
     302                 :            :     //I double
     303                 :            :     //I- u coordinate, if known (significantly faster, if this is known - however
     304                 :            :     //                           if not known let the function figure it out)
     305                 :            :     //I double
     306                 :            :     //I- v coordinate, if known (significantly faster, if this is known - however
     307                 :            :     //                           if not known let the function figure it out)
     308                 :            :     // NOTE: POINT MUST LIE ON THE SURFACE FOR THIS FUNCTION TO WORK PROPERLY.
     309                 :            : 
     310                 :            :   CubitStatus save_attribs( FILE* file_ptr );
     311                 :            :     // Write FactAttribs out to file
     312                 :            : 
     313                 :            :   CubitStatus restore_attribs( FILE* file_ptr, unsigned int endian );
     314                 :            :     // Read FactAttribs from file
     315                 :            :   
     316                 :            :   void get_lumps   ( DLIList<FacetLump   *>& lumps    );
     317                 :            :   void get_shells  ( DLIList<FacetShell  *>& shells   );
     318                 :            :   void get_surfaces( DLIList<FacetSurface*>& surfaces );
     319                 :            :   void get_loops   ( DLIList<FacetLoop   *>& loops    );
     320                 :            :   void get_coedges ( DLIList<FacetCoEdge *>& coedges  );
     321                 :            :   void get_points  ( DLIList<FacetPoint  *>& points   );
     322                 :            : 
     323                 :            :   void get_parents_virt( DLIList<TopologyBridge*>& parents );
     324                 :            :   void get_children_virt( DLIList<TopologyBridge*>& children );
     325                 :            : 
     326                 :       1650 :   void add_coedge( CoEdgeSM *coedge_ptr )
     327                 :       1650 :     { myCoEdges.append_unique( coedge_ptr ); }
     328                 :            :     //- associate this curve with a coedge
     329                 :            : 
     330                 :            :   void get_facets(DLIList<CubitFacetEdge*>& facet_list);
     331                 :            :     //- Gets the list of facets describing this curve.
     332                 :            :   void get_points(DLIList<CubitPoint*>& point_list);
     333                 :            :     //- Gets the list of points describing this curve.
     334                 :            : 
     335                 :            :   void reset_length();
     336                 :            :     //- update the length of the facet curve
     337                 :            : 
     338                 :       2046 :   CurveFacetEvalTool *get_eval_tool()
     339                 :       2046 :     { return curveFacetEvalTool; }
     340                 :            :     //- return the curve evaluation tool
     341                 :            : 
     342                 :          0 :   void set_eval_tool( CurveFacetEvalTool *eval_tool)
     343                 :          0 :     { curveFacetEvalTool = eval_tool; } 
     344                 :            :     //- set the curve evaluation tool
     345                 :            : 
     346                 :        594 :   TBPoint *start_point()
     347                 :        594 :     { return myStartPoint; }
     348                 :        594 :   TBPoint *end_point()
     349                 :        594 :     { return myEndPoint; }
     350                 :       1848 :   CubitSense get_sense() { return sense_; }
     351                 :            : 
     352                 :            :   CubitStatus disconnect_coedge( FacetCoEdge* coedge );
     353                 :            :   
     354                 :          0 :   void remove_start_point() { myStartPoint = 0; }
     355                 :          0 :   void remove_end_point() { myEndPoint = 0; }
     356                 :            :   
     357                 :          0 :   bool has_parent_coedge() { return myCoEdges.size() > 0; }
     358                 :            : 
     359                 :            :   //R CubitStatus
     360                 :            :   //O- true or false if spline is rational or not.
     361                 :            :   //O- the degree of this spline
     362                 :            :   //O- the control points
     363                 :            :   //O- If rational, weight for each control point
     364                 :            :   //O- the knots
     365                 :            :   //O- whether underlying spline is reversed
     366                 :            :   virtual CubitStatus get_spline_params( bool &rational,
     367                 :            :                                          int &degree,
     368                 :            :                                          DLIList<CubitVector> &cntrl_pts,
     369                 :            :                                          DLIList<double> &cntrl_pt_weights,
     370                 :            :                                          DLIList<double> &knots,
     371                 :            :                                          bool &spline_is_reversed
     372                 :            :                                        ) const;
     373                 :            :   //R CubitStatus
     374                 :            :   //O- center - ellipse center point
     375                 :            :   //O- normal - normal of the plane of the ellipse
     376                 :            :   //O- major_axis - major axis of the ellipse
     377                 :            :   //O- radius_ratio - ratio of the length of the major to minor axis.
     378                 :            :   virtual CubitStatus get_ellipse_params( CubitVector &center,
     379                 :            :                                           CubitVector &normal,
     380                 :            :                                           CubitVector &major_axis,
     381                 :            :                                           double &radius_ratio ) const;
     382                 :            : 
     383                 :            :   int id() {return myId;}
     384                 :            : 
     385                 :            : protected: 
     386                 :            :   
     387                 :            : private:
     388                 :            :   
     389                 :            :   CubitSense get_relative_curve_sense();
     390                 :            :     //R CubitSense
     391                 :            :     //R- Returned sense value
     392                 :            :     //- Returns the sense of the RefEdge with respect to the underlying
     393                 :            :     //- facet curve.
     394                 :            :   
     395                 :            :   void adjust_periodic_parameter(double& param);
     396                 :            :   
     397                 :            :   CubitSense sense_;
     398                 :            :     //- The sense of the RefEdge that owns this Curve with respect
     399                 :            :     //- to the positive sense of the first EDGE in EDGEPtrList_.
     400                 :            :     //- When a Curve is first constructed, this value is arbitrarily
     401                 :            :     //- set to CUBIT_FORWARD.
     402                 :            :     //- MJP NOTE:
     403                 :            :     //- Not only does the RefEdge have a sense wrt its Curve, but each
     404                 :            :     //-  EDGE has a sense wrt its underlying "curve" object.
     405                 :            :   
     406                 :            :   FacetAttribSet attribSet;
     407                 :            :     //List of FacetAttrib*'s instead of CubitSimpleAttribs 
     408                 :            :   
     409                 :            :   friend void run_test_function();
     410                 :            : 
     411                 :            :   CurveFacetEvalTool *curveFacetEvalTool;
     412                 :            :   TBPoint *myStartPoint;
     413                 :            :   TBPoint *myEndPoint;
     414                 :            :   DLIList<CoEdgeSM*> myCoEdges;
     415                 :            :   int myId;
     416                 :            :   bool periodic;
     417                 :            : };
     418                 :            : 
     419                 :            : // ********** BEGIN INLINE FUNCTIONS       **********
     420                 :            : // ********** END INLINE FUNCTIONS         **********
     421                 :            : 
     422                 :            : // ********** BEGIN FRIEND FUNCTIONS       **********
     423                 :            : // ********** END FRIEND FUNCTIONS         **********
     424                 :            : 
     425                 :            : // ********** BEGIN EXTERN FUNCTIONS       **********
     426                 :            : // ********** END EXTERN FUNCTIONS         **********
     427                 :            : 
     428                 :            : #endif
     429                 :            : 

Generated by: LCOV version 1.11