Expression* sintactico::Ep() { if(CurrentToken->tipo == CORRER_D) { CurrentToken = Lexer->NexToken(); Expression *izq = F(); Expression *der = Ep(); if(der != NULL) return new exprShiftRight(izq,der,Lexer->linea); return izq; } else if(CurrentToken->tipo == CORRER_I) { CurrentToken = Lexer->NexToken(); Expression *izq = F(); Expression *der = Ep(); if(der != NULL) return new exprShiftLeft(izq,der,Lexer->linea); return izq; } else if(CurrentToken->tipo == ROT) { CurrentToken = Lexer->NexToken(); Expression *izq = F(); Expression *der = Ep(); if(der != NULL) return new exprRot(izq,der,Lexer->linea); return izq; } return NULL; }
int Ep(){ int node = NODE++; if(lookahead == TOKEN_PLUS){ // 1: Ep -> + T E' int plus, t, ep; printf("\tnode%d [ label = \"<f0> + | <f1> T | <f2> E'\"];\n", node); plus = NODE++; printf("\tnode%d [ label = \"+\", shape = oval, fillcolor=green, style=filled];\n", plus); printf("\tnode%d:f0 -> node%d\n", node, plus); nextToken(); t = T(); printf("\tnode%d:f1 -> node%d\n", node, t); ep = Ep(t+1); printf("\tnode%d:f2 -> node%d\n", node, ep); return node; } else if(lookahead == TOKEN_CLOSEPAREN || lookahead == TOKEN_EOF){ // 2: Ep -> {} printf("\tnode%d [ label = \"<f0> \\{\\}\"];\n", node); return node; } else { die(); } }
int E(){ int node = NODE++; if(lookahead == TOKEN_ID || lookahead == TOKEN_OPENPAREN){ // E -> T E' int t, ep; printf("\tnode%d [ label = \"<f0> T | <f1> E'\"]\n", node); t = T(); printf("\tnode%d:f0 -> node%d\n", node, t); ep = Ep(); printf("\tnode%d:f1 -> node%d\n", node, ep); return node; } else { die(); } }
double RkPdf::EfRk(const double& x, const double& tau){ const double r_ckak = ck/ak; return (x<0.0 ? 0.5*(1-r_ckak)*En(x,tau*(ak-ck)) : 0.5*(1+r_ckak)*Ep(x, tau*(ak+ck))); }
void Planet::energy(double EP,int i){ Ep(i) = EP; Ek(i) = (Vx(i)*Vx(i) + Vy(i)*Vy(i)) * 0.5 * mass; }
void MisesMat :: giveFirstPKStressVector_3d(FloatArray &answer, GaussPoint *gp, const FloatArray &totalDefGradOOFEM, TimeStep *tStep) { MisesMatStatus *status = static_cast< MisesMatStatus * >( this->giveStatus(gp) ); double kappa, dKappa, yieldValue, mi; FloatMatrix F, oldF, invOldF; FloatArray s; F.beMatrixForm(totalDefGradOOFEM); //(method assumes full 3D) kappa = status->giveCumulativePlasticStrain(); oldF.beMatrixForm( status->giveFVector() ); invOldF.beInverseOf(oldF); //relative deformation radient FloatMatrix f; f.beProductOf(F, invOldF); //compute elastic predictor FloatMatrix trialLeftCauchyGreen, help; f.times( 1./cbrt(f.giveDeterminant()) ); help.beProductOf(f, status->giveTempLeftCauchyGreen()); trialLeftCauchyGreen.beProductTOf(help, f); FloatMatrix E; E.beTProductOf(F, F); E.at(1, 1) -= 1.0; E.at(2, 2) -= 1.0; E.at(3, 3) -= 1.0; E.times(0.5); FloatArray e; e.beSymVectorFormOfStrain(E); FloatArray leftCauchyGreen; FloatArray leftCauchyGreenDev; double leftCauchyGreenVol; leftCauchyGreen.beSymVectorFormOfStrain(trialLeftCauchyGreen); leftCauchyGreenVol = computeDeviatoricVolumetricSplit(leftCauchyGreenDev, leftCauchyGreen); FloatArray trialStressDev; applyDeviatoricElasticStiffness(trialStressDev, leftCauchyGreenDev, G / 2.); s = trialStressDev; //check for plastic loading double trialS = computeStressNorm(trialStressDev); double sigmaY = sig0 + H * kappa; //yieldValue = sqrt(3./2.)*trialS-sigmaY; yieldValue = trialS - sqrt(2. / 3.) * sigmaY; //store deviatoric trial stress(reused by algorithmic stiffness) status->letTrialStressDevBe(trialStressDev); //the return-mapping algorithm double J = F.giveDeterminant(); mi = leftCauchyGreenVol * G; if ( yieldValue > 0 ) { //dKappa =sqrt(3./2.)* yieldValue/(H + 3.*mi); //kappa = kappa + dKappa; //trialStressDev.times(1-sqrt(6.)*mi*dKappa/trialS); dKappa = ( yieldValue / ( 2 * mi ) ) / ( 1 + H / ( 3 * mi ) ); FloatArray n = trialStressDev; n.times(2 * mi * dKappa / trialS); ////return map s.beDifferenceOf(trialStressDev, n); kappa += sqrt(2. / 3.) * dKappa; //update of intermediate configuration trialLeftCauchyGreen.beMatrixForm(s); trialLeftCauchyGreen.times(1.0 / G); trialLeftCauchyGreen.at(1, 1) += leftCauchyGreenVol; trialLeftCauchyGreen.at(2, 2) += leftCauchyGreenVol; trialLeftCauchyGreen.at(2, 2) += leftCauchyGreenVol; trialLeftCauchyGreen.times(J * J); } //addition of the elastic mean stress FloatMatrix kirchhoffStress; kirchhoffStress.beMatrixForm(s); kirchhoffStress.at(1, 1) += 1. / 2. * K * ( J * J - 1 ); kirchhoffStress.at(2, 2) += 1. / 2. * K * ( J * J - 1 ); kirchhoffStress.at(3, 3) += 1. / 2. * K * ( J * J - 1 ); FloatMatrix iF, Ep(3, 3), S; FloatArray vF, vS, ep; //transform Kirchhoff stress into Second Piola - Kirchhoff stress iF.beInverseOf(F); help.beProductOf(iF, kirchhoffStress); S.beProductTOf(help, iF); this->computeGLPlasticStrain(F, Ep, trialLeftCauchyGreen, J); ep.beSymVectorFormOfStrain(Ep); vS.beSymVectorForm(S); vF.beVectorForm(F); answer.beVectorForm(kirchhoffStress); status->setTrialStressVol(mi); status->letTempLeftCauchyGreenBe(trialLeftCauchyGreen); status->setTempCumulativePlasticStrain(kappa); status->letTempStressVectorBe(answer); status->letTempStrainVectorBe(e); status->letTempPlasticStrainBe(ep); status->letTempPVectorBe(answer); status->letTempFVectorBe(vF); }