예제 #1
0
int main()
{
    int i,n,len,j;
    char s1[9],s2[9];
    freopen("poj3683.txt","r",stdin);
    freopen("poj3683ans.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        InitEdge();
        for (i=1;i<=n;i++)
        {
            scanf("%s%s%d",s1,s2,&len);
            wed[i].start=TimeStrToInt(s1);
            wed[i].end=TimeStrToInt(s2);
            wed[i].len=len;
        }
        for (i=1;i<=n;i++)
            for (j=1;j<=n;j++)
            {
                if (i==j) continue;
                if (Conflict(wed[i].start,wed[i].len,wed[j].start,wed[j].len)) AddEdge(i,j+n);
                if (Conflict(wed[i].start,wed[i].len,wed[j].end-wed[j].len,wed[j].len)) AddEdge(i,j);
                if (Conflict(wed[i].end-wed[i].len,wed[i].len,wed[j].start,wed[j].len)) AddEdge(i+n,j+n);
                if (Conflict(wed[i].end-wed[i].len,wed[i].len,wed[j].end-wed[j].len,wed[j].len)) AddEdge(i+n,j);
            }
        if (TwoSAT(n))
        {
            printf("YES\n");
            for (i=1;i<=n;i++) if (ans[i])
            {
                PrintTime(wed[i].start);
                printf(" ");
                PrintTime(wed[i].start+wed[i].len);
                printf("\n");
            }
            else
            {
                PrintTime(wed[i].end-wed[i].len);
                printf(" ");
                PrintTime(wed[i].end);
                printf("\n");
            }
        }
        else printf("NO\n");
    }
    return 0;
}
예제 #2
0
OpenSMOKE_Dictionary_GasStream::OpenSMOKE_Dictionary_GasStream()
{
    SetupBase();
	SetName("OpenSMOKE_GasStream Dictionary");

    Add("#Temperature",			'O', 'M', "Gas stream temperature");
    Add("#Pressure",			'O', 'M', "Gas stream pressure");
    Add("#Density",				'O', 'M', "Gas stream density");
    
	Add("#MassFlowRate",		'O', 'M', "Gas stream mass flow rate");
    Add("#MoleFlowRate",		'O', 'M', "Gas stream mole flow rate");
    Add("#VolumetricFlowRate",  'O', 'M', "Gas stream volumetric flow rate");

    Add("#MassFractions",		'O', 'L', "Gas stream mass fractions");
    Add("#MoleFractions",		'O', 'L', "Gas stream mole fractions");

	Add("#EquivalenceRatio",	'O', 'D', "Equivalence Ratio");
	Add("#FuelMoleFractions",	'O', 'L', "Fuel composition (mole fractions)");
	Add("#OxidizerMoleFractions",	'O', 'L', "Oxidizer composition (mole fractions)");
	Add("#FuelMassFractions",	'O', 'L', "Fuel composition (mass fractions)");
	Add("#OxidizerMassFractions",	'O', 'L', "Oxidizer composition (mass fractions)");

    Conflict("#MassFlowRate",   "#MoleFlowRate");
    Conflict("#MassFlowRate",   "#VolumetricFlowRate");
    Conflict("#MoleFlowRate",   "#VolumetricFlowRate");

	Conflict("#MassFractions",			"#MoleFractions");
	Conflict("#FuelMoleFractions",		"#FuelMassFractions");
	Conflict("#OxidizerMoleFractions",		"#OxidizerMassFractions");
	Conflict("#FuelMoleFractions",		"#MassFractions");
	Conflict("#FuelMoleFractions",		"#MoleFractions");
	Conflict("#EquivalenceRatio",		"#MassFractions");
	Conflict("#EquivalenceRatio",		"#MoleFractions");


	Compulsory("#MassFractions", "#MoleFractions", "#EquivalenceRatio");
	// Compulsory("#MassFlowRate",  "#MoleFlowRate", "#VolumetricFlowRate");

    Lock();
}
예제 #3
0
void lalr1( void )
{
    a_state         *x;
    a_shift_action  *tx;
    a_reduce_action *rx;
    a_look          *lk, *look;
    a_word          *lp, *lset;
    a_word          *rp, *rset;

    InitSets( nterm );
    lk = look = CALLOC( nvtrans + nstate, a_look );
    lp = lset = AllocSet( nvtrans );
    rp = rset = AllocSet( nredun );
    for( x = statelist; x != NULL; x = x->next ) {
        x->look = lk;
        for( tx = x->trans; tx->sym != NULL; ++tx ) {
            if( tx->sym->pro != NULL ) {
                lk->trans = tx;
                lk->follow = lp;
                lp += GetSetSize( 1 );
                ++lk;
            }
        }
        ++lk;
        for( rx = x->redun; rx->pro != NULL; ++rx ) {
            rx->follow = rp;
            rp += GetSetSize( 1 );
        }
    }
    stk = CALLOC( nvtrans, a_look * );
    top = stk;
    Nullable();
    CalcReads();
    CalcIncludes();
    Lookback();
    if( lk - look != nvtrans + nstate ) {
        puts( "internal error" );
    }
    if( lp - lset != GetSetSize( nvtrans ) ) {
        puts( "internal error" );
    }
    if( rp - rset != GetSetSize( nredun ) ) {
        puts( "internal error" );
    }
    FREE( look );
    FREE( lset );
    FREE( stk );
    Conflict();
    nbstate = nstate;
}
예제 #4
0
OpenSMOKE_Dictionary_ICEM::OpenSMOKE_Dictionary_ICEM()
{
    SetupBase();
    
	// Compulsory
    Add("#RotationRate",		'C', 'M', "Rotation rate");
    Add("#CompressionRatio",	'C', 'D', "Compression ratio");
    Add("#ClearanceVolume",		'C', 'M', "Clearance volume");
    Add("#ArmRatio",			'C', 'D', "Ratio between arms");
    Add("#StartAngle",			'C', 'M', "Starting angle");
    Add("#Diameter",			'C', 'M', "Cylinder diameter");

	// Optional
    Add("#Key",					'O', 'V', "Key species");
	Add("#NumberOfCycles",		'O', 'D', "Number of cycles");

	// Optional
	Add("#ReactionRates",		'O', 'V', "Reaction rates");
	Add("#FormationRates",		'O', 'V', "Formation rates");
	Add("#ROPA",				'O', 'V', "Rate of Production Analysis");
	Add("#Sensitivity",			'O', 'V', "Sensitivity Analysis");

     
	// Optional
	Add("#Adiabatic",				'O', 'N', "No thermal exchange");
	Add("#VerboseEnergy",			'O', 'N', "Report on energy");
	Add("#Qe",						'O', 'M', "Heat flux");
	Add("#A",						'O', 'M', "Exchange area");
	Add("#U",						'O', 'M', "Heat thermal exchange coefficient");
	Add("#Twall",					'O', 'M', "Wall temperature");

	Add("#UserDefined_T",			'O', 'S', "The temperature is assigned from external file");
	Add("#UserDefined_Qe",			'O', 'S', "The heat flux is assigned from external file");
    Add("#UserDefined_A",			'O', 'S', "The exchange area is assigned from external file");
	Add("#UserDefined_U",			'O', 'S', "The heat exchange coefficient is assigned from external file");
    Add("#UserDefined_Twall",		'O', 'S', "The wall temperature is assigned from external file");

	Add("#2E_Model",				'O', 'N', "The Soot 2E Model is solved");

	Conflict("#UserDefined_Qe",			"#Qe");
	Conflict("#UserDefined_A",			"#A");
	Conflict("#UserDefined_U",			"#U");
	Conflict("#UserDefined_Twall",		"#Twall");

	Conflict("#Qe",						"#U");
	Conflict("#Qe",						"#Twall");
	Conflict("#Qe",						"#UserDefined_U");
	Conflict("#Qe",						"#UserDefined_Twall");
	Conflict("#UserDefined_Qe",			"#U");
	Conflict("#UserDefined_Qe",			"#Twall");
	Conflict("#UserDefined_Qe",			"#UserDefined_U");
	Conflict("#UserDefined_Qe",			"#UserDefined_Twall");

	Compulsory("#Adiabatic", "#Twall", "#UserDefined_Twall", "#UserDefined_Qe");


    Lock();
}