// constructor: // responsible for allocating the necessary space needed by each object // and storing the tags of the CorotTruss end nodes. CorotTruss::CorotTruss(int tag, int dim, int Nd1, int Nd2, UniaxialMaterial &theMat, double a, double r) :Element(tag,ELE_TAG_CorotTruss), theMaterial(0), connectedExternalNodes(2), numDOF(0), numDIM(dim), Lo(0.0), Ln(0.0), A(a), rho(r), R(3,3), theMatrix(0), theVector(0) { // get a copy of the material and check we obtained a valid copy theMaterial = theMat.getCopy(); if (theMaterial == 0) { opserr << "FATAL CorotTruss::CorotTruss - " << tag << "failed to get a copy of material with tag " << theMat.getTag() << endln; exit(-1); } // ensure the connectedExternalNode ID is of correct size & set values if (connectedExternalNodes.Size() != 2) { opserr << "FATAL CorotTruss::CorotTruss - " << tag << "failed to create an ID of size 2\n"; exit(-1); } connectedExternalNodes(0) = Nd1; connectedExternalNodes(1) = Nd2; // set node pointers to NULL theNodes[0] = 0; theNodes[1] = 0; }
matObj *OPS_GetMaterial(int *matTag, int *matType) { if (*matType == OPS_UNIAXIAL_MATERIAL_TYPE) { UniaxialMaterial *theUniaxialMaterial = OPS_getUniaxialMaterial(*matTag); if (theUniaxialMaterial != 0) { UniaxialMaterial *theCopy = theUniaxialMaterial->getCopy(); // uniaxialMaterialObjectCount++; // theUniaxialMaterials[uniaxialMaterialObjectCount] = theCopy; matObject *theMatObject = new matObject; theMatObject->tag = *matTag; theMatObject->nParam = 1; theMatObject->nState = 0; theMatObject->theParam = new double[1]; // theMatObject->theParam[0] = uniaxialMaterialObjectCount; theMatObject->theParam[0] = 1; // code for uniaxial material theMatObject->tState = 0; theMatObject->cState = 0; theMatObject->matFunctPtr = OPS_InvokeMaterialObject; theMatObject->matObjectPtr = theCopy; return theMatObject; } fprintf(stderr,"getMaterial - no uniaxial material exists with tag %d\n", *matTag); return 0; } else if (*matType == OPS_SECTION_TYPE) { fprintf(stderr,"getMaterial - not yet implemented for Section\n"); return 0; } else { // NDMaterial *theNDMaterial = theModelBuilder->getNDMaterial(*matTag); // if (theNDMaterial != 0) // theNDMaterial = theNDMaterial->getCopy(matType); // else { // fprintf(stderr,"getMaterial - no nd material exists with tag %d\n", *matTag); // return 0; // } // if (theNDMaterial == 0) { // fprintf(stderr,"getMaterial - material with tag %d cannot deal with %d\n", *matTag, matType); // return 0; // } fprintf(stderr,"getMaterial - not yet implemented for nDMaterial\n"); return 0; } fprintf(stderr,"getMaterial - unknown material type\n"); return 0; }
// constructors: FiberSection3d::FiberSection3d(int tag, int num, Fiber **fibers): SectionForceDeformation(tag, SEC_TAG_FiberSection3d), numFibers(num), sizeFibers(num), theMaterials(0), matData(0), QzBar(0.0), QyBar(0.0), Abar(0.0), yBar(0.0), zBar(0.0), sectionIntegr(0), e(3), s(0), ks(0) { if (numFibers != 0) { theMaterials = new UniaxialMaterial *[numFibers]; if (theMaterials == 0) { opserr << "FiberSection3d::FiberSection3d -- failed to allocate Material pointers\n"; exit(-1); } matData = new double [numFibers*3]; if (matData == 0) { opserr << "FiberSection3d::FiberSection3d -- failed to allocate double array for material data\n"; exit(-1); } for (int i = 0; i < numFibers; i++) { Fiber *theFiber = fibers[i]; double yLoc, zLoc, Area; theFiber->getFiberLocation(yLoc, zLoc); Area = theFiber->getArea(); QzBar += yLoc*Area; QyBar += zLoc*Area; Abar += Area; matData[i*3] = yLoc; matData[i*3+1] = zLoc; matData[i*3+2] = Area; UniaxialMaterial *theMat = theFiber->getMaterial(); theMaterials[i] = theMat->getCopy(); if (theMaterials[i] == 0) { opserr << "FiberSection3d::FiberSection3d -- failed to get copy of a Material\n"; exit(-1); } } yBar = QzBar/Abar; zBar = QyBar/Abar; } s = new Vector(sData, 3); ks = new Matrix(kData, 3, 3); sData[0] = 0.0; sData[1] = 0.0; sData[2] = 0.0; for (int i=0; i<9; i++) kData[i] = 0.0; code(0) = SECTION_RESPONSE_P; code(1) = SECTION_RESPONSE_MZ; code(2) = SECTION_RESPONSE_MY; }
int FiberSection2d::addFiber(Fiber &newFiber) { // need to create larger arrays int newSize = numFibers+1; UniaxialMaterial **newArray = new UniaxialMaterial *[newSize]; double *newMatData = new double [2 * newSize]; if (newArray == 0 || newMatData == 0) { opserr <<"FiberSection2d::addFiber -- failed to allocate Fiber pointers\n"; return -1; } // copy the old pointers and data int i; for (i = 0; i < numFibers; i++) { newArray[i] = theMaterials[i]; newMatData[2*i] = matData[2*i]; newMatData[2*i+1] = matData[2*i+1]; } // set the new pointers and data double yLoc, zLoc, Area; newFiber.getFiberLocation(yLoc, zLoc); Area = newFiber.getArea(); newMatData[numFibers*2] = yLoc; newMatData[numFibers*2+1] = Area; UniaxialMaterial *theMat = newFiber.getMaterial(); newArray[numFibers] = theMat->getCopy(); if (newArray[numFibers] == 0) { opserr <<"FiberSection2d::addFiber -- failed to get copy of a Material\n"; delete [] newMatData; return -1; } numFibers++; if (theMaterials != 0) { delete [] theMaterials; delete [] matData; } theMaterials = newArray; matData = newMatData; double Qz = 0.0; double A = 0.0; // Recompute centroid for (i = 0; i < numFibers; i++) { yLoc = -matData[2*i]; Area = matData[2*i+1]; A += Area; Qz += yLoc*Area; } yBar = Qz/A; return 0; }
// Construct element with one unidirectional material (numMaterials1d=1) CoupledZeroLength::CoupledZeroLength(int tag, int Nd1, int Nd2, UniaxialMaterial &theMat, int direction1, int direction2, int doRayleigh) :Element(tag,ELE_TAG_CoupledZeroLength), connectedExternalNodes(2), dimension(0), numDOF(0), transformation(3,3), useRayleighDamping(doRayleigh), theMatrix(0), theVector(0), theMaterial(0), dirn1(direction1), dirn2(direction2), d0(0), v0(0) { // allocate memory for numMaterials1d uniaxial material models theMaterial = theMat.getCopy(); if ( theMaterial == 0) { opserr << "FATAL CoupledZeroLength::CoupledZeroLength - failed to create a 1d material\n"; exit(-1); } // initialize uniaxial materials and directions and check for valid values if (direction1 < 0 || direction1 > 5 || direction2 < 0 || direction2 > 5) { opserr << "FATAL: CoupledZeroLength::CoupledZeroLength - invalid diection\n"; exit(-1); } connectedExternalNodes(0) = Nd1; connectedExternalNodes(1) = Nd2; dX = 0.0; dY = 0.0; fX = 0.0; fY = 0.0; }
// constructors: FiberSection2d::FiberSection2d(int tag, int num, Fiber **fibers): SectionForceDeformation(tag, SEC_TAG_FiberSection2d), numFibers(num), theMaterials(0), matData(0), yBar(0.0), sectionIntegr(0), e(2), eCommit(2), s(0), ks(0), dedh(2) { if (numFibers != 0) { theMaterials = new UniaxialMaterial *[numFibers]; if (theMaterials == 0) { opserr << "FiberSection2d::FiberSection2d -- failed to allocate Material pointers"; exit(-1); } matData = new double [numFibers*2]; if (matData == 0) { opserr << "FiberSection2d::FiberSection2d -- failed to allocate double array for material data\n"; exit(-1); } double Qz = 0.0; double A = 0.0; for (int i = 0; i < numFibers; i++) { Fiber *theFiber = fibers[i]; double yLoc, zLoc, Area; theFiber->getFiberLocation(yLoc, zLoc); Area = theFiber->getArea(); A += Area; Qz += yLoc*Area; matData[i*2] = yLoc; matData[i*2+1] = Area; UniaxialMaterial *theMat = theFiber->getMaterial(); theMaterials[i] = theMat->getCopy(); if (theMaterials[i] == 0) { opserr << "FiberSection2d::FiberSection2d -- failed to get copy of a Material\n"; exit(-1); } } yBar = Qz/A; } s = new Vector(sData, 2); ks = new Matrix(kData, 2, 2); sData[0] = 0.0; sData[1] = 0.0; kData[0] = 0.0; kData[1] = 0.0; kData[2] = 0.0; kData[3] = 0.0; code(0) = SECTION_RESPONSE_P; code(1) = SECTION_RESPONSE_MZ; }
PathIndependentMaterial::PathIndependentMaterial(int tag, UniaxialMaterial &material) :UniaxialMaterial(tag,MAT_TAG_PathIndependent), theMaterial(0) { theMaterial = material.getCopy(); if (theMaterial == 0) { opserr << "PathIndependentMaterial::PathIndependentMaterial -- failed to get copy of material\n"; exit(-1); } }
//full constructor PlateRebarMaterial::PlateRebarMaterial(int tag, UniaxialMaterial &uniMat, double ang) : NDMaterial( tag, ND_TAG_PlateRebarMaterial ), strain(5),angle(ang) { theMat = uniMat.getCopy() ; double rang = ang * 0.0174532925; c = cos(rang); s = sin(rang); }
//first constructor //////////////////////////////////////////////////////////////////////////// Quad4FiberOverlay::Quad4FiberOverlay(int tag, int nd1, int nd2, int nd3, int nd4, UniaxialMaterial &m, double AreaFiber,double B1, double B2) :Element(tag, ELE_TAG_Quad4FiberOverlay) ,theMaterial(0) ,externalNodes(SL_NUM_NODE) ,g1(SL_NUM_NDF) ,dualg1(SL_NUM_NDF) ,g2(SL_NUM_NDF) ,dualg2(SL_NUM_NDF) ,beta1(B1) ,beta2(B2) ,dNidxAlphai(SL_NUM_NODE,SL_NUM_NDF) ,Q1(SL_NUM_NDF) ,Q2(SL_NUM_NDF),Q3(SL_NUM_NDF),Q4(SL_NUM_NDF) ,Qfi(SL_NUM_NDF) ,Qfj(SL_NUM_NDF) ,Vf(SL_NUM_NDF) ,A(3) ,AA(3) ,Bb(SL_NUM_DOF) ,Af(AreaFiber) ,u(SL_NUM_DOF) { //determine int pts location based on fiber orientation nFi.Zero(); nFj.Zero(); A.Zero(); AA.Zero(); nFi[0] = -1.0; nFi[1] = (beta1 - 0.5) * 2.0; nFj[0] = 1.0; nFj[1] = (beta2 - 0.5) * 2.0; A = nFj - nFi; A.Normalize(); AA[0] = A(0)*A(0); AA[1] = A(1)*A(1); AA[2] = A(1)*A(0); // this must be 1* A1 A2 since strain uses gamma = 2 eps12 //set up integration paramaters (2 intgr pts) pts[0][0] = nFi(0)+A(0)*(1-0.5773502691896258); pts[0][1] = nFi(1)+A(1)*(1-0.5773502691896258); pts[1][0] = nFj(0)-A(0)*(1-0.5773502691896258); pts[1][1] = nFj(1)-A(1)*(1-0.5773502691896258); wts[0] = 1.0; wts[1] = 1.0; externalNodes(0) = nd1; externalNodes(1) = nd2; externalNodes(2) = nd3; externalNodes(3) = nd4; theMaterial = m.getCopy(); for(int i = 0; i<4;i++){ theNodes[i] = 0; } }
MinMaxMaterial::MinMaxMaterial(int tag, UniaxialMaterial &material, double min, double max) :UniaxialMaterial(tag,MAT_TAG_MinMax), theMaterial(0), minStrain(min), maxStrain(max), Tfailed(false), Cfailed(false) { theMaterial = material.getCopy(); if (theMaterial == 0) { opserr << "MinMaxMaterial::MinMaxMaterial -- failed to get copy of material\n"; exit(-1); } }
//! @brief Constructor. //! //! Constructs a GenericSection1D whose unique integer tag among //! SectionForceDeformation objects in the domain is given by \p tag. Obtains //! a copy of the UniaxialMaterial \p m via a call to getCopy(). //! The section code is set to be \p code. XC::GenericSection1d::GenericSection1d(int tag, UniaxialMaterial &m, int type) :PrismaticBarCrossSection(tag,SEC_TAG_Generic1d), code(type) { theModel = m.getCopy(); if(!theModel) { std::cerr << getClassName() << "::" << __FUNCTION__ << "; failed to get copy of material model.\n"; exit(-1); } }
// constructor: // responsible for allocating the necessary space needed by each object // and storing the tags of the CorotTruss end nodes. XC::CorotTruss::CorotTruss(int tag, int dim,int Nd1, int Nd2, UniaxialMaterial &theMat,double a) :CorotTrussBase(tag,ELE_TAG_CorotTruss,dim,Nd1,Nd2), theMaterial(nullptr), A(a) { // get a copy of the material and check we obtained a valid copy theMaterial = theMat.getCopy(); if(theMaterial == 0) { std::cerr << getClassName() << "::" << __FUNCTION__ << "; FATAL error in element: " << tag << "failed to get a copy of material with tag " << theMat.getTag() << std::endl; exit(-1); } }
Truss2::Truss2(int tag, int dim, int Nd1, int Nd2, int oNd1, int oNd2, UniaxialMaterial &theMat, double a, double r, int damp) :Element(tag,ELE_TAG_Truss2), theMaterial(0), theBetaMaterial(0), connectedExternalNodes(2), connectedExternalOtherNodes(2), dimension(dim), numDOF(0), theLoad(0), theMatrix(0), theVector(0), L(0.0), A(a), rho(r), doRayleighDamping(damp) { // get a copy of the material and check we obtained a valid copy theMaterial = theMat.getCopy(); if (theMaterial == 0) { opserr << "FATAL Truss2::Truss2 - " << tag << "failed to get a copy of material with tag " << theMat.getTag() << endln; exit(-1); } else if (theMaterial->getClassTag() == MAT_TAG_ConcretewBeta) { theBetaMaterial = (ConcretewBeta *) theMaterial; } // ensure the connectedExternalNode ID is of correct size & set values if (connectedExternalNodes.Size() != 2 || connectedExternalOtherNodes.Size() != 2) { opserr << "FATAL Truss2::Truss2 - " << tag << "failed to create an ID of size 2\n"; exit(-1); } connectedExternalNodes(0) = Nd1; connectedExternalNodes(1) = Nd2; /// some work to save the other nodes: connectedExternalOtherNodes(0) = oNd1; connectedExternalOtherNodes(1) = oNd2; // set node pointers to NULL for (int i=0; i<2; i++) { theNodes[i] = 0; theOtherNodes[i] = 0; } cosX[0] = 0.0; cosX[1] = 0.0; cosX[2] = 0.0; // AddingSensitivity:BEGIN ///////////////////////////////////// parameterID = 0; theLoadSens = 0; // AddingSensitivity:END ////////////////////////////////////// }
N4BiaxialTruss::N4BiaxialTruss(int tag, int dim, int Nd1, int Nd2, int GNd1, int GNd2, UniaxialMaterial &theMat, double a, double r, int damp) :Element(tag,ELE_TAG_N4BiaxialTruss), theMaterial_1(0), theBetaMaterial_1(0), theMaterial_2(0), theBetaMaterial_2(0), connectedExternalNodes(4), dimension(dim), numDOF(0), theLoad(0), theMatrix(0), theVector(0), theVector2(0), L(0.0), A(a), rho(r), doRayleighDamping(damp) { // get a copy of the material and check we obtained a valid copy theMaterial_1 = theMat.getCopy(); theMaterial_2 = theMat.getCopy(); if ((theMaterial_1 == 0) || (theMaterial_2 == 0)) { opserr << "FATAL N4BiaxialTruss::N4BiaxialTruss - " << tag << "failed to get a copy of material with tag " << theMat.getTag() << endln; exit(-1); } else if (theMat.getClassTag() == MAT_TAG_ConcretewBeta) { theBetaMaterial_1 = (ConcretewBeta *) theMaterial_1; theBetaMaterial_2 = (ConcretewBeta *) theMaterial_2; } // ensure the connectedExternalNode ID is of correct size & set values if (connectedExternalNodes.Size() != 4) { opserr << "FATAL N4BiaxialTruss::N4BiaxialTruss - " << tag << "failed to create an node ID array of size 4\n"; exit(-1); } connectedExternalNodes(0) = Nd1; connectedExternalNodes(1) = Nd2; connectedExternalNodes(2) = GNd1; connectedExternalNodes(3) = GNd2; // set node pointers to NULL for (int i=0; i<4; i++) theNodes[i] = 0; cosX[0] = 0.0; cosX[1] = 0.0; cosX[2] = 0.0; }
InitStressMaterial::InitStressMaterial(int tag, UniaxialMaterial &material, double sigini) :UniaxialMaterial(tag,MAT_TAG_InitStress), theMaterial(0), epsInit(0.0), sigInit(sigini) { theMaterial = material.getCopy(); if (theMaterial == 0) { opserr << "InitStressMaterial::InitStressMaterial -- failed to get copy of material\n"; exit(-1); } // determine the initial strain double tol=1e-12; double dSig = sigInit; double tStrain = 0.0, tStress = 0.0; int count = 0; do { count++; double K = theMaterial->getTangent(); double dStrain = dSig/K; tStrain += dStrain; theMaterial->setTrialStrain(tStrain); tStress = theMaterial->getStress(); dSig = sigInit-tStress; } while ((fabs(tStress-sigInit) > tol) && (count <= 100)); epsInit = tStrain; if ((fabs(tStress-sigInit) < tol)) theMaterial->setTrialStrain(epsInit); else { opserr << "WARNING: InitStressMaterial - could not find initStrain to within tol for material: " << tag; opserr << " wanted sigInit: " << sigInit << " using tStress: " << theMaterial->getStress() << endln; } theMaterial->commitState(); }
ZeroLengthND::ZeroLengthND(int tag, int dim, int Nd1, int Nd2, const Vector& x, const Vector& yprime, NDMaterial &theNDmat, UniaxialMaterial &the1Dmat) : Element(tag, ELE_TAG_ZeroLengthND), connectedExternalNodes(2), dimension(dim), numDOF(0), transformation(3,3), A(0), v(0), e(0.0), K(0), P(0), end1Ptr(0), end2Ptr(0), theNDMaterial(0), the1DMaterial(0), order(0) { // Obtain copy of Nd material model theNDMaterial = theNDmat.getCopy(); if (theNDMaterial == 0) { opserr << "ZeroLengthND:: -- failed to get copy of NDMaterial\n"; exit(-1); } // Obtain copy of 1d material model the1DMaterial = the1Dmat.getCopy(); if (the1DMaterial == 0) { opserr << "ZeroLengthND""ZeroLengthND -- failed to get copy of UniaxialMaterial\n"; exit(-1); } // Get the material order order = theNDMaterial->getOrder(); if (order != 2) { opserr << "ZeroLengthND::ZeroLengthND-- NDMaterial not of order 2\n"; exit(-1); } // Set up the transformation matrix of direction cosines this->setUp(Nd1, Nd2, x, yprime); }
// constructors: FiberSection3dThermal::FiberSection3dThermal(int tag, int num, Fiber **fibers): SectionForceDeformation(tag, SEC_TAG_FiberSection3dThermal), numFibers(num), theMaterials(0), matData(0), yBar(0.0), zBar(0.0), e(3), eCommit(3), s(0), ks(0), sT(0) { if (numFibers != 0) { theMaterials = new UniaxialMaterial *[numFibers]; if (theMaterials == 0) { opserr << "FiberSection3dThermal::FiberSection3dThermal -- failed to allocate Material pointers\n"; exit(-1); } matData = new double [numFibers*3]; if (matData == 0) { opserr << "FiberSection3dThermal::FiberSection3dThermal -- failed to allocate double array for material data\n"; exit(-1); } double Qz = 0.0; double Qy = 0.0; double A = 0.0; for (int i = 0; i < numFibers; i++) { Fiber *theFiber = fibers[i]; double yLoc, zLoc, Area; theFiber->getFiberLocation(yLoc, zLoc); Area = theFiber->getArea(); Qz += yLoc*Area; Qy += zLoc*Area; A += Area; matData[i*3] = -yLoc; matData[i*3+1] = zLoc; matData[i*3+2] = Area; UniaxialMaterial *theMat = theFiber->getMaterial(); theMaterials[i] = theMat->getCopy(); if (theMaterials[i] == 0) { opserr << "FiberSection3dThermal::FiberSection3dThermal -- failed to get copy of a Material\n"; exit(-1); } } yBar = -Qz/A; zBar = Qy/A; } s = new Vector(sData, 3); ks = new Matrix(kData, 3, 3); sData[0] = 0.0; sData[1] = 0.0; sData[2] = 0.0; for (int i=0; i<9; i++) kData[i] = 0.0; code(0) = SECTION_RESPONSE_P; code(1) = SECTION_RESPONSE_MZ; code(2) = SECTION_RESPONSE_MY; // AddingSensitivity:BEGIN //////////////////////////////////// parameterID = 0; SHVs=0; // AddingSensitivity:END ////////////////////////////////////// //J.Jiang add to see fiberLocsZ[i] = zLoc; sT = new Vector(sTData, 3); sTData[0] = 0.0; sTData[1] = 0.0; sTData[2] = 0.0; //An array storing the current fiber Temperature and Maximum Temperature and intializing it. Fiber_T = new double [1000]; for (int i = 0;i<1000; i++) { Fiber_T[i] = 0; } Fiber_TMax = new double [1000]; for (int i = 0;i<1000; i++) { Fiber_TMax[i] = 0; } }
// constructors: RCFTSTLFiberSection3D::RCFTSTLFiberSection3D(int tag, int num, Fiber **fibers, double gj): SectionForceDeformation(tag, SEC_TAG_RCFTSTLFiberSection3D), numFibers(num), theMaterials(0), matData(0), yBar(0.0), zBar(0.0), e(4), eCommit(4), GJ(gj) { ofstream stlfib; stlfib.open("stlfib.dat",ios::app); double EA = 0.0; double EQz = 0.0; double EQy = 0.0; double EIz = 0.0; double EIy = 0.0; double EIyz = 0.0; double Es = 0.0; if (numFibers != 0) { theMaterials = new UniaxialMaterial *[numFibers]; if (theMaterials == 0) { opserr << "RCFTSTLFiberSection3D::RCFTSTLFiberSection3D -- failed to allocate Material pointers\n"; exit(-1); } matData = new double [numFibers*3]; if (matData == 0) { opserr << "RCFTSTLFiberSection3D::RCFTSTLFiberSection3D -- failed to allocate double array for material data\n"; exit(-1); } double Qz = 0.0; double Qy = 0.0; double A = 0.0; for (int i = 0; i < numFibers; i++) { Fiber *theFiber = fibers[i]; double yLoc, zLoc, Area; theFiber->getFiberLocation(yLoc, zLoc); Area = theFiber->getArea(); UniaxialMaterial *theMat = theFiber->getMaterial(); stlfib<<i<<" "<<yLoc<<" "<<zLoc<<" "<<Area<<endl; Es = theMat->getInitialTangent(); Qz += yLoc*Area; Qy += zLoc*Area; A += Area; EQz += yLoc*Area*Es; EQy += zLoc*Area*Es; EA += Area*Es; EIz += yLoc*yLoc*Area*Es; EIy += zLoc*zLoc*Area*Es; EIyz += yLoc*zLoc*Area*Es; matData[i*3] = -yLoc; matData[i*3+1] = zLoc; matData[i*3+2] = Area; theMaterials[i] = theMat->getCopy(); if (theMaterials[i] == 0) { opserr << "RCFTSTLFiberSection3D::RCFTFiberSection3D -- failed to get copy of a Material\n"; exit(-1); } } yBar = -Qz/A; zBar = Qy/A; } ks.Zero(); ks(0,0) = EA; ks(0,1) = ks(1,0) = -EQz; ks(0,2) = ks(2,0) = -EQy; ks(1,1) = EIz; ks(2,2) = EIy; ks(2,1) = ks(1,2) = EIyz; ks(3,3) = GJ; //ks(0,0) = 449602.6; //ks(0,1) = ks(1,0) = 0.0; //ks(0,2) = ks(2,0) = 0.0; //ks(1,1) = 6968845.86; //ks(2,2) = 6968845.86; //ks(2,1) = ks(1,2) = 0.0; //ks(3,3) = GJ; //ks(0,0) = 1000.0; //ks(0,1) = ks(1,0) = 0.0; //ks(0,2) = ks(2,0) = 0.0; //ks(1,1) = 1.0; //ks(2,2) = 1.0; //ks(2,1) = ks(1,2) = 0.0; //ks(3,3) = GJ; //ks(0,0) = 300000.0; //ks(0,1) = ks(1,0) = 0.0; //ks(0,2) = ks(2,0) = 0.0; //ks(1,1) = 3000000.0; //ks(2,2) = 3000000.0; //ks(2,1) = ks(1,2) = 0.0; //ks(3,3) = GJ; //ks(0,0) = 43200000.0; //ks(0,1) = ks(1,0) = 0.0; //ks(0,2) = ks(2,0) = 0.0; //ks(1,1) = 14400000.0; //ks(2,2) = 14400000.0; //ks(2,1) = ks(1,2) = 0.0; //ks(3,3) = GJ; //ks(0,0) = 449509.3; //ks(0,1) = ks(1,0) = 0.0; //ks(0,2) = ks(2,0) = 0.0; //ks(1,1) = 6967684.16; //ks(2,2) = 6967684.16; //ks(2,1) = ks(1,2) = 0.0; //ks(3,3) = GJ; sData[0] = 0.0; sData[1] = 0.0; sData[2] = 0.0; kData[0] = EA; kData[1] = -EQz; kData[2] = EIyz; kData[3] = 0.0; kData[4] = -EQz; kData[5] = EIz; kData[6] = -EQy; kData[7] = 0.0; kData[8] = EIyz; kData[9] = -EQy; kData[10] = EIy; kData[11] = 0.0; kData[12] = 0.0; kData[13] = 0.0; kData[14] = 0.0; kData[15] = GJ; //kData[0] = 43200000.0; //kData[1] = 0.0; //kData[2] = 0.0; //kData[3] = 0.0; //kData[4] = 0.0; //kData[5] = 14400000.0; //kData[6] = 0.0; //kData[7] = 0.0; //kData[8] = 0.0; //kData[9] = 0.0; //kData[10] = 14400000.0; //kData[11] = 0.0; //kData[12] = 0.0; //kData[13] = 0.0; //kData[14] = 0.0; //kData[15] = GJ; code(0) = SECTION_RESPONSE_P; code(1) = SECTION_RESPONSE_MZ; code(2) = SECTION_RESPONSE_MY; code(3) = SECTION_RESPONSE_T; }
int FiberSection2d::addFiber(Fiber &newFiber) { // need to create larger arrays if(numFibers == sizeFibers) { int newsize = 2*sizeFibers; if(newsize == 0) newsize = 30; UniaxialMaterial **newArray = new UniaxialMaterial *[newsize]; double *newMatData = new double [2 * newsize]; if (newArray == 0 || newMatData == 0) { opserr <<"FiberSection2d::addFiber -- failed to allocate Fiber pointers\n"; return -1; } // copy the old pointers and data int i; for (i = 0; i < sizeFibers; i++) { newArray[i] = theMaterials[i]; newMatData[2*i] = matData[2*i]; newMatData[2*i+1] = matData[2*i+1]; } // initialize new memory for(i = sizeFibers; i<newsize; i++) { newArray[i] = 0; newMatData[2*i] = 0.0; newMatData[2*i+1] = 0.0; } sizeFibers = newsize; // set new memory if (theMaterials != 0) { delete [] theMaterials; delete [] matData; } theMaterials = newArray; matData = newMatData; } // set the new pointers and data double yLoc, zLoc, Area; newFiber.getFiberLocation(yLoc, zLoc); Area = newFiber.getArea(); matData[numFibers*2] = yLoc; matData[numFibers*2+1] = Area; UniaxialMaterial *theMat = newFiber.getMaterial(); theMaterials[numFibers] = theMat->getCopy(); if(theMaterials[numFibers] == 0) { opserr <<"FiberSection2d::addFiber -- failed to get copy of a Material\n"; return -1; } numFibers++; // Recompute centroid ABar += Area; QzBar += yLoc*Area; yBar = QzBar/ABar; return 0; }
// full constructors: BeamColumnJoint3d::BeamColumnJoint3d(int tag,int Nd1, int Nd2, int Nd3, int Nd4, UniaxialMaterial& theMat1, UniaxialMaterial& theMat2, UniaxialMaterial& theMat3, UniaxialMaterial& theMat4, UniaxialMaterial& theMat5, UniaxialMaterial& theMat6, UniaxialMaterial& theMat7, UniaxialMaterial& theMat8, UniaxialMaterial& theMat9, UniaxialMaterial& theMat10, UniaxialMaterial& theMat11, UniaxialMaterial& theMat12, UniaxialMaterial& theMat13): Element(tag,ELE_TAG_BeamColumnJoint3d), connectedExternalNodes(4), elemActHeight(0.0), elemActWidth(0.0), elemWidth(0.0), elemHeight(0.0), HgtFac(1.0), WdtFac(1.0), Uecommit(24), UeIntcommit(4), UeprCommit(24), UeprIntCommit(4), BCJoint(13,16), dg_df(4,13), dDef_du(13,4), K(24,24), R(24), Node1(3), Node2(3), Node3(3), Node4(3) { // ensure the connectedExternalNode ID is of correct size & set values if (connectedExternalNodes.Size() != 4) opserr << "ERROR : BeamColumnJoint::BeamColumnJoint - " << tag << "failed to create an ID of size 4" << endln; connectedExternalNodes(0) = Nd1 ; connectedExternalNodes(1) = Nd2 ; connectedExternalNodes(2) = Nd3 ; connectedExternalNodes(3) = Nd4 ; MaterialPtr = new UniaxialMaterial*[13]; for (int x = 0; x <13; x++) { MaterialPtr[x] = 0; } Uecommit.Zero(); UeIntcommit.Zero(); UeprCommit.Zero(); UeprIntCommit.Zero(); BCJoint.Zero(); dg_df.Zero(); dDef_du.Zero(); K.Zero(); R.Zero(); Node1.Zero(); Node2.Zero(); Node3.Zero(); Node4.Zero(); nodePtr[0] = 0; nodePtr[1] = 0; // get a copy of the material and check we obtained a valid copy MaterialPtr[0] = theMat1.getCopy(); if (!MaterialPtr[0]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 1" << endln;} MaterialPtr[1] = theMat2.getCopy(); if (!MaterialPtr[1]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 2" << endln;} MaterialPtr[2] = theMat3.getCopy(); if (!MaterialPtr[2]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 3" << endln;} MaterialPtr[3] = theMat4.getCopy(); if (!MaterialPtr[3]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 4" << endln;} MaterialPtr[4] = theMat5.getCopy(); if (!MaterialPtr[4]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 5" << endln;} MaterialPtr[5] = theMat6.getCopy(); if (!MaterialPtr[5]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 6" << endln;} MaterialPtr[6] = theMat7.getCopy(); if (!MaterialPtr[6]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 7" << endln;} MaterialPtr[7] = theMat8.getCopy(); if (!MaterialPtr[7]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 8" << endln;} MaterialPtr[8] = theMat9.getCopy(); if (!MaterialPtr[8]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 9" << endln;} MaterialPtr[9] = theMat10.getCopy(); if (!MaterialPtr[9]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 10" << endln;} MaterialPtr[10] = theMat11.getCopy(); if (!MaterialPtr[10]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 11" << endln;} MaterialPtr[11] = theMat12.getCopy(); if (!MaterialPtr[11]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 12" << endln;} MaterialPtr[12] = theMat13.getCopy(); if (!MaterialPtr[12]){ opserr << "ERROR : BeamColumnJoint::Constructor failed to get a copy of material 13" << endln;} }