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); } }
int TclModelBuilder_addDispBeamColumnInt(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv, Domain*theTclDomain, TclModelBuilder *theTclBuilder) { // ensure the destructor has not been called - if (theTclBuilder == 0) { opserr << "WARNING builder has been destroyed\n"; return TCL_ERROR; } int ndm = theTclBuilder->getNDM(); int ndf = theTclBuilder->getNDF(); int ok = 0; if (ndm == 2 && ndf == 3) ok = 1; if (ok == 0) { opserr << "WARNING -- NDM = " << ndm << " and NDF = " << ndf << " not compatible with dispBeamColumn element" << endln; return TCL_ERROR; } if (argc < 9) { //8 opserr << "WARNING insufficient arguments\n"; printCommand(argc, argv); opserr << "Want: element dispBeamColumn eleTag? iNode? jNode? nIP? secTag? transfTag? C1? t1? NStrip1? t2? NStrip2? t3? NStrip3?\n"; return TCL_ERROR; } // get the id and end nodes int eleTag, iNode, jNode, nIP, transfTag; double C1; int secTag[10]; // Max size of integration rule ... can change if needed int argi = 2; if (Tcl_GetInt(interp, argv[argi++], &eleTag) != TCL_OK) { opserr << "WARNING invalid dispBeamColumn eleTag" << endln; return TCL_ERROR; } if (Tcl_GetInt(interp, argv[argi++], &iNode) != TCL_OK) { opserr << "WARNING invalid iNode "; opserr << "dispBeamColumn element: " << eleTag << endln; return TCL_ERROR; } if (Tcl_GetInt(interp, argv[argi++], &jNode) != TCL_OK) { opserr << "WARNING invalid jNode "; opserr << "dispBeamColumn element: " << eleTag << endln; return TCL_ERROR; } if (Tcl_GetInt(interp, argv[argi++], &nIP) != TCL_OK) { opserr << "WARNING invalid nIP "; opserr << "dispBeamColumn element: " << eleTag << endln; return TCL_ERROR; } if (strcmp(argv[argi], "-sections") == 0) { argi++; if (argi+nIP > argc) { opserr << "WARNING insufficient number of section tags - element dispBeamColumn eleTag? iNode? jNode? nIP? secTag? transfTag?\n"; return TCL_ERROR; } int section; for (int i = 0; i < nIP; i++) { if (Tcl_GetInt(interp, argv[argi+i], §ion) != TCL_OK) { opserr << "WARNING invalid secTag - element dispBeamColumn eleTag? iNode? jNode? nIP? secTag? transfTag?\n"; return TCL_ERROR; } secTag[i] = section; } argi += nIP; } else { int section; if (Tcl_GetInt(interp, argv[argi++], §ion) != TCL_OK) { opserr << "WARNING invalid secTag - element dispBeamColumn eleTag? iNode? jNode? nIP? secTag? transfTag?\n"; return TCL_ERROR; } for (int i = 0; i < nIP; i++) secTag[i] = section; } if (argi >= argc || Tcl_GetInt(interp, argv[argi++], &transfTag) != TCL_OK) { opserr << "WARNING invalid transfTag? - element dispBeamColumn eleTag? iNode? jNode? nIP? secTag? transfTag?\n"; return TCL_ERROR; } if (Tcl_GetDouble(interp, argv[argi++], &C1) != TCL_OK) { opserr << "WARNING invalid dispBeamColumn C1" << endln; return TCL_ERROR; } double massDens = 0.0; while (argi != argc) { if (strcmp(argv[argi++],"-mass") == 0 && argi < argc) { if (Tcl_GetDouble(interp, argv[argi++], &massDens) != TCL_OK) { opserr << "WARNING invalid massDens - element dispBeamColumn eleTag? iNode? jNode? nIP? secTag? transfTag? C1? t? NStrip?\n"; return TCL_ERROR; } } } SectionForceDeformation **sections = new SectionForceDeformation* [nIP]; if (!sections) { opserr << "WARNING TclElmtBuilder - addFrameElement - Insufficient memory to create sections\n"; return TCL_ERROR; } for (int j=0; j<nIP; j++) { SectionForceDeformation *theSection = theTclBuilder->getSection(secTag[j]); if (theSection == 0) { opserr << "WARNING TclElmtBuilder - frameElement - no Section found with tag "; opserr << secTag[j] << endln; delete [] sections; return TCL_ERROR; } sections[j] = theSection; } Element *theElement = 0; if (ndm == 2) { CrdTransf *theTransf = OPS_getCrdTransf(transfTag); if (theTransf == 0) { opserr << "WARNING transformation not found\n"; opserr << "transformation: " << transfTag; opserr << "\ndispBeamColumn element: " << eleTag << endln; return TCL_ERROR; } // now create the DispBeamColumn and add it to the Domain theElement = new DispBeamColumn2dInt(eleTag,iNode,jNode,nIP,sections,*theTransf,C1,massDens); delete [] sections; } if (theElement == 0) { opserr << "WARNING ran out of memory creating element\n"; opserr << "dispBeamColumn element: " << eleTag << endln; return TCL_ERROR; } if (theTclDomain->addElement(theElement) == false) { opserr << "WARNING could not add element to the domain\n"; opserr << "dispBeamColumn element: " << eleTag << endln; delete theElement; return TCL_ERROR; } // if get here we have sucessfully created the element and added it to the domain return TCL_OK; }
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); } }
OPS_Export void * OPS_PileToe3D(void) { if (num_PileToe3D == 0) { num_PileToe3D++; //OPS_Error("PileToe3D element - Written: P.Arduino, P.Mackenzie-Helnwein, U.Washington\n", 1); opserr <<"PileToe3D element - Written: P.Arduino, P.Mackenzie-Helnwein, U.Washington\n"; } // Pointer to a uniaxial material that will be returned Element *theElement = 0; int numRemainingInputArgs = OPS_GetNumRemainingInputArgs(); if (numRemainingInputArgs < 7) { opserr << "Invalid #args, want: element PileToe3D eleTag? iNode? BiNode? BjNode? radius? k? crdTransf?\n"; return 0; } int iData[5]; double dData[2]; int numData = 4; if (OPS_GetIntInput(&numData, iData) != 0) { opserr << "WARNING invalid integer data: element PileToe3D" << endln; return 0; } numData = 1; if (OPS_GetDoubleInput(&numData, dData) != 0) { opserr << "WARNING invalid radius data: element PileToe3D " << iData[0] << endln; return 0; } numData = 1; if (OPS_GetDoubleInput(&numData, &dData[1]) != 0) { opserr << "WARNING invalid k data: element PileToe3D " << iData[0] << endln; return 0; } numData = 1; if (OPS_GetIntInput(&numData, &iData[4]) != 0) { opserr << "WARNING invalid integer crdTransf data: element PileToe3D" << iData[0] << endln; return 0; } int transfTag = iData[4]; CrdTransf *theTransf = OPS_getCrdTransf(transfTag); if (theTransf == 0) { opserr << "WARNING element PileToe3D " << iData[0] << endln; opserr << " coordTransf: " << transfTag << "not found\n"; return 0; } // Parsing was successful, allocate the element theElement = new PileToe3D(iData[0], iData[1], iData[2], iData[3], dData[0], dData[1], *theTransf); if (theElement == 0) { opserr << "WARNING could not create element of type PileToe3D\n"; return 0; } 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; }