void Pressure_Constraint::connect(int eleId, bool fluid) { Domain* theDomain = this->getDomain(); if(theDomain == 0) { opserr<<"WARNING: domain has not been set"; opserr<<" -- Pressure_Constraint::connect\n"; return; } Element* theEle = theDomain->getElement(eleId); if(theEle == 0) { opserr<<"WARNING: element "<<eleId<<" does not exist "; opserr<<"-- Pressure_Constraint::connect\n"; return; } if(fluid) { fluidEleTags.insert(eleId); } else { bool isfluid = false; for(int i=0; i<fluidEleTags.Size(); i++) { if(fluidEleTags(i) == eleId) { isfluid = true; break; } } if(!isfluid) { otherEleTags.insert(eleId); } } }
int MeshRegion::setRayleighDampingFactors(double alpham, double betak, double betak0, double betakc) { alphaM = alpham; betaK = betak; betaK0 = betak0; betaKc = betakc; // now set the damping factors at the nodes & elements Domain *theDomain = this->getDomain(); if (theDomain == 0) { opserr << "MeshRegion::setRayleighDampingFactors() - no domain yet set\n"; return -1; } if (theElements != 0) { for (int i=0; i<theElements->Size(); i++) { int eleTag = (*theElements)(i); Element *theEle = theDomain->getElement(eleTag); if (theEle != 0) theEle->setRayleighDampingFactors(alphaM, betaK, betaK0, betaKc); } } if (theNodes != 0) { for (int i=0; i<theNodes->Size(); i++) { int nodTag = (*theNodes)(i); Node *theNode = theDomain->getNode(nodTag); if (theNode != 0) theNode->setRayleighDampingFactor(alphaM); } } return 0; }
void Receiver::release(PointwiseRecorder &recorderPW, const Domain &domain, int elemTag, const RDMatPP &interpFact) { Element *myElem = domain.getElement(elemTag); if (mDumpStrain || mDumpCurl) { myElem->forceTIso(); } recorderPW.addReceiver(mName, mNetwork, mPhi, interpFact, myElem, mTheta, mBackAzimuth, mLat, mLon, mDepth, mDumpStrain, mDumpCurl); }
int MeshRegion::setElements(const ID &theEles) { // destroy the old lists if (theNodes != 0) delete theNodes; if (theElements != 0) delete theElements; // create new element & node lists int numEle = theEles.Size(); theElements = new ID(0, numEle); // don't copy yet .. make sure ele in domain theNodes = new ID(0, numEle); // initial guess at size of ID if (theElements == 0 || theNodes == 0) { opserr << "MeshRegion::setElements() - ran out of memory\n"; return -1; } // now loop over the elements in ele ID passed in to create the node & ele list // NOTE - only add those elements to the list that are in the domain // NOTE - node added to region if any element has it as an external node int locEle = 0; int locNode = 0; Domain *theDomain = this->getDomain(); if (theDomain == 0) { opserr << "MeshRegion::setElements() - no domain yet set\n"; return -1; } Element *theEle; for (int i=0; i<numEle; i++) { int eleTag = theEles(i); theEle = theDomain->getElement(eleTag); if (theEle != 0) { if (theElements->getLocation(eleTag) < 0) (*theElements)[locEle++] = eleTag; const ID &theEleNodes = theEle->getExternalNodes(); for (int i=0; i<theEleNodes.Size(); i++) { int nodeTag = theEleNodes(i); // add the node tag if not already there if (theNodes->getLocation(nodeTag) < 0) (*theNodes)[locNode++] = nodeTag; } } } return 0; }
// changed RemoveRecorder::RemoveRecorder(int nodeID, ID &eleIDs, ID &secIDs, ID &slaveTags, Vector remCriteria, Domain &theDomainPtr, OPS_Stream &s, bool echotimeflag, double deltat, const char *theFileName , Vector eleMass, double gAcc, int gDir, int gPat, int nTagbotn, int nTagmidn, int nTagtopn, int globgrav, const char *thefileNameinf) :Recorder(RECORDER_TAGS_RemoveRecorder), nodeTag(nodeID), numEles(eleIDs.Size()), eleTags(eleIDs.Size()), secTags(secIDs.Size()), numSecs(secIDs.Size()), criteria(remCriteria), theDomain(&theDomainPtr), slaveEleTags(slaveTags.Size()), slaveFlag(false), echoTimeFlag(echotimeflag), deltaT(deltat), nextTimeStampToRecord(0.0), gAcc(gAcc), gDir(gDir), gPat(gPat), nTagbotn(nTagbotn), nTagmidn(nTagmidn), nTagtopn(nTagtopn), globgrav(globgrav), eleResponses(0) { numRecs++; #ifdef MMTDEBUGIO opserr<<"RemoveRecorder, constructor called"<<endln; #endif numRules = criteria.Size()/2; #ifdef MMTDEBUG for (int h=0 ; h<2 ; h++) { opserr<<"remCriteria["<<h<<"] = "<<criteria[h]<<endln; } #endif eleResponses = new Response *[numEles]; for (int l=0 ; l<numEles ; l++) { eleTags(l) = eleIDs(l); eleResponses[l] = 0; } if (secIDs[0] != 0 || secIDs.Size() != 1) { for (int l=0 ; l<numSecs ; l++) { secTags(l) = secIDs(l); #ifdef MMTDEBUG opserr<<"storing secID = "<<secIDs[l]<<endln; #endif } } else secTags[0] = 0; if (slaveTags[0] != 0 || slaveTags.Size() != 1) { slaveFlag = true; for (int l=0 ; l<slaveTags.Size() ; l++) { slaveEleTags(l) = slaveTags(l); #ifdef MMTDEBUG opserr<<"storing slaveEleID = "<<slaveTags[l]<<endln; #endif } } else slaveEleTags[0] = 0; if (thefileNameinf != 0) { int fileNameLength2 = strlen(thefileNameinf) + 1; // fileName = new char[fileNameLength + 8]; fileNameinf = new char[fileNameLength2]; strcpy(fileNameinf, thefileNameinf); } Element *theEle = 0; const char **argv = new const char *[1]; if (fileNameinf == 0) argv[0] = "getRemCriteria1"; else argv[0] = "getRemCriteria2"; // Get the element for (int j= 0; j<numEles; j++) { Element *theEle = theDomainPtr.getElement(eleTags[j]); if ( theEle == NULL ) { opserr << "WARNING RemoveRecorder::RemoveRecorder() - no element with tag: " << eleTags[j] << " exists in Domain\n"; eleResponses[j] = 0; } else { // set up the element responses eleResponses[j] = theEle->setResponse(argv, 1, s); if (eleResponses[j] == 0) { opserr << "WARNING :: getRemCriteria - not a response quantity of element\n"; } else { if (fileNameinf != 0) { Information &eleInfo = eleResponses[j]->getInformation(); eleInfo.setString(fileNameinf); } } } } delete [] argv; if (slaveEleTags[0] != 0) { for (int k= 0; k<slaveTags.Size(); k++) { theEle = theDomainPtr.getElement(slaveTags[k]); if ( theEle == NULL ) { opserr << "WARNING RemoveRecorder::RemoveRecorder() - no element with tag: " << slaveTags[k] << " exists in Domain\n"; exit(-1); } } } // check if the recorder is for node removal if (nodeTag != 0) { Node *theNode = theDomainPtr.getNode(nodeTag); if ( theNode == NULL ) { opserr << "WARNING RemoveRecorder::RemoveRecorder() - no node with tag: " << nodeTag << " exists in Domain\n"; exit(-1); } } // extract masses eleMasses = eleMass; // if file is specified, copy name and open the file if it hasn't been opened if (theFileName != 0 && fileName == 0) { // create char array to store file name int fileNameLength = strlen(theFileName) + 1; // fileName = new char[fileNameLength + 8]; fileName = new char[fileNameLength]; if (fileName == 0) { opserr << "RemoveRecorder::RemoveRecorder - out of memory creating string " << fileNameLength << " long\n"; exit(-1); } // compose and copy file name string strcpy(fileName, theFileName); // char* dumName = new char(fileNameLength) + 1; // strcpy(dumName, theFileName); // char *temp = "Collapse"; // fileName = strcat(temp, dumName); #ifdef MMTDEBUGIO // opserr<<"theFileName "<<theFileName<<"len "<<strlen(theFileName)<<" fileNameLength "<<fileNameLength<<endln; // opserr<<"filename "<<fileName<<"len "<<strlen(fileName)<<" temp "<<temp<<" len "<<strlen(temp)<<endln; // opserr<<"filename "<<fileName*<<"len "<<strlen(fileName)<<" temp "<<temp*<<" len "<<strlen(temp)<<endln; #endif #ifdef MMTDEBUGIO opserr<<"filename "<<fileName<<" len "<<strlen(fileName)<<endln; #endif // delete [] temp; // open the file theFile.open(fileName, ios::out); if ((&theFile) == NULL) { opserr << "WARNING - RemoveRecorder::RemoveRecorder()"; opserr << " - could not open file " << fileName << endln; } } #ifdef MMTDEBUG opserr<<"RemoveRecorder, constructor finished"<<endln; #endif }
void * OPS_RotationShearCurve(void) { if (shearCurveCount == 0) { opserr << "RotationShearCurve limit curve - Written by MRL UT Austin Copyright 2012 - Use at your Own Peril \n"; shearCurveCount++; } int argc = OPS_GetNumRemainingInputArgs(); if (!(argc == 9 || argc == 23)) { opserr << "WARNING RotationShearCurve -- insufficient arguments\n"; opserr << "For direct input of shear curve parameters and degrading slope want:\n\n"; opserr << "limitCurve RotationShearCurve crvTag? eleTag? \n"; opserr << "ndI? ndJ? rotAxis? Vn? Vr? Kdeg? rotLim? \n" << endln; opserr << "OR for calibrated shear curve and degrading slope want:\n\n"; opserr << "limitCurve RotationShearCurve crvTag? eleTag?\n"; opserr << "ndI? ndJ? rotAxis? Vn? Vr? Kdeg? defType?\n"; opserr << "b? d? h? L? st? As? Acc? ld? db? rhot? f'c?\n"; opserr << "fy? fyt? delta?\n" << endln; return 0; } int iTagData[2]; int iNodeData[3]; double dKdegData[3]; double dRotLimData[1]; int iTypeData[1]; double dPropData[14]; int numData; numData = 2; if (OPS_GetIntInput(&numData, iTagData) != 0) { opserr << "WARNING RotationShearCurve -- invalid crvTag? eleTag?\n" << endln; return 0; } int eleTag = iTagData[1]; Domain *theDomain = 0; theDomain = OPS_GetDomain(); if (theDomain == 0) { opserr << "WARNING RotationShearCurve -- Pointer to Domain was not returned\n" << endln; return 0; } Element *theElement = 0; theElement = theDomain->getElement(eleTag); if (theElement == 0) { opserr << "WARNING RotationShearCurve -- Element with tag " << iTagData[1] << " does not exist for shear curve tag " << iTagData[0] << endln << endln; return 0; } numData = 3; if (OPS_GetIntInput(&numData, iNodeData) != 0) { opserr << "WARNING RotationShearCurve -- invalid ndI? ndJ? rotAxis?\n" << endln; return 0; } Node *theNodeI = 0; theNodeI = theDomain->getNode(iNodeData[0]); if (theNodeI == 0) { opserr << "WARNING RotationShearCurve -- Node with tag " << iNodeData[0] << " does not exist for shear curve tag " << iTagData[0] << endln << endln; return 0; } Node *theNodeJ = 0; theNodeJ = theDomain->getNode(iNodeData[1]); if (theNodeJ == 0) { opserr << "WARNING RotationShearCurve -- Node with tag " << iNodeData[1] << " does not exist for shear curve tag " << iTagData[0] << endln << endln; return 0; } if (iNodeData[2] < 3 || iNodeData[2] > 6) { opserr << "WARNING RotationShearCurve -- rotAxis is invalid\n"; opserr << "rotAxis = 3 -- Rotation about z-axis - 2D\n"; opserr << "rotAxis = 4 -- Rotation about x-axis - 3D\n"; opserr << "rotAxis = 5 -- Rotation about y-axis - 3D\n"; opserr << "rotAxis = 6 -- Rotation about z-axis - 3D\n" << endln; return 0; } if (argc == 9) { numData = 3; if (OPS_GetDoubleInput(&numData, dKdegData) != 0) { opserr << "WARNING RotationShearCurve -- invalid Vn? Vr? Kdeg?\n" << endln; return 0; } if (dKdegData[0] != -1 && !(dKdegData[0] > 0)) { opserr << "WARNING RotationShearCurve -- Vn input is invalid\n"; opserr << "Vn = -1 -- Shear critical limit is not used\n"; opserr << "Vn > 0 -- Shear critical limit is the input value\n" << endln; return 0; } if (dKdegData[1] < -1) { opserr << "WARNING RotationShearCurve -- Vr input is invalid\n"; opserr << "Vr = -1 -- Residual shear strength = 0.2*(maximum shear at failure)\n"; opserr << "-1 < Vr < 0 -- Residual shear strength = Vr*(maximum shear at failure)\n"; opserr << "Vr >= 0 -- Residual shear strength is the input value\n" << endln; return 0; } if (dKdegData[2] >= 0) { opserr << "WARNING RotationShearCurve -- Kdeg input is invalid\n"; opserr << "The degrading slope must be less than zero\n" << endln; return 0; } numData = 1; if (OPS_GetDoubleInput(&numData, dRotLimData) != 0) { opserr << "WARNING RotationShearCurve -- invalid rotLim?\n" << endln; return 0; } if (dRotLimData[0] <= 0) { opserr << "WARNING RotationShearCurve -- rotLim input must be greater than zero\n" << endln; return 0; } LimitCurve *theCurve = 0; theCurve = new RotationShearCurve(iTagData[0], iTagData[1], iNodeData[0], iNodeData[1], iNodeData[2], dKdegData[0], dKdegData[1], dKdegData[2], dRotLimData[0], 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, theDomain, theElement, theNodeI, theNodeJ); if (theCurve == 0) { opserr << "WARNING RotationShearCurve -- could not create limitCurve with constructor " << iTagData[0] << endln << endln; return 0; } return theCurve; } else { numData = 3; if (OPS_GetDoubleInput(&numData, dKdegData) != 0) { opserr << "WARNING RotationShearCurve -- invalid Vn? Vr? Kdeg?\n" << endln; return 0; } if (dKdegData[0] != -1 && !(dKdegData[0] >= 0)) { opserr << "WARNING RotationShearCurve -- Vn input is invalid\n"; opserr << "Vn = -1 -- Shear critical limit is not used\n"; opserr << "Vn = 0 -- Shear critical limit is calculated using ASCE 41 Eq. 6-4\n"; opserr << "Vn > 0 -- Shear critical limit is the input value\n" << endln; return 0; } if (dKdegData[1] < -1) { opserr << "WARNING RotationShearCurve -- Vr input is invalid\n"; opserr << "Vr = -1 -- Residual shear strength from regression\n"; opserr << "-1 < Vr < 0 -- Residual shear strength = Vr*(maximum shear at failure)\n"; opserr << "Vr >= 0 -- Residual shear strength is the input value\n" << endln; return 0; } if (dKdegData[2] > 0) { opserr << "WARNING RotationShearCurve -- Kdeg input is invalid\n"; opserr << "Kdeg = 0 -- Degrading slope calculated by regressions\n"; opserr << "Kdeg < 0 -- Degrading slope is the input value\n" << endln; return 0; } numData = 1; if (OPS_GetIntInput(&numData, iTypeData) != 0) { opserr << "WARNING RotationShearCurve -- invalid defType?\n" << endln; return 0; } if (iTypeData[0] > 5 || iTypeData[0] <= 0) { opserr << "WARNING RotationShearCurve -- invalid defType input?\n" << endln; opserr << "1 -- Flexure-Shear capacity based on theta_f rotation capacity\n"; opserr << "2 -- Flexure-Shear capacity based on theta_total rotation capacity\n"; opserr << "3 -- Flexure-Shear capacity based on theta_flexural rotation capacity\n"; opserr << "4 -- Flexure-Shear capacity based on theta_total-plastic rotation capacity\n"; opserr << "5 -- Flexure-Shear capacity based on theta_flexural-plastic rotation capacity\n" << endln; return 0; } numData = 14; if (OPS_GetDoubleInput(&numData, dPropData) != 0) { opserr << "WARNING RotationShearCurve -- invalid b? d? h? L? st? As? Acc? ld? db? rhot? f'c? fy? fyt? delta?\n" << endln; return 0; } LimitCurve *theCurve = 0; theCurve = new RotationShearCurve(iTagData[0], iTagData[1], iNodeData[0], iNodeData[1], iNodeData[2], dKdegData[0], dKdegData[1], dKdegData[2], 0.0, iTypeData[0], fabs(dPropData[0]), fabs(dPropData[1]), fabs(dPropData[2]), fabs(dPropData[3]), fabs(dPropData[4]), fabs(dPropData[5]), fabs(dPropData[6]), fabs(dPropData[7]), fabs(dPropData[8]), fabs(dPropData[9]), fabs(dPropData[10]), fabs(dPropData[11]), fabs(dPropData[12]), dPropData[13], theDomain, theElement, theNodeI, theNodeJ); if (theCurve == 0) { opserr << "WARNING RotationShearCurve -- could not create limitCurve with constructor " << iTagData[0] << endln << endln; return 0; } return theCurve; } }