int MumpsParallelSOE::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker) { ID idData(2); int res = theChannel.recvID(0, commitTag, idData); if (res < 0) { opserr <<"WARNING MumpsParallelSOE::recvSelf() - failed to send data\n"; return -1; } processID = idData(0); matType = idData(1); numChannels = 1; theChannels = new Channel *[1]; theChannels[0] = &theChannel; localCol = new ID *[numChannels]; for (int i=0; i<numChannels; i++) localCol[i] = 0; MumpsParallelSolver *theSolvr = new MumpsParallelSolver(); if (theSolvr->recvSelf(commitTag, theChannel, theBroker) < 0) { opserr <<"WARNING MumpsParallelSOE::sendSelf() - failed to recv solver\n"; return -1; } theSolvr->setLinearSOE(*this); this->setSolver(*theSolvr); return 0; }
int DistributedSparseGenColLinSOE::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker) { ID idData(1); int res = theChannel.recvID(0, commitTag, idData); if (res < 0) { opserr <<"WARNING DistributedSparseGenColLinSOE::recvSelf() - failed to send data\n"; return -1; } processID = idData(0); numChannels = 1; theChannels = new Channel *[1]; theChannels[0] = &theChannel; localCol = new ID *[numChannels]; for (int i=0; i<numChannels; i++) localCol[i] = 0; opserr << "DistributedSparseGenColLinSOE::recvSelf() - DONE\n"; DistributedSuperLU *theSolvr = new DistributedSuperLU(); theSolvr->setLinearSOE(*this); this->setSolver(*theSolvr); return 0; }
int XC::ParallelNumberer::recvSelf(const CommParameters &cp) { ID idData(1); int res= cp.receiveID(idData,DistributedObj::getDbTagData(),CommMetaData(0)); if(res < 0) { std::cerr <<"WARNING XC::Parallel::recvSelf() - failed to send data\n"; return -1; } processID= idData(0); theChannels.resize(1); theChannels[0]= const_cast<Channel *>(cp.getChannel()); return 0; }
int XC::ParallelNumberer::sendSelf(CommParameters &cp) { int sendID =0; // if P0 check if already sent. If already sent use old processID; if not allocate a new_ process // id for remote part of object, enlarge channel * to hold a channel * for this remote object. // if not P0, send current processID if(processID == 0) { // check if already using this object bool found= buscaCanal(cp,sendID); // if new_ object, enlarge channel pointers to hold new_ channel * & allocate new_ ID if(found == false) { theChannels.push_back(cp.getChannel()); // allocate new_ processID for remote object sendID= theChannels.size(); } } else sendID= processID; // send remotes processID ID idData(1); idData(0)= sendID; int res= cp.sendID(idData,DistributedObj::getDbTagData(),CommMetaData(0)); if(res < 0) { std::cerr <<"WARNING XC::DistributedSparseGenColLinSOE::sendSelf() - failed to send data\n"; return -1; } return 0; }
// --------------------------------------------------------------------------- // RPeninputServerImpl::SetForeground // Set current session to be foreground application session // --------------------------------------------------------------------------- // TBool RPeninputServerImpl::SetForeground(TBool aMustConnectFlag) { // if(iIsForegroundSession) // return ETrue; TInt curAppId; TRAP_IGNORE( curAppId = GetAppUidByWndGroupIdL(CCoeEnv::Static()->WsSession(), CCoeEnv::Static()->RootWin().Identifier()).iUid); TIpcArgs arg; TPckgC<TInt> idData(curAppId); arg.Set(KMsgSlot0,&idData); TPckgC<TBool> flagMsg(aMustConnectFlag); arg.Set(KMsgSlot1,&flagMsg); TPckg<TInt> retMsg(iIsForegroundSession); arg.Set(KMsgSlot2,&retMsg); SendReceive(EPeninputRequestSetForeground,arg); return iIsForegroundSession; }
// responsible for allocating the necessary space needed // by each object and storing the tags of the end nodes. EETrussCorot::EETrussCorot(int tag, int dim, int Nd1, int Nd2, int port, char *machineInetAddr, int ssl, int udp, int dataSize, bool iM, int addRay, double r) : ExperimentalElement(tag, ELE_TAG_EETrussCorot), numDIM(dim), numDOF(0), connectedExternalNodes(2), iMod(iM), addRayleigh(addRay), rho(r), L(0.0), Ln(0.0), R(3,3), theMatrix(0), theVector(0), theLoad(0), 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(1), vbCtrl(1), abCtrl(1), kbInit(1,1), tLast(0.0), firstWarning(true) { // ensure the connectedExternalNode ID is of correct size & set values if (connectedExternalNodes.Size() != 2) { opserr << "EETrussCorot::EETrussCorot() - element: " << 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; // 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 << "EETrussCorot::EETrussCorot() " << "- failed to create channel\n"; exit(-1); } if (theChannel->setUpConnection() != 0) { opserr << "EETrussCorot::EETrussCorot() " << "- 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] = 1; (*sizeCtrl)[OF_Resp_Vel] = 1; (*sizeCtrl)[OF_Resp_Accel] = 1; (*sizeCtrl)[OF_Resp_Time] = 1; (*sizeDaq)[OF_Resp_Disp] = 1; (*sizeDaq)[OF_Resp_Vel] = 1; (*sizeDaq)[OF_Resp_Accel] = 1; (*sizeDaq)[OF_Resp_Force] = 1; (*sizeDaq)[OF_Resp_Time] = 1; if (dataSize < 5) dataSize = 5; 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], 1); id += 1; vb = new Vector(&sData[id], 1); id += 1; ab = new Vector(&sData[id], 1); id += 1; 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], 1); id += 1; vbDaq = new Vector(&rData[id], 1); id += 1; abDaq = new Vector(&rData[id], 1); id += 1; qDaq = new Vector(&rData[id], 1); id += 1; tDaq = new Vector(&rData[id], 1); recvData->Zero(); // initialize additional vectors dbCtrl.Zero(); vbCtrl.Zero(); abCtrl.Zero(); }
int DistributedSparseGenColLinSOE::sendSelf(int commitTag, Channel &theChannel) { int sendID =0; // if P0 check if already sent. If already sent use old processID; if not allocate a new process // id for remote part of object, enlarge channel * to hold a channel * for this remote object. // if not P0, send current processID if (processID == 0) { // check if already using this object bool found = false; for (int i=0; i<numChannels; i++) if (theChannels[i] == &theChannel) { sendID = i+1; found = true; } // if new object, enlarge Channel pointers to hold new channel * & allocate new ID if (found == false) { int nextNumChannels = numChannels + 1; Channel **nextChannels = new Channel *[nextNumChannels]; if (nextNumChannels == 0) { opserr << "DistributedSparseGenColLinSOE::sendSelf() - failed to allocate channel array of size: " << nextNumChannels << endln; return -1; } for (int i=0; i<numChannels; i++) nextChannels[i] = theChannels[i]; nextChannels[numChannels] = &theChannel; numChannels = nextNumChannels; if (theChannels != 0) delete [] theChannels; theChannels = nextChannels; if (localCol != 0) delete [] localCol; localCol = new ID *[numChannels]; if (localCol == 0) { opserr << "DistributedSparseGenColLinSOE::sendSelf() - failed to allocate id array of size: " << nextNumChannels << endln; return -1; } for (int i=0; i<numChannels; i++) localCol[i] = 0; // allocate new processID for remote object sendID = numChannels; } } else sendID = processID; // send remotes processID ID idData(1); idData(0) = sendID; int res = theChannel.sendID(0, commitTag, idData); if (res < 0) { opserr <<"WARNING DistributedSparseGenColLinSOE::sendSelf() - failed to send data\n"; return -1; } return 0; }
int GenericClient::setupConnection() { // setup the connection if (udp) { if (machineInetAddr == 0) theChannel = new UDP_Socket(port, "127.0.0.1"); else theChannel = new UDP_Socket(port, machineInetAddr); } #ifdef SSL else if (ssl) { if (machineInetAddr == 0) theChannel = new TCP_SocketSSL(port, "127.0.0.1"); else theChannel = new TCP_SocketSSL(port, machineInetAddr); } #endif else { if (machineInetAddr == 0) theChannel = new TCP_Socket(port, "127.0.0.1"); else theChannel = new TCP_Socket(port, machineInetAddr); } if (!theChannel) { opserr << "GenericClient::setupConnection() " << "- failed to create channel\n"; return -1; } if (theChannel->setUpConnection() != 0) { opserr << "GenericClient::setupConnection() " << "- failed to setup connection\n"; return -2; } // set the data size for the experimental element ID idData(2*5+1); idData.Zero(); idData(0) = numBasicDOF; // sizeCtrl->disp idData(1) = numBasicDOF; // sizeCtrl->vel idData(2) = numBasicDOF; // sizeCtrl->accel idData(4) = 1; // sizeCtrl->time idData(8) = numBasicDOF; // sizeDaq->force if (dataSize < 1+3*numBasicDOF+1) dataSize = 1+3*numBasicDOF+1; if (dataSize < numBasicDOF*numBasicDOF) dataSize = numBasicDOF*numBasicDOF; idData(10) = 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], numBasicDOF); id += numBasicDOF; vb = new Vector(&sData[id], numBasicDOF); id += numBasicDOF; ab = new Vector(&sData[id], numBasicDOF); id += numBasicDOF; 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); qDaq = new Vector(&rData[id], numBasicDOF); recvData->Zero(); // allocate memory for the receive matrix rMatrix = new Matrix(rData, numBasicDOF, numBasicDOF); return 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; } }
// responsible for allocating the necessary space needed // by each object and storing the tags of the end nodes. EEBearing3d::EEBearing3d(int tag, int Nd1, int Nd2, int pfc, UniaxialMaterial **materials, int port, char *machineInetAddr, int ssl, int udp, int dataSize, const Vector _y, const Vector _x, const Vector Mr, double sdI, bool iM, int addRay, double m) : ExperimentalElement(tag, ELE_TAG_EEBearing3d), connectedExternalNodes(2), pFrcCtrl(pfc), x(_x), y(_y), Mratio(Mr), shearDistI(sdI), iMod(iM), addRayleigh(addRay), mass(m), L(0.0), theChannel(0), sData(0), sendData(0), rData(0), recvData(0), db(0), vb(0), ab(0), qb(0), t(0), dbDaq(0), vbDaq(0), abDaq(0), qbDaq(0), tDaq(0), dbCtrl(6), vbCtrl(6), abCtrl(6), dl(12), Tgl(12,12), Tlb(6,12), kbInit(6,6), tLast(0.0), theLoad(12), firstWarning(true), onP0(true) { // ensure the connectedExternalNode ID is of correct size & set values if (connectedExternalNodes.Size() != 2) { opserr << "EEBearing3d::EEBearing3d() - element: " << this->getTag() << " failed to create an ID of size 2.\n"; exit(OF_ReturnType_failed); } connectedExternalNodes(0) = Nd1; connectedExternalNodes(1) = Nd2; // set node pointers to NULL for (int i=0; i<2; i++) theNodes[i] = 0; // check material input if (materials == 0) { opserr << "EEBearing3d::EEBearing3d() - " << "null material array passed.\n"; exit(OF_ReturnType_failed); } // get copies of the uniaxial materials for (int i=0; i<4; i++) { if (materials[i] == 0) { opserr << "EEBearing3d::EEBearing3d() - " "null uniaxial material pointer passed.\n"; exit(OF_ReturnType_failed); } theMaterials[i] = materials[i]->getCopy(); if (theMaterials[i] == 0) { opserr << "EEBearing3d::EEBearing3d() - " << "failed to copy uniaxial material.\n"; exit(OF_ReturnType_failed); } } // check p-delta moment distribution ratios if (Mratio.Size() == 4) { if (Mratio(0)+Mratio(1) > 1.0) { opserr << "EETwoNodeLink::EETwoNodeLink() - " << "incorrect p-delta moment ratios:\nrMy1 + rMy2 = " << Mratio(0)+Mratio(1) << " > 1.0\n"; exit(OF_ReturnType_failed); } if (Mratio(2)+Mratio(3) > 1.0) { opserr << "EETwoNodeLink::EETwoNodeLink() - " << "incorrect p-delta moment ratios:\nrMz1 + rMz2 = " << Mratio(2)+Mratio(3) << " > 1.0\n"; exit(OF_ReturnType_failed); } } // 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 << "EEBearing3d::EEBearing3d() " << "- failed to create channel.\n"; exit(OF_ReturnType_failed); } if (theChannel->setUpConnection() != 0) { opserr << "EEBearing3d::EEBearing3d() " << "- failed to setup connection.\n"; exit(OF_ReturnType_failed); } delete [] machineInetAddr; // set the data size for the experimental site int numDir = 6; 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] = numDir; (*sizeCtrl)[OF_Resp_Vel] = numDir; (*sizeCtrl)[OF_Resp_Accel] = numDir; (*sizeCtrl)[OF_Resp_Force] = numDir*pFrcCtrl; (*sizeCtrl)[OF_Resp_Time] = 1; (*sizeDaq)[OF_Resp_Disp] = numDir; (*sizeDaq)[OF_Resp_Vel] = numDir; (*sizeDaq)[OF_Resp_Accel] = numDir; (*sizeDaq)[OF_Resp_Force] = numDir; (*sizeDaq)[OF_Resp_Time] = 1; if (dataSize < 4*numDir+1) dataSize = 4*numDir+1; 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], numDir); id += numDir; vb = new Vector(&sData[id], numDir); id += numDir; ab = new Vector(&sData[id], numDir); id += numDir; qb = new Vector(&sData[id], numDir*pFrcCtrl); id += numDir*pFrcCtrl; 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], numDir); id += numDir; vbDaq = new Vector(&rData[id], numDir); id += numDir; abDaq = new Vector(&rData[id], numDir); id += numDir; qbDaq = new Vector(&rData[id], numDir); id += numDir; tDaq = new Vector(&rData[id], 1); recvData->Zero(); // initialize additional vectors dbCtrl.Zero(); vbCtrl.Zero(); abCtrl.Zero(); }