cgma
|
#include <SubSurface.hpp>
Public Member Functions | |
SubSurface (Surface *real_surf) | |
CubitStatus | combine (PartitionSurface *dead_surface) |
virtual | ~SubSurface () |
Surface * | partitioned_surface () const |
virtual CubitStatus | save (CubitSimpleAttrib &) |
double | measure () |
GeometryType | geometry_type () |
CubitStatus | get_point_normal (CubitVector &point, CubitVector &normal) |
virtual CubitStatus | closest_point_uv_guess (CubitVector const &location, double &u, double &v, CubitVector *closest_location=NULL, CubitVector *unit_normal=NULL) |
virtual CubitStatus | evaluate (double u, double v, CubitVector *position, CubitVector *unit_normal, CubitVector *curvature1, CubitVector *curvature2) |
CubitStatus | closest_point (CubitVector const &pos, CubitVector *close=0, CubitVector *norm=0, CubitVector *curv1=0, CubitVector *curv2=0) |
void | closest_point_trimmed (CubitVector from, CubitVector &result) |
CubitStatus | closest_point_along_vector (CubitVector &from_point, CubitVector &along_vector, CubitVector &point_on_surface) |
CubitStatus | principal_curvatures (CubitVector const &loc, double &curv1, double &curv2, CubitVector *closest_location=0) |
CubitVector | position_from_u_v (double u, double v) |
CubitStatus | u_v_from_position (CubitVector const &location, double &u, double &v, CubitVector *closest_location=NULL) |
CubitBoolean | is_periodic () |
CubitBoolean | is_periodic_in_U (double &period) |
CubitBoolean | is_periodic_in_V (double &period) |
CubitBoolean | is_singular_in_U (double u_param) |
CubitBoolean | is_singular_in_V (double v_param) |
CubitBoolean | is_closed_in_U () |
CubitBoolean | is_closed_in_V () |
CubitStatus | uv_derivitives (double u, double v, CubitVector &du, CubitVector &dv) |
CubitBoolean | is_parametric () |
CubitBoolean | get_param_range_U (double &lo, double &hi) |
CubitBoolean | get_param_range_V (double &lo, double &hi) |
CubitBoolean | is_position_on (CubitVector &test_position) |
CubitSense | get_geometry_sense () |
CubitStatus | get_sphere_params (CubitVector ¢er, double &radius) const |
CubitStatus | get_cone_params (CubitVector ¢er, CubitVector &normal, CubitVector &major_axis, double &radius_ratio, double &sine_angle, double &cos_angle) const |
virtual CubitStatus | get_torus_params (CubitVector ¢er, CubitVector &normal, double &major_radius, double &minor_radius) const |
virtual CubitStatus | get_nurb_params (bool &rational, int °ree_u, int °ree_v, int &num_cntrl_pts_u, int &num_cntrl_pts_v, DLIList< CubitVector > &cntrl_pts, DLIList< double > &weights, DLIList< double > &u_knots, DLIList< double > &v_knots) const |
void | reverse_sense () |
Protected Member Functions | |
virtual PartitionSurface * | copy () |
Private Member Functions | |
SubSurface (SubSurface *split_from) |
Definition at line 18 of file SubSurface.hpp.
SubSurface::SubSurface | ( | Surface * | real_surf | ) |
Definition at line 32 of file SubSurface.cpp.
{ assert( dynamic_cast<SubEntitySet*>(real_surf->owner()) == 0 ); new SubEntitySet( real_surf, this ); // ensure that the sense is the same on both entities //if( real_surf->bridge_sense() != this->bridge_sense() ) // reverse_bridge_sense(); geometry_sense = CUBIT_FORWARD; }
SubSurface::~SubSurface | ( | ) | [virtual] |
Definition at line 64 of file SubSurface.cpp.
{ }
SubSurface::SubSurface | ( | SubSurface * | split_from | ) | [private] |
Definition at line 44 of file SubSurface.cpp.
{ split_from->sub_entity_set().add_partition( this ); geometry_sense = CUBIT_FORWARD; }
CubitStatus SubSurface::closest_point | ( | CubitVector const & | pos, |
CubitVector * | close = 0 , |
||
CubitVector * | norm = 0 , |
||
CubitVector * | curv1 = 0 , |
||
CubitVector * | curv2 = 0 |
||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 133 of file SubSurface.cpp.
{ CubitStatus ret = partitioned_surface()->closest_point( a, b, c, d, e ); if(c && geometry_sense == CUBIT_REVERSED) *c = -(*c); return ret; }
CubitStatus SubSurface::closest_point_along_vector | ( | CubitVector & | from_point, |
CubitVector & | along_vector, | ||
CubitVector & | point_on_surface | ||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 174 of file SubSurface.cpp.
{ return partitioned_surface()->closest_point_along_vector( from_point, along_vector, point_on_surface ); }
void SubSurface::closest_point_trimmed | ( | CubitVector | from, |
CubitVector & | result | ||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 156 of file SubSurface.cpp.
{ PartitionCurve* curve = 0; if ( point_containment( from, curve ) == CUBIT_PNT_INSIDE ) partitioned_surface()->closest_point( from, &result ); else curve->closest_point_trimmed( from, result ); }
CubitStatus SubSurface::closest_point_uv_guess | ( | CubitVector const & | location, |
double & | u, | ||
double & | v, | ||
CubitVector * | closest_location = NULL , |
||
CubitVector * | unit_normal = NULL |
||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 108 of file SubSurface.cpp.
{ CubitStatus ret = partitioned_surface()-> closest_point_uv_guess(location, u, v, closest_location, unit_normal); if(unit_normal && geometry_sense == CUBIT_REVERSED) *unit_normal = -(*unit_normal); return ret; }
CubitStatus SubSurface::combine | ( | PartitionSurface * | dead_surface | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 396 of file SubSurface.cpp.
{ SubSurface* dead = dynamic_cast<SubSurface*>(dead_surface ); if( !dead ) { assert(0); return CUBIT_FAILURE; } return PartitionSurface::combine(dead_surface); }
PartitionSurface * SubSurface::copy | ( | ) | [protected, virtual] |
Reimplemented from PartitionSurface.
Definition at line 50 of file SubSurface.cpp.
{ return new SubSurface(this); }
CubitStatus SubSurface::evaluate | ( | double | u, |
double | v, | ||
CubitVector * | position, | ||
CubitVector * | unit_normal, | ||
CubitVector * | curvature1, | ||
CubitVector * | curvature2 | ||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 448 of file SubSurface.cpp.
{ CubitStatus ret = partitioned_surface()->evaluate(u, v, position, unit_normal, curvature1, curvature2 ); if(unit_normal && geometry_sense == CUBIT_REVERSED) *unit_normal = -(*unit_normal); return ret; }
GeometryType SubSurface::geometry_type | ( | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 100 of file SubSurface.cpp.
{ return partitioned_surface()->geometry_type(); }
CubitStatus SubSurface::get_cone_params | ( | CubitVector & | center, |
CubitVector & | normal, | ||
CubitVector & | major_axis, | ||
double & | radius_ratio, | ||
double & | sine_angle, | ||
double & | cos_angle | ||
) | const [virtual] |
Reimplemented from PartitionSurface.
Definition at line 473 of file SubSurface.cpp.
{ PRINT_ERROR("Currently, Cubit is unable to determine cone parameters for SubSurfaces.\n"); return CUBIT_FAILURE; }
CubitSense SubSurface::get_geometry_sense | ( | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 408 of file SubSurface.cpp.
{ /* #ifdef ALPHA_TREADSWEEP return geometry_sense; #else */ return CUBIT_FORWARD; /* #endif */ }
CubitStatus SubSurface::get_nurb_params | ( | bool & | rational, |
int & | degree_u, | ||
int & | degree_v, | ||
int & | num_cntrl_pts_u, | ||
int & | num_cntrl_pts_v, | ||
DLIList< CubitVector > & | cntrl_pts, | ||
DLIList< double > & | weights, | ||
DLIList< double > & | u_knots, | ||
DLIList< double > & | v_knots | ||
) | const [virtual] |
Reimplemented from PartitionSurface.
Definition at line 499 of file SubSurface.cpp.
{ PRINT_ERROR("Currently, Cubit is unable to determine nurbs parameters for SubSurface.\n"); return CUBIT_FAILURE; }
CubitBoolean SubSurface::get_param_range_U | ( | double & | lo, |
double & | hi | ||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 376 of file SubSurface.cpp.
{ return partitioned_surface()->get_param_range_U(lower,upper); }
CubitBoolean SubSurface::get_param_range_V | ( | double & | lo, |
double & | hi | ||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 378 of file SubSurface.cpp.
{ return partitioned_surface()->get_param_range_V(lower,upper); }
CubitStatus SubSurface::get_point_normal | ( | CubitVector & | point, |
CubitVector & | normal | ||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 104 of file SubSurface.cpp.
{ return partitioned_surface()->get_point_normal( origin, normal ); }
CubitStatus SubSurface::get_sphere_params | ( | CubitVector & | center, |
double & | radius | ||
) | const [virtual] |
Reimplemented from PartitionSurface.
Definition at line 463 of file SubSurface.cpp.
{ PRINT_ERROR("Currently, Cubit is unable to determine sphere parameters for a SubSurface.\n"); return CUBIT_FAILURE; }
CubitStatus SubSurface::get_torus_params | ( | CubitVector & | center, |
CubitVector & | normal, | ||
double & | major_radius, | ||
double & | minor_radius | ||
) | const [virtual] |
Reimplemented from PartitionSurface.
Definition at line 487 of file SubSurface.cpp.
{ PRINT_ERROR("Currently, Cubit is unable to determine torus parameters for SubSurface.\n"); return CUBIT_FAILURE; }
CubitBoolean SubSurface::is_closed_in_U | ( | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 337 of file SubSurface.cpp.
{ return CUBIT_FALSE; }
CubitBoolean SubSurface::is_closed_in_V | ( | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 339 of file SubSurface.cpp.
{ return CUBIT_FALSE; }
CubitBoolean SubSurface::is_parametric | ( | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 364 of file SubSurface.cpp.
{ return partitioned_surface()->is_parametric(); }
CubitBoolean SubSurface::is_periodic | ( | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 232 of file SubSurface.cpp.
{ double u_period = 0.0, v_period = 0.0; bool u_periodic = is_periodic_in_U(u_period); bool v_periodic = is_periodic_in_V(v_period); if( !u_periodic && !v_periodic ) return CUBIT_FALSE; if ( !next_loop(0) ) // sphere return CUBIT_TRUE; if( u_period < 0.0 ) u_period = -u_period; if( v_period < 0.0 ) v_period = -v_period; // If a single step exceeds this delta of the parameter // range, assume the step crossed the "international date // line" of the parameterization. Could probably safely // use a smaller value. double u_wrap = 0.75 * u_period; double v_wrap = 0.75 * v_period; int num_periodic_loops = 0; std::vector<CubitVector> loop_polyline; PartitionLoop* loop = 0; while( (loop = next_loop(loop) ) != NULL ) { // Get a polyline representation of the loop VGLoopTool<PartitionSurface,PartitionLoop,PartitionCoEdge,PartitionCurve,PartitionPoint> ::get_loop_polyline( loop->first_coedge(), loop_polyline ); if ( loop_polyline.size() < 2 ) continue; // Sum steps (in parameter space) between points in polyline std::vector<CubitVector>::iterator itor = loop_polyline.begin(), end = loop_polyline.end(); double u_sum = 0, v_sum = 0; double u_prev, v_prev; u_v_from_position( loop_polyline[loop_polyline.size()-1], u_prev, v_prev ); for ( ; itor != end; ++itor ) { double u, v; u_v_from_position( *itor, u, v ); double u_step = u - u_prev; if ( u_step > u_wrap ) u_step = u_period - u_step; else if ( u_step < -u_wrap ) u_step = -u_period - u_step; double v_step = v - v_prev; if ( v_step > v_wrap ) v_step = v_period - v_step; else if ( v_step < -v_wrap ) v_step = -v_period - v_step; u_sum += u_step; v_sum += v_step; u_prev = u; v_prev = v; } // Sum should be either zero or +/-period if loop // is non-periodic or periodic respectively. if ( (u_periodic && fabs(u_sum) > 0.5*u_period) || (v_periodic && fabs(v_sum) > 0.5*v_period) ) num_periodic_loops++; } return CubitBoolean(num_periodic_loops > 0); }
CubitBoolean SubSurface::is_periodic_in_U | ( | double & | period | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 309 of file SubSurface.cpp.
{ return partitioned_surface()->is_periodic_in_U(period); }
CubitBoolean SubSurface::is_periodic_in_V | ( | double & | period | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 311 of file SubSurface.cpp.
{ return partitioned_surface()->is_periodic_in_V(period); }
CubitBoolean SubSurface::is_position_on | ( | CubitVector & | test_position | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 391 of file SubSurface.cpp.
{ return partitioned_surface()->is_position_on( position ); }
CubitBoolean SubSurface::is_singular_in_U | ( | double | u_param | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 323 of file SubSurface.cpp.
{ return partitioned_surface()->is_singular_in_U(u_param); }
CubitBoolean SubSurface::is_singular_in_V | ( | double | v_param | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 325 of file SubSurface.cpp.
{ return partitioned_surface()->is_singular_in_V(v_param); }
double SubSurface::measure | ( | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 91 of file SubSurface.cpp.
{ if( ! sub_entity_set().has_multiple_sub_entities() ) return partitioned_surface()->measure(); else return PartitionSurface::measure(); }
Surface * SubSurface::partitioned_surface | ( | ) | const [inline] |
Definition at line 181 of file SubSurface.hpp.
{ return dynamic_cast<Surface*>(partitioned_entity()); }
CubitVector SubSurface::position_from_u_v | ( | double | u, |
double | v | ||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 206 of file SubSurface.cpp.
{ return partitioned_surface()->position_from_u_v( u, v ); }
CubitStatus SubSurface::principal_curvatures | ( | CubitVector const & | loc, |
double & | curv1, | ||
double & | curv2, | ||
CubitVector * | closest_location = 0 |
||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 191 of file SubSurface.cpp.
{ return partitioned_surface()->principal_curvatures(a,b,c,d); }
void SubSurface::reverse_sense | ( | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 421 of file SubSurface.cpp.
{ reverse_loops(); if( owner() ) owner()->notify_reversed(this); if(geometry_sense == CUBIT_FORWARD) geometry_sense = CUBIT_REVERSED; else geometry_sense = CUBIT_FORWARD; int j; DLIList<CubitFacetData*> surf_facets; this->get_facet_data( surf_facets ); for(j=surf_facets.size(); j--;) surf_facets.get_and_step()->flip(); }
CubitStatus SubSurface::save | ( | CubitSimpleAttrib & | attrib | ) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 439 of file SubSurface.cpp.
{ DLIList<int> curves; get_save_topology(curves); int id = sub_entity_set().get_id(this); return sub_entity_set().save_geometry( id, 2, 0, 0, &curves, 0, attrib ); }
CubitStatus SubSurface::u_v_from_position | ( | CubitVector const & | location, |
double & | u, | ||
double & | v, | ||
CubitVector * | closest_location = NULL |
||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 218 of file SubSurface.cpp.
{ return partitioned_surface()->u_v_from_position(location,u,v,closest); }
CubitStatus SubSurface::uv_derivitives | ( | double | u, |
double | v, | ||
CubitVector & | du, | ||
CubitVector & | dv | ||
) | [virtual] |
Reimplemented from PartitionSurface.
Definition at line 351 of file SubSurface.cpp.
{ return partitioned_surface()->uv_derivitives(u,v,du,dv); }