void* OPS_PDeltaCrdTransf2d() { if(OPS_GetNumRemainingInputArgs() < 1) { opserr<<"insufficient arguments for PDeltaCrdTransf2d\n"; return 0; } // get tag int tag; int numData = 1; if(OPS_GetIntInput(&numData,&tag) < 0) return 0; // get option Vector jntOffsetI(2), jntOffsetJ(2); double *iptr=&jntOffsetI(0), *jptr=&jntOffsetJ(0); while(OPS_GetNumRemainingInputArgs() > 4) { std::string type = OPS_GetString(); if(type == "-jntOffset") { numData = 2; if(OPS_GetDoubleInput(&numData,iptr) < 0) return 0; if(OPS_GetDoubleInput(&numData,jptr) < 0) return 0; } } return new PDeltaCrdTransf2d(tag,jntOffsetI,jntOffsetJ); }
void* OPS_InterpolatedGroundMotion(MultiSupportPattern& thePattern) { int numArgs = OPS_GetNumRemainingInputArgs(); int numMotions = (numArgs-1)/2; GroundMotion* motions[numMotions]; // get ground motion tags int gmTags[numMotions]; if(OPS_GetIntInput(&numMotions,&gmTags[0]) < 0) return 0; // get factors Vector facts(numMotions); double* fact_ptr = &facts(0); std::string type = OPS_GetString(); if(type == "-fact") { if(OPS_GetDoubleInput(&numMotions,fact_ptr) < 0) return 0; } // get ground motions for(int i=0; i<numMotions; i++) { motions[i] = thePattern.getMotion(gmTags[i]); if(motions[i] == 0) { opserr<<"ground motion "<<gmTags[i]<<" is not found\n"; return 0; } } return new InterpolatedGroundMotion(motions,facts,false); }
GroundMotion * OPS_ParseGroundMotionCommand(MultiSupportPattern& thePattern, int&gmTag) { // get tag if(OPS_GetNumRemainingInputArgs() < 1) { opserr<<"ERROR must give GroundMotion tag.\n"; return 0; } int numData = 1; if(OPS_GetIntInput(&numData,&gmTag) < 0) return NULL; // get type std::string gmType = OPS_GetString(); // create object GroundMotion* theObj = 0; if(gmType == "Plain") { theObj = (GroundMotion*) OPS_GroundMotion(); } else if(gmType == "Interpolated") { theObj = (GroundMotion*) OPS_InterpolatedGroundMotion(thePattern); } if(theObj == 0) return 0; if(thePattern.addMotion(*theObj,gmTag) == false) { delete theObj; // invoke the destructor, otherwise mem leak return 0; } return theObj; }
void* OPS_ElasticBeam2d() { if(OPS_GetNumRemainingInputArgs() < 7) { opserr<<"insufficient arguments:eleTag,iNode,jNode,A,E,Iz,transfTag\n"; return 0; } int ndm = OPS_GetNDM(); int ndf = OPS_GetNDF(); if(ndm != 2 || ndf != 3) { opserr<<"ndm must be 2 and ndf must be 3\n"; return 0; } // inputs: int iData[3]; int numData = 3; if(OPS_GetIntInput(&numData,&iData[0]) < 0) return 0; double data[3]; if(OPS_GetDoubleInput(&numData,&data[0]) < 0) return 0; numData = 1; int transfTag; if(OPS_GetIntInput(&numData,&transfTag) < 0) return 0; // options double mass = 0.0, alpha=0.0, depth=0.0; int cMass = 0; while(OPS_GetNumRemainingInputArgs() > 0) { std::string type = OPS_GetString(); if(type == "-alpha") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&alpha) < 0) return 0; } } else if(type == "-depth") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&depth) < 0) return 0; } } else if(type == "-mass") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&mass) < 0) return 0; } } else if(type == "-cMass") { cMass = 1; } } // check transf CrdTransf* theTransf = OPS_GetCrdTransf(transfTag); if(theTransf == 0) { opserr<<"coord transfomration not found\n"; return 0; } return new ElasticBeam2d(iData[0],data[0],data[1],data[2],iData[1],iData[2], *theTransf,alpha,depth,mass,cMass); }
void* OPS_UniformExcitationPattern() { TimeSeries* accelSeries = 0; TimeSeries* velSeries = 0; TimeSeries* dispSeries = 0; TimeSeriesIntegrator* seriesIntegrator = 0; double fact = 1.0; double vel0 = 0.0; int iData[2]; if(OPS_GetNumRemainingInputArgs() < 2) { opserr<<"insufficient number of args\n"; return 0; } // get tag and direction int numData = 2; if(OPS_GetIntInput(&numData,&iData[0]) < 0) return 0; iData[1]--; // subtract 1 for c indexing // get options numData = 1; while(OPS_GetNumRemainingInputArgs() > 1) { std::string type = OPS_GetString(); if(type == "-accel"||type == "-acceleration") { int tstag; if(OPS_GetIntInput(&numData,&tstag) < 0) return 0; accelSeries = OPS_getTimeSeries(tstag); } else if(type == "-vel"||type == "-velocity") { int tstag; if(OPS_GetIntInput(&numData,&tstag) < 0) return 0; velSeries = OPS_getTimeSeries(tstag); } else if(type == "-disp"||type == "-displacement") { int tstag; if(OPS_GetIntInput(&numData,&tstag) < 0) return 0; dispSeries = OPS_getTimeSeries(tstag); } else if(type == "-fact"||type == "-factor") { if(OPS_GetDoubleInput(&numData,&fact) < 0) return 0; } else if(type == "-vel0"||type == "-initialVel") { if(OPS_GetDoubleInput(&numData,&vel0) < 0) return 0; } } // create groundmotion if(accelSeries==0&&dispSeries==0&&velSeries==0) { opserr<<"no time series is specified\n"; return 0; } GroundMotion* theMotion = new GroundMotion(dispSeries,velSeries,accelSeries,seriesIntegrator); if(theMotion == 0) { opserr << "WARNING ran out of memory creating ground motion - pattern UniformExcitation\n"; return 0; } // return new UniformExcitation(*theMotion,iData[1],iData[0],vel0,fact); }
void* OPS_LoadPattern() { if(OPS_GetNumRemainingInputArgs() < 2) { opserr<<"insufficient number of args\n"; return 0; } LoadPattern *thePattern = 0; // get tags int tags[2]; int numData = 2; if(OPS_GetIntInput(&numData, &tags[0]) < 0) { opserr << "WARNING failed to get load pattern tag\n"; return 0; } // get factor double fact = 1.0; if(OPS_GetNumRemainingInputArgs() > 1) { std::string type = OPS_GetString(); if(type=="-fact" || type=="-factor") { numData = 1; if(OPS_GetDoubleInput(&numData,&fact) < 0) { opserr << "WARNING failed to get load pattern factor\n"; return 0; } } } // create pattern thePattern = new LoadPattern(tags[0], fact); TimeSeries *theSeries = OPS_getTimeSeries(tags[1]); // check if(thePattern == 0 || theSeries == 0) { if(thePattern == 0) { opserr << "WARNING - out of memory creating LoadPattern \n"; } else { opserr << "WARNING - problem creating TimeSeries for LoadPattern \n"; } // clean up the memory and return an error if(thePattern != 0) delete thePattern; return 0; } thePattern->setTimeSeries(theSeries); return thePattern; }
TransientIntegrator * OPS_NewNewmark(void) { // Pointer to a uniaxial material that will be returned TransientIntegrator *theIntegrator = 0; int argc = OPS_GetNumRemainingInputArgs(); if (argc != 2 && argc != 4) { opserr << "WARNING - incorrect number of args want Newmark $gamma $beta <-form $typeUnknown>\n"; return 0; } bool dispFlag = true; double dData[2]; int numData = 2; if (OPS_GetDouble(&numData, dData) != 0) { opserr << "WARNING - invalid args want Newmark $gamma $beta <-form $typeUnknown>\n"; return 0; } if (argc == 2) theIntegrator = new Newmark(dData[0], dData[1]); else { char nextString[10]; OPS_GetString(nextString, 10); if (strcmp(nextString,"-form") == 0) { OPS_GetString(nextString, 10); if ((nextString[0] == 'D') || (nextString[0] == 'd')) dispFlag = true; else if ((nextString[0] == 'A') || (nextString[0] == 'a')) dispFlag = false; } theIntegrator = new Newmark(dData[0], dData[1], dispFlag); } if (theIntegrator == 0) opserr << "WARNING - out of memory creating Newmark integrator\n"; return theIntegrator; }
int OPS_Section() { theActiveFiberSection2d = 0; theActiveFiberSection3d = 0; theActiveNDFiberSection2d = 0; theActiveNDFiberSection3d = 0; theActiveFiberSection2dThermal = 0; theActiveFiberSection3dThermal = 0; theActiveFiberSectionGJThermal = 0; if (initDone == false) { setUpFunctions(); initDone = true; } // num args if(OPS_GetNumRemainingInputArgs() < 1) { opserr<<"WARNING insufficient args: pattern type ...\n"; return -1; } const char* type = OPS_GetString(); OPS_ParsingFunctionMap::const_iterator iter = functionMap.find(type); if (iter == functionMap.end()) { opserr<<"WARNING section type " << type << " is unknown\n"; return -1; } SectionForceDeformation* theSection = (SectionForceDeformation*) (*iter->second)(); if (theSection == 0) { return -1; } // Now add the section if (OPS_addSectionForceDeformation(theSection) == false) { opserr<<"ERROR could not add section.\n"; theActiveFiberSection2d = 0; theActiveFiberSection3d = 0; theActiveNDFiberSection2d = 0; theActiveNDFiberSection3d = 0; theActiveFiberSection2dThermal = 0; theActiveFiberSection3dThermal = 0; theActiveFiberSectionGJThermal = 0; delete theSection; return -1; } return 0; }
OPS_Export void * OPS_NewLinearSeries(void) { // Pointer to a uniaxial material that will be returned TimeSeries *theSeries = 0; int numRemainingArgs = OPS_GetNumRemainingInputArgs(); int tag = 0; double cFactor = 1.0; int numData = 0; if (numRemainingArgs != 0) { if (numRemainingArgs == 1 || numRemainingArgs == 3) { numData = 1; if (OPS_GetIntInput(&numData, &tag) != 0) { opserr << "WARNING invalid series tag in LinearSeries tag? <-factor factor?>" << endln; return 0; } numRemainingArgs--; } if (numRemainingArgs > 1) { char argvS[10]; if (OPS_GetString(argvS, 10) != 0) { opserr << "WARNING invalid string in LinearSeries with tag: " << tag << endln; return 0; } numData = 1; if (OPS_GetDouble(&numData, &cFactor) != 0) { opserr << "WARNING invalid factor in LinearSeries with tag: " << tag << endln; return 0; } } } theSeries = new LinearSeries(tag, cFactor); if (theSeries == 0) { opserr << "WARNING ran out of memory creating ConstantTimeSeries with tag: " << tag << "\n"; return 0; } return theSeries; }
void* OPS_NodalLoad() { // check inputs int ndm = OPS_GetNDM(); int ndf = OPS_GetNDF(); if(ndm<=0 || ndf<=0) { opserr<<"zero ndm or ndf\n"; return 0; } if(OPS_GetNumRemainingInputArgs() < 1+ndf) { opserr<<"insufficient number of args\n"; return 0; } // get node tag int ndtag; int numData = 1; if(OPS_GetIntInput(&numData, &ndtag) < 0) return 0; // get load vector Vector forces(ndf); if(OPS_GetDoubleInput(&ndf, &forces(0)) < 0) return 0; // get load const bool isLoadConst = false; if(OPS_GetNumRemainingInputArgs() > 0) { std::string type = OPS_GetString(); if(type == "-const") { isLoadConst = true; } } // create the load NodalLoad* theLoad = new NodalLoad(nodeLoadTag, ndtag, forces, isLoadConst); if(theLoad == 0) return 0; nodeLoadTag++; return theLoad; }
TransientIntegrator * OPS_NewAlphaOSGeneralized(void) { // pointer to an integrator that will be returned TransientIntegrator *theIntegrator = 0; int argc = OPS_GetNumRemainingInputArgs(); if (argc != 1 && argc != 2 && argc != 4 && argc != 5) { opserr << "WARNING - incorrect number of args want AlphaOSGeneralized $rhoInf <-updateDomain>\n"; opserr << " or integrator AlphaOSGeneralized $alphaI $alphaF $beta $gamma <-updateDomain>\n"; return 0; } bool updDomFlag = false; double dData[4]; int numData; if (argc < 3) numData = 1; else numData = 4; if (OPS_GetDouble(&numData, dData) != 0) { opserr << "WARNING - invalid args want AlphaOSGeneralized $alpha <-updateDomain>\n"; return 0; } if (argc == 2 || argc == 5) { const char *argvLoc = OPS_GetString(); if (strcmp(argvLoc, "-updateDomain") == 0) updDomFlag = true; } if (argc < 3) theIntegrator = new AlphaOSGeneralized(dData[0], updDomFlag); else theIntegrator = new AlphaOSGeneralized(dData[0], dData[1], dData[2], dData[3], updDomFlag); if (theIntegrator == 0) opserr << "WARNING - out of memory creating AlphaOSGeneralized integrator\n"; return theIntegrator; }
void * OPS_AlphaOS(void) { // pointer to an integrator that will be returned TransientIntegrator *theIntegrator = 0; int argc = OPS_GetNumRemainingInputArgs(); if (argc < 1 || argc > 4) { opserr << "WARNING - incorrect number of args want AlphaOS $alpha <-updateElemDisp>\n"; opserr << " or AlphaOS $alpha $beta $gamma <-updateElemDisp>\n"; return 0; } bool updElemDisp = false; double dData[3]; int numData; if (argc < 3) numData = 1; else numData = 3; if (OPS_GetDouble(&numData, dData) != 0) { opserr << "WARNING - invalid args want AlphaOS $alpha <-updateElemDisp>\n"; opserr << " or AlphaOS $alpha $beta $gamma <-updateElemDisp>\n"; return 0; } if (argc == 2 || argc == 4) { const char *argvLoc = OPS_GetString(); if (strcmp(argvLoc, "-updateElemDisp") == 0) updElemDisp = true; } if (argc < 3) theIntegrator = new AlphaOS(dData[0], updElemDisp); else theIntegrator = new AlphaOS(dData[0], dData[1], dData[2], updElemDisp); if (theIntegrator == 0) opserr << "WARNING - out of memory creating AlphaOS integrator\n"; return theIntegrator; }
int OPS_BeamIntegration() { static bool initDone = false; if (initDone == false) { setUpFunctions(); initDone = true; } if (OPS_GetNumRemainingInputArgs() < 2) { opserr<<"WARNING too few arguments: beamIntegration type? tag? ...\n"; return -1; } const char* type = OPS_GetString(); OPS_ParsingFunctionMap::const_iterator iter = functionMap.find(type); if (iter == functionMap.end()) { opserr<<"WARNING beam integration type " << type << " is unknown\n"; return -1; } int iTag; ID secTags; BeamIntegration* bi = (BeamIntegration*)(*iter->second)(iTag,secTags); if (bi == 0) { return -1; } BeamIntegrationRule* rule = new BeamIntegrationRule(iTag,bi,secTags); if (rule == 0) { return -1; } // add it if (OPS_addBeamIntegrationRule(rule) == false) { opserr << "WARNING failed to add BeamIntegration\n"; delete rule; return -1; } return 0; }
int OPS_UniaxialMaterial() { static bool initDone = false; if (initDone == false) { setUpUniaxialMaterials(); initDone = true; } if (OPS_GetNumRemainingInputArgs() < 2) { opserr<<"WARNING too few arguments: uniaxialMaterial type? tag? ...\n"; return -1; } const char* matType = OPS_GetString(); OPS_ParsingFunctionMap::const_iterator iter = uniaxialMaterialsMap.find(matType); if (iter == uniaxialMaterialsMap.end()) { opserr<<"WARNING material type " << matType << " is unknown\n"; return -1; } UniaxialMaterial* theMaterial = (UniaxialMaterial*) (*iter->second)(); if (theMaterial == 0) { return -1; } // Now add the material to the modelBuilder if (OPS_addUniaxialMaterial(theMaterial) == false) { opserr<<"ERROR could not add uniaaialMaterial.\n"; delete theMaterial; // invoke the material objects destructor, otherwise mem leak return -1; } return 0; }
void* OPS_FourNodeQuadWithSensitivity() { int ndm = OPS_GetNDM(); int ndf = OPS_GetNDF(); if (ndm != 2 || ndf != 2) { opserr << "WARNING -- model dimensions and/or nodal DOF not compatible with quad element\n"; return 0; } if (OPS_GetNumRemainingInputArgs() < 8) { opserr << "WARNING insufficient arguments\n"; opserr << "Want: element FourNodeQuadWithSensitivity eleTag? iNode? jNode? kNode? lNode? thk? type? matTag? <pressure? rho? b1? b2?>\n"; return 0; } // FourNodeQuadId, iNode, jNode, kNode, lNode int idata[5]; int num = 5; if (OPS_GetIntInput(&num,idata) < 0) { opserr<<"WARNING: invalid integer inputs\n"; return 0; } double thk = 0.0; num = 1; if (OPS_GetDoubleInput(&num,&thk) < 0) { opserr<<"WARNING: invalid double inputs\n"; return 0; } const char* type = OPS_GetString(); int matTag; num = 1; if (OPS_GetIntInput(&num,&matTag) < 0) { opserr<<"WARNING: invalid matTag\n"; return 0; } NDMaterial* mat = OPS_getNDMaterial(matTag); if (mat == 0) { opserr << "WARNING material not found\n"; opserr << "Material: " << matTag; opserr << "\nFourNodeQuad element: " << idata[0] << endln; return 0; } // p, rho, b1, b2 double data[4] = {0,0,0,0}; num = OPS_GetNumRemainingInputArgs(); if (num > 4) { num = 4; } if (num > 0) { if (OPS_GetDoubleInput(&num,data) < 0) { opserr<<"WARNING: invalid integer data\n"; return 0; } } return new FourNodeQuadWithSensitivity(idata[0],idata[1],idata[2],idata[3],idata[4], *mat,type,thk,data[0],data[1],data[2],data[3]); }
int TriMesh::mesh(double alpha, const ID& rtags2, const ID& rtags) { // get all regions int numregions = rtags.Size()+rtags2.Size(); int numpoints = 0; std::vector<MeshRegion*> regions(numregions); for(int i=0; i<rtags.Size(); i++) { MeshRegion* region = theDomain->getRegion(rtags(i)); if(region == 0) { opserr<<"WARNING: region "<<rtags(i)<<" is not defined\n"; return -1; } numpoints += region->getNodes().Size(); regions[i] = region; } for(int i=0; i<rtags2.Size(); i++) { MeshRegion* region = theDomain->getRegion(rtags2(i)); if(region == 0) { opserr<<"WARNING: region "<<rtags2(i)<<" is not defined\n"; return -1; } numpoints += region->getNodes().Size(); regions[i+rtags.Size()] = region; // remove elements const ID& eles = region->getExtraEles(); for (int j=0; j<eles.Size(); j++) { Element* ele = theDomain->removeElement(eles(j)); if (ele != 0) { delete ele; } } } // get all points ID ptreg(0,numpoints), ptnode(0,numpoints); for(int i=0; i<numregions; i++) { const ID& nodes = regions[i]->getNodes(); for(int j=0; j<nodes.Size(); j++) { int index = ptreg.Size(); ptreg[index] = i; ptnode[index] = nodes(j); } } // calling mesh generator TriangleMeshGenerator gen; for(int i=0; i<ptnode.Size(); i++) { // get node Node* theNode = theDomain->getNode(ptnode(i)); if(theNode == 0) { opserr<<"WARNING: node "<<ptnode(i)<<" is not defined\n"; return -1; } const Vector& crds = theNode->getCrds(); const Vector& disp = theNode->getTrialDisp(); if(crds.Size() < 2 || disp.Size() < 2) { opserr<<"WARNING: ndm < 2 or ndf < 2\n"; return -1; } // add point gen.addPoint(crds(0)+disp(0), crds(1)+disp(1)); } // meshing gen.remesh(alpha); // get elenodes std::vector<ID> regelenodes(rtags2.Size()); for(int i=0; i<gen.getNumTriangles(); i++) { int p1,p2,p3; gen.getTriangle(i,p1,p2,p3); // if all connected to fixed regions int numfix = rtags.Size(); if(ptreg(p1)<numfix && ptreg(p2)<numfix && ptreg(p3)<numfix) { continue; } // which region it belongs to int reg = ptreg(p1); if(reg<numfix || (reg>ptreg(p2) && ptreg(p2)>=numfix)) reg = ptreg(p2); if(reg<numfix || (reg>ptreg(p3) && ptreg(p3)>=numfix)) reg = ptreg(p3); reg -= numfix; // elenodes int index = regelenodes[reg].Size(); regelenodes[reg][index++] = ptnode(p1); regelenodes[reg][index++] = ptnode(p2); regelenodes[reg][index++] = ptnode(p3); } // all elenodes ID allelenodes; for(int i=0; i<(int)regelenodes.size(); i++) { int num = allelenodes.Size(); int num1 = regelenodes[i].Size(); allelenodes.resize(num+num1); for (int j=0; j<num1; j++) { allelenodes(num+j) = regelenodes[i](j); } } // create elements std::string eletype = OPS_GetString(); ID eletags; if (eletype=="PFEMElement2D") { if (OPS_PFEMElement2D(*theDomain,allelenodes,eletags) < 0) { return -1; } } else if (eletype=="PFEMElement2DQuasi") { if (OPS_PFEMElement2DCompressible(*theDomain,allelenodes,eletags) < 0) { return -1; } } else if (eletype=="PFEMElement2DBubble") { if (OPS_PFEMElement2DBubble(*theDomain,allelenodes,eletags) < 0) { return -1; } } else if (eletype=="tri31") { if (OPS_Tri31(*theDomain,allelenodes,eletags) < 0) { return -1; } } else { opserr<<"WARNING: element "<<eletype.c_str()<<" can't be used for tri mesh at this time\n"; return -1; } // add to region int num = 0; for(int i=rtags.Size(); i<numregions; i++) { int num1 = regelenodes[i-rtags.Size()].Size()/3; ID eletag(num1); for (int j=0; j<num1; j++) { eletag(j) = eletags(num+j); } num += num1; regions[i]->setExtraEles(eletag); } return 0; }
void * OPS_ZeroLengthInterface2D(void) { if (numZeroLengthInterface2D == 0) { numZeroLengthInterface2D++; opserr << "ZeroLengthContactNTS2d - Written by Roozbeh G. Mikola and N.Sitar, UC Berkeley\n"; } Element *theEle = 0; int numData = 0; // get the ele tag int eleTag, sNdNum, mNdNum, sDOF, mDOF; numData = 1; if (OPS_GetInt(&numData, &eleTag) != 0) { opserr << "ZeroLengthInterface2D::WARNING invalid eleTag \n"; return 0; } const char *nextString = OPS_GetString(); if (strcmp(nextString,"-sNdNum") != 0) { opserr << "ZeroLengthInterface2D:: expecting -sNdNum \n"; return 0; } // get the number of slave nodes numData = 1; if (OPS_GetInt(&numData, &sNdNum) != 0) { opserr << "ZeroLengthInterface2D::WARNING invalied sNdNum \n"; return 0; } numData = 10; nextString = OPS_GetString(); if (strcmp(nextString,"-mNdNum") != 0) { opserr << "ZeroLengthInterface2D:: expecting -mNdNum\n"; return 0; } numData = 1; if (OPS_GetInt(&numData, &mNdNum) != 0) { opserr << "ZeroLengthInterface2D::WARNING invalied sNdNum \n"; return 0; } numData = 10; nextString = OPS_GetString(); if (strcmp(nextString,"-dof") != 0) { opserr << "ZeroLengthInterface2D:: expecting -sdof in "<< "element zeroLengthInterface2D eleTag? -sNdNum sNdNum? -mNdNum mNdNum? -dof sdof? mdof? -Nodes Nodes? Kn? Kt? phi? \n" ; return 0; } numData = 1; if (OPS_GetInt(&numData, &sDOF) != 0) { opserr << "ZeroLengthInterface2D::WARNING invalied sDOF\n"; return 0; } numData = 1; if (OPS_GetInt(&numData, &mDOF) != 0) { opserr << "ZeroLengthInterface2D::WARNING invalied mDOF\n"; return 0; } // a quick check on number of args int argc = OPS_GetNumRemainingInputArgs(); if (argc < 3 + sNdNum + mNdNum) { opserr << "ZeroLengthInterface2D::WARNING too few arguments " << "element zeroLengthInterface2D eleTag? -sNdNum sNdNum? -mNdNum mNdNum? -dof sdof? mdof? -Nodes Nodes? Kn? Kt? phi? \n" ; return 0; } numData = 10; nextString = OPS_GetString(); if (strcmp(nextString,"-Nodes") != 0) { opserr << "ZeroLengthInterface2D:: expecting -Nodes\n"; return 0; } // read the Nodes values numData = sNdNum+mNdNum; int *theNodeData = new int[numData]; ID Nodes(theNodeData, numData); if (OPS_GetInt(&numData, theNodeData) != 0) { opserr << "ZeroLengthInterface2D:: not enough node tags provided for ele: "; opserr << eleTag << "\n"; return 0; } // read the material properties numData = 3; double dData[3]; if (OPS_GetDouble(&numData, dData) != 0) { opserr << "ZeroLengthInterface2D::WARNING invalid Kn,Kt or phi\n" ; return 0; } // // now we create the element and add it to the domain // theEle = new ZeroLengthInterface2D(eleTag, sNdNum, mNdNum, sDOF, mDOF, Nodes, dData[0], dData[1], dData[2]); return theEle; }
void* OPS_ElasticBeam3d(void) { int numArgs = OPS_GetNumRemainingInputArgs(); if(numArgs < 10 && numArgs != 5) { opserr<<"insufficient arguments:eleTag,iNode,jNode,A,E,G,J,Iy,Iz,transfTag\n"; return 0; } int ndm = OPS_GetNDM(); int ndf = OPS_GetNDF(); if(ndm != 3 || ndf != 6) { opserr<<"ndm must be 3 and ndf must be 6\n"; return 0; } // inputs: int iData[3]; int numData = 3; if(OPS_GetIntInput(&numData,&iData[0]) < 0) return 0; SectionForceDeformation* theSection = 0; CrdTransf* theTrans = 0; double data[6]; int transfTag, secTag; if(numArgs == 5) { numData = 1; if(OPS_GetIntInput(&numData,&secTag) < 0) return 0; if(OPS_GetIntInput(&numData,&transfTag) < 0) return 0; theSection = OPS_getSectionForceDeformation(secTag); if(theSection == 0) { opserr<<"no section is found\n"; return 0; } theTrans = OPS_getCrdTransf(transfTag); if(theTrans == 0) { opserr<<"no CrdTransf is found\n"; return 0; } } else { numData = 6; if(OPS_GetDoubleInput(&numData,&data[0]) < 0) return 0; numData = 1; if(OPS_GetIntInput(&numData,&transfTag) < 0) return 0; theTrans = OPS_getCrdTransf(transfTag); if(theTrans == 0) { opserr<<"no CrdTransf is found\n"; return 0; } } // options double mass = 0.0; int cMass = 0; while(OPS_GetNumRemainingInputArgs() > 0) { std::string theType = OPS_GetString(); if (theType == "-mass") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&mass) < 0) return 0; } } else if (theType == "-cMass") { cMass = 1; } } if (theSection != 0) { return new ElasticBeam3d(iData[0],iData[1],iData[2],theSection,*theTrans,mass,cMass); } else { return new ElasticBeam3d(iData[0],data[0],data[1],data[2],data[3],data[4], data[5],iData[1],iData[2],*theTrans, mass,cMass); } }
OPS_Export void * OPS_NewTrussSectionElement() { Element *theElement = 0; int numRemainingArgs = OPS_GetNumRemainingInputArgs(); if (numRemainingArgs < 4) { opserr << "Invalid Args want: element TrussSection $tag $iNode $jNode $sectTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n"; return 0; } int iData[4]; double rho = 0.0; int ndm = OPS_GetNDM(); int doRayleigh = 0; // by default rayleigh not done int cMass = 0; // by default use lumped mass matrix int numData = 4; if (OPS_GetInt(&numData, iData) != 0) { opserr << "WARNING invalid integer (tag, iNode, jNode, sectTag) in element TrussSection " << endln; return 0; } SectionForceDeformation *theSection = OPS_GetSectionForceDeformation(iData[3]); if (theSection == 0) { opserr << "WARNING: Invalid section not found element TrussSection " << iData[0] << " $iNode $jNode " << iData[3] << " <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n"; return 0; } numRemainingArgs -= 4; while (numRemainingArgs > 1) { char argvS[15]; if (OPS_GetString(argvS, 15) != 0) { opserr << "WARNING: Invalid optional string element TrussSection " << iData[0] << " $iNode $jNode $sectTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n"; return 0; } if (strcmp(argvS,"-rho") == 0) { numData = 1; if (OPS_GetDouble(&numData, &rho) != 0) { opserr << "WARNING Invalid rho in element TrussSection " << iData[0] << " $iNode $jNode $secTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n"; return 0; } } else if (strcmp(argvS,"-cMass") == 0) { numData = 1; if (OPS_GetInt(&numData, &cMass) != 0) { opserr << "WARNING: Invalid cMass in element TrussSection " << iData[0] << " $iNode $jNode $sectTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n"; return 0; } } else if (strcmp(argvS,"-doRayleigh") == 0) { numData = 1; if (OPS_GetInt(&numData, &doRayleigh) != 0) { opserr << "WARNING: Invalid doRayleigh in element TrussSection " << iData[0] << " $iNode $jNode $sectTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n"; return 0; } } else { opserr << "WARNING: Invalid option " << argvS << " in: element TrussSection " << iData[0] << " $iNode $jNode $secTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n"; return 0; } numRemainingArgs -= 2; } // now create the TrussSection theElement = new TrussSection(iData[0], ndm, iData[1], iData[2], *theSection, rho, doRayleigh, cMass); if (theElement == 0) { opserr << "WARNING: out of memory: element TrussSection " << iData[0] << " $iNode $jNode $secTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n"; } return theElement; }
void *OPS_NewElasticMultiLinear() { // Pointer to a uniaxial material that will be returned UniaxialMaterial *theMaterial = 0; int argc = OPS_GetNumRemainingInputArgs(); if (argc < 7) { opserr << "WARNING incorrect num args want: uniaxialMaterial "; opserr << "ElasticMultiLinear tag -strain strainPoints "; opserr << "-stress stressPoints "; opserr << "(with at least two stress-strain points)\n"; return 0; } int tag[1]; double strainData[64]; double stressData[64]; char paraStr[8]; int numData = 1; if (OPS_GetIntInput(&numData,tag) != 0) { opserr << "WARNING invalid uniaxialMaterial ElasticMultiLinear tag\n"; return 0; } // get strain data points numData = (argc - 3)/2; OPS_GetString(paraStr,7); if (strcmp(paraStr,"-strain") == 0) { if (OPS_GetDoubleInput(&numData,strainData) != 0) { opserr << "WARNING invalid strainPoints\n"; opserr << "uniaxialMaterial ElasticMultiLinear: " << tag[0] << endln; return 0; } } else { opserr << "WARNING expecting -strain but got " << paraStr << endln; opserr << "uniaxialMaterial ElasticMultiLinear: " << tag[0] << endln; return 0; } Vector strainPts(strainData,numData); // get stress data points OPS_GetString(paraStr,7); if (strcmp(paraStr,"-stress") == 0) { if (OPS_GetDoubleInput(&numData, stressData) != 0) { opserr << "WARNING invalid stressPoints\n"; opserr << "uniaxialMaterial ElasticMultiLinear: " << tag[0] << endln; return 0; } } else { opserr << "WARNING expecting -stress but got " << paraStr << endln; opserr << "uniaxialMaterial ElasticMultiLinear: " << tag[0] << endln; return 0; } Vector stressPts(stressData,numData); // Parsing was successful, allocate the material theMaterial = new ElasticMultiLinear(tag[0], strainPts, stressPts); if (theMaterial == 0) { opserr << "WARNING could not create uniaxialMaterial of type "; opserr << "ElasticMultiLinear\n"; return 0; } return theMaterial; }
void * OPS_ParallelMaterial(void) { // Pointer to a uniaxial material that will be returned UniaxialMaterial *theMaterial = 0; Vector *theFactors = 0; int argc = OPS_GetNumRemainingInputArgs(); if (argc < 2) { opserr << "Invalid #args, want: uniaxialMaterial Parallel $tag $tag1 $tag2 ... <-factors $fact1 $fact2 ...>" << endln; return 0; } // count the number of materials int numMats = -1; int gotFactors = 0; while (argc > 0) { const char *argvLoc = OPS_GetString(); if (strcmp(argvLoc, "-factors") == 0) { gotFactors = 1; break; } numMats++; argc = OPS_GetNumRemainingInputArgs(); } // reset to read from beginning OPS_ResetCurrentInputArg(2); int numData = 1+numMats; int *iData = new int[numData]; UniaxialMaterial **theMats = new UniaxialMaterial *[numMats]; double *dData = 0; if (gotFactors) { dData = new double[numMats]; theFactors = new Vector(dData, numMats); } if (OPS_GetIntInput(&numData, iData) != 0) { opserr << "WARNING invalid data for uniaxialMaterial Parallel" << endln; return 0; } for (int i=1; i<numMats+1; i++) { UniaxialMaterial *theMat = OPS_getUniaxialMaterial(iData[i]); if (theMat == 0) { opserr << "WARNING no existing material with tag " << iData[i] << " for uniaxialMaterial Parallel" << iData[0] << endln; delete [] iData; delete [] theMats; return 0; } theMats[i-1] = theMat; } if (gotFactors) { const char *argvLoc = OPS_GetString(); if (OPS_GetDoubleInput(&numMats, dData) != 0) { opserr << "WARNING invalid factors for uniaxialMaterial Parallel" << endln; return 0; } } // Parsing was successful, allocate the material theMaterial = new ParallelMaterial(iData[0], numMats, theMats, theFactors); if (theMaterial == 0) { opserr << "WARNING could not create uniaxialMaterial of type Parallel\n"; return 0; } delete [] iData; delete [] theMats; if (theFactors != 0) delete theFactors; return theMaterial; }
void* OPS_Bidirectional() { if (OPS_GetNumRemainingInputArgs() < 5) { opserr << "WARNING insufficient arguments\n"; opserr << "Want: section Bidirectional tag? E? sigY? Hiso? Hkin?" << endln; return 0; } int tag; int numdata = 1; if (OPS_GetIntInput(&numdata, &tag) < 0) { opserr << "WARNING invalid Bidirectional tag" << endln; return 0; } numdata = 4; double data[4]; if (OPS_GetDoubleInput(&numdata, data) < 0) { opserr << "WARNING invalid double inputs\n"; opserr << "section Bidirectional: " << tag << endln; return 0; } double E = data[0]; double sigY = data[1]; double Hi = data[2]; double Hk = data[3]; if (OPS_GetNumRemainingInputArgs() > 1) { int code1, code2; const char* type1 = OPS_GetString(); const char* type2 = OPS_GetString(); if (strcmp(type1,"Mz") == 0) code1 = SECTION_RESPONSE_MZ; else if (strcmp(type1,"P") == 0) code1 = SECTION_RESPONSE_P; else if (strcmp(type1,"Vy") == 0) code1 = SECTION_RESPONSE_VY; else if (strcmp(type1,"My") == 0) code1 = SECTION_RESPONSE_MY; else if (strcmp(type1,"Vz") == 0) code1 = SECTION_RESPONSE_VZ; else if (strcmp(type1,"T") == 0) code1 = SECTION_RESPONSE_T; else { opserr << "WARNING invalid code 1 " << type1 << endln; opserr << "section Bidirectional: " << tag << endln; return 0; } if (strcmp(type2,"Mz") == 0) code2 = SECTION_RESPONSE_MZ; else if (strcmp(type2,"P") == 0) code2 = SECTION_RESPONSE_P; else if (strcmp(type2,"Vy") == 0) code2 = SECTION_RESPONSE_VY; else if (strcmp(type2,"My") == 0) code2 = SECTION_RESPONSE_MY; else if (strcmp(type2,"Vz") == 0) code2 = SECTION_RESPONSE_VZ; else if (strcmp(type2,"T") == 0) code2 = SECTION_RESPONSE_T; else { opserr << "WARNING invalid code 2 " << type2 << endln; opserr << "section Bidirectional: " << tag << endln; return 0; } return new Bidirectional(tag, E, sigY, Hi, Hk, code1, code2); } else { return new Bidirectional(tag, E, sigY, Hi, Hk); } }
OPS_Export void * OPS_NewCorotTrussElement() { Element *theElement = 0; int numRemainingArgs = OPS_GetNumRemainingInputArgs(); if (numRemainingArgs < 4) { opserr << "Invalid Args want: element CorotTruss $tag $iNode $jNode $sectTag <-rho $rho>"; opserr << " or: element CorotTruss $tag $iNode $jNode $A $matTag <-rho $rho>\n"; return 0; } if (numRemainingArgs == 4 || numRemainingArgs == 6) return 0; // it's a CorotTrussSection int iData[3]; double A = 0.0; double rho = 0.0; int matTag = 0; int ndm = OPS_GetNDM(); int numData = 3; if (OPS_GetInt(&numData, iData) != 0) { opserr << "WARNING invalid integer (tag, iNode, jNode) in element CorotTruss " << endln; return 0; } numData = 1; if (OPS_GetDouble(&numData, &A) != 0) { opserr << "WARNING: Invalid A: element CorotTruss " << iData[0] << " $iNode $jNode $A $matTag <-rho $rho> <-rayleig $flagh>\n"; return 0; } numData = 1; if (OPS_GetInt(&numData, &matTag) != 0) { opserr << "WARNING: Invalid matTag: element CorotTruss " << iData[0] << " $iNode $jNode $A $matTag <-rho $rho> <-rayleig $flagh>\n"; return 0; } UniaxialMaterial *theUniaxialMaterial = OPS_GetUniaxialMaterial(matTag); if (theUniaxialMaterial == 0) { opserr << "WARNING: Invalid material not found element CorotTruss " << iData[0] << " $iNode $jNode $A " << matTag << " <-rho $rho> <-rayleigh $flagh>\n"; return 0; } numRemainingArgs -= 5; while (numRemainingArgs > 1) { char argvS[10]; if (OPS_GetString(argvS, 10) != 0) { opserr << "WARNING: Invalid optional string element CorotTruss " << iData[0] << " $iNode $jNode $A $matTag <-rho $rho> <-rayleigh $flagh>\n"; return 0; } if (strcmp(argvS,"-rho") == 0) { numData = 1; if (OPS_GetDouble(&numData, &rho) != 0) { opserr << "WARNING Invalid rho in element CorotTruss " << iData[0] << " $iNode $jNode $A $matTag <-rho $rho> <-rayleigh $flagh>\n"; return 0; } } else { opserr << "WARNING: Invalid option " << argvS << " in: element CorotTruss " << iData[0] << " $iNode $jNode $A $matTag <-rho $rho> <-rayleigh $flagh>\n"; return 0; } numRemainingArgs -= 2; } //now create the ReinforcedConcretePlaneStress theElement = new CorotTruss(iData[0], ndm, iData[1], iData[2], *theUniaxialMaterial, A, rho); if (theElement == 0) { opserr << "WARNING: out of memory: element CorotTruss " << iData[0] << " $iNode $jNode $A $matTag <-rho $rho> \n"; } return theElement; }
int OPS_Layer() { // num args if(OPS_GetNumRemainingInputArgs() < 1) { opserr<<"WARNING insufficient args: layer type ...\n"; return -1; } // create patch ReinfLayer *theLayer = 0; const char* type = OPS_GetString(); if(strcmp(type,"straight")==0) { theLayer = (ReinfLayer*) OPS_StraightReinfLayer(); } else if(strcmp(type,"circ")==0 || strcmp(type,"circular")==0) { theLayer = (ReinfLayer*) OPS_CircReinfLayer(); } else { opserr<<"ERROR unknow layer type\n"; return -1; } if (theLayer == 0) { opserr<<"WARNING failed to create layer\n"; return -1; } // add fibers to the section int numReinfBars = theLayer->getNumReinfBars(); ReinfBar* reinfBar = theLayer->getReinfBars(); int matTag = theLayer->getMaterialID(); if(reinfBar == 0) { opserr<<"ERROR out of run to create fibers\n"; delete theLayer; return -1; } for(int j=0; j<numReinfBars; j++) { // get fiber data double area = reinfBar[j].getArea(); const Vector& cPos = reinfBar[j].getPosition(); // create fibers Fiber *theFiber = 0; UniaxialMaterial *material = 0; NDMaterial *ndmaterial = 0; if (theActiveFiberSection2d != 0) { material = OPS_getUniaxialMaterial(matTag); if (material == 0) { opserr << "WARNING material "<<matTag<<" cannot be found\n"; delete theLayer; return -1; } theFiber = new UniaxialFiber2d(j,*material,area,cPos(0)); theActiveFiberSection2d->addFiber(*theFiber); } else if (theActiveFiberSection2dThermal != 0) { material = OPS_getUniaxialMaterial(matTag); if (material == 0) { opserr << "WARNING material "<<matTag<<" cannot be found\n"; delete theLayer; return -1; } theFiber = new UniaxialFiber2d(j,*material,area,cPos(0)); theActiveFiberSection2dThermal->addFiber(*theFiber); } else if (theActiveFiberSection3d != 0) { material = OPS_getUniaxialMaterial(matTag); if (material == 0) { opserr << "WARNING material "<<matTag<<" cannot be found\n"; delete theLayer; return -1; } theFiber = new UniaxialFiber3d(j,*material,area,cPos); theActiveFiberSection3d->addFiber(*theFiber); } else if (theActiveFiberSection3dThermal != 0) { material = OPS_getUniaxialMaterial(matTag); if (material == 0) { opserr << "WARNING material "<<matTag<<" cannot be found\n"; delete theLayer; return -1; } theFiber = new UniaxialFiber3d(j,*material,area,cPos); theActiveFiberSection3dThermal->addFiber(*theFiber); } else if (theActiveFiberSectionGJThermal != 0) { material = OPS_getUniaxialMaterial(matTag); if (material == 0) { opserr << "WARNING material "<<matTag<<" cannot be found\n"; delete theLayer; return -1; } theFiber = new UniaxialFiber3d(j,*material,area,cPos); theActiveFiberSectionGJThermal->addFiber(*theFiber); } else if (theActiveNDFiberSection2d != 0) { ndmaterial = OPS_getNDMaterial(matTag); if (ndmaterial == 0) { opserr << "WARNING material "<<matTag<<" cannot be found\n"; delete theLayer; return -1; } theFiber = new NDFiber2d(j,*ndmaterial,area,cPos(0)); theActiveNDFiberSection2d->addFiber(*theFiber); } else if (theActiveNDFiberSection3d != 0) { ndmaterial = OPS_getNDMaterial(matTag); if (ndmaterial == 0) { opserr << "WARNING material "<<matTag<<" cannot be found\n"; delete theLayer; return -1; } theFiber = new NDFiber3d(j,*ndmaterial,area,cPos(0),cPos(1)); theActiveNDFiberSection3d->addFiber(*theFiber); } } delete [] reinfBar; delete theLayer; return 0; }
void * OPS_Truss2(void) { Element *theElement = 0; int numRemainingArgs = OPS_GetNumRemainingInputArgs(); if (numRemainingArgs < 7) { opserr << "Invalid Args want: element Truss2 $tag $iNode $jNode $auxN1 $auxN2 $A $matTag <-rho $rho> <-rayleigh $flag>\n"; return 0; } int iData[5]; double A = 0.0; double rho = 0.0; int matTag = 0; int doRayleigh = 0; int ndm = OPS_GetNDM(); int numData = 5; if (OPS_GetInt(&numData, iData) != 0) { opserr << "WARNING invalid integer (tag, iNode, jNode, auxN1, auxN2) in element Truss2 " << endln; return 0; } numData = 1; if (OPS_GetDouble(&numData, &A) != 0) { opserr << "WARNING: Invalid A: element Truss2 " << iData[0] << " $iNode $jNode $auxN1 $auxN2 $A $matTag <-rho $rho> <-rayleig $flagh>\n"; return 0; } numData = 1; if (OPS_GetInt(&numData, &matTag) != 0) { opserr << "WARNING: Invalid matTag: element Truss2 " << iData[0] << " $iNode $jNode $auxN1 $auxN2 $A $matTag <-rho $rho> <-rayleig $flagh>\n"; return 0; } UniaxialMaterial *theUniaxialMaterial = OPS_GetUniaxialMaterial(matTag); if (theUniaxialMaterial == 0) { opserr << "WARNING: Invalid material not found element Truss2 " << iData[0] << " $iNode $jNode $auxN1 $auxN2 $A " << matTag << " <-rho $rho> <-rayleig $flagh>\n"; return 0; } numRemainingArgs -= 7; while (numRemainingArgs > 1) { const char *argvS = OPS_GetString(); if (strcmp(argvS,"-rho") == 0) { numData = 1; if (OPS_GetDouble(&numData, &rho) != 0) { opserr << "WARNING Invalid rho in element Truss " << iData[0] << " $iNode $jNode $A $matTag <-rho $rho> <-doRayleigh $flagh>\n"; return 0; } } else if (strcmp(argvS,"-doRayleigh") == 0) { numData = 1; if (OPS_GetInt(&numData, &doRayleigh) != 0) { opserr << "WARNING: Invalid doRayleigh in element Truss " << iData[0] << " $iNode $jNode $A $matTag <-rho $rho> <-doRayleigh $flagh>\n"; return 0; } } else { opserr << "WARNING: Invalid option " << argvS << " in: element Truss " << iData[0] << " $iNode $jNode $A $matTag <-rho $rho> <-doRayleigh $flagh>\n"; return 0; } numRemainingArgs -= 2; } //now create the ReinforcedConcretePlaneStress theElement = new Truss2(iData[0], ndm, iData[1], iData[2], iData[3], iData[4], *theUniaxialMaterial, A, rho, doRayleigh); if (theElement == 0) { opserr << "WARNING: out of memory: element Truss2 " << iData[0] << " $iNode $jNode $auxN1 $auxN2 $A $matTag <-rho $rho>\n"; } return theElement; }
int OPS_ElasticBeam2d(Domain& theDomain, const ID& elenodes, ID& eletags) { if(OPS_GetNumRemainingInputArgs() < 4) { opserr<<"insufficient arguments:A,E,Iz,transfTag\n"; return -1; } // inputs: double data[3]; int numData = 3; if(OPS_GetDoubleInput(&numData,&data[0]) < 0) return -1; numData = 1; int transfTag; if(OPS_GetIntInput(&numData,&transfTag) < 0) return -1; // options double mass = 0.0, alpha=0.0, depth=0.0; int cMass = 0; while(OPS_GetNumRemainingInputArgs() > 0) { std::string type = OPS_GetString(); if(type == "-alpha") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&alpha) < 0) return -1; } } else if(type == "-depth") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&depth) < 0) return -1; } } else if(type == "-mass") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&mass) < 0) return -1; } } else if(type == "-cMass") { cMass = 1; } } // check transf CrdTransf* theTransf = OPS_getCrdTransf(transfTag); if(theTransf == 0) { opserr<<"coord transfomration not found\n"; return -1; } // create elements ElementIter& theEles = theDomain.getElements(); Element* theEle = theEles(); int currTag = 0; if (theEle != 0) { currTag = theEle->getTag(); } eletags.resize(elenodes.Size()/2); for (int i=0; i<elenodes.Size()/2; i++) { theEle = new ElasticBeam2d(--currTag,data[0],data[1],data[2],elenodes(2*i),elenodes(2*i+1), *theTransf,alpha,depth,mass,cMass); if (theEle == 0) { opserr<<"WARING: run out of memory for creating element\n"; return -1; } if (theDomain.addElement(theEle) == false) { opserr<<"WARNING: failed to add element to domain\n"; delete theEle; return -1; } eletags(i) = currTag; } return 0; }
int Mesh::setEleArgs() { // no elements if (OPS_GetNumRemainingInputArgs() < 1) { eleType = 0; return 0; } // get type and set info const char* type = OPS_GetString(); int ndm = OPS_GetNDM(); ID info(2); info(0) = 1; //save data info(1) = this->getTag(); if (strcmp(type, "elasticBeamColumn") == 0) { if (ndm == 2) { eleType = ELE_TAG_ElasticBeam2d; if (OPS_ElasticBeam2d(info) == 0) { opserr << "WARNING: failed to read eleArgs\n"; return -1; } numelenodes = 2; } } else if(strcmp(type, "forceBeamColumn") == 0) { if (ndm == 2) { eleType = ELE_TAG_ForceBeamColumn2d; if (OPS_ForceBeamColumn2d(info) == 0) { opserr << "WARNING: failed to read eleArgs\n"; return -1; } numelenodes = 2; } } else if(strcmp(type, "dispBeamColumn") == 0) { if (ndm == 2) { eleType = ELE_TAG_DispBeamColumn2d; if (OPS_DispBeamColumn2d(info) == 0) { opserr << "WARNING: failed to read eleArgs\n"; return -1; } numelenodes = 2; } } else if(strcmp(type, "PFEMElementBubble") == 0) { if (ndm == 2) { eleType = ELE_TAG_PFEMElement2DBubble; if (OPS_PFEMElement2DBubble(info) == 0) { opserr << "WARNING: failed to read eleArgs\n"; return -1; } fluid = true; numelenodes = 3; } else { eleType = ELE_TAG_PFEMElement3DBubble; if (OPS_PFEMElement3DBubble(info) == 0) { opserr << "WARNING: failed to read eleArgs\n"; return -1; } fluid = true; numelenodes = 4; } } else if(strcmp(type, "MINI") == 0) { if (ndm == 2) { eleType = ELE_TAG_PFEMElement2Dmini; if (OPS_PFEMElement2Dmini(info) == 0) { opserr << "WARNING: failed to read eleArgs\n"; return -1; } fluid = true; numelenodes = 3; } } else if(strcmp(type, "PFEMElementCompressible") == 0) { if (ndm == 2) { eleType = ELE_TAG_PFEMElement2DCompressible; if (OPS_PFEMElement2DCompressible(info) == 0) { opserr << "WARNING: failed to read eleArgs\n"; return -1; } fluid = true; numelenodes = 3; } } else if(strcmp(type, "tri31") == 0) { eleType = ELE_TAG_Tri31; if (OPS_Tri31(info) == 0) { opserr << "WARNING: failed to read eleArgs\n"; return -1; } numelenodes = 3; } else if(strcmp(type, "FourNodeTetrahedron") == 0) { eleType = ELE_TAG_FourNodeTetrahedron; if (OPS_FourNodeTetrahedron(info) == 0) { opserr << "WARNING: failed to read eleArgs\n"; return -1; } numelenodes = 4; } else if (strcmp(type, "ShellMITC4") == 0) { eleType = ELE_TAG_ShellMITC4; if (OPS_ShellMITC4(info) == 0) { opserr << "WARNING: failed to read eleArgs\n"; return -1; } numelenodes = 4; } else { opserr << "WARNING: element "<<type<<" is not currently supported in mesh\n"; return -1; } return 0; }
void* OPS_ElasticBeam2d(const ID &info) { if(OPS_GetNumRemainingInputArgs() < 5) { opserr<<"insufficient arguments:eleTag,iNode,jNode,<A,E,Iz>or<sectionTag>,transfTag\n"; return 0; } int ndm = OPS_GetNDM(); int ndf = OPS_GetNDF(); if(ndm != 2 || ndf != 3) { opserr<<"ndm must be 2 and ndf must be 3\n"; return 0; } // inputs: int iData[3]; int numData = 3; if(OPS_GetIntInput(&numData,&iData[0]) < 0) { opserr<<"WARNING failed to read integers\n"; return 0; } bool section = false; int sectionTag; double data[3]; if (OPS_GetNumRemainingInputArgs() > 3) { // Read A, E, Iz numData = 3; if(OPS_GetDoubleInput(&numData,&data[0]) < 0) { opserr<<"WARNING failed to read doubles\n"; return 0; } } else { // Read a section tag numData = 1; if(OPS_GetIntInput(&numData,§ionTag) < 0) { opserr<<"WARNING sectionTag is not integer\n"; return 0; } section = true; } numData = 1; int transfTag; if(OPS_GetIntInput(&numData,&transfTag) < 0) { opserr<<"WARNING transfTag is not integer\n"; return 0; } // options double mass = 0.0, alpha=0.0, depth=0.0; int cMass = 0; while(OPS_GetNumRemainingInputArgs() > 0) { std::string type = OPS_GetString(); if(type == "-alpha") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&alpha) < 0) return 0; } } else if(type == "-depth") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&depth) < 0) return 0; } } else if(type == "-mass") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&mass) < 0) return 0; } } else if(type == "-cMass") { cMass = 1; } } // check transf CrdTransf* theTransf = OPS_getCrdTransf(transfTag); if(theTransf == 0) { opserr<<"coord transfomration not found\n"; return 0; } if (section) { SectionForceDeformation *theSection = OPS_getSectionForceDeformation(sectionTag); if (theSection == 0) { opserr << "section not found\n"; return 0; } return new ElasticBeam2d(iData[0],iData[1],iData[2],*theSection, *theTransf,alpha,depth,mass,cMass); } else { return new ElasticBeam2d(iData[0],data[0],data[1],data[2],iData[1],iData[2], *theTransf,alpha,depth,mass,cMass); } }
void* OPS_YamamotoBiaxialHDR() { // 3-dim, 6-dof int ndm = OPS_GetNDM(); int ndf = OPS_GetNDF(); if (ndm != 3 || ndf != 6) { opserr << "ndm=" << ndm << ", ndf=" << ndf << endln; opserr << "WARNING YamamotoBiaxialHDR command only works when ndm is 3 and ndf is 6" << endln; return 0; } //arguments (necessary) int eleTag; int iNode; int jNode; int Tp = 1; double DDo; double DDi; double Hr; //arguments (optional) double Cr=1.0; double Cs=1.0; Vector oriX(0); Vector oriYp(3); oriYp(0) = 0.0; oriYp(1) = 1.0; oriYp(2) = 0.0; double mass = 0.0; // Element *theElement = 0; //error flag bool ifNoError = true; // int numdata = 1; if (OPS_GetNumRemainingInputArgs() < 7) { // element YamamotoBiaxialHDR eleTag? iNode? jNode? Tp? DDo? DDi? Hr? // argc = 1 2 3 4 5 6 7 8 9 // argv = argv[0] argv[1] argv[2] argv[3] ................. argv[8] opserr << "WARNING insufficient arguments\n"; ifNoError = false; } else { //argv[2~8] if (OPS_GetIntInput(&numdata, &eleTag) < 0) { opserr << "WARNING invalid YamamotoBiaxialHDR eleTag\n"; ifNoError = false; } // iNode if (OPS_GetIntInput(&numdata, &iNode) < 0) { opserr << "WARNING invalid iNode\n"; ifNoError = false; } // jNode if (OPS_GetIntInput(&numdata, &jNode) < 0) { opserr << "WARNING invalid jNode\n"; ifNoError = false; } // Tp const char* tparg = OPS_GetString(); if (strcmp(tparg,"1") == 0) { Tp = 1; // Bridgestone X0.6R (EESD version) } else { opserr << "WARNING invalid YamamotoBiaxialHDR Tp" << endln; ifNoError = false; } // DDo if (OPS_GetDoubleInput(&numdata, &DDo) < 0 || DDo <= 0.0) { opserr << "WARNING invalid YamamotoBiaxialHDR DDo" << endln; ifNoError = false; } // DDi if (OPS_GetDoubleInput(&numdata, &DDi) < 0 || DDi < 0.0) { opserr << "WARNING invalid YamamotoBiaxialHDR DDi" << endln; ifNoError = false; } // Hr if (OPS_GetDoubleInput(&numdata, &Hr) < 0 || Hr <= 0.0) { opserr << "WARNING invalid YamamotoBiaxialHDR Hr" << endln; ifNoError = false; } // check print--------------------------------------------/ // opserr << " \n"; // opserr << "TclModelBuilder_addYamamotoBiaxialHDR()\n"; // opserr << " tp = " << Tp << endln; // opserr << " ddo = " << DDo << endln; // opserr << " ddi = " << DDi << endln; // opserr << " hr = " << Hr << endln; //------------------------------------------------------ // argv[9~] while (OPS_GetNumRemainingInputArgs() > 0) { double value; const char* flag = OPS_GetString(); if (strcmp(flag,"-orient")==0 && OPS_GetNumRemainingInputArgs() >= 6) { // <-orient x1? x2? x3? yp1? yp2? yp3?> oriX.resize(3); // x1, x2, x3 for (int j=1; j<=3; j++) { if (OPS_GetDoubleInput(&numdata, &value) < 0) { opserr << "WARNING invalid -orient value\n"; ifNoError = false; } else { oriX(j-1) = value; } } // yp1, yp2, yp3 for (int j=1; j<=3; j++) { if (OPS_GetDoubleInput(&numdata, &value) < 0) { opserr << "WARNING invalid -orient value\n"; ifNoError = false; } else { oriYp(j-1) = value; } } } else if (strcmp(flag,"-orient")==0 && OPS_GetNumRemainingInputArgs() >= 3) { // <-orient yp1? yp2? yp3?> for (int j=1; j<=3; j++) { if (OPS_GetDoubleInput(&numdata, &value) < 0) { opserr << "WARNING invalid -orient value\n"; ifNoError = false; } else { oriYp(j-1) = value; } } } else if (strcmp(flag,"-mass")==0 && OPS_GetNumRemainingInputArgs()>0) { // <-mass m?> if (OPS_GetDoubleInput(&numdata, &mass) < 0 || mass <= 0) { opserr << "WARNING invalid mass\n"; ifNoError = false; } } else if (strcmp(flag,"-coRS")==0 && OPS_GetNumRemainingInputArgs()>=2) { // <-coRS cr? cs?> if (OPS_GetDoubleInput(&numdata, &Cr) < 0 || Cr <= 0) { opserr << "WARNING invalid cr\n"; ifNoError = false; } if (OPS_GetDoubleInput(&numdata, &Cs) < 0 || Cs <= 0) { opserr << "WARNING invalid cs\n"; ifNoError = false; } } else { opserr << "WARNING invalid optional arguments \n"; ifNoError = false; break; } } } //end input //if error detected if (!ifNoError) { //input: //want: opserr << "Want: element YamamotoBiaxialHDR eleTag? iNode? jNode? Tp? DDo? DDi? Hr? <-coRS cr? cs?> <-orient <x1? x2? x3?> y1? y2? y3?> <-mass m?>\n"; return 0; } // now create the YamamotoBiaxialHDR theElement = new YamamotoBiaxialHDR(eleTag, iNode, jNode, Tp, DDo, DDi, Hr, Cr, Cs, oriYp, oriX, mass); // if get here we have successfully created the YamamotoBiaxialHDR and added it to the domain return theElement; }
OPS_Export void * OPS_NewMinMaxMaterial(void) { // Pointer to a uniaxial material that will be returned UniaxialMaterial *theMaterial = 0; UniaxialMaterial *theOtherMaterial = 0; double minStrain = -1.0e16; double maxStrain = 1.0e16; int iData[2]; int argc = OPS_GetNumRemainingInputArgs(); if (argc < 2) { opserr << "WARNING invalid uniaxialMaterial MinMaxMaterial $tag $otherTag <-min $minStrain> <-max $maxStrain>" << endln; return 0; } int numData = 2; if (OPS_GetIntInput(&numData, iData) != 0) { opserr << "WARNING invalid uniaxialMaterial MinMaxMaterial $tag $otherTag" << endln; return 0; } theOtherMaterial = OPS_GetUniaxialMaterial(iData[1]); if (theOtherMaterial == 0) { opserr << "WARNING invalid otherTag uniaxialMaterial MinMax tag: " << iData[0] << endln; return 0; } argc = OPS_GetNumRemainingInputArgs(); while (argc > 1) { char argvLoc[10]; if (OPS_GetString(argvLoc, 10) != 0) { opserr << "WARNING invalid string option uniaxialMaterial MinMax tag: " << iData[0] << endln; return 0; } numData = 1; if ((strcmp(argvLoc, "-min") == 0) || (strcmp(argvLoc, "-Min") == 0) || (strcmp(argvLoc, "-MIN") == 0)) { if (OPS_GetDouble(&numData, &minStrain) != 0) { opserr << "WARNING invalid min value uniaxialMaterial MinMax tag: " << iData[0] << endln; return 0; } } else if ((strcmp(argvLoc, "-max") == 0) || (strcmp(argvLoc, "-Max") == 0) || (strcmp(argvLoc, "-MAX") == 0)) { if (OPS_GetDouble(&numData, &maxStrain) != 0) { opserr << "WARNING invalid min value uniaxialMaterial MinMax tag: " << iData[0] << endln; return 0; } } else { opserr << "WARNING invalid option:" << argvLoc << " uniaxialMaterial MinMax tag: " << iData[0] << endln; return 0; } argc = OPS_GetNumRemainingInputArgs(); } // Parsing was successful, allocate the material theMaterial = new MinMaxMaterial(iData[0], *theOtherMaterial, minStrain, maxStrain); if (theMaterial == 0) { opserr << "WARNING could not create uniaxialMaterial of type MinMaxMaterial\n"; return 0; } return theMaterial; }