/**Function******************************************************************** Synopsis [Initializes the ZDD universe.] Description [Initializes the ZDD universe. Returns 1 if successful; 0 otherwise.] SideEffects [None] SeeAlso [cuddZddFreeUniv] ******************************************************************************/ int cuddZddInitUniv( DdManager * zdd) { DdNode *p, *res; int i; #ifdef __osf__ #pragma pointer_size save #pragma pointer_size short #endif zdd->univ = ALLOC(DdNode *, zdd->sizeZ); #ifdef __osf__ #pragma pointer_size restore #endif if (zdd->univ == NULL) { zdd->errorCode = CUDD_MEMORY_OUT; return(0); } res = DD_ONE(zdd); cuddRef(res); for (i = zdd->sizeZ - 1; i >= 0; i--) { unsigned int index = zdd->invpermZ[i]; p = res; res = cuddUniqueInterZdd(zdd, index, p, p); if (res == NULL) { Cudd_RecursiveDerefZdd(zdd,p); FREE(zdd->univ); return(0); } cuddRef(res); cuddDeref(p); zdd->univ[i] = res; } #ifdef DD_VERBOSE cuddZddP(zdd, zdd->univ[0]); #endif return(1); } /* end of cuddZddInitUniv */
/**Function******************************************************************** Synopsis [Prints to the standard output a ZDD and its statistics.] Description [Prints to the standard output a DD and its statistics. The statistics include the number of nodes and the number of minterms. (The number of minterms is also the number of combinations in the set.) The statistics are printed if pr > 0. Specifically: <ul> <li> pr = 0 : prints nothing <li> pr = 1 : prints counts of nodes and minterms <li> pr = 2 : prints counts + disjoint sum of products <li> pr = 3 : prints counts + list of nodes <li> pr > 3 : prints counts + disjoint sum of products + list of nodes </ul> Returns 1 if successful; 0 otherwise. ] SideEffects [None] SeeAlso [] ******************************************************************************/ int Cudd_zddPrintDebug( DdManager * zdd, DdNode * f, int n, int pr) { DdNode *empty = DD_ZERO(zdd); int nodes; double minterms; int retval = 1; if (f == empty && pr > 0) { (void) fprintf(zdd->out,": is the empty ZDD\n"); (void) fflush(zdd->out); return(1); } if (pr > 0) { nodes = Cudd_zddDagSize(f); if (nodes == CUDD_OUT_OF_MEM) retval = 0; minterms = Cudd_zddCountMinterm(zdd, f, n); if (minterms == (double)CUDD_OUT_OF_MEM) retval = 0; (void) fprintf(zdd->out,": %d nodes %g minterms\n", nodes, minterms); if (pr > 2) if (!cuddZddP(zdd, f)) retval = 0; if (pr == 2 || pr > 3) { if (!Cudd_zddPrintMinterm(zdd, f)) retval = 0; (void) fprintf(zdd->out,"\n"); } (void) fflush(zdd->out); } return(retval); } /* end of Cudd_zddPrintDebug */