cgma
TopologyBridge Class Reference

#include <TopologyBridge.hpp>

Inheritance diagram for TopologyBridge:
BodySM CoEdgeSM GeometryEntity LoopSM ShellSM CompositeBody FacetBody OCCBody PartitionBody CompositeCoEdge FacetCoEdge OCCCoEdge PartitionCoEdge Curve Lump Surface TBPoint CompositeLoop FacetLoop OCCLoop PartitionLoop CompositeShell FacetShell OCCShell PartitionShell

List of all members.

Public Types

enum  { MAX_TB_LAYER = 255 }

Public Member Functions

 TopologyBridge ()
virtual ~TopologyBridge ()
virtual void append_simple_attribute_virt (const CubitSimpleAttrib &)=0
virtual void remove_simple_attribute_virt (const CubitSimpleAttrib &)=0
virtual void remove_all_simple_attribute_virt ()=0
virtual CubitStatus get_simple_attribute (DLIList< CubitSimpleAttrib > &)=0
virtual CubitStatus get_simple_attribute (const CubitString &name, DLIList< CubitSimpleAttrib > &)=0
TopologyEntitytopology_entity () const
TBOwnerowner () const
void owner (TBOwner *new_owner)
BridgeManagerbridge_manager () const
void bridge_manager (BridgeManager *manager)
CubitSense bridge_sense ()
void reverse_bridge_sense ()
virtual GeometryQueryEngineget_geometry_query_engine () const =0
virtual int validate (const CubitString &, DLIList< TopologyEntity * > &)
virtual int layer () const
void get_parents (DLIList< TopologyBridge * > &parents)
void get_children (DLIList< TopologyBridge * > &children, bool return_hidden_entities=false, int layer=MAX_TB_LAYER)
void bodysms (DLIList< BodySM * > &bodies, bool unique=true)
void lumps (DLIList< Lump * > &lumps, bool unique=true)
void shellsms (DLIList< ShellSM * > &shellsms, bool unique=true)
void surfaces (DLIList< Surface * > &surfaces, bool unique=true)
void surfaces_ignore_virtual (DLIList< Surface * > &surfaces, bool unique=true)
void loopsms (DLIList< LoopSM * > &loopsms, bool unique=true)
void curves (DLIList< Curve * > &curves, bool unique=true)
void curves_ignore_virtual (DLIList< Curve * > &curves, bool unique=true)
void coedgesms (DLIList< CoEdgeSM * > &coedgesms, bool unique=true)
void points (DLIList< TBPoint * > &points, bool unique=true)
BodySMbodysm ()
Lumplump ()
LoopSMloopsm ()
virtual void get_parents_virt (DLIList< TopologyBridge * > &parents)=0
virtual void get_children_virt (DLIList< TopologyBridge * > &children)=0

Private Attributes

TBOwnerbridgeOwner
CubitSense bridgeSense

Detailed Description

Definition at line 54 of file TopologyBridge.hpp.


Member Enumeration Documentation

anonymous enum
Enumerator:
MAX_TB_LAYER 

Definition at line 158 of file TopologyBridge.hpp.

{ MAX_TB_LAYER = 255 };

Constructor & Destructor Documentation

Definition at line 57 of file TopologyBridge.hpp.

Definition at line 29 of file TopologyBridge.cpp.


Member Function Documentation

Definition at line 44 of file TopologyBridge.cpp.

{
  DLIList<BodySM*> bodies;
  bodysms(bodies);
  if (bodies.size() > 0) return bodies.get();
  else return NULL;
}
void TopologyBridge::bodysms ( DLIList< BodySM * > &  bodies,
bool  unique = true 
)

Definition at line 72 of file TopologyBridge.cpp.

{
  DLIList<TopologyBridge*> parents;
  BodySM* this_body = dynamic_cast<BodySM*>(this);
  if( this_body )
  {
    bodies.append( this_body );
  }
  else if( dynamic_cast<Lump*>(this) )
  {
    get_parents( parents );
    parents.reset();
    for ( int i = parents.size(); i--; )
      bodies.append (dynamic_cast<BodySM*>(parents.get_and_step()));
  }
  else
  {
    get_parents( parents );
    for( int i = parents.size(); i--; )
      parents.get_and_step()->bodysms( bodies, false );
    
    if (unique)
      bodies.uniquify_ordered();
  }
}

Definition at line 443 of file TopologyBridge.cpp.

{ return dynamic_cast<BridgeManager*>(bridgeOwner); }

Definition at line 446 of file TopologyBridge.cpp.

{ bridgeOwner = manager; }

Definition at line 123 of file TopologyBridge.hpp.

    { return bridgeSense; }
void TopologyBridge::coedgesms ( DLIList< CoEdgeSM * > &  coedgesms,
bool  unique = true 
)

Definition at line 255 of file TopologyBridge.cpp.

{
  DLIList<TopologyBridge*> related;
  
  CoEdgeSM* this_coedge = dynamic_cast<CoEdgeSM*>(this);
  if( this_coedge )
  {
    coedges.append(this_coedge);
  }
  else if( dynamic_cast<Curve*>(this) )
  {
    get_parents( related );
    related.reset();
    for (int i = related.size(); i--; )
      coedges.append( dynamic_cast<CoEdgeSM*>(related.get_and_step()) );
  }
  else if( dynamic_cast<LoopSM*>(this) )
  {
    get_children( related );
    related.reset();
    for (int i = related.size(); i--; )
      coedges.append( dynamic_cast<CoEdgeSM*>(related.get_and_step()) );
  }
  else
  {
    if( dynamic_cast<TBPoint*>(this) )
      get_parents( related );
    else
      get_children( related );
    
    related.reset();  
    for( int i = related.size(); i--; )
      related.get_and_step()->coedgesms(coedges, false);
    
    if (unique)
      coedges.uniquify_ordered();
  }
}  
void TopologyBridge::curves ( DLIList< Curve * > &  curves,
bool  unique = true 
)

Definition at line 379 of file TopologyBridge.cpp.

{
  DLIList<TopologyBridge*> related;
  
  Curve* this_curve = dynamic_cast<Curve*>(this);
  if( this_curve )
  {
    curves.append(this_curve);
  }
  else if( dynamic_cast<TBPoint*>(this) )
  {
    get_parents( related );
    related.reset();
    for (int i = related.size(); i--; )
      curves.append( dynamic_cast<Curve*>(related.get_and_step()) );
  }
  else if( dynamic_cast<CoEdgeSM*>(this) )
  {
    get_children( related );
    related.reset();
    for (int i = related.size(); i--; )
      curves.append( dynamic_cast<Curve*>(related.get_and_step()) );
  }
  else
  {
    get_children( related );
    
    related.reset();
    for (int i = related.size(); i--; )
      related.get_and_step()->curves (curves, false);
    
    if (unique)
      curves.uniquify_ordered();
  }
}  
void TopologyBridge::curves_ignore_virtual ( DLIList< Curve * > &  curves,
bool  unique = true 
)

Definition at line 294 of file TopologyBridge.cpp.

{
  int i;
  if(dynamic_cast<BodySM*>(this))
  {
    DLIList<TopologyBridge*> lumps;
    this->get_children_virt(lumps);
    for(i=lumps.size(); i>0; i--)
      lumps.get_and_step()->curves_ignore_virtual(curves, unique);
  }
  else if(dynamic_cast<Lump*>(this))
  {
    DLIList<TopologyBridge*> shells;
    this->get_children_virt(shells);
    for(i=shells.size(); i>0; i--)
      shells.get_and_step()->curves_ignore_virtual(curves, unique);
  }
  else if(dynamic_cast<ShellSM*>(this))
  {
    DLIList<TopologyBridge*> surfs;
    this->get_children_virt(surfs);
    for(i=surfs.size(); i>0; i--)
      surfs.get_and_step()->curves_ignore_virtual(curves, unique);
  }
  else if(dynamic_cast<Surface*>(this))
  {
    DLIList<TopologyBridge*> loops;
    this->get_children_virt(loops);
    for(i=loops.size(); i>0; i--)
      loops.get_and_step()->curves_ignore_virtual(curves, unique);
  }
  else if(dynamic_cast<LoopSM*>(this))
  {
    DLIList<TopologyBridge*> coedges;
    this->get_children_virt(coedges);
    for(i=coedges.size(); i>0; i--)
      coedges.get_and_step()->curves_ignore_virtual(curves, unique);
  }
  else if(dynamic_cast<CoEdgeSM*>(this))
  {
    DLIList<TopologyBridge*> tmp_curves;
    this->get_children_virt(tmp_curves);
    for(i=tmp_curves.size(); i>0; i--)
      tmp_curves.get_and_step()->curves_ignore_virtual(curves, unique);
  }
  else if(dynamic_cast<Curve*>(this))
  {
    curves.append(dynamic_cast<Curve*>(this));
  }
  if(unique)
    curves.uniquify_ordered();
}
void TopologyBridge::get_children ( DLIList< TopologyBridge * > &  children,
bool  return_hidden_entities = false,
int  layer = MAX_TB_LAYER 
)

Definition at line 527 of file TopologyBridge.cpp.

{
  assert(this->layer() <= layer);
  
  DLIList<TopologyBridge*> child_list[2], partitions;
  int current = 0;
  
  get_children_virt( child_list[current] );
  // Note: be careful to return result list in the same order
  // as the child list we got above.
  
  bool done = false;
  while( !done )
  {
    done = true;
    
    int next = 1 - current;
    child_list[current].reset();
    child_list[next].clean_out();
    for( int i = child_list[current].size(); i--; )
    {
      TopologyBridge* child = child_list[current].get_and_step();
      TBOwner* owner = child->owner();
      
      TopologyBridge* composite = 0;
      TBOwnerSet* partition = 0;
      
      if( !owner || dynamic_cast<BridgeManager*>(owner) )
      {
        child_list[next].append( child );
      }
      else if( (partition = dynamic_cast<TBOwnerSet*>(owner) ) != NULL )
      {
        if( partition->get_owner_layer() > layer )
        {
          child_list[next].append(child);
        }
        else
        {
          done = false;
          partitions.clean_out();
          partition->get_owners( partitions );
          partitions.reset();
          child_list[next] += partitions;
        }
      }
      else if( (composite = dynamic_cast<TopologyBridge*>(owner) ) != NULL )
      {
        if( composite->layer() > layer )
        {
           child_list[next].append(child);
        }
        else
        {
          done = false;
          if( !child_list[current].is_in_list(composite) )
            child_list[next].append_unique( composite );
        }
      }
      else if( return_hidden )
      {
        child_list[next].append( child );
      }
      else
      {
        ; // Do nothing. This entity is hidden by some composite.
      }
    }
      
    current = next;
  }
  
  children = child_list[current];
}

Definition at line 449 of file TopologyBridge.cpp.

{
  parents.clean_out();
  get_parents_virt( parents );
  for ( int i = parents.size(); i--; )
  {
    TopologyBridge* tb_ptr = parents.step_and_get();
    TBOwnerSet* partition_body = dynamic_cast<TBOwnerSet*>(tb_ptr->owner());
    if ( partition_body )
    {
      DLIList<TopologyBridge*> owner_list;
      partition_body->get_owners(owner_list);
      assert(owner_list.size() == 1);
      parents.change_to(owner_list.get());
    }
  }
}

Definition at line 61 of file TopologyBridge.cpp.

{
  DLIList<LoopSM*> loopsm_list;
  loopsms(loopsm_list);
  if (loopsm_list.size() > 0) return loopsm_list.get();
  else return NULL;
}
void TopologyBridge::loopsms ( DLIList< LoopSM * > &  loopsms,
bool  unique = true 
)

Definition at line 215 of file TopologyBridge.cpp.

{
  DLIList<TopologyBridge*> related;
  
  LoopSM* this_loop = dynamic_cast<LoopSM*>(this);
  if( this_loop )
  {
    loops.append(this_loop);
  }
  else if( dynamic_cast<CoEdgeSM*>(this ) )
  {
    get_parents( related );
    related.reset();
    for (int i = related.size(); i--; )
      loops.append( dynamic_cast<LoopSM*>(related.get_and_step()) );
  }
  else if( dynamic_cast<Surface*>(this) )
  {
    get_children( related );
    related.reset();
    for (int i = related.size(); i--; )
      loops.append( dynamic_cast<LoopSM*>(related.get_and_step()) );
  }
  else
  {
    if( dynamic_cast<Curve*>(this) || dynamic_cast<TBPoint*>(this) )
      get_parents( related );
    else
      get_children( related );
      
    related.reset();
    for( int i = related.size(); i--; )
      related.get_and_step()->loopsms( loops, false );
    
    if (unique)
      loops.uniquify_ordered();
  }
}  

Definition at line 52 of file TopologyBridge.cpp.

{
  DLIList<Lump*> lump_list;
  lumps(lump_list);
  if (lump_list.size() > 0) return lump_list.get();
  else return NULL;
}
void TopologyBridge::lumps ( DLIList< Lump * > &  lumps,
bool  unique = true 
)

Definition at line 98 of file TopologyBridge.cpp.

{
  DLIList<TopologyBridge*> related;
  Lump* this_lump = dynamic_cast<Lump*>(this);
  if( this_lump )
  {
    lumps.append( this_lump );
  }
  else if( dynamic_cast<BodySM*>(this) )
  {
    get_children( related );
    related.reset();
    for ( int i = related.size(); i--; )
      lumps.append( dynamic_cast<Lump*>(related.get_and_step()) );
  }
  else if( dynamic_cast<ShellSM*>(this) )
  {
    get_parents( related );
    related.reset();
    for ( int i = related.size(); i--; )
      lumps.append( dynamic_cast<Lump*>(related.get_and_step()) );
  }
  else
  {
    get_parents( related );
    for( int i = related.size(); i--; )
      related.get_and_step()->lumps( lumps, false );
      
    if (unique)
      lumps.uniquify_ordered();
  }
}
TBOwner* TopologyBridge::owner ( ) const [inline]

Definition at line 114 of file TopologyBridge.hpp.

    { return bridgeOwner; }
void TopologyBridge::owner ( TBOwner new_owner) [inline]

Definition at line 117 of file TopologyBridge.hpp.

    { bridgeOwner = new_owner; }
void TopologyBridge::points ( DLIList< TBPoint * > &  points,
bool  unique = true 
)

Definition at line 415 of file TopologyBridge.cpp.

{
  DLIList<TopologyBridge*> children;
  
  TBPoint* this_point = dynamic_cast<TBPoint*>(this);
  if( this_point )
  {
    points.append(this_point);
  }
  else if( dynamic_cast<Curve*>(this) )
  {
    get_children( children );
    children.reset();
    for (int i = children.size(); i--; )
      points.append( dynamic_cast<TBPoint*>(children.get_and_step()) );
  }
  else
  {
    get_children( children );
      
    for( int i = children.size(); i--; )
      children.get_and_step()->points(points, false);
    
    if (unique)
      points.uniquify_ordered();
  }
}  
void TopologyBridge::shellsms ( DLIList< ShellSM * > &  shellsms,
bool  unique = true 
)

Definition at line 131 of file TopologyBridge.cpp.

{
  DLIList<TopologyBridge*> related;
  ShellSM* this_shell = dynamic_cast<ShellSM*>(this);
  if( this_shell )
  {
    shells.append(this_shell);
  }
  else if( dynamic_cast<Lump*>(this) )
  {
    get_children( related );
    related.reset();
    for ( int i = related.size(); i--; )
      shells.append( dynamic_cast<ShellSM*>(related.get_and_step()) );
  }
  else if( dynamic_cast<Surface*>(this) )
  {
    get_parents( related );
    related.reset();
    for ( int i = related.size(); i--; )
      shells.append( dynamic_cast<ShellSM*>(related.get_and_step()) );
  }
  else if( dynamic_cast<BodySM*>(this) )
  {
    get_children( related );
    for ( int i = related.size(); i--; )
      related.get_and_step()->shellsms( shells );
  }
  else 
  {
    get_parents( related );
      
    for( int i = related.size(); i--; )
      related.get_and_step()->shellsms( shells, false );
    
    if ( unique )
      shells.uniquify_ordered();
  }
}  
void TopologyBridge::surfaces ( DLIList< Surface * > &  surfaces,
bool  unique = true 
)

Definition at line 171 of file TopologyBridge.cpp.

{
  DLIList<TopologyBridge*> related;
  Surface* this_surf = dynamic_cast<Surface*>(this);
  if( this_surf )
  {
    surfaces.append(this_surf);
  }
  else if( dynamic_cast<LoopSM*>(this) )
  {
    get_parents( related );
    related.reset();
    for (int i = related.size(); i--; )
      surfaces.append( dynamic_cast<Surface*>(related.get_and_step()) );
  }
  else if( dynamic_cast<ShellSM*>(this) )
  {
    get_children( related );
    related.reset();
    for (int i = related.size(); i--; )
      surfaces.append( dynamic_cast<Surface*>(related.get_and_step()) );
  }
  else if ( dynamic_cast<BodySM*>(this) || dynamic_cast<Lump*>(this) )
  {
    get_children(related);
    related.reset();
    for (int i = related.size(); i--; )
      related.get_and_step()->surfaces( surfaces, false );
      
    if (unique)
      surfaces.uniquify_ordered();
  }
  else
  {
    get_parents(related);
    related.reset();
    for (int i = related.size(); i--; )
      related.get_and_step()->surfaces( surfaces, false );

    if (unique && !dynamic_cast<CoEdgeSM*>(this))
      related.uniquify_ordered();
  }
}  
void TopologyBridge::surfaces_ignore_virtual ( DLIList< Surface * > &  surfaces,
bool  unique = true 
)

Definition at line 347 of file TopologyBridge.cpp.

{
  int i;
  if(dynamic_cast<BodySM*>(this))
  {
    DLIList<TopologyBridge*> lumps;
    this->get_children_virt(lumps);
    for(i=lumps.size(); i>0; i--)
      lumps.get_and_step()->surfaces_ignore_virtual(surfaces, unique);
  }
  else if(dynamic_cast<Lump*>(this))
  {
    DLIList<TopologyBridge*> shells;
    this->get_children_virt(shells);
    for(i=shells.size(); i>0; i--)
      shells.get_and_step()->surfaces_ignore_virtual(surfaces, unique);
  }
  else if(dynamic_cast<ShellSM*>(this))
  {
    DLIList<TopologyBridge*> surfs;
    this->get_children_virt(surfs);
    for(i=surfs.size(); i>0; i--)
      surfs.get_and_step()->surfaces_ignore_virtual(surfaces, unique);
  }
  else if(dynamic_cast<Surface*>(this))
  {
    surfaces.append(dynamic_cast<Surface*>(this));
  }
  if(unique)
    surfaces.uniquify_ordered();
}

Definition at line 35 of file TopologyBridge.cpp.

{
  BridgeManager* bridgeManager = bridge_manager();
  if (bridgeManager)
    return bridgeManager->topology_entity();
  else
    return NULL;
}
virtual int TopologyBridge::validate ( const CubitString ,
DLIList< TopologyEntity * > &   
) [inline, virtual]

Reimplemented in FacetBody.

Definition at line 150 of file TopologyBridge.hpp.

    { return 0; }

Member Data Documentation

Definition at line 206 of file TopologyBridge.hpp.

Definition at line 208 of file TopologyBridge.hpp.


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