cgma
CompositeSurface Class Reference

#include <CompositeSurface.hpp>

Inheritance diagram for CompositeSurface:
Surface TBOwner GeometryEntity TopologyBridge

List of all members.

Public Member Functions

 CompositeSurface (Surface *surf_ptr)
 CompositeSurface (CompositeGeom *geom_ptr)
virtual ~CompositeSurface ()
void get_ignored_surfs (DLIList< Surface * > &surfs)
int num_surfs () const
int index_of (Surface *surface) const
void update ()
Surfaceget_surface (int index) const
CubitSense get_sense (int index) const
Surfaceremove_surface (int index)
void ignore_surface (int surface_id)
void ignore_surface (Surface *surf)
void unignore_surface (int surface_id)
CompositeLoopfirst_loop () const
CompositeLoopnext_loop (CompositeLoop *after_this=0) const
CubitStatus add (CompositeLoop *loop)
CubitStatus remove (CompositeLoop *loop)
CubitStatus add (CompositeCoSurf *cosurf)
CubitStatus remove (CompositeCoSurf *cosurf)
CompositeCoSurfnext_co_surface (CompositeCoSurf *prev=0) const
CompositeCoSurffind_first (CompositeShell *shell) const
CompositeCoSurffind_first (CompositeLump *lump) const
CompositeCoSurffind_next (CompositeCoSurf *cosurf) const
void get_curves (DLIList< CompositeCurve * > &curves)
HiddenEntitySethidden_entities ()
bool has_hidden_entities () const
CompositeSurfacesplit (VGArray< int > &indices_to_move)
CubitStatus combine (CompositeSurface *dead_surface)
CubitStatus stitch (CompositeSurface *stitch_partner)
CompositeSurfaceunstitch ()
CompositeSurfaceget_stitch_partner () const
CubitBox bounding_box () const
double measure ()
GeometryQueryEngineget_geometry_query_engine () const
GeometryType geometry_type ()
CubitStatus remove_bridge (TopologyBridge *bridge)
CubitStatus swap_bridge (TopologyBridge *old_tb, TopologyBridge *new_tb, bool reversed)
CubitBoolean contains_bridge (TopologyBridge *bridge) const
void notify_reversed (TopologyBridge *bridge)
void notify_split (TopologyBridge *new_bridge, TopologyBridge *old_bridge)
void notify_topology_modified (TopologyBridge *bridge)
void append_simple_attribute_virt (const CubitSimpleAttrib &simple_attrib_ptr)
void remove_simple_attribute_virt (const CubitSimpleAttrib &simple_attrib_ptr)
void remove_all_simple_attribute_virt ()
CubitStatus get_simple_attribute (DLIList< CubitSimpleAttrib > &attrib_list)
CubitStatus get_simple_attribute (const CubitString &name, DLIList< CubitSimpleAttrib > &attrib_list)
void get_parents_virt (DLIList< TopologyBridge * > &parents)
void get_children_virt (DLIList< TopologyBridge * > &children)
int layer () const
virtual CubitSense get_shell_sense (ShellSM *shell_ptr) const
virtual void closest_point_trimmed (CubitVector from_point, CubitVector &result)
virtual CubitStatus get_point_normal (CubitVector &origin, 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 *normal, CubitVector *curvature1, CubitVector *curvature2)
virtual CubitStatus get_projected_distance_on_surface (CubitVector *pos1, CubitVector *pos2, double &distance)
virtual CubitStatus closest_point (CubitVector const &location, CubitVector *closest_location=NULL, CubitVector *unit_normal=NULL, CubitVector *curvature1=NULL, CubitVector *curvature2=NULL)
virtual CubitStatus closest_point_along_vector (CubitVector &from_point, CubitVector &along_vector, CubitVector &point_on_surface)
virtual CubitStatus principal_curvatures (CubitVector const &location, double &curvature_1, double &curvature_2, CubitVector *closest_location)
virtual CubitBoolean is_parametric ()
virtual CubitBoolean is_position_on (CubitVector &position)
virtual CubitPointContainment point_containment (const CubitVector &point)
virtual CubitPointContainment point_containment (double u, double v)
virtual CubitSense get_geometry_sense ()
virtual void reverse_sense ()
virtual CubitVector position_from_u_v (double u, double v)
virtual CubitStatus u_v_from_position (CubitVector const &position, double &u, double &v, CubitVector *closest_point)
virtual CubitBoolean is_periodic ()
virtual CubitBoolean is_periodic_in_U (double &period)
virtual CubitBoolean is_periodic_in_V (double &period)
virtual CubitBoolean is_singular_in_U (double u_value)
virtual CubitBoolean is_singular_in_V (double v_value)
virtual CubitBoolean is_closed_in_U ()
virtual CubitBoolean is_closed_in_V ()
virtual CubitStatus uv_derivitives (double u, double v, CubitVector &du, CubitVector &dv)
virtual CubitBoolean get_param_range_U (double &lower, double &upper)
virtual CubitBoolean get_param_range_V (double &lower, double &upper)
virtual CubitStatus get_sphere_params (CubitVector &center, double &radius) const
virtual CubitStatus get_cone_params (CubitVector &center, CubitVector &normal, CubitVector &major_axis, double &radius_ratio, double &sine_angle, double &cos_angle) const
virtual CubitStatus get_torus_params (CubitVector &center, CubitVector &normal, double &major_radius, double &minor_radius) const
virtual CubitStatus 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
void get_hidden_curves (DLIList< Curve * > &curves)
void print_debug_info (const char *line_prefix=0, bool brief=false)
int closest_underlying_surface (const CubitVector &position)
void read_attributes ()
void write_attributes ()
CubitStatus get_graphics (GMem &gmem)
void notify_transformed ()

Static Public Member Functions

static void print_cpt_stats ()
static void reset_cpt_stats ()

Protected Member Functions

void update_facet_tool ()
void update_facets_to_ignore ()
CubitStatus closest_trimmed (int underlying_surface, const CubitVector &position, CubitVector &result)
void update_modified (Surface *modified_surface, DLIList< CompositeCurve * > &new_curves)
void update_modified ()
bool is_dead_coedge (CompositeCoEdge *coedge)
void remove_dead_coedge (CompositeCoEdge *coedge)

Private Member Functions

CompositeSurfaceoperator= (const CompositeSurface &)
 CompositeSurface (const CompositeSurface &)

Private Attributes

int HadBridgeRemoved
DLIList< Surface * > surfacesToIgnore
CompositeGeomcompGeom
CompositeSurfacestitchPartner
CompositeCoSurffirstCoSurf
CompositeLoopfirstLoop
HiddenEntitySethiddenSet
CompSurfFacetsfacetTool

Friends

class CompositeEngine

Detailed Description

Definition at line 35 of file CompositeSurface.hpp.


Constructor & Destructor Documentation

Definition at line 43 of file CompositeSurface.cpp.

  : HadBridgeRemoved(0), stitchPartner(0), firstCoSurf(0), firstLoop(0), hiddenSet(0), facetTool(0)
{
  assert( surface != NULL );
  compGeom = new CompositeGeom(1);
  compGeom->append( surface, CUBIT_FORWARD );
  if( surface->owner() )
    surface->owner()->swap_bridge( surface, this, false );
  surface->owner(this);
}

Definition at line 54 of file CompositeSurface.cpp.

  : HadBridgeRemoved(0),
    compGeom(geometry),
    stitchPartner(0),
    firstCoSurf(0),
    firstLoop(0),
    hiddenSet(0),
    facetTool(0)
{
  assert( geometry != NULL );
  for( int i = 0; i < compGeom->num_entities(); i++ )
  {
    GeometryEntity* entity = compGeom->entity(i);
    assert( !entity->owner() );
    entity->owner(this);
  }
}

Definition at line 83 of file CompositeSurface.cpp.

{
  while( firstCoSurf )
  {
    CompositeCoSurf* cosurf = firstCoSurf;
    remove( cosurf );
    if( cosurf->get_shell() )
      cosurf->get_shell()->remove( cosurf );
    delete cosurf;
  }
  
  while( firstLoop )
    remove( firstLoop );
  
  for( int j = 0; j < num_surfs(); j++ )
    if( get_surface(j)->owner() == this )
      get_surface(j)->owner(0);
  
  if( stitchPartner )
  {
    stitchPartner->stitchPartner = 0;
    stitchPartner = 0;
  }
  
  delete hiddenSet;
  delete compGeom;
  delete facetTool;
  hiddenSet = (HiddenEntitySet*)0xbdbdbdbd;
  compGeom = (CompositeGeom*)0xbdbdbdbd;
}

Member Function Documentation

Definition at line 123 of file CompositeSurface.cpp.

{
  if( loop->mySurface )
  {
    assert(0);
    return CUBIT_FAILURE;
  }
  
  loop->mySurface = this;
  loop->loopNext = firstLoop;
  firstLoop = loop;
  
  return CUBIT_SUCCESS;
}

Definition at line 185 of file CompositeSurface.cpp.

{
  if( cosurf->mySurface )
    return CUBIT_FAILURE;
  
  cosurf->mySurface = this;
  cosurf->surfaceNext = firstCoSurf;
  firstCoSurf = cosurf;
  return CUBIT_SUCCESS;
}
void CompositeSurface::append_simple_attribute_virt ( const CubitSimpleAttrib simple_attrib_ptr) [virtual]

Implements TopologyBridge.

Definition at line 398 of file CompositeSurface.cpp.

{
  if(compGeom)
    compGeom->add_attribute( simple_attrib_ptr );
}
CubitBox CompositeSurface::bounding_box ( void  ) const [virtual]

Implements GeometryEntity.

Definition at line 346 of file CompositeSurface.cpp.

{
  return compGeom->bounding_box();
}
CubitStatus CompositeSurface::closest_point ( CubitVector const &  location,
CubitVector closest_location = NULL,
CubitVector unit_normal = NULL,
CubitVector curvature1 = NULL,
CubitVector curvature2 = NULL 
) [virtual]

Implements Surface.

Definition at line 895 of file CompositeSurface.cpp.

{
  if ( num_surfs() == 1 )
    return get_surface(0)->closest_point( location, closest_location,
                                          unit_normal,
                                          curvature1, curvature2 );
  
  update_facet_tool();
  
  if ( facetTool )
  {
    CubitStatus result = CUBIT_SUCCESS;
    CubitVector facet_closest;

      // look for multiple surfaces if normal is requested
    if (unit_normal)
    {
      DLIList<int> index_list;
      int num_found = facetTool->closest_index( location, index_list,
                                                &facet_closest );

      CubitVector normal(0.0, 0.0, 0.0);
      int i;
      for (i = 0; i < num_found; i++) 
      {
        int index = index_list[i];
        if(index > -1)
        {
          Surface* surf = get_surface(index);
          
          result = surf->closest_point( facet_closest, closest_location,
                                        &normal, curvature1, curvature2 );
          
          if (get_sense(index) == CUBIT_REVERSED)
            *unit_normal += (-normal);
          else
            *unit_normal += normal;
        }
      }
      unit_normal->normalize();
    }
    else
    {  
      int index = facetTool->closest_index( location, &facet_closest );
      if(index > -1)
      {
        Surface* surf = get_surface(index);
      
        result = surf->closest_point( location, closest_location,
                                      unit_normal, curvature1, curvature2 );
    
  //       if (unit_normal && get_sense(index) == CUBIT_REVERSED)
  //         *unit_normal = -*unit_normal;
      }
      else
        result = CUBIT_FAILURE;
    }
    
    return result;

      // this code is never accessed
    Surface* surf = NULL;
    int index = -1;
    double u, v;
    result = surf->u_v_from_position( facet_closest, u, v );
    if (!result) return CUBIT_FAILURE;
    
    CubitVector surf_closest;
    result = surf->closest_point_uv_guess( location, u, v, &surf_closest, 
                                           unit_normal );
    if (!result) return CUBIT_FAILURE;
    
    if (unit_normal && get_sense(index) == CUBIT_REVERSED)
      *unit_normal = -*unit_normal;
    
    if (curvature1 || curvature2)
    {
      result = surf->closest_point( surf_closest, 0, 0, 
                                    curvature1, curvature2 );
      if (!result) return CUBIT_FAILURE;
    }
    
    if(closest_location)
      *closest_location = surf_closest;
  
    return CUBIT_SUCCESS;
  }
  
  double shortest_dist_sqr, current_dist_sqr;
  CubitVector closest_point, current_point;
  int closest_surf, current_surf;
    
  //initialize CompositeEntity data structures
  closest_surf = compGeom->closest_box( location );
    
  closest_trimmed( closest_surf, location, closest_point );
  shortest_dist_sqr = (location - closest_point).length_squared();
    
  while( (current_surf = compGeom->next_box_within_dist( shortest_dist_sqr ) ) >= 0 )
  {
    closest_trimmed( current_surf, location, current_point );
    current_dist_sqr = (location - current_point).length_squared();
    
    if( current_dist_sqr < shortest_dist_sqr )
    {
      closest_surf = current_surf;
      closest_point = current_point;
      shortest_dist_sqr = current_dist_sqr;
    }
  }

  if( closest_location ) *closest_location = closest_point;
  if( unit_normal || curvature1 || curvature2 )
  {
    get_surface( closest_surf )->closest_point( closest_point, NULL,
                              unit_normal, curvature1, curvature2 );
    if( unit_normal && compGeom->sense(closest_surf) == CUBIT_REVERSED )
      *unit_normal *= -1;
  }

  return CUBIT_SUCCESS;
}
CubitStatus CompositeSurface::closest_point_along_vector ( CubitVector from_point,
CubitVector along_vector,
CubitVector point_on_surface 
) [virtual]

Implements Surface.

Definition at line 2044 of file CompositeSurface.cpp.

{
  int index = closest_underlying_surface( from_point );
  CubitStatus status = get_surface(index)->closest_point_along_vector( from_point, along_vector, point_on_surface );    

  if( CUBIT_FAILURE == status )
  {
    //find the next closest surface and try it
    double shortest_dist_sqr = CUBIT_DBL_MAX;
    double current_dist_sqr;
    CubitVector closest_point;
    int closest_surf = 0;

    for( int k=0; k<compGeom->num_entities(); k++ )
    {
      if( k==index )
        continue;

      closest_trimmed( k, from_point, closest_point );
      current_dist_sqr = (from_point - closest_point).length_squared();

      if( current_dist_sqr < shortest_dist_sqr )
      {
        closest_surf = k;
        shortest_dist_sqr = current_dist_sqr;
      }
    }
    status = get_surface(closest_surf)->closest_point_along_vector( from_point, along_vector, point_on_surface );    
  }


  return status;
}
void CompositeSurface::closest_point_trimmed ( CubitVector  from_point,
CubitVector result 
) [virtual]

Implements Surface.

Definition at line 580 of file CompositeSurface.cpp.

{
  int index = closest_underlying_surface( from_point );
  get_surface(index)->closest_point_trimmed( from_point, point_on_surf );
}
CubitStatus CompositeSurface::closest_point_uv_guess ( CubitVector const &  location,
double &  u,
double &  v,
CubitVector closest_location = NULL,
CubitVector unit_normal = NULL 
) [virtual]

Implements Surface.

Definition at line 757 of file CompositeSurface.cpp.

{
  if ( num_surfs() == 1)
    return get_surface(0)->
      closest_point_uv_guess(location, u, v, closest_location, unit_normal);
  else
    return closest_point(location, closest_location, unit_normal);
}
CubitStatus CompositeSurface::closest_trimmed ( int  underlying_surface,
const CubitVector position,
CubitVector result 
) [protected]

Definition at line 1097 of file CompositeSurface.cpp.

{
  get_surface(index)->closest_point_trimmed( position, result );
  return CUBIT_SUCCESS;
/*
  total_calls++;
  CubitVector close, copy(position);
  Surface* surf = get_surface(index);
  
  timer.cpu_secs();
  surf->closest_point_trimmed( position, result );
  trimmed_time += timer.cpu_secs();
  
  surf->closest_point( position, &close );
  closest_time += timer.cpu_secs();
  
  CubitPointContainment contain = surf->point_containment( copy );
  contain_time += timer.cpu_secs();
  
  if ( contain == CUBIT_PNT_OUTSIDE )
    contain_trim_count++;
  else if( (result - close).length_squared() > GEOMETRY_RESABS*GEOMETRY_RESABS)
    error_count++;
  
  return CUBIT_SUCCESS;
*/
//  if( use_gme_cpt )
//  {
//      get_surface( index )->closest_point_trimmed( position, result );
//      return CUBIT_SUCCESS;
//  }
/*  
  DLIList<TopologyBridge*> bridge_list;
    Surface* surf_ptr = get_surface(index);
  CubitVector surf_pt, normal, curve_pt;
  if( !surf_ptr->closest_point( position, &surf_pt, &normal ) )
    return CUBIT_FAILURE;

  CoEdgeSM *closest_coedge, *other_coedge = 0;
  cptInfo.setup(surf_ptr);
  cptInfo.closest_coedge( position, closest_coedge, other_coedge, curve_pt );
  if ( !closest_coedge )
    return CUBIT_FAILURE;

  CubitVector coe_normal, cross, tangent1, tangent2, junk;
  bool inside;


  if ( !other_coedge )
  {
    bridge_list.clean_out();
    closest_coedge->get_children_virt( bridge_list );
    Curve* curve_ptr = dynamic_cast<Curve*>(bridge_list.get());
    assert( !!curve_ptr );
    double u = curve_ptr->u_from_position( curve_pt );

    if( !curve_ptr->G1_discontinuous( u, &tangent1, &tangent2 ) )
    {
      curve_ptr->closest_point( curve_pt, junk, &tangent1 );
      bool inside = is_inside( tangent1, curve_pt, surf_pt, normal );
      result = inside ? surf_pt : curve_pt;
      return CUBIT_SUCCESS;
    }

    if( closest_coedge->sense() == CUBIT_REVERSED )
    {
      tangent1 = -tangent1;
      tangent2 = -tangent2;
    }
  }
  else
  {
    bridge_list.clean_out();
    closest_coedge->get_children_virt( bridge_list );
    Curve* curve1 = dynamic_cast<Curve*>(bridge_list.get());
    bridge_list.clean_out();
    other_coedge->get_children_virt( bridge_list );
    Curve* curve2 = dynamic_cast<Curve*>(bridge_list.get());
    assert(curve1 && curve2);

    curve1->closest_point( curve_pt, junk, &tangent1 );
    curve2->closest_point( curve_pt, junk, &tangent2 );
    if( closest_coedge->sense() == CUBIT_REVERSED ) tangent1 = -tangent1;
    if( other_coedge->sense() == CUBIT_REVERSED ) tangent2 = -tangent2;
  }
    
  surf_ptr->closest_point( curve_pt, 0, &coe_normal );
  cross = tangent1 * tangent2;
  bool inside1 = is_inside( tangent1, curve_pt, surf_pt, normal );
  bool inside2 = is_inside( tangent2, curve_pt, surf_pt, normal );
  
  if ( (cross % coe_normal) > 0.0 )
    inside = inside1 && inside2;
  else
    inside = inside1 || inside2;

  result = inside ? surf_pt : curve_pt;
  return CUBIT_SUCCESS;
*/
}

Definition at line 1031 of file CompositeSurface.cpp.

{
  if( num_surfs() == 1 )
    return 0;
  
  update_facet_tool();
  if( facetTool )
    return facetTool->closest_index( pos );
 
  double shortest_dist_sqr, current_dist_sqr;
  CubitVector closest_point;
  int closest_surf, current_surf;
    
  //initialize CompositeEntity data structures
  closest_surf = compGeom->closest_box( pos );
    
  closest_trimmed( closest_surf, pos, closest_point );
  shortest_dist_sqr = (pos - closest_point).length_squared();
    
  while( (current_surf = compGeom->next_box_within_dist( shortest_dist_sqr ) ) >= 0 )
  {
    closest_trimmed( current_surf, pos, closest_point );
    current_dist_sqr = (pos - closest_point).length_squared();
    
    if( current_dist_sqr < shortest_dist_sqr )
    {
      closest_surf = current_surf;
      shortest_dist_sqr = current_dist_sqr;
    }
  }

  return closest_surf;
}

Definition at line 299 of file CompositeSurface.cpp.

{
  int old_size = compGeom->num_entities();

  // Merge the "surfaces_to_ignore" list.
  surfacesToIgnore.merge_unique(dead_surf->surfacesToIgnore);

  compGeom->merge( *(dead_surf->compGeom) );
  if( dead_surf->hiddenSet != 0 )
    hidden_entities().merge( dead_surf->hiddenSet );
  for( int i = old_size; i < compGeom->num_entities(); i++ )
  {
    TopologyBridge* bridge = compGeom->entity(i);
    assert( bridge->owner() == dead_surf );
    bridge->owner( this );
  }
  
  delete facetTool;
  facetTool = 0;
  
  return CUBIT_SUCCESS;
}

Reimplemented from TBOwner.

Definition at line 532 of file CompositeSurface.cpp.

{
  return (CubitBoolean)(compGeom->index_of(bridge) >= 0);
}
CubitStatus CompositeSurface::evaluate ( double  u,
double  v,
CubitVector position,
CubitVector normal,
CubitVector curvature1,
CubitVector curvature2 
) [virtual]

Implements Surface.

Definition at line 770 of file CompositeSurface.cpp.

{
  if( position || normal || (curvature1 && curvature2) )
  {
    if ( num_surfs() == 1)
      return get_surface(0)->evaluate(u, v, position, normal, curvature1, curvature2 ); 
    else
      return CUBIT_FAILURE; 
  }
  else
    return CUBIT_FAILURE;
}

Definition at line 236 of file CompositeSurface.cpp.

{
  CompositeCoSurf* cos = firstCoSurf;
  while( cos && cos->get_shell() != shell )
    cos = cos->next_in_surface();
  return cos;
}

Definition at line 243 of file CompositeSurface.cpp.

{
  CompositeCoSurf* cos = firstCoSurf;
  while( cos && (!cos->get_shell() || cos->get_shell()->get_lump() != lump ) )
    cos = cos->next_in_surface();
  return cos;
}

Definition at line 250 of file CompositeSurface.cpp.

{
  CompositeCoSurf* cos = cosurf;
  while( cos && cos->get_shell() != cosurf->get_shell() )
    cos = cos->next_in_surface();
  return cos;
}

Definition at line 346 of file CompositeSurface.hpp.

  { return firstLoop; }

Reimplemented from Surface.

Definition at line 1563 of file CompositeSurface.cpp.

void CompositeSurface::get_children_virt ( DLIList< TopologyBridge * > &  children) [virtual]

Implements TopologyBridge.

Definition at line 382 of file CompositeSurface.cpp.

{
  for( CompositeLoop* loop = firstLoop; loop; loop = loop->loopNext )
    list.append( loop );
}
CubitStatus CompositeSurface::get_cone_params ( CubitVector center,
CubitVector normal,
CubitVector major_axis,
double &  radius_ratio,
double &  sine_angle,
double &  cos_angle 
) const [virtual]

Implements Surface.

Definition at line 2001 of file CompositeSurface.cpp.

{
  PRINT_ERROR("Currently, Cubit is unable to determine cone parameters for CompositeSurfaces.\n");
  return CUBIT_FAILURE;
}

Definition at line 1544 of file CompositeSurface.cpp.

{
  for( CompositeLoop* loop = firstLoop; loop; loop = loop->loopNext )
  {
    CompositeCoEdge* coedge = loop->first_coedge();
    while( coedge )
    {
      result.append_unique( coedge->get_curve() );
      coedge = loop->next_coedge( coedge );
    }
  }
}

Implements Surface.

Definition at line 1534 of file CompositeSurface.cpp.

{
  return CUBIT_FORWARD;
}

Definition at line 1566 of file CompositeSurface.cpp.

{
  if( hiddenSet )
    hiddenSet->hidden_curves( curves );
}

Definition at line 322 of file CompositeSurface.cpp.

{
  int i;

  if(surfacesToIgnore.size() > 0)
  {
    for(i=0; i<num_surfs(); i++)
    {
      Surface *srf = get_surface(i);
      if(surfacesToIgnore.is_in_list(srf))
        surfs.append(srf);
    }
  }
}
CubitStatus CompositeSurface::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]

Implements Surface.

Definition at line 2027 of file CompositeSurface.cpp.

{
  PRINT_ERROR("Currently, Cubit is unable to determine nurbs parameters for CompositeSurface.\n");
  return CUBIT_FAILURE;
}
CubitBoolean CompositeSurface::get_param_range_U ( double &  lower,
double &  upper 
) [virtual]

Implements Surface.

Definition at line 1430 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->get_param_range_U(lower, upper);
  
  lower = upper = 0;
    return CUBIT_FALSE;
}
CubitBoolean CompositeSurface::get_param_range_V ( double &  lower,
double &  upper 
) [virtual]

Implements Surface.

Definition at line 1439 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->get_param_range_V(lower, upper);
  
  lower = upper = 0;
  return CUBIT_FALSE;
}
void CompositeSurface::get_parents_virt ( DLIList< TopologyBridge * > &  parents) [virtual]

Implements TopologyBridge.

Definition at line 360 of file CompositeSurface.cpp.

{
  DLIList<TopologyBridge*> parents, parents2;
  for( int i = 0; i < num_surfs(); i++ )
  {
    parents.clean_out();
    get_surface(i)->get_parents( parents );
    parents.reset();
    for ( int j = parents.size(); j--; )
    {
      TopologyBridge* shell = parents.get_and_step();
      shell->get_parents( parents2 );
      assert (parents2.size() == 1);
      if (0 == dynamic_cast<CompositeLump*>(parents2.pop()->owner()))
        list.append_unique( shell );
    }
  }
  
  CompositeCoSurf* cosurf = 0;
  while ((cosurf = next_co_surface( cosurf )))
    list.append_unique( cosurf->get_shell() );
}

Implements Surface.

Definition at line 589 of file CompositeSurface.cpp.

{
  int count = num_surfs();
  CubitVector* vect_list = new CubitVector[count];
  double RESABS_SQUARED = CUBIT_RESABS * CUBIT_RESABS;
  normal.set(0.0,0.0,0.0);
    
  if (count == 1)
  {
    return get_surface(0)->get_point_normal(origin,normal);
  }
  
  for( int i = 0; i < count; i++ )
  {
    Surface* surf = get_surface(i);
    if( surf->get_point_normal(origin,vect_list[i]) == CUBIT_FAILURE )
    {
      delete [] vect_list;
      return CUBIT_FAILURE;
    }

    if( compGeom->sense(i) == CUBIT_REVERSED )
      vect_list[i] *= -1.0;
    normal += vect_list[i];
  }
  //If we reach this point, then all of the underlying surfaces are planar.
  //Next check if they are coplanar.
  if( normal.length_squared() < RESABS_SQUARED )
  {
    delete [] vect_list;
    return CUBIT_FAILURE;
  }
  normal.normalize();
  for( int j = 0; j < count; j++ )
  {
    if( fabs( 1.0 - (normal % ~vect_list[j]) ) > CUBIT_RESABS )
    {
      delete [] vect_list;
      return CUBIT_FAILURE;
    }
  }
    
  delete [] vect_list;
  CubitVector zero( 0.0, 0.0, 0.0 );
  closest_point( zero, &origin );
  return CUBIT_SUCCESS;
}   
CubitStatus CompositeSurface::get_projected_distance_on_surface ( CubitVector pos1,
CubitVector pos2,
double &  distance 
) [virtual]

Implements Surface.

Definition at line 1980 of file CompositeSurface.cpp.

{
  if ( num_surfs() == 1)
      return get_surface(0)->get_projected_distance_on_surface( pos1, pos2, distance );
    else
      return CUBIT_FAILURE; 
  return CUBIT_FAILURE;
}
CubitSense CompositeSurface::get_sense ( int  index) const [inline]

Definition at line 335 of file CompositeSurface.hpp.

  { return compGeom->sense(index); }
CubitSense CompositeSurface::get_shell_sense ( ShellSM shell_ptr) const [virtual]

Implements Surface.

Definition at line 1650 of file CompositeSurface.cpp.

{
  CompositeShell* shell = dynamic_cast<CompositeShell*>(shellsm_ptr);
  if( shell )
    return shell->find_sense(this);
  
  DLIList<TopologyBridge*> parents;
  for( int i = 0; i < num_surfs(); i++ )
  {
    parents.clean_out();
    get_surface(i)->get_parents( parents );
    if( parents.is_in_list( shellsm_ptr ) )
    {
      CubitSense result = get_surface(i)->get_shell_sense(shellsm_ptr);
      if( get_sense(i) == CUBIT_REVERSED )
      {
        if( result == CUBIT_FORWARD )
          result = CUBIT_REVERSED;
        else if( result == CUBIT_REVERSED )
          result = CUBIT_FORWARD;
      }
      return result;
    }
  }
  return CUBIT_UNKNOWN;
}

Implements TopologyBridge.

Definition at line 447 of file CompositeSurface.cpp.

{
  if(!compGeom)
    return CUBIT_FAILURE;
  compGeom->get_attributes( attrib_list );
  return CUBIT_SUCCESS;
}
CubitStatus CompositeSurface::get_simple_attribute ( const CubitString name,
DLIList< CubitSimpleAttrib > &  attrib_list 
) [virtual]

Implements TopologyBridge.

Definition at line 455 of file CompositeSurface.cpp.

{
  if(!compGeom)
    return CUBIT_FAILURE;
  compGeom->get_attributes( name.c_str(), attrib_list );
  return CUBIT_SUCCESS;
}
CubitStatus CompositeSurface::get_sphere_params ( CubitVector center,
double &  radius 
) const [virtual]

Implements Surface.

Definition at line 1991 of file CompositeSurface.cpp.

{
  PRINT_ERROR("Currently, Cubit is unable to determine sphere parameters for CompositeSurfaces.\n");
  return CUBIT_FAILURE;
}

Definition at line 88 of file CompositeSurface.hpp.

    { return stitchPartner; }
Surface * CompositeSurface::get_surface ( int  index) const [inline]

Definition at line 332 of file CompositeSurface.hpp.

  { return dynamic_cast<Surface*>(compGeom->entity(index)); }
CubitStatus CompositeSurface::get_torus_params ( CubitVector center,
CubitVector normal,
double &  major_radius,
double &  minor_radius 
) const [virtual]

Implements Surface.

Definition at line 2015 of file CompositeSurface.cpp.

{
  PRINT_ERROR("Currently, Cubit is unable to determine torus parameters for CompositeSurface.\n");
  return CUBIT_FAILURE;
}

Definition at line 1558 of file CompositeSurface.cpp.

{
  return hiddenSet && !hiddenSet->is_empty();
}

Definition at line 355 of file CompositeSurface.hpp.

{ 
  if( !hiddenSet )
    hiddenSet = new HiddenEntitySet(this);
  return *hiddenSet;
}
void CompositeSurface::ignore_surface ( int  surface_id)

Definition at line 673 of file CompositeSurface.cpp.

{
   update_facet_tool();
   if(facetTool)
   {
      int i;
      int num_surfs_in_composite = num_surfs();
      for (i=0; i<num_surfs_in_composite; i++)
      {
         Surface *cur_surf = get_surface(i);
         if(cur_surf->get_saved_id() == surface_id)
         {
            surfacesToIgnore.append_unique(cur_surf);
            i = num_surfs_in_composite;
            update_facets_to_ignore();
         }
      }
   }
}

Definition at line 693 of file CompositeSurface.cpp.

{
   update_facet_tool();
   if(facetTool)
   {
      int i;
      int num_surfs_in_composite = num_surfs();
      for (i=0; i<num_surfs_in_composite; i++)
      {
         Surface *cur_surf = get_surface(i);
         if(cur_surf == surf)
         {
            surfacesToIgnore.append_unique(cur_surf);
            i = num_surfs_in_composite;
            update_facets_to_ignore();
         }
      }
   }
}
int CompositeSurface::index_of ( Surface surface) const [inline]

Definition at line 341 of file CompositeSurface.hpp.

  { return compGeom->index_of( surf ); }

Reimplemented from Surface.

Definition at line 1365 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->is_closed_in_U();
    
  return CUBIT_FALSE;
}

Reimplemented from Surface.

Definition at line 1372 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->is_closed_in_V();
    
  return CUBIT_FALSE;
}
bool CompositeSurface::is_dead_coedge ( CompositeCoEdge coedge) [protected]

Definition at line 1838 of file CompositeSurface.cpp.

{
  if (coedge->num_coedges() > 0)
    return false;
  
  CompositeCurve* curve = coedge->get_curve();
  if (!curve)
    return true;
  
  if (curve->num_curves() == 0) // point-curve
  {
    CompositePoint* comp = curve->start_point();
    assert(comp == curve->end_point());
    return !(comp->get_point());
  }
  
  return false;
}

Implements Surface.

Definition at line 1412 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->is_parametric();

  return CUBIT_FALSE;
}

Implements Surface.

Definition at line 1296 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->is_periodic();
    
  return CUBIT_FALSE;
}
CubitBoolean CompositeSurface::is_periodic_in_U ( double &  period) [virtual]

Implements Surface.

Definition at line 1313 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->is_periodic_in_U(period);
    
    period = 0.0;
    return CUBIT_FALSE;
}
CubitBoolean CompositeSurface::is_periodic_in_V ( double &  period) [virtual]

Implements Surface.

Definition at line 1321 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->is_periodic_in_V(period);
    
    period = 0.0;
    return CUBIT_FALSE;
}

Implements Surface.

Definition at line 1459 of file CompositeSurface.cpp.

{
  for( int i = 0; i < compGeom->num_entities(); i++ )
  {
    Surface* surf = get_surface(i);
    if( surf->is_position_on( position ) ) return CUBIT_TRUE;
  }
    
  return CUBIT_FALSE;
}
CubitBoolean CompositeSurface::is_singular_in_U ( double  u_value) [virtual]

Implements Surface.

Definition at line 1340 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->is_singular_in_U(param);
    
    return CUBIT_FALSE;
}
CubitBoolean CompositeSurface::is_singular_in_V ( double  v_value) [virtual]

Implements Surface.

Definition at line 1347 of file CompositeSurface.cpp.

{
   if (num_surfs() == 1)
    return get_surface(0)->is_singular_in_V(param);
    
 return CUBIT_FALSE;
}
int CompositeSurface::layer ( ) const [inline, virtual]

Reimplemented from TopologyBridge.

Definition at line 125 of file CompositeSurface.hpp.

{ return COMPOSITE_LAYER; }
double CompositeSurface::measure ( ) [virtual]

Implements GeometryEntity.

Definition at line 565 of file CompositeSurface.cpp.

{
  return compGeom->measure();
}

Definition at line 352 of file CompositeSurface.hpp.

  { return prev ? prev->surfaceNext : firstCoSurf; }
CompositeLoop * CompositeSurface::next_loop ( CompositeLoop after_this = 0) const [inline]

Definition at line 349 of file CompositeSurface.hpp.

  { return !loop ? firstLoop : loop->mySurface == this ? loop->loopNext : 0; }
void CompositeSurface::notify_reversed ( TopologyBridge bridge) [virtual]

Implements TBOwner.

Definition at line 1677 of file CompositeSurface.cpp.

{
  int index = compGeom->index_of(bridge);
  if( index >= 0 )
    compGeom->reverse_sense(index);
}
void CompositeSurface::notify_split ( TopologyBridge new_bridge,
TopologyBridge old_bridge 
) [virtual]

Reimplemented from TBOwner.

Definition at line 1814 of file CompositeSurface.cpp.

{
  assert(!new_bridge->owner());
  
  Surface* old_surf = dynamic_cast<Surface*>(old_bridge);
  Surface* new_surf = dynamic_cast<Surface*>(new_bridge);
  assert( old_surf && new_surf );
  int old_surf_index = index_of(old_surf);
  assert(old_surf_index >= 0);
  
  compGeom->append(new_surf, compGeom->sense(old_surf_index));
  new_surf->owner(this);
  
  DLIList<CompositeCurve*> new_curves;
  update_modified();
  update_modified( old_surf, new_curves );
  update_modified( new_surf, new_curves );
  
//  for( int i = new_curves.size(); i--; )
//    if( !CompositeEngine::instance().restore_curve(new_curves.get_and_step()) )
//      assert(0);
}

Reimplemented from TBOwner.

Definition at line 1714 of file CompositeSurface.cpp.

{
  DLIList<CompositeCurve*> new_curves;
  Surface* surf = dynamic_cast<Surface*>(bridge);
  assert( surf && index_of(surf) >= 0 );
  update_modified();
  update_modified( surf, new_curves );
  
//  for( int i = new_curves.size(); i--; )
//    if( !CompositeEngine::instance().restore_curve(new_curves.get_and_step()) )
//      assert(0);
}

Definition at line 1969 of file CompositeSurface.cpp.

{
  if (facetTool)
  {
    delete facetTool;
    facetTool = 0;
  }
}
int CompositeSurface::num_surfs ( ) const [inline]

Definition at line 338 of file CompositeSurface.hpp.

  { return compGeom->num_entities(); }
CompositeSurface& CompositeSurface::operator= ( const CompositeSurface ) [private]

Implements Surface.

Definition at line 1480 of file CompositeSurface.cpp.

{
  bool boundary = false;
  for( int i = 0; i < num_surfs(); i++ )
  {
    CubitPointContainment cpc = get_surface(i)->point_containment( point );
    switch( cpc )
    {
      case CUBIT_PNT_OUTSIDE:
      //case CUBIT_PNT_OFF: 
        break;
      case CUBIT_PNT_INSIDE:
      //case CUBIT_PNT_ON:
        return cpc;
      case CUBIT_PNT_BOUNDARY:
        boundary = true;
        break;
      case CUBIT_PNT_UNKNOWN:
      default:
        return CUBIT_PNT_UNKNOWN;
    }
  }
  
  if( boundary )
    return CUBIT_PNT_BOUNDARY;
  else
    return CUBIT_PNT_OUTSIDE;
}
CubitPointContainment CompositeSurface::point_containment ( double  u,
double  v 
) [virtual]

Implements Surface.

Definition at line 1516 of file CompositeSurface.cpp.

{
   if (num_surfs() == 1)
    return get_surface(0)->point_containment(u,v);
   // Set this up when uv parameters are defined for composite surfaces.
   return CUBIT_PNT_UNKNOWN;
}
CubitVector CompositeSurface::position_from_u_v ( double  u,
double  v 
) [virtual]

Implements Surface.

Definition at line 1251 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->position_from_u_v(u,v);
    
  PRINT_ERROR("CompositeSurface::position_from_u_v for non-paramtric surface.\n");
  CubitVector nulvect( 0., 0., 0.);
  return nulvect;
}
CubitStatus CompositeSurface::principal_curvatures ( CubitVector const &  location,
double &  curvature_1,
double &  curvature_2,
CubitVector closest_location 
) [virtual]

Implements Surface.

Definition at line 1220 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->
      principal_curvatures(location, curvature_1, curvature_2, closest_location);
  
  CubitVector curvature1, curvature2;
  CubitStatus s = closest_point( location, closest_location, NULL, 
                                 &curvature1, &curvature2 );
  if( s == CUBIT_FAILURE ) return CUBIT_FAILURE;
    
  curvature_1 = curvature1.length();
  curvature_2 = curvature2.length();
  return CUBIT_SUCCESS;
}

Definition at line 1074 of file CompositeSurface.cpp.

{
/*
  PRINT_INFO("Total Calls    %10d\n",          total_calls);
  PRINT_INFO("ClosestTrimmed %10.0f %10.5f\n", trimmed_time, trimmed_time / total_calls );
  PRINT_INFO("Closest        %10.0f %10.5f\n", closest_time, closest_time / total_calls );
  PRINT_INFO("Containment    %10.0f %10.5f\n", contain_time, contain_time / total_calls );
  double average_outside = (double)contain_trim_count / total_calls;
  PRINT_INFO("Outside Count  %10d   %10.5f\n", contain_trim_count, average_outside );
  double containment = contain_time + 
                       average_outside * trimmed_time + 
                       (1.0-average_outside) * closest_time;
  PRINT_INFO("Contain Est.   %10.0f %10.5f\n", containment, containment / total_calls );
  PRINT_INFO("Error Count    %10d   %10.5f\n", error_count, (double)error_count / total_calls );
*/
}
void CompositeSurface::print_debug_info ( const char *  line_prefix = 0,
bool  brief = false 
)

Definition at line 1572 of file CompositeSurface.cpp.

{
  if( line_prefix == 0 ) line_prefix = "";
  CompositeLoop* loop = 0;
  
  if( brief )
  {
    int count = 0;
    while ( (loop = next_loop(loop) ) != NULL )
      count++;
#ifdef TOPOLOGY_BRIDGE_IDS
    PRINT_INFO("%sCompositeSurface %d : %d loops ", line_prefix, get_id(), count );
    if ( num_surfs() == 1 )
      PRINT_INFO("%s %d\n", fix_type_name(typeid(*get_surface(0)).name()), get_surface(0)->get_id());
    else
      PRINT_INFO("%d surfaces.\n", num_surfs());

#else
    PRINT_INFO("%sCompositeSurface %p : %d loops ", line_prefix, (void*)this, count );
    if ( num_surfs() == 1 )
      PRINT_INFO("%s %d\n", fix_type_name(typeid(*get_surface(0)).name()), get_surface(0)->get_saved_id());
   //   PRINT_INFO("%s %p\n", fix_type_name(typeid(*get_surface(0)).name()), get_surface(0));
    else
      PRINT_INFO("%d surfaces.\n", num_surfs());
#endif
    return;
  }
  
  char* new_prefix = new char[strlen(line_prefix)+3];
  strcpy( new_prefix, line_prefix );
  strcat( new_prefix, "  " );
#ifdef TOPOLOGY_BRIDGE_IDS
  PRINT_INFO("%sCompositeSurface %d\n", line_prefix, get_id() );
#else
  PRINT_INFO("%sCompositeSurface %d\n", line_prefix, this->get_saved_id() );
 // PRINT_INFO("%sCompositeSurface %p\n", line_prefix, this );
#endif
  compGeom->print_debug_info( new_prefix );

  // Print out info about any surfaces we are ingoring
  // during evaluation.
  if(surfacesToIgnore.size() > 0)
  {
      PRINT_INFO("%sSurfaces which are ignored:\n", new_prefix);
      for(int k=surfacesToIgnore.size(); k--;)
      {
         PRINT_INFO("%sSurface: %d\n", 
                    new_prefix, surfacesToIgnore.get_and_step()->get_saved_id());
      }
  }
  if( hiddenSet ) hiddenSet->print_debug_info( new_prefix );
  else PRINT_INFO("%s  No Hidden Entities.\n", line_prefix );
  while( (loop = next_loop(loop) ) != NULL )
    loop->print_debug_info( new_prefix );
  delete [] new_prefix;
  
  update_facet_tool();
  if ( facetTool )
  {
    facetTool->debug_draw_facets();
//    bool* reversed = new bool[num_surfs()];
//    for (int i = 0; i < num_surfs(); i++ )
//      reversed[i] = get_sense(i) == CUBIT_REVERSED;
//    facetTool->consolidate_points(reversed, GEOMETRY_RESABS);
//    delete [] reversed;
  }
}

Definition at line 285 of file CompositeSurface.hpp.

Definition at line 147 of file CompositeSurface.cpp.

{
  if( loop->mySurface != this )
    return CUBIT_FAILURE;
 
  if( firstLoop == loop )
  {
    firstLoop = loop->loopNext;
  }
  else
  {
    CompositeLoop *prev = firstLoop,
                  *next = firstLoop->loopNext;
    
    while( next != loop )
    {
      assert( next != NULL );
      prev = next;
      next = next->loopNext;
    }
    
    prev->loopNext = next->loopNext;
  }
  
  loop->loopNext = 0;
  loop->mySurface = 0;
  return CUBIT_SUCCESS;
}

Definition at line 205 of file CompositeSurface.cpp.

{
  if( cosurf->mySurface != this )
    return CUBIT_FAILURE;
  
  if( cosurf == firstCoSurf )
    firstCoSurf = cosurf->surfaceNext;
  else
  {
    CompositeCoSurf* prev = firstCoSurf;
    while( prev && prev->surfaceNext != cosurf )
      prev = prev->surfaceNext;
    assert( prev != NULL );
    prev->surfaceNext = cosurf->surfaceNext;
  }
  
  cosurf->mySurface = 0;
  cosurf->surfaceNext = 0;
  return CUBIT_SUCCESS;
}

Implements TBOwner.

Definition at line 474 of file CompositeSurface.cpp.

{
  if(!compGeom)
    return CUBIT_FAILURE;

  int i = compGeom->index_of(bridge);
  if( i < 0 )
    return CUBIT_FAILURE;
  
  delete facetTool;
  facetTool = 0;
  
  assert( bridge->owner() == this );
  bridge->owner(0);
  if (!compGeom->remove(i, true))
    return CUBIT_FAILURE;
  
  if (compGeom->num_entities() == 0)
    CompositeEngine::instance().notify_deactivated(this);
  HadBridgeRemoved = 1;
  return CUBIT_SUCCESS;
}
void CompositeSurface::remove_dead_coedge ( CompositeCoEdge coedge) [protected]

Definition at line 1905 of file CompositeSurface.cpp.

{
  assert(is_dead_coedge(coedge));

  CompositeCurve* curve = coedge->get_curve();
  assert(curve->num_curves() == 0);
  curve->remove(coedge);
  delete coedge;
  if (curve->next_coedge(NULL))
    return;

  CompositePoint* start = curve->start_point();
  CompositePoint* end = curve->end_point();
  curve->start_point(0);
  curve->end_point(0);
  delete curve;

  if ( start->next_curve(NULL) == NULL )
  {
    if ( start->get_point() )
      CompositeEngine::instance().restore_point_in_curve(start);
    else 
      delete start;
  }

  if ( end != start && end->next_curve(NULL) == NULL )
  {
    if ( end->get_point() )
      CompositeEngine::instance().restore_point_in_curve(end);
    else
      delete end;
  }
}
void CompositeSurface::remove_simple_attribute_virt ( const CubitSimpleAttrib simple_attrib_ptr) [virtual]

Implements TopologyBridge.

Definition at line 414 of file CompositeSurface.cpp.

{
  if(compGeom)
    compGeom->rem_attribute( simple_attrib_ptr );
}

Definition at line 497 of file CompositeSurface.cpp.

{
  Surface* result = get_surface(index);
  if ( !result || !compGeom->remove(index,false) ) 
    return 0;

  result->owner(0);
  return result;
}

Definition at line 1090 of file CompositeSurface.cpp.

{
/*
  trimmed_time = contain_time = closest_time = 0.0;
  total_calls = contain_trim_count = error_count = 0;
*/
}
void CompositeSurface::reverse_sense ( ) [virtual]

Definition at line 1538 of file CompositeSurface.cpp.

{
  compGeom->reverse();
}       
CompositeSurface * CompositeSurface::split ( VGArray< int > &  indices_to_move)

Definition at line 268 of file CompositeSurface.cpp.

{
  int i;
  
  for( i = 0; i < indices_to_move.size(); i++ )
    if( indices_to_move[i] < 0 || indices_to_move[i] >= num_surfs() )
      return 0;
  
  CompositeGeom* new_geom = compGeom->split( indices_to_move );
  if( !new_geom )
    return 0;
  
  for( i = 0; i < new_geom->num_entities(); i++ )
    new_geom->entity(i)->owner( 0 );
    
  delete facetTool;
  facetTool = 0;
  
  return new CompositeSurface( new_geom );
}

Definition at line 1684 of file CompositeSurface.cpp.

{
  if( this == partner || this->stitchPartner || partner->stitchPartner )
  {
    assert(0);
    return CUBIT_FAILURE;
  }
  
  this->stitchPartner = partner;
  partner->stitchPartner = this;
  return CUBIT_SUCCESS;
}
CubitStatus CompositeSurface::swap_bridge ( TopologyBridge old_tb,
TopologyBridge new_tb,
bool  reversed 
) [virtual]

Implements TBOwner.

Definition at line 509 of file CompositeSurface.cpp.

{
  if( n->owner() )
    return CUBIT_FAILURE;

  int i = compGeom->index_of(o);
  GeometryEntity* ge = dynamic_cast<GeometryEntity*>(n);
  if( i >= 0 && ge != 0 )
  {
    o->owner(0);
    n->owner(this);
    if ( !compGeom->swap( i, ge ) )
      return CUBIT_FAILURE;
    
    if (reversed)
      compGeom->reverse_sense(i);
    return CUBIT_SUCCESS;
  }
  else
    return CUBIT_FAILURE;
}
CubitStatus CompositeSurface::u_v_from_position ( CubitVector const &  position,
double &  u,
double &  v,
CubitVector closest_point 
) [virtual]

Implements Surface.

Definition at line 1272 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->u_v_from_position(pos, u, v, closest);

  PRINT_ERROR("CompositeSurface::u_v_from_position for non-paramtric surface.\n");
    u = v = 0.0;
    return CUBIT_FAILURE;
}
void CompositeSurface::unignore_surface ( int  surface_id)

Definition at line 715 of file CompositeSurface.cpp.

{
   update_facet_tool();
   if(facetTool)
   {
      int i;
      int num_surfs_in_composite = num_surfs();
      for (i=0; i<num_surfs_in_composite; i++)
      {
         Surface *cur_surf = get_surface(i);
         if(cur_surf->get_saved_id() == surface_id)
         {
            surfacesToIgnore.remove(cur_surf);
            update_facets_to_ignore();
            i = num_surfs_in_composite;
         }
      }
   }
}

Definition at line 1697 of file CompositeSurface.cpp.

{
  CompositeSurface* result = this->stitchPartner;
  if( result )
    this->stitchPartner = result->stitchPartner = 0;
  return result;
}
void CompositeSurface::update ( ) [inline]

Definition at line 344 of file CompositeSurface.hpp.

Definition at line 735 of file CompositeSurface.cpp.

{
  if( ! facetTool )
  {
    std::vector<Surface*> surf_vect(num_surfs());
    for ( int i = 0; i < num_surfs(); i++ )
      surf_vect[i] =  get_surface(i);
    facetTool = new CompSurfFacets();
    if ( ! facetTool->setup( surf_vect ) )
    {
      delete facetTool;
      facetTool = 0;
    }
    else
    {
      // Make sure to update the facetTool to reflect
      // any surfaces we think we need to ignore.
      update_facets_to_ignore();
    }
  }
}

Definition at line 644 of file CompositeSurface.cpp.

{
   if(facetTool)
   {
      int i;
      DLIList<int> surfaces_to_ignore;
      int num_surfs_in_composite = num_surfs();
      for (i=0; i<num_surfs_in_composite; i++)
      {
         Surface *cur_surf = get_surface(i);
         surfacesToIgnore.reset();
         for(int j=surfacesToIgnore.size(); j--;)
         {
            if(cur_surf == surfacesToIgnore.get_and_step())
            {
               surfaces_to_ignore.append( i );
               j=0;
            }
         }
      }
      
      //do it all at once
      facetTool->set_ignore_flag( surfaces_to_ignore, 1 );
   }
}
void CompositeSurface::update_modified ( Surface modified_surface,
DLIList< CompositeCurve * > &  new_curves 
) [protected]

Definition at line 1727 of file CompositeSurface.cpp.

{
  int i;
  //int i = index_of(surf);
  //assert(i >= 0);
  //CubitSense rel_sense = get_sense(i);
  
    // find any new coedges in the surface
  DLIList<TopologyBridge*> bridge_list;
  DLIList<LoopSM*> loops;
  DLIList<CoEdgeSM*> coedges;
  
  surf->get_children_virt( bridge_list );
  CAST_LIST( bridge_list, loops, LoopSM );
  assert( bridge_list.size() == loops.size() );
  bridge_list.clean_out();
  
  for( i = loops.size(); i--; )
  {
    loops.get_and_step()->get_children_virt( bridge_list );
    while( bridge_list.size() )
    {
      CoEdgeSM* coedge = dynamic_cast<CoEdgeSM*>(bridge_list.pop());
      assert(0 != coedge);
      coedges.append(coedge);
    }
  }
  
  for( i = coedges.size(); i--; )
  {
    CoEdgeSM* coedge = coedges.get_and_step();
    bridge_list.clean_out();
    coedge->get_children_virt( bridge_list );
    assert( bridge_list.size() == 1 );
    Curve* curve = dynamic_cast<Curve*>(bridge_list.get());
    assert( 0 != curve );
    
    CompositeCoEdge* ccoedge = dynamic_cast<CompositeCoEdge*>(coedge->owner());
    if (ccoedge)
    {
        // If replace-curve was already done for the curve 
        // when processing the other surface, the composite
        // coedge will have been created already.  Add it to
        // the hidden set.
      if( !ccoedge->owner() && ccoedge->get_curve()->owner() == &hidden_entities())
        hidden_entities().hide( ccoedge );
      
        // If the coedge is a composite, the curve must be one
        // already as well.  Done with this coedge.
      continue;
    }
      
      // Replace curve with composite, and hide composite curve 
      // and any new child points.
    CompositeCurve* ccurve = CompositeEngine::instance().replace_curve(curve);
    assert(0 != ccurve);
    new_curves.append(ccurve);
    hidden_entities().hide( ccurve );
    CompositePoint* start = ccurve->start_point();
    if( ! start->owner() )
      hidden_entities().hide(start);
    CompositePoint* end = ccurve->start_point();
    if( ! end->owner() )
      hidden_entities().hide(end);
    
      // CompositeCoEdge was created by replace_curve(..)
      // Add it to the HiddenEntitySet
    ccoedge = dynamic_cast<CompositeCoEdge*>(coedge->owner());
    assert(ccoedge && !ccoedge->owner());
    hidden_entities().hide( ccoedge );
  }
}
void CompositeSurface::update_modified ( ) [protected]

Definition at line 1857 of file CompositeSurface.cpp.

{
    // search for dead CoEdge-Curve pairs
  DLIList<CoEdgeSM*> coedge_list;
  if ( hiddenSet )
    hiddenSet->hidden_coedges( coedge_list );
  
  while (coedge_list.size())
  {
    CompositeCoEdge* coedge = dynamic_cast<CompositeCoEdge*>(coedge_list.pop());
    if ( is_dead_coedge(coedge) )
      remove_dead_coedge(coedge);
  }
  
  CompositeLoop* loop = next_loop();
  while (loop)
  {
    CompositeLoop* next = next_loop(loop);
    CompositeCoEdge* coedge = loop->first_coedge();
    while (coedge && is_dead_coedge(coedge))
    {
      remove_dead_coedge(coedge);
      coedge = loop->first_coedge();
    }
    
    if (coedge)
    {
      coedge = coedge->next();
      while ( coedge != loop->first_coedge() )
      {
        CompositeCoEdge* next_coe = coedge->next();
        if (is_dead_coedge(coedge))
          remove_dead_coedge(coedge);
        coedge = next_coe;
      }
    }
    
    if (loop->first_coedge() == NULL)
    {
      remove(loop);
      delete loop;
    }
    
    loop = next;
  }
  
}
CubitStatus CompositeSurface::uv_derivitives ( double  u,
double  v,
CubitVector du,
CubitVector dv 
) [virtual]

Implements Surface.

Definition at line 1390 of file CompositeSurface.cpp.

{
  if (num_surfs() == 1)
    return get_surface(0)->uv_derivitives(u, v, du, dv);
  
  PRINT_ERROR("CompositeSurface::uv_derivitives for non-paramtric surface.\n");
    return CUBIT_FAILURE;
}

Definition at line 286 of file CompositeSurface.hpp.


Friends And Related Function Documentation

friend class CompositeEngine [friend]

Definition at line 37 of file CompositeSurface.hpp.


Member Data Documentation

Definition at line 319 of file CompositeSurface.hpp.

Definition at line 328 of file CompositeSurface.hpp.

Definition at line 324 of file CompositeSurface.hpp.

Definition at line 310 of file CompositeSurface.hpp.

Definition at line 326 of file CompositeSurface.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines