abc/src/opt/fxch/FxchDiv.c
/**Function*************************************************************

  Synopsis    [ Separete the cubes in present in a divisor ]

  Description [ In this implementation *all* stored divsors are composed 
                of two cubes. 

                In order to save space and to be able to use the Vec_Int_t
                hash table both cubes are stored in the same vector - using
                a little hack to differentiate which literal belongs to each
                cube.

                This function separetes the two cubes in their own vectors
                so that they can be added to the cover.

                *Note* that this also applies to single cube 
                divisors beacuse of the DeMorgan Law: ab = ( a! + !b )! ]

  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [ Separete the cubes in present in a divisor ]

Description [ In this implementation *all* stored divsors are composed
of two cubes.

In order to save space and to be able to use the Vec_Int_t
hash table both cubes are stored in the same vector - using
a little hack to differentiate which literal belongs to each
cube.

This function separetes the two cubes in their own vectors
so that they can be added to the cover.

Note* that this also applies to single cube
divisors beacuse of the DeMorgan Law: ab = ( a. + !b ).




Function Synopsis [ Separete the cubes in present in a divisor ] Description [ In this implementation * all * stored divsors are composed of two cubes . In order to save space and to be able to use the Vec_Int_t hash table both cubes are stored in the same vector - using a little hack to differentiate which literal belongs to each cube . This function separetes the two cubes in their own vectors so that they can be added to the cover . Note * that this also applies to single cube divisors beacuse of the DeMorgan Law : ab = ( a . + !b ) .
void Fxch_DivSepareteCubes( Vec_Int_t* vDiv,
                            Vec_Int_t* vCube0,
                            Vec_Int_t* vCube1 )
{
    int* pArray;
    int i,
        Lit;
    Vec_IntForEachEntry( vDiv, Lit, i )
        if ( Abc_LitIsCompl(Lit) )
            Vec_IntPush( vCube1, Abc_Lit2Var( Lit ) );
        else
            Vec_IntPush( vCube0, Abc_Lit2Var( Lit ) );
    if ( ( Vec_IntSize( vDiv ) == 4 ) && ( Vec_IntSize( vCube0 ) == 3 ) )
    {
        assert( Vec_IntSize( vCube1 ) == 3 );
        pArray = Vec_IntArray( vCube0 );
        if ( pArray[1] > pArray[2] )
            ABC_SWAP( int, pArray[1], pArray[2] );
        pArray = Vec_IntArray( vCube1 );
        if ( pArray[1] > pArray[2] )
            ABC_SWAP( int, pArray[1], pArray[2] );
    }
}
void Fxch_DivSepareteCubes ( Vec_Int_t * vDiv , Vec_Int_t * vCube0 , Vec_Int_t * vCube1 ) { int * pArray ; int i , Lit ; Vec_IntForEachEntry ( vDiv , Lit , i ) if ( Abc_LitIsCompl ( Lit ) ) Vec_IntPush ( vCube1 , Abc_Lit2Var ( Lit ) ) ; else Vec_IntPush ( vCube0 , Abc_Lit2Var ( Lit ) ) ; if ( ( Vec_IntSize ( vDiv ) == 4 ) && ( Vec_IntSize ( vCube0 ) == 3 ) ) { assert ( Vec_IntSize ( vCube1 ) == 3 ) ; pArray = Vec_IntArray ( vCube0 ) ; if ( pArray [ 1 ] > pArray [ 2 ] ) ABC_SWAP ( int , pArray [ 1 ] , pArray [ 2 ] ) ; pArray = Vec_IntArray ( vCube1 ) ; if ( pArray [ 1 ] > pArray [ 2 ] ) ABC_SWAP ( int , pArray [ 1 ] , pArray [ 2 ] ) ; } }
Function
Synopsis    [ Separete the cubes in present in a divisor ]
Function Synopsis [ Separete the cubes in present in a divisor ]