Token *ScannerImp::createToken(TType typ,int wortlaenge,int X_Anfang,int Y_Anfang){ x+=wortlaenge; char tmp[wortlaenge + 1]; memcpy(tmp, tokenAnfang, (size_t) wortlaenge); tmp[wortlaenge] = '\0'; Information <char*>* info; switch(typ) { case Identifier: info = symboltable->insert(tmp, X_Anfang, Y_Anfang); switch (info->getX()) { case -1: typ = If; break; case -2: typ = While; break; default:break; } break; case Integer: return new Token(typ, X_Anfang, Y_Anfang, new InfoInt(tmp)); case Fehler: buffer->getChar(); return new Token(typ, X_Anfang, Y_Anfang, new InfoError(tmp)); default:break; } return new Token(typ, X_Anfang, Y_Anfang, info); }
LfcCommand * ServState::NextState( std::vector<Item *>::const_iterator & iterator, vector<Item*> items, Item* item ) { PrintMessage("SERV", item); item->SetAssigned(true); int errorStart = item->GetInformation().find(':'); string info = item->GetInformation().substr(errorStart + 1); Information * information = new Information(); information->SetInformation(info); if (item->GetUser()->GetName().length() != 0 && item->GetUser()->GetName().find('=') == std::string::npos) { item->GetStartTime()->print(); return NULL; } return new LfcServCommand( item->GetStartTime(), item->GetEndTime(), item->GetFilePath(), new User("UNKNOWN"), item->GetSite(), true, information); }
int FourNodeQuad3d::getResponse(int responseID, Information &eleInfo) { if (responseID == 1) { return eleInfo.setVector(this->getResistingForce()); } else if (responseID == 3) { // Loop over the integration points static Vector stresses(12); int cnt = 0; for (int i = 0; i < 4; i++) { // Get material stress response const Vector &sigma = theMaterial[i]->getStress(); stresses(cnt) = sigma(0); stresses(cnt+1) = sigma(1); stresses(cnt+2) = sigma(2); cnt += 3; } return eleInfo.setVector(stresses); } else return -1; }
int TFP_Bearing::getResponse(int responseID, Information &eleInfo) { double strain; // Vector res(this->getResistingForce()); // res(2) = Ac; switch (responseID) { case -1: return -1; case 1: // global forces return eleInfo.setVector(this->getResistingForce()); // return eleInfo.setVector(res); case 2: // v for (int i=0; i<8; i++) vectorSize8(i)=vTrial[i]; return eleInfo.setVector(vectorSize8); case 3: // vp for (int i=0; i<8; i++) vectorSize8(i)=vpTrial[i]; return eleInfo.setVector(vectorSize8); default: return 0; } }
int SectionForceDeformation2d::getResponse(int responseID, Information &secInfo) { switch (responseID) { case 1: return secInfo.setVector(this->getSectionDeformation()); case 2: return secInfo.setVector(this->getStressResultant()); case 4: { Vector &theVec = *(secInfo.theVector); const Vector &e = this->getSectionDeformation(); const Vector &s = this->getStressResultant(); int order = this->getOrder(); for (int i = 0; i < order; i++) { theVec(i) = e(i); theVec(i+order) = s(i); } return secInfo.setVector(theVec); } default: return -1; } }
int NineNodeMixedQuad::getResponse(int responseID, Information &eleInfo) { if (responseID == 1) { return eleInfo.setVector(this->getResistingForce()); } else if (responseID == 3) { // Loop over the integration points static Vector stresses(4*9); int cnt = 0; for (int i = 0; i < 9; i++) { // Get material stress response const Vector &sigma = materialPointers[i]->getStress(); stresses(cnt) = sigma(0); stresses(cnt+1) = sigma(1); stresses(cnt+2) = sigma(2); stresses(cnt+3) = sigma(3); cnt += 4; } return eleInfo.setVector(stresses); } else return -1; }
int FiberSection3d::getResponse(int responseID, Information §Info) { // Just call the base class method ... don't need to define // this function, but keeping it here just for clarity if (responseID == 5) { int numData = 5*numFibers; Vector data(numData); int count = 0; for (int j = 0; j < numFibers; j++) { double yLoc, zLoc, A, stress, strain; yLoc = matData[3*j]; zLoc = matData[3*j+1]; A = matData[3*j+2]; stress = theMaterials[j]->getStress(); strain = theMaterials[j]->getStrain(); data(count) = yLoc; data(count+1) = zLoc; data(count+2) = A; data(count+3) = stress; data(count+4) = strain; count += 5; } return sectInfo.setVector(data); } else if (responseID == 6) { int count = 0; for (int j = 0; j < numFibers; j++) { if (theMaterials[j]->hasFailed() == true) count++; } return sectInfo.setInt(count); } return SectionForceDeformation::getResponse(responseID, sectInfo); }
int FourNodeQuadWithSensitivity::getResponse(int responseID, Information &eleInfo) { if (responseID == 1) { return eleInfo.setVector(this->getResistingForce()); } else if (responseID == 2) { return eleInfo.setMatrix(this->getTangentStiff()); } else if (responseID == 3) { // Loop over the integration points int cnt = 0; for (int i = 0; i < 4; i++) { // Get material stress response const Vector &sigma = theMaterial[i]->getStress(); P(cnt) = sigma(0); P(cnt+1) = sigma(1); cnt += 2; } return eleInfo.setVector(P); } else return -1; }
int Mehanny::getResponse(int responseID, Information &info) { switch (responseID) { case -1: return -1; case 1: return info.setDouble( this->getDamage() ); case 2: return info.setDouble( TrialPlasticDefo ); case 3: if(info.theVector!=0) { (*(info.theVector))(0) = TrialPosPHC; (*(info.theVector))(1) = TrialSumPosFHC; (*(info.theVector))(2) = TrialNegPHC; (*(info.theVector))(3) = TrialSumNegFHC; } return 0; default: return -1; } }
int BeamEndContact3D::getResponse(int responseID, Information &eleInfo) { // initialize variables Vector slaveForce(3); Vector masterForce(6); if (responseID == 1) { // forces on slave node slaveForce(0) = -mInternalForces(6); slaveForce(1) = -mInternalForces(7); slaveForce(2) = -mInternalForces(8); return eleInfo.setVector(slaveForce); } else if (responseID == 2) { // reactions (forces and moments) on master node for (int i = 0; i < 3; i++) { masterForce(i) = -mInternalForces(i); masterForce(i+3) = -mInternalForces(i+3); } return eleInfo.setVector(masterForce); } else { // otherwise response quantity is unknown for the BeamEndContact3D class opserr << "BeamEndContact3D::getResponse(int responseID = " << responseID << ", Information &eleInfo); " << " unknown request" << endln; return -1; } }
int YamamotoBiaxialHDR::getResponse(int responseID, Information &eleInfo) { switch (responseID) { case 1: // global forces return eleInfo.setVector(this->getResistingForce()); case 2: // local forces theVector.Zero(); // determine resisting forces in local system theVector = Tlb^basicForce; return eleInfo.setVector(theVector); case 3: // basic forces return eleInfo.setVector(basicForce); case 4: // local displacements return eleInfo.setVector(localDisp); case 5: // basic displacements return eleInfo.setVector(basicDisp); default: return -1; } }
void MissionPanel::Draw() const { MapPanel::Draw(); Color routeColor(.2, .1, 0., 0.); const System *system = selectedSystem; while(distance.Distance(system) > 0) { const System *next = distance.Route(system); Point from = next->Position() + center; Point to = system->Position() + center; Point unit = (from - to).Unit() * 7.; from -= unit; to += unit; LineShader::Draw(from, to, 5., routeColor); system = next; } DrawSelectedSystem(); Point pos = DrawPanel( Screen::TopLeft() + Point(0., -availableScroll), "Missions available here:", available.size()); DrawList(available, pos); pos = DrawPanel( Screen::TopRight() + Point(-SIDE_WIDTH, -acceptedScroll), "Your current missions:", AcceptedVisible()); DrawList(accepted, pos); DrawMissionInfo(); const Set<Color> &colors = GameData::Colors(); const Color &availableColor = *colors.Get("available back"); const Color &unavailableColor = *colors.Get("unavailable back"); const Color ¤tColor = *colors.Get("active back"); const Color &blockedColor = *colors.Get("blocked back"); if(availableIt != available.end() && availableIt->Destination()) DotShader::Draw(availableIt->Destination()->GetSystem()->Position() + center, 22., 20.5, CanAccept() ? availableColor : unavailableColor); if(acceptedIt != accepted.end() && acceptedIt->Destination()) { bool isBlocked = !acceptedIt->Waypoints().empty(); for(const NPC &npc : acceptedIt->NPCs()) isBlocked |= !npc.HasSucceeded(player.GetSystem()); DotShader::Draw(acceptedIt->Destination()->GetSystem()->Position() + center, 22., 20.5, IsSatisfied(*acceptedIt) ? currentColor : blockedColor); } // Draw the buttons to switch to other map modes. Information info; info.SetCondition("is missions"); const Interface *interface = GameData::Interfaces().Get("map buttons"); interface->Draw(info); }
int FiberSection2d::getResponse(int responseID, Information §Info) { if (responseID == 5) { int numData = 5*numFibers; Vector data(numData); int count = 0; for (int j = 0; j < numFibers; j++) { double yLoc, zLoc, A, stress, strain; yLoc = matData[3*j]; zLoc = matData[3*j+1]; A = matData[3*j+2]; stress = theMaterials[j]->getStress(); strain = theMaterials[j]->getStrain(); data(count) = yLoc; data(count+1) = zLoc; data(count+2) = A; data(count+3) = stress; data(count+4) = strain; count += 5; } return sectInfo.setVector(data); } else if (responseID == 6) { int count = 0; for (int j = 0; j < numFibers; j++) { if (theMaterials[j]->hasFailed() == true) count++; } return sectInfo.setInt(count); } return SectionForceDeformation::getResponse(responseID, sectInfo); }
int SingleFPSimple2d::getResponse(int responseID, Information &eleInfo) { double MpDelta1, MpDelta2; switch (responseID) { case 1: // global forces return eleInfo.setVector(this->getResistingForce()); case 2: // local forces theVector.Zero(); // determine resisting forces in local system theVector = Tlb^qb; // add P-Delta moments MpDelta1 = qb(0)*(ul(4)-ul(1)); theVector(2) += MpDelta1; MpDelta2 = qb(0)*(1.0 - shearDistI)*L*ul(5); theVector(2) -= MpDelta2; theVector(5) += MpDelta2; return eleInfo.setVector(theVector); case 3: // basic forces return eleInfo.setVector(qb); case 4: // local displacements return eleInfo.setVector(ul); case 5: // basic displacements return eleInfo.setVector(ub); default: return -1; } }
void InfoPanel::Draw() const { DrawBackdrop(); Information interfaceInfo; if(showShip) { interfaceInfo.SetCondition("ship tab"); if(canEdit && (shipIt != player.Ships().end()) && ((shipIt->get() != player.Flagship() && !(*shipIt)->IsDisabled()) || (*shipIt)->IsParked())) interfaceInfo.SetCondition((*shipIt)->IsParked() ? "show unpark" : "show park"); else if(!canEdit) interfaceInfo.SetCondition(CanDump() ? "enable dump" : "show dump"); if(player.Ships().size() > 1) interfaceInfo.SetCondition("four buttons"); else interfaceInfo.SetCondition("two buttons"); } else { interfaceInfo.SetCondition("player tab"); if(canEdit && player.Ships().size() > 1) { bool allParked = true; bool hasOtherShips = false; const Ship *flagship = player.Flagship(); for(const auto &it : player.Ships()) if(!it->IsDisabled() && it.get() != flagship) { allParked &= it->IsParked(); hasOtherShips = true; } if(hasOtherShips) interfaceInfo.SetCondition(allParked ? "show unpark all" : "show park all"); if(!allSelected.empty()) { allParked = true; for(int i : allSelected) { const Ship &ship = *player.Ships()[i]; if(!ship.IsDisabled() && &ship != flagship) allParked &= ship.IsParked(); } interfaceInfo.SetCondition(allParked ? "show unpark" : "show park"); } } interfaceInfo.SetCondition("two buttons"); } const Interface *interface = GameData::Interfaces().Get("info panel"); interface->Draw(interfaceInfo); zones.clear(); commodityZones.clear(); if(showShip) DrawShip(); else DrawInfo(); }
int ElasticBeam3d::getResponse (int responseID, Information &eleInfo) { double N, V, M1, M2, T; double L = theCoordTransf->getInitialLength(); double oneOverL = 1.0/L; static Vector Res(12); Res = this->getResistingForce(); switch (responseID) { case 1: // stiffness return eleInfo.setMatrix(this->getTangentStiff()); case 2: // global forces return eleInfo.setVector(Res); case 3: // local forces // Axial N = q(0); P(6) = N; P(0) = -N+p0[0]; // Torsion T = q(5); P(9) = T; P(3) = -T; // Moments about z and shears along y M1 = q(1); M2 = q(2); P(5) = M1; P(11) = M2; V = (M1+M2)*oneOverL; P(1) = V+p0[1]; P(7) = -V+p0[2]; // Moments about y and shears along z M1 = q(3); M2 = q(4); P(4) = M1; P(10) = M2; V = (M1+M2)*oneOverL; P(2) = -V+p0[3]; P(8) = V+p0[4]; return eleInfo.setVector(P); case 4: // basic forces return eleInfo.setVector(q); case 5: return eleInfo.setVector(theCoordTransf->getBasicTrialDisp()); default: return -1; } }
int ZeroLengthContact3D::getResponse(int responseID, Information &eleInfo) { if (responseID == 1) return eleInfo.setVector(this->getResistingForce()); else if (responseID == 2) return eleInfo.setMatrix(this->getTangentStiff()); else return -1; }
int main(int argc, char **argv) { // symTable = new Symboltable(); char word[4] = "abc"; Information* myInformation = new Information(word); myInformation->printLexem(); return 1; }
int EEBeamColumn2d::getResponse(int responseID, Information &eleInfo) { double L = theCoordTransf->getInitialLength(); double alpha; static Vector qA(3); switch (responseID) { case 1: // global forces return eleInfo.setVector(this->getResistingForce()); case 2: // local forces /* transform forces from basic sys B to basic sys A (linear) qA(0) = (*qDaq)[0]; qA(1) = -L*(*qDaq)[1] - (*qDaq)[2]; qA(2) = (*qDaq)[2];*/ // transform forces from basic sys B to basic sys A (nonlinear) alpha = atan2((*db)[1],L+(*db)[0]); qA(0) = cos(alpha)*(*qDaq)[0] + sin(alpha)*(*qDaq)[1]; qA(1) = (*db)[1]*(*qDaq)[0] - (L+(*db)[0])*(*qDaq)[1] - (*qDaq)[2]; qA(2) = (*qDaq)[2]; // Axial theVector(0) = -qA(0) + pA0[0]; theVector(3) = qA(0); // Shear theVector(1) = (qA(1)+qA(2))/L + pA0[1]; theVector(4) = -(qA(1)+qA(2))/L + pA0[2]; // Moment theVector(2) = qA(1); theVector(5) = qA(2); return eleInfo.setVector(theVector); case 3: // forces in basic system B return eleInfo.setVector(*qDaq); case 4: // ctrl displacements in basic system B return eleInfo.setVector(dbCtrl); case 5: // ctrl velocities in basic system B return eleInfo.setVector(vbCtrl); case 6: // ctrl accelerations in basic system B return eleInfo.setVector(abCtrl); case 7: // daq displacements in basic system B return eleInfo.setVector(this->getBasicDisp()); case 8: // daq velocities in basic system B return eleInfo.setVector(this->getBasicVel()); case 9: // daq accelerations in basic system B return eleInfo.setVector(this->getBasicAccel()); default: return -1; } }
void MapSalesPanel::DrawButtons() const { Information info; info.SetCondition(isOutfitters ? "is outfitters" : "is shipyards"); if(ZoomIsMax()) info.SetCondition("max zoom"); if(ZoomIsMin()) info.SetCondition("min zoom"); const Interface *interface = GameData::Interfaces().Get("map buttons"); interface->Draw(info); }
int ShellMITC9::getResponse(int responseID, Information &eleInfo) { int i; int cnt = 0; static Vector stresses(84); static Vector strains(84); switch (responseID) { case 1: // global forces return eleInfo.setVector(this->getResistingForce()); break; case 2: // stresses for (i = 0; i < 9; i++) { // Get material stress response const Vector &sigma = materialPointers[i]->getStressResultant(); stresses(cnt) = sigma(0); stresses(cnt+1) = sigma(1); stresses(cnt+2) = sigma(2); stresses(cnt+3) = sigma(3); stresses(cnt+4) = sigma(4); stresses(cnt+5) = sigma(5); stresses(cnt+6) = sigma(6); stresses(cnt+7) = sigma(7); cnt += 8; } return eleInfo.setVector(stresses); break; case 3: // strains for (i = 0; i < 9; i++) { // Get material stress response const Vector &deformation = materialPointers[i]->getSectionDeformation(); strains(cnt) = deformation(0); strains(cnt+1) = deformation(1); strains(cnt+2) = deformation(2); strains(cnt+3) = deformation(3); strains(cnt+4) = deformation(4); strains(cnt+5) = deformation(5); strains(cnt+6) = deformation(6); strains(cnt+7) = deformation(7); cnt += 8; } return eleInfo.setVector(strains); break; default: return -1; } }
int SSPquad::getResponse(int responseID, Information &eleInfo) { if (responseID == 1) { return eleInfo.setVector(mStress); } else if (responseID == 2) { return eleInfo.setVector(mStrain); } else { opserr << "SSPquad::getResponse ID = " << responseID << " unknown request" << endln; return -1; } }
int XC::CorotTruss::getResponse(int responseID, Information &eleInfo) { switch (responseID) { case 1: return eleInfo.setDouble(getAxialForce()); case 2: return eleInfo.setDouble(Lo * theMaterial->getStrain()); default: return 0; } }
//============================================================================= int EightNode_Brick_u_p::getResponse(int responseID, Information &eleInfo) { if (responseID == 1) return eleInfo.setVector(this->getResistingForce()); else if (responseID == 5) { static Vector stresses(Num_TotalGaussPts*6); stresstensor sigma; int cnt = 0; int i; for (i=0; i<Num_TotalGaussPts; i++) { sigma = theMaterial[i]->getStressTensor(); stresses(cnt++) = sigma.cval(1,1); //xx stresses(cnt++) = sigma.cval(2,2); //yy stresses(cnt++) = sigma.cval(3,3); //zz stresses(cnt++) = sigma.cval(2,3); //yz stresses(cnt++) = sigma.cval(3,1); //zx stresses(cnt++) = sigma.cval(1,2); //xy } return eleInfo.setVector(stresses); } else if (responseID == 6) { static Vector Gpts(Num_TotalGaussPts*Num_Dim); tensor GCoord; int cnt = 0; int i,j; GCoord = getGaussPts(); for (i=0; i<Num_TotalGaussPts; i++) { for (j=0; j<Num_Dim; j++) { Gpts(cnt++) = GCoord.cval(i+1,j+1); } } return eleInfo.setVector(Gpts); } else if (responseID == 7) { static Vector Gpts(Num_TotalGaussPts*2); stresstensor sigma; int i; for (i=0; i<Num_TotalGaussPts; i++) { sigma = theMaterial[i]->getStressTensor(); Gpts(i*2 ) = sigma.p_hydrostatic(); Gpts(i*2 +1) = sigma.q_deviatoric(); } return eleInfo.setVector(Gpts); } else return (-1); }
int Element::getResponse(int responseID, Information &eleInfo) { switch (responseID) { case 111111: // global forces return eleInfo.setVector(this->getResistingForce()); case 222222: return eleInfo.setVector(this->getRayleighDampingForces()); case 333333: return eleInfo.setVector(this->getResistingForceIncInertia()); default: return -1; } }
int ZeroLengthInterface2D::getResponse(int responseID, Information &eleInfo) { if (responseID == 1) return eleInfo.setVector(this->getResistingForce()); else if (responseID == 2) return eleInfo.setMatrix(this->getTangentStiff()); else if (responseID == 3) return eleInfo.setVector(this->pressure); else if (responseID == 4) return eleInfo.setVector(this->normal_gap); else return -1; }
int AC3D8HexWithSensitivity::getResponse (int responseID, Information &eleInfo) { switch(responseID) { case 1: return eleInfo.setVector(this->getResistingForce()); case 2: return eleInfo.setMatrix(this->getTangentStiff()); default: return -1; } }
int main() { database data; vector<Scientist> vec; data.readFile(vec); Information info; info.displayOpening(); info.instructions(vec); data.writeFile(vec); return 0; }
void PlanetPanel::Draw() { if(player.IsDead()) return; const Ship *flagship = player.Flagship(); Information info; info.SetSprite("land", planet.Landscape()); bool hasAccess = planet.CanUseServices(); bool hasShip = false; for(const auto &it : player.Ships()) if(it->GetSystem() == player.GetSystem() && !it->IsDisabled()) { hasShip = true; break; } if(flagship && flagship->CanBeFlagship()) info.SetCondition("has ship"); if(planet.IsInhabited() && hasAccess) info.SetCondition("has bank"); if(flagship && planet.IsInhabited() && hasAccess) info.SetCondition("is inhabited"); if(flagship && planet.HasSpaceport() && hasAccess) info.SetCondition("has spaceport"); if(planet.HasShipyard() && hasAccess) info.SetCondition("has shipyard"); if(hasShip && planet.HasOutfitter() && hasAccess) info.SetCondition("has outfitter"); ui.Draw(info, this); if(!selectedPanel) text.Draw(Point(-300., 80.), *GameData::Colors().Get("bright")); }
int NDMaterial::getResponse (int responseID, Information &matInfo) { switch (responseID) { case 1: return matInfo.setVector(this->getStress()); case 2: return matInfo.setVector(this->getStrain()); default: return -1; } }