cgma
|
#include <DAG.hpp>
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 DAG * | instance () |
static void | delete_instance () |
Protected Member Functions | |
DAG () | |
Private Attributes | |
DLIList< TopologyEntity * > | deactivatedDAGNodeList_ |
Static Private Attributes | |
static DAG * | instance_ = NULL |
DAG::DAG | ( | ) | [protected] |
Definition at line 327 of file DAG.cpp.
: deactivatedDAGNodeList_() { }
void DAG::add_deactivated_DAG_node | ( | TopologyEntity * | deactivatedDAGNodePtr | ) |
Definition at line 94 of file DAG.cpp.
{ deactivatedDAGNodeList_.append(deactivatedDAGNodePtr) ; }
void DAG::cleanout_deactivated_DAG_nodes | ( | ) |
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] |
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( ¤t_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( ¤t_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] |
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.
{ if (deactivatedDAGNodeList_.move_to(deactivatedDAGNodePtr)) deactivatedDAGNodeList_.extract(); }
DLIList<TopologyEntity*> DAG::deactivatedDAGNodeList_ [private] |
DAG * DAG::instance_ = NULL [static, private] |