cgma
BridgeManager Class Reference

#include <BridgeManager.hpp>

Inheritance diagram for BridgeManager:
TBOwner

List of all members.

Public Member Functions

 BridgeManager ()
virtual ~BridgeManager ()
void set_entity (TopologyEntity *ent)
virtual CubitStatus add_bridge (TopologyBridge *bridge)
CubitStatus add_bridge_as_representation (TopologyBridge *bridge)
virtual CubitStatus remove_bridge (TopologyBridge *bridge)
virtual CubitStatus bridge_destroyed (TopologyBridge *bridge)
CubitStatus remove_all_bridges ()
CubitStatus merge (BridgeManager *dead_manager, CubitSense relative_sense)
virtual CubitStatus swap_bridge (TopologyBridge *old_tb, TopologyBridge *new_tb, bool reversed)
virtual CubitBoolean contains_bridge (TopologyBridge *bridge) const
int get_bridge_list (DLIList< TopologyBridge * > &bridge_list) const
TopologyBridgetopology_bridge () const
int get_bridge_list (DLIList< TopologyBridge * > &bridge_list, GeometryQueryEngine *gme_ptr) const
TopologyBridgetopology_bridge (GeometryQueryEngine *gme_ptr) const
int number_of_bridges () const
TopologyEntitytopology_entity () const
void reverse_bridge_senses ()
virtual void notify_reversed (TopologyBridge *bridge)

Private Attributes

TopologyEntitytopologyEntity
std::vector< TopologyBridge * > mergeList

Detailed Description

Definition at line 28 of file BridgeManager.hpp.


Constructor & Destructor Documentation

Definition at line 23 of file BridgeManager.cpp.

    : topologyEntity(NULL)
{
}

Definition at line 29 of file BridgeManager.cpp.

{
  std::vector<TopologyBridge*>::iterator iter;
  for (iter=mergeList.begin(); iter!=mergeList.end(); iter++)
  {
    delete (*iter);
  }
  mergeList.clear();
}

Member Function Documentation

Definition at line 49 of file BridgeManager.cpp.

{
  if( !bridge || bridge->owner() )
  {
    assert( bridge && !bridge->owner() );
    return CUBIT_FAILURE;
  }

  mergeList.push_back(bridge);
  
  bridge->owner(this);
  return CUBIT_SUCCESS;
}

Definition at line 64 of file BridgeManager.cpp.

{
    // Make sure bridge isn't already owned by someone else
  if( !bridge || bridge->owner() ) 
  {
    assert( bridge && !bridge->owner() ); 
    return CUBIT_FAILURE;
  }

  // Add the bridge to the beginning of the list
  mergeList.insert(mergeList.begin(), bridge );
    
  bridge->owner(this);
  return CUBIT_SUCCESS;
}  

Reimplemented from TBOwner.

Definition at line 95 of file BridgeManager.cpp.

{
//  if( firstBridge == bridge &&
//      bridge->next_bridge() &&
//      bridge->next_bridge()->bridge_sense() != bridge->bridge_sense() )
//    topologyEntity->reverse_topology();

  return remove_bridge( bridge );
}

Reimplemented from TBOwner.

Definition at line 154 of file BridgeManager.cpp.

{
  return bridge->owner() == (TBOwner*)this;
}
int BridgeManager::get_bridge_list ( DLIList< TopologyBridge * > &  bridge_list) const

Definition at line 162 of file BridgeManager.cpp.

{
  std::vector<TopologyBridge*>::const_iterator iter;
  for (iter = mergeList.begin(); iter != mergeList.end(); iter++)
  {
    bridge_list.append(*iter);
  }
  return mergeList.size();
}
int BridgeManager::get_bridge_list ( DLIList< TopologyBridge * > &  bridge_list,
GeometryQueryEngine gme_ptr 
) const

Definition at line 176 of file BridgeManager.cpp.

{
  std::vector<TopologyBridge*>::const_iterator iter;
  for (iter=mergeList.begin(); iter!=mergeList.end(); iter++)
  {
    if ( (*iter)->get_geometry_query_engine() == gqe_ptr )
      bridge_list.append(*iter);
  }
  return bridge_list.size();
  // TODO - BWH - return on this function should be consistent with other bridge list function
}
CubitStatus BridgeManager::merge ( BridgeManager dead_manager,
CubitSense  relative_sense 
)

Definition at line 127 of file BridgeManager.cpp.

{
  if (dead_manager->mergeList.empty())
    return CUBIT_SUCCESS;
  
    // Remove bridge list from dead BridgeManager
  std::vector<TopologyBridge*> dead_list = dead_manager->mergeList;
  dead_manager->mergeList.clear();

    // Set owner and reverse sense if necessary
    // for all bridges in merge list.
  std::vector<TopologyBridge*>::iterator iter;
  for (iter = dead_list.begin(); iter != dead_list.end(); iter++)
  {
    (*iter)->owner(this);
    if( relative_sense == CUBIT_REVERSED )
      (*iter)->reverse_bridge_sense();
  }
  
    // append merge list to end of this manager's bridge list
  mergeList.insert(mergeList.end(), dead_list.begin(), dead_list.end());
  
  return CUBIT_SUCCESS;
}
void BridgeManager::notify_reversed ( TopologyBridge bridge) [virtual]

Implements TBOwner.

Definition at line 260 of file BridgeManager.cpp.

{
  bridge->reverse_bridge_sense();
}

Definition at line 255 of file BridgeManager.cpp.

{
  return mergeList.size();
}

Definition at line 105 of file BridgeManager.cpp.

{
  if (mergeList.empty())
    return CUBIT_SUCCESS;

  std::vector<TopologyBridge*>::iterator iter;
  std::vector<TopologyBridge*> temp_list;

  // make a copy of the list so we can modify the real one
  temp_list = mergeList;

  for (iter=temp_list.begin(); iter!=temp_list.end(); iter++)
  {
    if (!remove_bridge( *iter ))
      break;
  }

  return mergeList.empty() ? CUBIT_SUCCESS : CUBIT_FAILURE;
}

Implements TBOwner.

Definition at line 82 of file BridgeManager.cpp.

{
  std::vector<TopologyBridge*>::iterator iter;
  iter = std::find(mergeList.begin(), mergeList.end(), bridge);
  if (iter != mergeList.end())
    mergeList.erase(iter);
  else
    return CUBIT_FAILURE;
  
  bridge->owner(0);
  return CUBIT_SUCCESS;
}

Definition at line 204 of file BridgeManager.cpp.

{
  std::vector<TopologyBridge*>::iterator iter;
  for (iter=mergeList.begin(); iter!=mergeList.end(); iter++)
  {
    (*iter)->reverse_bridge_sense();
  }
}  

Definition at line 39 of file BridgeManager.cpp.

{
  topologyEntity = ent;
}
CubitStatus BridgeManager::swap_bridge ( TopologyBridge old_tb,
TopologyBridge new_tb,
bool  reversed 
) [virtual]

Implements TBOwner.

Definition at line 213 of file BridgeManager.cpp.

{
    // make sure new_tb isn't already owned by someone else
  if( new_tb->owner() != NULL )
  {
    assert( new_tb->owner() == 0 );
    return CUBIT_FAILURE;
  }

    // Replace old bridge with new bridge at same location
    // in linked list.

  std::vector<TopologyBridge*>::iterator iter;
  iter = std::find(mergeList.begin(), mergeList.end(), old_tb);
  if (iter != mergeList.end())
  {
    iter = mergeList.erase(iter);
    mergeList.insert(iter, new_tb);
  }
  else
  {
    assert(false);
    return CUBIT_FAILURE;
  }
  
    // Update owner pointers
  
  new_tb->owner(this);
  old_tb->owner(0);
  
    // If 'reversed == true' then make sure bridges have
    // opposite sense.
  
  bool same_sense = new_tb->bridge_sense() == old_tb->bridge_sense();
  if (reversed == same_sense) // if (reversed XOR same_sense) 
    new_tb->reverse_bridge_sense();
    
  return CUBIT_SUCCESS;
}

Definition at line 52 of file BridgeManager.hpp.

    {
      if(!mergeList.empty())
        return *(mergeList.begin());
      else
        return 0;
    }

Definition at line 190 of file BridgeManager.cpp.

{
  std::vector<TopologyBridge*>::const_iterator iter;
  for (iter=mergeList.begin(); iter!=mergeList.end(); iter++)
  {
    if ( (*iter)->get_geometry_query_engine() == gqe_ptr )
      return *iter;
  }
  
  return 0;
}

Definition at line 68 of file BridgeManager.hpp.

    {return topologyEntity;}

Member Data Documentation

std::vector<TopologyBridge*> BridgeManager::mergeList [private]

Definition at line 82 of file BridgeManager.hpp.

Definition at line 81 of file BridgeManager.hpp.


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