cgma
CompositeCoEdge Class Reference

#include <CompositeCoEdge.hpp>

Inheritance diagram for CompositeCoEdge:
CoEdgeSM TBOwner TopologyBridge

List of all members.

Public Member Functions

 CompositeCoEdge (CoEdgeSM *coedge_ptr)
 CompositeCoEdge (CompositeCurve *point_curve)
 ~CompositeCoEdge ()
int num_coedges () const
int index_of (CoEdgeSM *coedge_ptr) const
int index_of (Curve *curve_ptr) const
CubitSense get_sense (int index) const
CoEdgeSMget_coedge (int index) const
CompositeCoEdgenext () const
CompositeCoEdgeprev () const
CubitStatus combine (CompositeCoEdge *dead_coedge, bool prepend)
CubitStatus insert_coedge (int index, CoEdgeSM *coedge)
CubitStatus remove_coedge (int index)
CompositeCoEdgesplit (int index)
CompositePointstart_point ()
CompositePointend_point ()
virtual CubitSense sense ()
void sense (CubitSense sense)
CompositeLoopget_loop () const
CompositeCurveget_curve () const
LoopSMget_parent_loop ()
void get_parents_virt (DLIList< TopologyBridge * > &parents)
void get_children_virt (DLIList< TopologyBridge * > &children)
GeometryQueryEngineget_geometry_query_engine () const
int layer () const
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)
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 reverse ()
void print_debug_info (const char *line_prefix=0, bool brief=false)

Private Member Functions

 CompositeCoEdge ()

Private Attributes

VGArray< CoEdgeSM * > coedgeSet
CubitSense mySense
CompositeLoopmyLoop
CompositeCoEdgenextCoedge
CompositeCoEdgeprevCoedge
CompositeCurvemyCurve
CompositeCoEdgenextOnCurve

Friends

class CompositeLoop
class CompositeCurve

Detailed Description

Definition at line 25 of file CompositeCoEdge.hpp.


Constructor & Destructor Documentation

Definition at line 31 of file CompositeCoEdge.cpp.

  : myLoop(0), 
    nextCoedge(0), 
    prevCoedge(0), 
    myCurve(0), 
    nextOnCurve(0)
{
  mySense = coedge->sense();
  coedgeSet.push( coedge );
  if( coedge->owner() )
    coedge->owner()->swap_bridge( coedge, this, false );
  coedge->owner(this);
}

Definition at line 45 of file CompositeCoEdge.cpp.

  : mySense(CUBIT_FORWARD),
    myLoop(0), 
    nextCoedge(0), 
    prevCoedge(0), 
    myCurve(0), 
    nextOnCurve(0)
{
  assert(point_curve->num_curves() == 0);
  CubitStatus stat = point_curve->add(this);
  assert(stat);
  if (CUBIT_SUCCESS != stat) {
    PRINT_ERROR("Failed to add a coedge to point curve.\n");
  }
}

Definition at line 79 of file CompositeCoEdge.cpp.

{
  if( myLoop )
    myLoop->remove(this);
  if( myCurve )
    myCurve->remove(this);

  assert( !prevCoedge && !nextCoedge && !nextOnCurve );

  for( int i = 0; i < coedgeSet.size(); i++ )
    if( coedgeSet[i]->owner() == this )
      coedgeSet[i]->owner(0);
}

Definition at line 61 of file CompositeCoEdge.cpp.


Member Function Documentation

void CompositeCoEdge::append_simple_attribute_virt ( const CubitSimpleAttrib simple_attrib_ptr) [virtual]

Implements TopologyBridge.

Definition at line 474 of file CompositeCoEdge.cpp.

{ }
CubitStatus CompositeCoEdge::combine ( CompositeCoEdge dead_coedge,
bool  prepend 
)

Definition at line 185 of file CompositeCoEdge.cpp.

{
  int insert;
  if ( prepend )
  {
    insert = 0;
    coedgeSet.size_end( coedgeSet.size() + dead->coedgeSet.size() );
  }
  else
  {
    insert = coedgeSet.size();
    coedgeSet.size( coedgeSet.size() + dead->coedgeSet.size() );
  }
  
  for( int i = 0; i < dead->coedgeSet.size(); i++ )
  {
    CoEdgeSM* coedge = dead->coedgeSet[i];
    assert( coedge->owner() == dead );
    coedge->owner(this);
    coedgeSet[insert++] = coedge;
  }
  dead->coedgeSet.size(0);
  return CUBIT_SUCCESS;
}

Reimplemented from TBOwner.

Definition at line 443 of file CompositeCoEdge.cpp.

{
  CompositeCoEdge* coedge = dynamic_cast<CompositeCoEdge*>(bridge);
  return (index_of(coedge) < 0) ? CUBIT_FALSE : CUBIT_TRUE;
}
void CompositeCoEdge::get_children_virt ( DLIList< TopologyBridge * > &  children) [virtual]

Implements TopologyBridge.

Definition at line 278 of file CompositeCoEdge.cpp.

{ 
  if( myCurve ) 
  {
    children.append( myCurve->primary_stitched_curve() ); 
  }
/*
  else if( num_coedges() )
  {
    DLIList<TopologyBridge*> coedge_children;
    coedge(0)->get_children( coedge_children );
    assert( coedge_children.size() == 1 );
    children.append( coedge_children.get() );
  }
*/
}
CoEdgeSM * CompositeCoEdge::get_coedge ( int  index) const [inline]

Definition at line 120 of file CompositeCoEdge.hpp.

  { return coedgeSet[index]; }

Definition at line 138 of file CompositeCoEdge.hpp.

  { return myCurve; }

Definition at line 135 of file CompositeCoEdge.hpp.

  { return myLoop; }

Definition at line 349 of file CompositeCoEdge.cpp.

{
  LoopSM* result = get_loop();
  
  if( !result && num_coedges() )
  {
    DLIList<TopologyBridge*> parents(1);
    get_coedge(0)->get_parents_virt( parents );
    assert( parents.size() == 1 );
    result = dynamic_cast<LoopSM*>(parents.get());
  }
  
  return result;
}
void CompositeCoEdge::get_parents_virt ( DLIList< TopologyBridge * > &  parents) [virtual]

Implements TopologyBridge.

Definition at line 260 of file CompositeCoEdge.cpp.

{ 
  LoopSM* result = get_parent_loop();
  if( result ) 
  {
    parents.append( result ); 
  }
}
CubitSense CompositeCoEdge::get_sense ( int  index) const

Implements TopologyBridge.

Definition at line 480 of file CompositeCoEdge.cpp.

{ return CUBIT_FAILURE; }
CubitStatus CompositeCoEdge::get_simple_attribute ( const CubitString name,
DLIList< CubitSimpleAttrib > &  attrib_list 
) [virtual]

Implements TopologyBridge.

Definition at line 482 of file CompositeCoEdge.cpp.

{ return CUBIT_FAILURE; }
int CompositeCoEdge::index_of ( CoEdgeSM coedge_ptr) const [inline]

Definition at line 123 of file CompositeCoEdge.hpp.

  { return coedgeSet.find( coedge ); }
int CompositeCoEdge::index_of ( Curve curve_ptr) const

Definition at line 123 of file CompositeCoEdge.cpp.

{
  int i;
  DLIList<TopologyBridge*> curve_list;
  TopologyBridge* curve = ptr;
  for( i = coedgeSet.size() - 1; i > 0; i-- )
  {
    curve_list.clean_out();
    coedgeSet[i]->get_children( curve_list );
    if( curve_list.is_in_list( curve ) )
      break;
  }
  return i;
}
CubitStatus CompositeCoEdge::insert_coedge ( int  index,
CoEdgeSM coedge 
)

Definition at line 548 of file CompositeCoEdge.cpp.

{
  if( index < 0 || index > coedgeSet.size() )
    return CUBIT_FAILURE;
  
  coedgeSet.insert(coedge, index);
  coedge->owner(this);
  return CUBIT_SUCCESS;
}
int CompositeCoEdge::layer ( ) const [inline, virtual]

Reimplemented from TopologyBridge.

Definition at line 81 of file CompositeCoEdge.hpp.

{ return COMPOSITE_LAYER; }
CompositeCoEdge * CompositeCoEdge::next ( ) const [inline]

Definition at line 132 of file CompositeCoEdge.hpp.

  { return nextCoedge; }
void CompositeCoEdge::notify_reversed ( TopologyBridge bridge) [virtual]

Implements TBOwner.

Definition at line 449 of file CompositeCoEdge.cpp.

  {}
int CompositeCoEdge::num_coedges ( ) const [inline]

Definition at line 117 of file CompositeCoEdge.hpp.

  { return coedgeSet.size(); }
void CompositeCoEdge::print_debug_info ( const char *  line_prefix = 0,
bool  brief = false 
)

Definition at line 558 of file CompositeCoEdge.cpp.

{
  if( prefix == 0 ) prefix = "";
  
  const char* sense = mySense == CUBIT_FORWARD ? "Forward" :
                      mySense == CUBIT_REVERSED ? "Reverse" : "UNKNOWN";
                      
  PRINT_INFO("%sCompCoEdge %p %s ", prefix, (void*)this, sense );
  if ( num_coedges() == 1 )
    PRINT_INFO("%s %p ", fix_type_name(typeid(*get_coedge(0)).name()),
      (void*)get_coedge(0));
  else
    PRINT_INFO("%d coedges ", num_coedges() );
    
  if( !myCurve )
    PRINT_INFO("NULL CURVE\n");
  else if( brief )
#ifdef TOPOLOGY_BRIDGE_IDS
    PRINT_INFO("curve %d\n", myCurve->get_id() );
#else
    PRINT_INFO("curve %p\n", (void*)myCurve );
#endif
  else
    { PRINT_INFO("\n  ");  myCurve->print_debug_info(prefix, true); }

/*  
  if( coedgeSet.size() == 0 )
    PRINT_INFO(" No CoEdgeSMs!\n");
  else if( coedgeSet.size() == 1 )
    PRINT_INFO(" CoEdgeSM=%p\n", coedgeSet[0] );
  else
  {
    PRINT_INFO("\n");
    for( int i = 0; i < coedgeSet.size(); i++ )
      PRINT_INFO("%s  CoEdgeSM[%d] = %p\n", prefix, i, coedgeSet[i] );
  }
*/
}

Implements TopologyBridge.

Definition at line 478 of file CompositeCoEdge.cpp.

{ }

Implements TBOwner.

Definition at line 373 of file CompositeCoEdge.cpp.

{
  int index;
  for( index = coedgeSet.size() - 1; index >= 0; index-- )
    if( coedgeSet[index] == bridge )
      break;
  if( index < 0 )
    return CUBIT_FAILURE;
  
  coedgeSet.remove( index );
  bridge->owner(0);
/*  
  if ( coedgeSet.size() > 0 )
    return CUBIT_SUCCESS;
  
  if ( get_curve() )
    get_curve()->remove(this);

  if ( get_loop() )
  {
    CompositeLoop* loop = get_loop();
    loop->remove(this);
    if ( loop->first_coedge() == 0 )
      delete loop;
  }
  
  delete this;  
*/    
  return CUBIT_SUCCESS;
}

Definition at line 536 of file CompositeCoEdge.cpp.

{
  if( index < 0 || index >= coedgeSet.size() )
    return CUBIT_FAILURE;
  
  coedgeSet[index]->owner(0);
  coedgeSet.remove( index );

  return CUBIT_SUCCESS;
}
void CompositeCoEdge::remove_simple_attribute_virt ( const CubitSimpleAttrib simple_attrib_ptr) [virtual]

Implements TopologyBridge.

Definition at line 476 of file CompositeCoEdge.cpp.

{ }

Definition at line 489 of file CompositeCoEdge.cpp.

{
  switch( mySense ) {
    case CUBIT_FORWARD:
      mySense = CUBIT_REVERSED;
      break;
    case CUBIT_REVERSED:
      mySense = CUBIT_FORWARD;
      break;
    default:
      mySense = CUBIT_UNKNOWN;
  }
  
  int half = coedgeSet.size() / 2;
  for( int i = 0; i < half; i++ )
  {
    int j = coedgeSet.size() - i - 1;
    CoEdgeSM* tmp = coedgeSet[i];
    coedgeSet[i] = coedgeSet[j];
    coedgeSet[j] = tmp;
  }
    
}
CubitSense CompositeCoEdge::sense ( ) [inline, virtual]

Implements CoEdgeSM.

Definition at line 129 of file CompositeCoEdge.hpp.

  { return mySense; }
void CompositeCoEdge::sense ( CubitSense  sense) [inline]

Definition at line 126 of file CompositeCoEdge.hpp.

  { assert( sense != CUBIT_UNKNOWN ); mySense = sense; }

Definition at line 147 of file CompositeCoEdge.cpp.

{
  if( index < 0 || index >= coedgeSet.size() )
    return 0;
  
  ++index;
  CompositeCoEdge* new_cce = new CompositeCoEdge();
  new_cce->mySense = mySense;
  
  int new_cce_count = coedgeSet.size() - index;
  new_cce->coedgeSet.size( new_cce_count );
  
  for( int i = 0; i < new_cce_count; i++ )
  {
    new_cce->coedgeSet[i] = coedgeSet[i+index];
    new_cce->coedgeSet[i]->owner( new_cce );
  }
  coedgeSet.size( index );
  
  if( myLoop )
  {
    CubitStatus s;
    if( mySense == CUBIT_FORWARD )
      s = myLoop->insert_after( new_cce, this );
    else
      s = myLoop->insert_before( new_cce, this );
    assert( s );
    if (CUBIT_SUCCESS != s) {
      PRINT_ERROR("Failed to insert a child coedge.\n");
      return NULL;
    }
  }
  
  new_cce->mySense = mySense;
  
  return new_cce;
}
CubitStatus CompositeCoEdge::swap_bridge ( TopologyBridge old_tb,
TopologyBridge new_tb,
bool  reversed 
) [virtual]

Implements TBOwner.

Definition at line 413 of file CompositeCoEdge.cpp.

{
  CoEdgeSM* old_coedge = dynamic_cast<CoEdgeSM*>(old_tb);
  CoEdgeSM* new_coedge = dynamic_cast<CoEdgeSM*>(new_tb);
  
  int index = index_of( old_coedge );
  if( index < 0 || !new_coedge || index_of(new_coedge) >= 0 )
    return CUBIT_FAILURE;
  
  coedgeSet[index] = new_coedge;

  old_tb->owner(0);
  if( new_tb->owner() )
    new_tb->owner()->remove_bridge( new_tb );
  new_tb->owner(this);
  
  return CUBIT_SUCCESS;
}

Friends And Related Function Documentation

friend class CompositeCurve [friend]

Definition at line 28 of file CompositeCoEdge.hpp.

friend class CompositeLoop [friend]

Definition at line 27 of file CompositeCoEdge.hpp.


Member Data Documentation

Definition at line 105 of file CompositeCoEdge.hpp.

Definition at line 113 of file CompositeCoEdge.hpp.

Definition at line 109 of file CompositeCoEdge.hpp.

Definition at line 107 of file CompositeCoEdge.hpp.

Definition at line 110 of file CompositeCoEdge.hpp.

Definition at line 114 of file CompositeCoEdge.hpp.

Definition at line 111 of file CompositeCoEdge.hpp.


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