예제 #1
0
double hydrogen::up()
{
    double rt = 1.0/T;
    double rt2 = rt*rt;
    double rt3 = rt*rt2;
    double egrho = exp(-Gamma*Rho*Rho);
    double sum = u0;
    for (int i=0; i<14; i++) {
        sum += (C(i, rt, rt2) - T*Cprime(i, rt, rt2, rt3))*I(i, egrho);
    }

    //   add \int c_{v,0} term
    sum += Ghydro[0] * (std::min(T, T1) - To);
    if (T > T1) {
        double x = std::min(T, T2) / T1;
        for (int i = 0; i < 12; i++) {
            sum += Ghydro[i] * T1 * icv(i, x, log(x));
        }
    }
    if (T > T2) {
        double x = T/T2;
        for (int i = 0; i < 5; i++) {
            sum += Ghydro[i+12] * T2 * icv(i, x, log(x));
        }
    }

    return sum + m_energy_offset;
}
예제 #2
0
파일: inlinecost.c 프로젝트: quickfur/GDC
    void expressionInlineCost(Expression *e)
    {
        //printf("expressionInlineCost()\n");
        //e->print();
        if (e)
        {
            class LambdaInlineCost : public StoppableVisitor
            {
                InlineCostVisitor *icv;
            public:
                LambdaInlineCost(InlineCostVisitor *icv) : icv(icv) {}

                void visit(Expression *e)
                {
                    e->accept(icv);
                    stop = icv->cost >= COST_MAX;
                }
            };

            InlineCostVisitor icv(this);
            LambdaInlineCost lic(&icv);
            walkPostorder(e, &lic);
            cost += icv.cost;
        }
    }
예제 #3
0
파일: Util.cpp 프로젝트: encukou/pki
TPS_PUBLIC PRStatus Util::ComputeCryptogram(PK11SymKey *key, 
	const Buffer &card_challenge, const Buffer &host_challenge,
	Buffer &output)
{
	Buffer icv(8, (BYTE)0);
	Buffer input = card_challenge + host_challenge;

	return ComputeMAC(key, input, icv, output);
} /* ComputeCryptogram */
예제 #4
0
파일: inlinecost.c 프로젝트: quickfur/GDC
 void visit(CompoundStatement *s)
 {
     InlineCostVisitor icv(this);
     for (size_t i = 0; i < s->statements->dim; i++)
     {
         Statement *s2 = (*s->statements)[i];
         if (s2)
         {
             s2->accept(&icv);
             if (tooCostly(icv.cost))
                 break;
         }
     }
     cost += icv.cost;
 }
예제 #5
0
double hydrogen::icv(int i, double x, double xlg)
{
    return (i == 0 ? x - 1 : x*pow(xlg,i) - i*icv(i-1,x,xlg));
}