cgma
DAG Class Reference

#include <DAG.hpp>

List of all members.

Public Member Functions

 ~DAG ()
void add_deactivated_DAG_node (TopologyEntity *deactivatedDAGNodePtr)
void remove_deactivated_DAG_node (TopologyEntity *deactivatedDAGNodePtr)
void cleanout_deactivated_DAG_nodes ()
void remove (TopologyEntity *DAGNodePtr)
CubitStatus get_children_at_level (TopologyEntity *parent, int level, DLIList< TopologyEntity * > &result_set)
CubitStatus get_parents_at_level (TopologyEntity *child, int level, DLIList< TopologyEntity * > &result_set)
CubitStatus get_children_at_level (DLIList< TopologyEntity * > &parents, int level, DLIList< TopologyEntity * > &result_set)
CubitStatus get_parents_at_level (DLIList< TopologyEntity * > &children, int level, DLIList< TopologyEntity * > &result_set)

Static Public Member Functions

static DAGinstance ()
static void delete_instance ()

Protected Member Functions

 DAG ()

Private Attributes

DLIList< TopologyEntity * > deactivatedDAGNodeList_

Static Private Attributes

static DAGinstance_ = NULL

Detailed Description

Definition at line 56 of file DAG.hpp.


Constructor & Destructor Documentation

DAG::~DAG ( )

Definition at line 78 of file DAG.cpp.

{
  instance_ = NULL ;
}
DAG::DAG ( ) [protected]

Definition at line 327 of file DAG.cpp.


Member Function Documentation

void DAG::add_deactivated_DAG_node ( TopologyEntity deactivatedDAGNodePtr)

Definition at line 94 of file DAG.cpp.

{
  deactivatedDAGNodeList_.append(deactivatedDAGNodePtr) ;
}

Definition at line 125 of file DAG.cpp.

{
  TopologyEntity* tempDAGNode = NULL;
  while ( deactivatedDAGNodeList_.size() > 0)
  {
    tempDAGNode = NULL;
    deactivatedDAGNodeList_.last();
    tempDAGNode = deactivatedDAGNodeList_.get();
    if( tempDAGNode != NULL )
    {
      delete tempDAGNode;
    }
  }
   
  deactivatedDAGNodeList_.clean_out() ;
}
static void DAG::delete_instance ( ) [inline, static]

Definition at line 71 of file DAG.hpp.

  {
    if(instance_)
      delete instance_;
    instance_ = NULL;
  };
CubitStatus DAG::get_children_at_level ( TopologyEntity parent,
int  level,
DLIList< TopologyEntity * > &  result_set 
)

Definition at line 171 of file DAG.cpp.

{
  DLIList<TopologyEntity*> parent_list;  // nodes at current level
    
    // Start with a parent_list with one node, the passed parent
  parent_list.append( parent );
    
    // Call with list
  return get_children_at_level( parent_list, level, result_set );
}
CubitStatus DAG::get_children_at_level ( DLIList< TopologyEntity * > &  parents,
int  level,
DLIList< TopologyEntity * > &  result_set 
)

Definition at line 216 of file DAG.cpp.

{
  assert( level > 0 );
  if( parent_list.size( ) < 1 ) return CUBIT_FAILURE;
    
  DLIList<TopologyEntity*> child_list;   // children of all parents
  DLIList<TopologyEntity*> current_node_children;
    
    //Get a list of all the children one level down from 
    //the nodes in parent_list.
  for( int i = 0; i < parent_list.size( ); i++ )
  {
    TopologyEntity* current = parent_list.get_and_step( );
        
    current_node_children.clean_out( );
    current->get_children( &current_node_children );
        
    for( int j = 0; j < current_node_children.size( ); j++ )
    {
      child_list.append_unique(
        current_node_children.get_and_step( ) );
    }
  }
    
    //If we found no children, return failure.
  if( child_list.size( ) < 1 ) return CUBIT_FAILURE;
    
    //If level 1, then return the list of children.
  if( level == 1 )
  {
    result_set = child_list;
    return CUBIT_SUCCESS;
  }
    //Otherwise get next level down by recursion.
  else
  {
    return get_children_at_level( child_list, level - 1, 
                                  result_set );
  } 
}
CubitStatus DAG::get_parents_at_level ( TopologyEntity child,
int  level,
DLIList< TopologyEntity * > &  result_set 
)

Definition at line 193 of file DAG.cpp.

{
  DLIList<TopologyEntity*> child_list;  // nodes at current level
    
    // Start with a parent_list with one node, the passed parent
  child_list.append( child );
    
    // Call with list
  return get_parents_at_level( child_list, level, result_set );
}
CubitStatus DAG::get_parents_at_level ( DLIList< TopologyEntity * > &  children,
int  level,
DLIList< TopologyEntity * > &  result_set 
)

Definition at line 269 of file DAG.cpp.

{
  assert( level > 0 );
  if( child_list.size( ) < 1 ) return CUBIT_FAILURE;
    
  DLIList<TopologyEntity*> parent_list;   // children of all parents
  DLIList<TopologyEntity*> current_node_parents;
    
    //Get a list of all the parents one level up from 
    //the nodes in child_list.
  for( int i = 0; i < child_list.size( ); i++ )
  {
    TopologyEntity* current = child_list.get_and_step( );
        
    current_node_parents.clean_out( );
    current->get_parents( &current_node_parents );
        
    for( int j = 0; j < current_node_parents.size( ); j++ )
    {
      parent_list.append_unique(
        current_node_parents.get_and_step( ) );
    }
  }
    
    //If we found no parents, return failure.
  if( parent_list.size( ) < 1 ) return CUBIT_FAILURE;
    
    //If level 1, then return the list of parents.
  if( level == 1 )
  {
    result_set = parent_list;
    return CUBIT_SUCCESS;
  }
    //Otherwise get next level down by recursion.
  else
  {
    return get_parents_at_level( parent_list, level - 1, 
                                 result_set );
  } 
}
DAG * DAG::instance ( ) [static]

Definition at line 60 of file DAG.cpp.

{
  if (instance_ == NULL ) 
  {
    instance_ = new DAG;
  }
  return instance_ ;
}
void DAG::remove ( TopologyEntity DAGNodePtr)

Definition at line 153 of file DAG.cpp.

{
    // If this input pointer exists in the deactivated DAG Node list,
    // remove it
  deactivatedDAGNodeList_.remove(DAGNodePtr);
}
void DAG::remove_deactivated_DAG_node ( TopologyEntity deactivatedDAGNodePtr)

Definition at line 110 of file DAG.cpp.


Member Data Documentation

Definition at line 195 of file DAG.hpp.

DAG * DAG::instance_ = NULL [static, private]

Definition at line 192 of file DAG.hpp.


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