cgma
|
#include <FacetCurve.hpp>
Definition at line 48 of file FacetCurve.hpp.
FacetCurve::FacetCurve | ( | CurveFacetEvalTool * | curve_facet_tool, |
TBPoint * | fp0, | ||
TBPoint * | fp1, | ||
DLIList< CoEdgeSM * > & | coedgelist | ||
) |
Definition at line 61 of file FacetCurve.cpp.
: sense_(CUBIT_FORWARD) { static int counter = 0; myId = counter++; // Calculate a bounding box if there isn't one already curveFacetEvalTool = curve_facet_tool; myStartPoint = start_ptr; myEndPoint = end_ptr; myCoEdges += coedge_list; periodic = start_ptr == end_ptr; }
FacetCurve::FacetCurve | ( | CurveFacetEvalTool * | curve_facet_tool, |
TBPoint * | fp0, | ||
TBPoint * | fp1, | ||
CubitSense | sense | ||
) |
Definition at line 85 of file FacetCurve.cpp.
{ static int counter = 0; myId = counter++; // Calculate a bounding box if there isn't one already curveFacetEvalTool = curve_facet_tool; myStartPoint = start_ptr; myEndPoint = end_ptr; periodic = start_ptr == end_ptr; sense_ = sense; }
FacetCurve::~FacetCurve | ( | ) | [virtual] |
Definition at line 107 of file FacetCurve.cpp.
{ if(this->curveFacetEvalTool) delete this->curveFacetEvalTool; }
void FacetCurve::add_coedge | ( | CoEdgeSM * | coedge_ptr | ) | [inline] |
Definition at line 326 of file FacetCurve.hpp.
{ myCoEdges.append_unique( coedge_ptr ); }
void FacetCurve::adjust_periodic_parameter | ( | double & | param | ) | [private] |
Definition at line 933 of file FacetCurve.cpp.
{ // Adjustment only legal if this is a periodic curve. double period; if ( this->is_periodic(period) && (fabs(period) > CUBIT_RESABS)) { double upper_bound, lower_bound; this->get_param_range( lower_bound, upper_bound ); assert((upper_bound - lower_bound) > CUBIT_RESABS * 100); lower_bound -= CUBIT_RESABS; upper_bound += CUBIT_RESABS; // Make sure period is positive if (period < 0.) period = -period; // Move the parameter above the low param while (param < lower_bound) param += period; // Move the parameter below the high param while (param > upper_bound) param -= period; } }
void FacetCurve::append_simple_attribute_virt | ( | const CubitSimpleAttrib & | csa | ) | [virtual] |
Implements TopologyBridge.
Definition at line 126 of file FacetCurve.cpp.
{ attribSet.append_attribute(csa); }
CubitBox FacetCurve::bounding_box | ( | void | ) | const [virtual] |
Implements GeometryEntity.
Definition at line 209 of file FacetCurve.cpp.
{ return curveFacetEvalTool->bounding_box(); }
CubitStatus FacetCurve::closest_point | ( | CubitVector const & | location, |
CubitVector & | closest_location, | ||
CubitVector * | tangent_ptr = NULL , |
||
CubitVector * | curvature_ptr = NULL , |
||
double * | param = NULL |
||
) | [virtual] |
Implements Curve.
Definition at line 376 of file FacetCurve.cpp.
{ // Only the closest point is required if (tangent_ptr == NULL && curvature_ptr == NULL) { CubitVector temp = location; curveFacetEvalTool->closest_point( temp, closest_location, NULL, NULL, param ); } // The closest point and the tangent are required else if (tangent_ptr != NULL && curvature_ptr == NULL) { CubitVector temp = location; curveFacetEvalTool->closest_point( temp, closest_location, tangent_ptr, NULL, param ); } // Everything is required // NOTE: If the curvature is required but not the tangent, the tangent, // too, will be computed. else { CubitVector temp = location; curveFacetEvalTool->closest_point( temp, closest_location, tangent_ptr, curvature_ptr, param ); } if (tangent_ptr != NULL) { if (sense_ == CUBIT_REVERSED) *tangent_ptr = -(*tangent_ptr); } // Set the curvature, if necessary if (curvature_ptr != NULL) { // get the sense wrt the curve, consists of 2 sense values if (sense_ == CUBIT_REVERSED) *curvature_ptr = -(*curvature_ptr); } if (param != NULL) { adjust_periodic_parameter(*param); } return CUBIT_SUCCESS; }
CubitStatus FacetCurve::disconnect_coedge | ( | FacetCoEdge * | coedge | ) |
Definition at line 983 of file FacetCurve.cpp.
{ if (!myCoEdges.move_to(coedge)) return CUBIT_FAILURE; myCoEdges.remove(); assert(coedge->curve() == this); coedge->remove_curve(); return CUBIT_SUCCESS; }
double FacetCurve::end_param | ( | ) | [virtual] |
Implements Curve.
Definition at line 652 of file FacetCurve.cpp.
{ double start = 0.0, end = 0.0; get_param_range( start, end ); return end; }
TBPoint* FacetCurve::end_point | ( | ) | [inline] |
Definition at line 348 of file FacetCurve.hpp.
{ return myEndPoint; }
CubitBoolean FacetCurve::G1_discontinuous | ( | double | param, |
CubitVector * | minus_tangent = NULL , |
||
CubitVector * | plus_tangent = NULL |
||
) | [virtual] |
Reimplemented from Curve.
Definition at line 750 of file FacetCurve.cpp.
{ DLIList<CubitPoint*> point_list; curveFacetEvalTool->get_points( point_list ); CubitVector position; position_from_u( param, position ); point_list.reset(); CubitPoint* prev = point_list.get_and_step(); for( int i = point_list.size(); i > 2; i--) { CubitPoint* point = point_list.get_and_step(); if( (point->coordinates() - position).length_squared() < (GEOMETRY_RESABS*GEOMETRY_RESABS) ) { if( mtan ) { *mtan = point->coordinates() - prev->coordinates(); } if( ptan ) { *ptan = point_list.get()->coordinates() - point->coordinates(); } return CUBIT_TRUE; } } return CUBIT_FALSE; }
GeometryType FacetCurve::geometry_type | ( | ) | [virtual] |
Reimplemented from Curve.
Definition at line 587 of file FacetCurve.cpp.
{ return SEGMENTED_CURVE_TYPE; }
CubitStatus FacetCurve::get_center_radius | ( | CubitVector & | center, |
double & | radius | ||
) | [virtual] |
Implements Curve.
Definition at line 619 of file FacetCurve.cpp.
{ PRINT_DEBUG_122("FacetCurve::get_center_radius currently not implemented.\n"); return CUBIT_FAILURE; }
void FacetCurve::get_children_virt | ( | DLIList< TopologyBridge * > & | children | ) | [virtual] |
Implements TopologyBridge.
Definition at line 731 of file FacetCurve.cpp.
{ children.append( myStartPoint ); if( myStartPoint != myEndPoint ) children.append( myEndPoint ); }
void FacetCurve::get_coedges | ( | DLIList< FacetCoEdge * > & | coedges | ) |
Definition at line 901 of file FacetCurve.cpp.
CubitStatus FacetCurve::get_ellipse_params | ( | CubitVector & | center, |
CubitVector & | normal, | ||
CubitVector & | major_axis, | ||
double & | radius_ratio | ||
) | const [virtual] |
Implements Curve.
Definition at line 1010 of file FacetCurve.cpp.
{ PRINT_ERROR("Currently, Cubit is unable to determine ellipse parameters for FacetCurves.\n"); return CUBIT_FAILURE; }
CurveFacetEvalTool* FacetCurve::get_eval_tool | ( | ) | [inline] |
Definition at line 338 of file FacetCurve.hpp.
{ return curveFacetEvalTool; }
void FacetCurve::get_facets | ( | DLIList< CubitFacetEdge * > & | facet_list | ) |
Definition at line 788 of file FacetCurve.cpp.
{ if (curveFacetEvalTool) { curveFacetEvalTool->get_facets(facet_list); } else { PRINT_ERROR("curve facet evaluation tool not defined for FacetCurve\n"); } }
GeometryQueryEngine * FacetCurve::get_geometry_query_engine | ( | ) | const [virtual] |
Implements TopologyBridge.
Definition at line 195 of file FacetCurve.cpp.
{ return FacetQueryEngine::instance(); }
CubitStatus FacetCurve::get_interior_extrema | ( | DLIList< CubitVector * > & | interior_points, |
CubitSense & | return_sense | ||
) | [virtual] |
Implements Curve.
Definition at line 306 of file FacetCurve.cpp.
{ // Need curveFacetEvalTool to get point list if( ! curveFacetEvalTool ) return CUBIT_FAILURE; // Get list of points defining this curve DLIList<CubitPoint*> point_list; get_points( point_list ); // If there are only 2 points, then the curve is a line and there // are no interior extrema if( point_list.size() < 3 ) return CUBIT_SUCCESS; // Return sense is whatever the sense of this curve is. return_sense = sense_; // Get a vector between the first two points point_list.reset(); CubitVector prev_pt = point_list.get_and_step()->coordinates(); CubitVector curr_pt = point_list.get_and_step()->coordinates(); CubitVector prev_vct = curr_pt - prev_pt; CubitVector next_vct; for( int i = point_list.size(); i > 2; i-- ) { // Get a vector between the next two points next_vct = point_list.get()->coordinates() - curr_pt; // In Curve::get_interior_extrema, the extrema seem to // be evaluated with respect to the principle axes, so do // the same here. The extrema are points at which the // derivitive in the specified direction (principle axis) // is zero. So look for a sign change in the slope across // a point wrt each principle direction. if( (prev_vct.x() * next_vct.x() < 0.) || // x extrema (prev_vct.y() * next_vct.y() < 0.) || // y extrema (prev_vct.z() * next_vct.z() < 0.) ) // z extrema interior_points.append( new CubitVector( curr_pt ) ); // Advance to next point. prev_vct = next_vct; curr_pt = point_list.get_and_step()->coordinates(); } return CUBIT_SUCCESS; }
void FacetCurve::get_loops | ( | DLIList< FacetLoop * > & | loops | ) |
Definition at line 887 of file FacetCurve.cpp.
{ DLIList<FacetCoEdge*> coedge_list; get_coedges( coedge_list ); coedge_list.reset(); for ( int i = coedge_list.size(); i--; ) { FacetCoEdge* coedge = coedge_list.get_and_step(); FacetLoop* loop = dynamic_cast<FacetLoop*>(coedge->get_loop()); if (loop) result_list.append_unique(loop); } }
void FacetCurve::get_lumps | ( | DLIList< FacetLump * > & | lumps | ) |
Definition at line 843 of file FacetCurve.cpp.
{ DLIList<FacetShell*> shell_list; get_shells( shell_list ); shell_list.reset(); for ( int i = shell_list.size(); i--; ) { FacetShell* shell = shell_list.get_and_step(); shell->get_lumps( result_list ); FacetLump* lump = dynamic_cast<FacetLump*>(shell->get_lump()); if (lump) result_list.append_unique(lump); } }
CubitBoolean FacetCurve::get_param_range | ( | double & | lower_bound, |
double & | upper_bound | ||
) | [virtual] |
Implements Curve.
Definition at line 287 of file FacetCurve.cpp.
{ lower_bound = 0.0; upper_bound = 1.0; return CUBIT_TRUE; }
void FacetCurve::get_parents_virt | ( | DLIList< TopologyBridge * > & | parents | ) | [virtual] |
Implements TopologyBridge.
Definition at line 729 of file FacetCurve.cpp.
{ CAST_LIST_TO_PARENT( myCoEdges, parents ); }
CubitStatus FacetCurve::get_point_direction | ( | CubitVector & | origin, |
CubitVector & | direction | ||
) | [virtual] |
Reimplemented from Curve.
Definition at line 601 of file FacetCurve.cpp.
{ point = point; direction = direction; PRINT_DEBUG_122("FacetCurve::get_point_direction currently not implemented.\n"); return CUBIT_FAILURE; }
void FacetCurve::get_points | ( | DLIList< FacetPoint * > & | points | ) |
Definition at line 909 of file FacetCurve.cpp.
{ FacetPoint* point; if ( (point = dynamic_cast<FacetPoint*>(myStartPoint)) ) result_list.append( point ); if ( (myStartPoint != myEndPoint) && (point = dynamic_cast<FacetPoint*>(myEndPoint)) ) result_list.append( point ); }
void FacetCurve::get_points | ( | DLIList< CubitPoint * > & | point_list | ) |
Definition at line 809 of file FacetCurve.cpp.
{ if (curveFacetEvalTool) { curveFacetEvalTool->get_points(point_list); } else { PRINT_ERROR("curve facet evaluation tool not defined for FacetCurve\n"); } }
CubitSense FacetCurve::get_relative_curve_sense | ( | ) | [private] |
CubitSense FacetCurve::get_sense | ( | ) | [inline] |
Definition at line 350 of file FacetCurve.hpp.
{ return sense_; }
void FacetCurve::get_shells | ( | DLIList< FacetShell * > & | shells | ) |
Definition at line 858 of file FacetCurve.cpp.
{ DLIList<FacetSurface*> surface_list; DLIList<FacetShell*> temp_list; get_surfaces( surface_list ); surface_list.reset(); for ( int i = surface_list.size(); i--; ) { FacetSurface* surface = surface_list.get_and_step(); temp_list.clean_out(); surface->get_shells( temp_list ); result_list.merge_unique( temp_list ); } }
CubitStatus FacetCurve::get_simple_attribute | ( | DLIList< CubitSimpleAttrib > & | csa_list | ) | [virtual] |
Implements TopologyBridge.
Definition at line 169 of file FacetCurve.cpp.
{ return attribSet.get_attributes(csa_list); }
CubitStatus FacetCurve::get_simple_attribute | ( | const CubitString & | name, |
DLIList< CubitSimpleAttrib > & | csa_list | ||
) | [virtual] |
Implements TopologyBridge.
Definition at line 173 of file FacetCurve.cpp.
{ return attribSet.get_attributes( name, csa_list ); }
CubitStatus FacetCurve::get_spline_params | ( | bool & | rational, |
int & | degree, | ||
DLIList< CubitVector > & | cntrl_pts, | ||
DLIList< double > & | cntrl_pt_weights, | ||
DLIList< double > & | knots, | ||
bool & | spline_is_reversed | ||
) | const [virtual] |
Implements Curve.
Definition at line 996 of file FacetCurve.cpp.
{ PRINT_ERROR("Currently, Cubit is unable to determine spline parameters for FacetCurves.\n"); return CUBIT_FAILURE; }
void FacetCurve::get_surfaces | ( | DLIList< FacetSurface * > & | surfaces | ) |
Definition at line 873 of file FacetCurve.cpp.
{ DLIList<FacetLoop*> loop_list; get_loops( loop_list ); loop_list.reset(); for ( int i = loop_list.size(); i--; ) { FacetLoop* loop = loop_list.get_and_step(); FacetSurface* surface = dynamic_cast<FacetSurface*>(loop->get_surface()); if (surface) result_list.append_unique(surface); } }
bool FacetCurve::has_parent_coedge | ( | ) | [inline] |
Definition at line 357 of file FacetCurve.hpp.
int FacetCurve::id | ( | void | ) | [inline] |
Definition at line 383 of file FacetCurve.hpp.
{return myId;}
CubitBoolean FacetCurve::is_periodic | ( | double & | period | ) | [virtual] |
Implements Curve.
Definition at line 265 of file FacetCurve.cpp.
{ if( periodic ) { period = 1.0; return CUBIT_TRUE; } return CUBIT_FALSE; }
CubitBoolean FacetCurve::is_position_on | ( | const CubitVector & | test_position | ) | [virtual] |
Implements Curve.
Definition at line 562 of file FacetCurve.cpp.
{ CubitVector new_point; CubitStatus stat = closest_point(test_position, new_point, NULL,NULL,NULL); if ( !stat ) return CUBIT_FALSE; CubitVector result_vec = test_position - new_point; if ( result_vec.length_squared() < GEOMETRY_RESABS ) return CUBIT_TRUE; return CUBIT_FALSE; }
double FacetCurve::length_from_u | ( | double | parameter1, |
double | parameter2 | ||
) | [virtual] |
Implements Curve.
Definition at line 240 of file FacetCurve.cpp.
{ //Don't perform the periodic adjustment so that // this function will satisfy the properties of // the function as defined in RefEdge.hpp. // Also, take the fabs of the arc length for the same reason. //if( periodic ) //{ // adjust_periodic_parameter( parameter1 ); // adjust_periodic_parameter( parameter2 ); //} return curveFacetEvalTool->length_from_u( parameter1, parameter2 ); }
double FacetCurve::measure | ( | ) | [virtual] |
Implements GeometryEntity.
Definition at line 224 of file FacetCurve.cpp.
{ return curveFacetEvalTool->length(); }
CubitPointContainment FacetCurve::point_containment | ( | const CubitVector & | point | ) | [virtual] |
CubitPointContainment FacetCurve::point_containment | ( | double | u, |
double | v | ||
) | [virtual] |
Definition at line 962 of file FacetCurve.cpp.
{ return CUBIT_PNT_UNKNOWN; }
CubitPointContainment FacetCurve::point_containment | ( | CubitVector & | point, |
double | u, | ||
double | v | ||
) | [virtual] |
Definition at line 967 of file FacetCurve.cpp.
{ return CUBIT_PNT_UNKNOWN; }
CubitStatus FacetCurve::position_from_u | ( | double | u_value, |
CubitVector & | output_position | ||
) | [virtual] |
Implements Curve.
Definition at line 441 of file FacetCurve.cpp.
{ CubitStatus status = CUBIT_SUCCESS; // Get the parameter range of this Curve double lower_bound, upper_bound; this->get_param_range( lower_bound, upper_bound ); double param_interval = upper_bound - lower_bound; // Make sure the requested u_value is either within the range or, if // the Curve is periodic, then reduce the input value down to the // fundamental range if (u_value > upper_bound || u_value < lower_bound) { adjust_periodic_parameter(u_value); } // Now that we have a "valid" parameter value, get its global location // on the Curve // Now we assume that the u_value is with respect to the // EDGE, we must switch it according the the EDGE->curve sense. if (sense_ == CUBIT_REVERSED) { u_value = -(u_value); } //now the u_value is with respect to curve so we are safe in //passing this parameter for evaluation on the curve. double fraction = (u_value - lower_bound) / param_interval; status = curveFacetEvalTool->position_from_fraction( fraction, output_position ); return status; }
void FacetCurve::remove_all_simple_attribute_virt | ( | ) | [virtual] |
Implements TopologyBridge.
Definition at line 155 of file FacetCurve.cpp.
{ attribSet.remove_all_attributes(); }
void FacetCurve::remove_end_point | ( | ) | [inline] |
Definition at line 355 of file FacetCurve.hpp.
{ myEndPoint = 0; }
void FacetCurve::remove_simple_attribute_virt | ( | const CubitSimpleAttrib & | csa | ) | [virtual] |
Implements TopologyBridge.
Definition at line 140 of file FacetCurve.cpp.
{ attribSet.remove_attribute(csa); }
void FacetCurve::remove_start_point | ( | ) | [inline] |
Definition at line 354 of file FacetCurve.hpp.
{ myStartPoint = 0; }
void FacetCurve::reset_length | ( | ) |
Definition at line 830 of file FacetCurve.cpp.
{ if (curveFacetEvalTool) { curveFacetEvalTool->set_length(); } else { PRINT_ERROR("curve facet evaluation tool not defined for FacetCurve\n"); } }
CubitStatus FacetCurve::restore_attribs | ( | FILE * | file_ptr, |
unsigned int | endian | ||
) |
Definition at line 181 of file FacetCurve.cpp.
{ return attribSet.restore_attributes(file_ptr, endian); }
CubitStatus FacetCurve::save_attribs | ( | FILE * | file_ptr | ) |
Definition at line 178 of file FacetCurve.cpp.
{ return attribSet.save_attributes(file_ptr); }
void FacetCurve::set_eval_tool | ( | CurveFacetEvalTool * | eval_tool | ) | [inline] |
Definition at line 342 of file FacetCurve.hpp.
{ curveFacetEvalTool = eval_tool; }
double FacetCurve::start_param | ( | ) | [virtual] |
Implements Curve.
Definition at line 635 of file FacetCurve.cpp.
{ double start = 0.0, end = 0.0; get_param_range( start, end ); return start; }
TBPoint* FacetCurve::start_point | ( | ) | [inline] |
Definition at line 346 of file FacetCurve.hpp.
{ return myStartPoint; }
double FacetCurve::u_from_arc_length | ( | double | root_param, |
double | arc_length | ||
) | [virtual] |
Implements Curve.
Definition at line 539 of file FacetCurve.cpp.
{ if (!curveFacetEvalTool) { PRINT_ERROR("curve facet evaluation tool not defined in FacetCurve::u_from_arc_length\n"); return 0.0; } return curveFacetEvalTool->u_from_arc_length( root_param, arc_length ); }
double FacetCurve::u_from_position | ( | const CubitVector & | input_position | ) | [virtual] |
Implements Curve.
Definition at line 492 of file FacetCurve.cpp.
{ // Get the closest point on the Curve to the input position CubitVector closest_point; double u_val; this->closest_point(input_position, closest_point, NULL, NULL, &u_val); // closest_point already makes adjustments for sense and periodicity return u_val; }
void run_test_function | ( | ) | [friend] |
FacetAttribSet FacetCurve::attribSet [private] |
Definition at line 406 of file FacetCurve.hpp.
CurveFacetEvalTool* FacetCurve::curveFacetEvalTool [private] |
Definition at line 411 of file FacetCurve.hpp.
DLIList<CoEdgeSM*> FacetCurve::myCoEdges [private] |
Definition at line 414 of file FacetCurve.hpp.
TBPoint* FacetCurve::myEndPoint [private] |
Definition at line 413 of file FacetCurve.hpp.
int FacetCurve::myId [private] |
Reimplemented from GeometryEntity.
Definition at line 415 of file FacetCurve.hpp.
TBPoint* FacetCurve::myStartPoint [private] |
Definition at line 412 of file FacetCurve.hpp.
bool FacetCurve::periodic [private] |
Definition at line 416 of file FacetCurve.hpp.
CubitSense FacetCurve::sense_ [private] |
Definition at line 397 of file FacetCurve.hpp.