abc/src/bdd/cudd/cuddGroup.c
int
cuddTreeSifting(
  DdManager * table /* DD table */,
  Cudd_ReorderingType method /* reordering method for the groups of leaves */)
{
    int i;
    int nvars;
    int result;
    int tempTree;

    /* If no tree is provided we create a temporary one in which all
    ** variables are in a single group. After reordering this tree is
    ** destroyed.
    */
    tempTree = table->tree == NULL;
    if (tempTree) {
        table->tree = Mtr_InitGroupTree(0,table->size);
        table->tree->index = table->invperm[0];
    }
    nvars = table->size;

#ifdef DD_DEBUG
    if (pr > 0 && !tempTree) (void) fprintf(table->out,"cuddTreeSifting:");
    Mtr_PrintGroups(table->tree,pr <= 0);
#endif

#ifdef DD_STATS
    extsymmcalls = 0;
    extsymm = 0;
    secdiffcalls = 0;
    secdiff = 0;
    secdiffmisfire = 0;

    (void) fprintf(table->out,"\n");
    if (!tempTree)
        (void) fprintf(table->out,"#:IM_NODES  %8d: group tree nodes\n",
                       ddCountInternalMtrNodes(table,table->tree));
#endif

    /* Initialize the group of each subtable to itself. Initially
    ** there are no groups. Groups are created according to the tree
    ** structure in postorder fashion.
    */
    for (i = 0; i < nvars; i++)
        table->subtables[i].next = i;


    /* Reorder. */
    result = ddTreeSiftingAux(table, table->tree, method);

#ifdef DD_STATS         /* print stats */
    if (!tempTree && method == CUDD_REORDER_GROUP_SIFT &&
        (table->groupcheck == CUDD_GROUP_CHECK7 ||
         table->groupcheck == CUDD_GROUP_CHECK5)) {
        (void) fprintf(table->out,"\nextsymmcalls = %d\n",extsymmcalls);
        (void) fprintf(table->out,"extsymm = %d",extsymm);
    }
    if (!tempTree && method == CUDD_REORDER_GROUP_SIFT &&
        table->groupcheck == CUDD_GROUP_CHECK7) {
        (void) fprintf(table->out,"\nsecdiffcalls = %d\n",secdiffcalls);
        (void) fprintf(table->out,"secdiff = %d\n",secdiff);
        (void) fprintf(table->out,"secdiffmisfire = %d",secdiffmisfire);
    }
#endif

    if (tempTree)
        Cudd_FreeTree(table);
    return(result);

}
/**Function********************************************************************

  Synopsis    [Tree sifting algorithm.]

  Description [Tree sifting algorithm. Assumes that a tree representing
  a group hierarchy is passed as a parameter. It then reorders each
  group in postorder fashion by calling ddTreeSiftingAux.  Assumes that
  no dead nodes are present.  Returns 1 if successful; 0 otherwise.]

  SideEffects [None]

******************************************************************************/
Function
Synopsis    [Tree sifting algorithm.]

Description [Tree sifting algorithm. Assumes that a tree representing
a group hierarchy is passed as a parameter. It then reorders each
group in postorder fashion by calling ddTreeSiftingAux.  Assumes that
no dead nodes are present.  Returns 1 if successful; 0 otherwise.]


Function Synopsis [ Tree sifting algorithm . ] Description [ Tree sifting algorithm . Assumes that a tree representing a group hierarchy is passed as a parameter . It then reorders each group in postorder fashion by calling ddTreeSiftingAux . Assumes that no dead nodes are present . Returns 1 if successful ; 0 otherwise . ]
int
cuddTreeSifting(
  DdManager * table ,
  Cudd_ReorderingType method )
{
    int i;
    int nvars;
    int result;
    int tempTree;
    tempTree = table->tree == NULL;
    if (tempTree) {
        table->tree = Mtr_InitGroupTree(0,table->size);
        table->tree->index = table->invperm[0];
    }
    nvars = table->size;
#ifdef DD_DEBUG
    if (pr > 0 && !tempTree) (void) fprintf(table->out,"cuddTreeSifting:");
    Mtr_PrintGroups(table->tree,pr <= 0);
#endif
#ifdef DD_STATS
    extsymmcalls = 0;
    extsymm = 0;
    secdiffcalls = 0;
    secdiff = 0;
    secdiffmisfire = 0;
    (void) fprintf(table->out,"\n");
    if (!tempTree)
        (void) fprintf(table->out,"#:IM_NODES  %8d: group tree nodes\n",
                       ddCountInternalMtrNodes(table,table->tree));
#endif
    for (i = 0; i < nvars; i++)
        table->subtables[i].next = i;
    result = ddTreeSiftingAux(table, table->tree, method);
#ifdef DD_STATS         
    if (!tempTree && method == CUDD_REORDER_GROUP_SIFT &&
        (table->groupcheck == CUDD_GROUP_CHECK7 ||
         table->groupcheck == CUDD_GROUP_CHECK5)) {
        (void) fprintf(table->out,"\nextsymmcalls = %d\n",extsymmcalls);
        (void) fprintf(table->out,"extsymm = %d",extsymm);
    }
    if (!tempTree && method == CUDD_REORDER_GROUP_SIFT &&
        table->groupcheck == CUDD_GROUP_CHECK7) {
        (void) fprintf(table->out,"\nsecdiffcalls = %d\n",secdiffcalls);
        (void) fprintf(table->out,"secdiff = %d\n",secdiff);
        (void) fprintf(table->out,"secdiffmisfire = %d",secdiffmisfire);
    }
#endif
    if (tempTree)
        Cudd_FreeTree(table);
    return(result);
}
int cuddTreeSifting ( DdManager * table , Cudd_ReorderingType method ) { int i ; int nvars ; int result ; int tempTree ; tempTree = table -> tree == NULL ; if ( tempTree ) { table -> tree = Mtr_InitGroupTree ( 0 , table -> size ) ; table -> tree -> index = table -> invperm [ 0 ] ; } nvars = table -> size ; #ifdef DD_DEBUG if ( pr > 0 && ! tempTree ) ( void ) fprintf ( table -> out , " " ) ; Mtr_PrintGroups ( table -> tree , pr <= 0 ) ; #endif #ifdef DD_STATS extsymmcalls = 0 ; extsymm = 0 ; secdiffcalls = 0 ; secdiff = 0 ; secdiffmisfire = 0 ; ( void ) fprintf ( table -> out , " \n " ) ; if ( ! tempTree ) ( void ) fprintf ( table -> out , " \n " , ddCountInternalMtrNodes ( table , table -> tree ) ) ; #endif for ( i = 0 ; i < nvars ; i ++ ) table -> subtables [ i ] . next = i ; result = ddTreeSiftingAux ( table , table -> tree , method ) ; #ifdef DD_STATS if ( ! tempTree && method == CUDD_REORDER_GROUP_SIFT && ( table -> groupcheck == CUDD_GROUP_CHECK7 || table -> groupcheck == CUDD_GROUP_CHECK5 ) ) { ( void ) fprintf ( table -> out , " \n \n " , extsymmcalls ) ; ( void ) fprintf ( table -> out , " " , extsymm ) ; } if ( ! tempTree && method == CUDD_REORDER_GROUP_SIFT && table -> groupcheck == CUDD_GROUP_CHECK7 ) { ( void ) fprintf ( table -> out , " \n \n " , secdiffcalls ) ; ( void ) fprintf ( table -> out , " \n " , secdiff ) ; ( void ) fprintf ( table -> out , " " , secdiffmisfire ) ; } #endif if ( tempTree ) Cudd_FreeTree ( table ) ; return ( result ) ; }
Function
Synopsis    [Tree sifting algorithm.]
Function Synopsis [ Tree sifting algorithm . ]
/* DD table */ /* reordering method for the groups of leaves */ /* If no tree is provided we create a temporary one in which all
    ** variables are in a single group. After reordering this tree is
    ** destroyed.
    */ /* Initialize the group of each subtable to itself. Initially
    ** there are no groups. Groups are created according to the tree
    ** structure in postorder fashion.
    */ /* Reorder. */ /* print stats */