abc/src/bdd/cudd/cuddGroup.c
/**Function********************************************************************

  Synopsis    [Visits the group tree and reorders each group.]

  Description [Recursively visits the group tree and reorders each
  group in postorder fashion.  Returns 1 if successful; 0 otherwise.]

  SideEffects [None]

******************************************************************************/
Function
Synopsis    [Visits the group tree and reorders each group.]

Description [Recursively visits the group tree and reorders each
group in postorder fashion.  Returns 1 if successful; 0 otherwise.]


Function Synopsis [ Visits the group tree and reorders each group . ] Description [ Recursively visits the group tree and reorders each group in postorder fashion . Returns 1 if successful ; 0 otherwise . ]
static int
ddTreeSiftingAux(
  DdManager * table,
  MtrNode * treenode,
  Cudd_ReorderingType method)
{
    MtrNode  *auxnode;
    int res;
    Cudd_AggregationType saveCheck;
#ifdef DD_DEBUG
    Mtr_PrintGroups(treenode,1);
#endif
    auxnode = treenode;
    while (auxnode != NULL) {
        if (auxnode->child != NULL) {
            if (!ddTreeSiftingAux(table, auxnode->child, method))
                return(0);
            saveCheck = table->groupcheck;
            table->groupcheck = CUDD_NO_CHECK;
            if (method != CUDD_REORDER_LAZY_SIFT)
              res = ddReorderChildren(table, auxnode, CUDD_REORDER_GROUP_SIFT);
            else
              res = ddReorderChildren(table, auxnode, CUDD_REORDER_LAZY_SIFT);
            table->groupcheck = saveCheck;
            if (res == 0)
                return(0);
        } else if (auxnode->size > 1) {
            if (!ddReorderChildren(table, auxnode, method))
                return(0);
        }
        auxnode = auxnode->younger;
    }
    return(1);
}
static int ddTreeSiftingAux ( DdManager * table , MtrNode * treenode , Cudd_ReorderingType method ) { MtrNode * auxnode ; int res ; Cudd_AggregationType saveCheck ; #ifdef DD_DEBUG Mtr_PrintGroups ( treenode , 1 ) ; #endif auxnode = treenode ; while ( auxnode != NULL ) { if ( auxnode -> child != NULL ) { if ( ! ddTreeSiftingAux ( table , auxnode -> child , method ) ) return ( 0 ) ; saveCheck = table -> groupcheck ; table -> groupcheck = CUDD_NO_CHECK ; if ( method != CUDD_REORDER_LAZY_SIFT ) res = ddReorderChildren ( table , auxnode , CUDD_REORDER_GROUP_SIFT ) ; else res = ddReorderChildren ( table , auxnode , CUDD_REORDER_LAZY_SIFT ) ; table -> groupcheck = saveCheck ; if ( res == 0 ) return ( 0 ) ; } else if ( auxnode -> size > 1 ) { if ( ! ddReorderChildren ( table , auxnode , method ) ) return ( 0 ) ; } auxnode = auxnode -> younger ; } return ( 1 ) ; }
Function
Synopsis    [Visits the group tree and reorders each group.]
Function Synopsis [ Visits the group tree and reorders each group . ]