예제 #1
0
// responsible for allocating the necessary space needed
// by each object and storing the tags of the end nodes.
EEBeamColumn2d::EEBeamColumn2d(int tag, int Nd1, int Nd2,
                               CrdTransf &coordTransf,
                               int port, char *machineInetAddr, int ssl, int udp,
                               int dataSize, bool iM, int addRay, double r)
    : ExperimentalElement(tag, ELE_TAG_EEBeamColumn2d),
      connectedExternalNodes(2), theCoordTransf(0),
      iMod(iM), addRayleigh(addRay), rho(r), L(0.0), theLoad(6),
      theChannel(0), sData(0), sendData(0), rData(0), recvData(0),
      db(0), vb(0), ab(0), t(0),
      dbDaq(0), vbDaq(0), abDaq(0), qDaq(0), tDaq(0),
      dbCtrl(3), vbCtrl(3), abCtrl(3),
      kbInit(3,3), tLast(0.0), firstWarning(true)
{
    // ensure the connectedExternalNode ID is of correct size & set values
    if (connectedExternalNodes.Size() != 2)  {
        opserr << "EEBeamColumn2d::EEBeamColumn2d() - element: "
               <<  tag << " failed to create an ID of size 2\n";
        exit(-1);
    }

    connectedExternalNodes(0) = Nd1;
    connectedExternalNodes(1) = Nd2;

    // set node pointers to NULL
    int i;
    for (i=0; i<2; i++)
        theNodes[i] = 0;

    // setup the connection
    if (ssl)  {
        if (machineInetAddr == 0)
            theChannel = new TCP_SocketSSL(port, "127.0.0.1");
        else
            theChannel = new TCP_SocketSSL(port, machineInetAddr);
    }
    else if (udp)  {
        if (machineInetAddr == 0)
            theChannel = new UDP_Socket(port, "127.0.0.1");
        else
            theChannel = new UDP_Socket(port, machineInetAddr);
    }
    else  {
        if (machineInetAddr == 0)
            theChannel = new TCP_Socket(port, "127.0.0.1");
        else
            theChannel = new TCP_Socket(port, machineInetAddr);
    }
    if (!theChannel)  {
        opserr << "EEBeamColumn2d::EEBeamColumn2d() "
               << "- failed to create channel\n";
        exit(-1);
    }
    if (theChannel->setUpConnection() != 0)  {
        opserr << "EEBeamColumn2d::EEBeamColumn2d() "
               << "- failed to setup connection\n";
        exit(-1);
    }
    delete [] machineInetAddr;

    // set the data size for the experimental site
    int intData[2*OF_Resp_All+1];
    ID idData(intData, 2*OF_Resp_All+1);
    sizeCtrl = new ID(intData, OF_Resp_All);
    sizeDaq = new ID(&intData[OF_Resp_All], OF_Resp_All);
    idData.Zero();

    (*sizeCtrl)[OF_Resp_Disp]  = 3;
    (*sizeCtrl)[OF_Resp_Vel]   = 3;
    (*sizeCtrl)[OF_Resp_Accel] = 3;
    (*sizeCtrl)[OF_Resp_Time]  = 1;

    (*sizeDaq)[OF_Resp_Disp]   = 3;
    (*sizeDaq)[OF_Resp_Vel]    = 3;
    (*sizeDaq)[OF_Resp_Accel]  = 3;
    (*sizeDaq)[OF_Resp_Force]  = 3;
    (*sizeDaq)[OF_Resp_Time]   = 1;

    if (dataSize < 13) dataSize = 13;
    intData[2*OF_Resp_All] = dataSize;

    theChannel->sendID(0, 0, idData, 0);

    // allocate memory for the send vectors
    int id = 1;
    sData = new double [dataSize];
    sendData = new Vector(sData, dataSize);
    db = new Vector(&sData[id], 3);
    id += 3;
    vb = new Vector(&sData[id], 3);
    id += 3;
    ab = new Vector(&sData[id], 3);
    id += 3;
    t = new Vector(&sData[id], 1);
    sendData->Zero();

    // allocate memory for the receive vectors
    id = 0;
    rData = new double [dataSize];
    recvData = new Vector(rData, dataSize);
    dbDaq = new Vector(&rData[id], 3);
    id += 3;
    vbDaq = new Vector(&rData[id], 3);
    id += 3;
    abDaq = new Vector(&rData[id], 3);
    id += 3;
    qDaq = new Vector(&rData[id], 3);
    id += 3;
    tDaq = new Vector(&rData[id], 1);
    recvData->Zero();

    // set the initial stiffness matrix size
    theInitStiff.resize(6,6);

    // get a copy of the coordinate transformation
    theCoordTransf = coordTransf.getCopy2d();
    if (!theCoordTransf)  {
        opserr << "EEBeamColumn2d::EEBeamColumn2d() - "
               << "failed to get copy of the coordinate transformation\n";
        exit(-1);
    }

    // initialize additional vectors
    dbCtrl.Zero();
    vbCtrl.Zero();
    abCtrl.Zero();
    for (i=0; i<3; i++)  {
        qA0[i] = 0.0;
        pA0[i] = 0.0;
    }
}