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

  Synopsis    [Creates a new ZDD variable group.]

  Description [Creates a new ZDD variable group. The group starts at
  variable and contains size variables. The parameter low is the index
  of the first variable. If the variable already exists, its current
  position in the order is known to the manager. If the variable does
  not exist yet, the position is assumed to be the same as the index.
  The group tree is created if it does not exist yet.
  Returns a pointer to the group if successful; NULL otherwise.]

  SideEffects [The ZDD variable tree is changed.]

  SeeAlso     [Cudd_MakeTreeNode]

******************************************************************************/
Function
Synopsis    [Creates a new ZDD variable group.]

Description [Creates a new ZDD variable group. The group starts at
variable and contains size variables. The parameter low is the index
of the first variable. If the variable already exists, its current
position in the order is known to the manager. If the variable does
not exist yet, the position is assumed to be the same as the index.
The group tree is created if it does not exist yet.
Returns a pointer to the group if successful; NULL otherwise.]

SideEffects [The ZDD variable tree is changed.]


Function Synopsis [ Creates a new ZDD variable group . ] Description [ Creates a new ZDD variable group . The group starts at variable and contains size variables . The parameter low is the index of the first variable . If the variable already exists its current position in the order is known to the manager . If the variable does not exist yet the position is assumed to be the same as the index . The group tree is created if it does not exist yet . Returns a pointer to the group if successful ; NULL otherwise . ] SideEffects [ The ZDD variable tree is changed . ]
MtrNode *
Cudd_MakeZddTreeNode(
  DdManager * dd ,
  unsigned int  low ,
  unsigned int  size ,
  unsigned int  type )
{
    MtrNode *group;
    MtrNode *tree;
    unsigned int level;
    level = (low < (unsigned int) dd->sizeZ) ? dd->permZ[low] : low;
    if (level + size - 1> (int) MTR_MAXHIGH)
        return(NULL);
    tree = dd->treeZ;
    if (tree == NULL) {
        dd->treeZ = tree = Mtr_InitGroupTree(0, dd->sizeZ);
        if (tree == NULL)
            return(NULL);
        tree->index = dd->invpermZ[0];
    }
    tree->size = ddMax(tree->size, level + size);
    group = Mtr_MakeGroup(tree, level, size, type);
    if (group == NULL)
        return(NULL);
    group->index = (MtrHalfWord) low;
    return(group);
}
MtrNode * Cudd_MakeZddTreeNode ( DdManager * dd , unsigned int low , unsigned int size , unsigned int type ) { MtrNode * group ; MtrNode * tree ; unsigned int level ; level = ( low < ( unsigned int ) dd -> sizeZ ) ? dd -> permZ [ low ] : low ; if ( level + size - 1 > ( int ) MTR_MAXHIGH ) return ( NULL ) ; tree = dd -> treeZ ; if ( tree == NULL ) { dd -> treeZ = tree = Mtr_InitGroupTree ( 0 , dd -> sizeZ ) ; if ( tree == NULL ) return ( NULL ) ; tree -> index = dd -> invpermZ [ 0 ] ; } tree -> size = ddMax ( tree -> size , level + size ) ; group = Mtr_MakeGroup ( tree , level , size , type ) ; if ( group == NULL ) return ( NULL ) ; group -> index = ( MtrHalfWord ) low ; return ( group ) ; }
Function
Synopsis    [Creates a new ZDD variable group.]
Function Synopsis [ Creates a new ZDD variable group . ]
/* manager */ /* index of the first group variable */ /* number of variables in the group */ /* MTR_DEFAULT or MTR_FIXED */ /* If the variable does not exist yet, the position is assumed to be
    ** the same as the index. Therefore, applications that rely on
    ** Cudd_bddNewVarAtLevel or Cudd_addNewVarAtLevel to create new
    ** variables have to create the variables before they group them.
    */ /* If the tree does not exist yet, create it. */ /* Extend the upper bound of the tree if necessary. This allows the
    ** application to create groups even before the variables are created.
    */ /* Create the group. */ /* Initialize the index field to the index of the variable currently
    ** in position low. This field will be updated by the reordering
    ** procedure to provide a handle to the group once it has been moved.
    */