Element * ShadowSubdomain::removeElement(int tag) { int loc = theElements.removeValue(tag); if (loc < 0) return 0; else { // the element is there go get it // send a message to remove the object from the actor msgData(0) = ShadowActorSubdomain_removeElement; msgData(1) = tag; this->sendID(msgData); numElements--; // this->Domain::domainChange(); // get the element from the actor this->recvID(msgData); int theType = msgData(0); if (theType == -1) // the ele was not there! return 0; Element *theEle = theObjectBroker->getNewElement(theType); if (theEle != 0) this->recvObject(*theEle); return theEle; } }
bool ShadowSubdomain::addSP_Constraint(SP_Constraint *theSP, int loadPattern) { #ifdef _G3DEBUG // do all the checking stuff #endif /* LoadPattern *thePattern = this->Subdomain::getLoadPattern(loadPattern); if ((thePattern == 0) || (thePattern->addSP_Constraint(theSP) == false)) { opserr << "ShadowSubdomain::addSP_Constraint() - could not add SP_Constraint: " << *theSP; return false; } */ msgData(0) = ShadowActorSubdomain_addSP_ConstraintToPattern; msgData(1) = theSP->getClassTag(); msgData(2) = theSP->getDbTag(); msgData(3) = loadPattern; this->sendID(msgData); this->sendObject(*theSP); numSPs++; // this->Domain::domainChange(); return true; }
int ShadowSubdomain::computeNodalResponse(void) { DomainDecompositionAnalysis *theDDA = this->getDDAnalysis(); if (theDDA != 0 && theDDA->doesIndependentAnalysis() != true) { FE_Element *theFePtr = this->getFE_ElementPtr(); if (theFePtr != 0) { const Vector &lastChange = theFePtr->getLastResponse(); msgData(0) = ShadowActorSubdomain_computeNodalResponse; msgData(1) = lastChange.Size(); if (numDOF != msgData(1)) { opserr << "ShadowSubdomain::update(void)"; opserr << " - numDOF " << numDOF << " and size of Vector "; opserr << msgData(1) << "do not agree?\n"; numDOF = msgData(1); } this->sendID(msgData); Vector theChange(lastChange); this->sendVector(theChange); } } return 0; }
Element * ShadowSubdomain::getElement(int tag) { opserr << "ShadowSubdomain::getElement(int tag) START \n"; if (theElements.getLocation(tag) < 0) return 0; opserr << "ShadowSubdomain::getElement(int tag) 2\n"; msgData(0) = ShadowActorSubdomain_getElement; msgData(1) = tag; this->sendID(msgData); this->recvID(msgData); int theType = msgData(0); opserr << "ShadowSubdomain::getElement(int tag) 3 type: " << theType << endln; Element *theEle = theObjectBroker->getNewElement(theType); if (theEle != 0) { opserr << *theEle; this->recvObject(*theEle); } opserr << *theEle; opserr << "ShadowSubdomain::getElement(int tag) DONE\n"; return theEle; }
bool ShadowSubdomain::addNodalLoad(NodalLoad *theLoad, int loadPattern) { #ifdef _G3DEBUG // do all the checking stuff #endif /* LoadPattern *thePattern = this->Subdomain::getLoadPattern(loadPattern); if ((thePattern == 0) || (thePattern->addNodalLoad(theLoad) == false)) { opserr << "ShadowSubdomain::addNodalLoad() - could not add the load: " << *theLoad; return false; } opserr << "ShadowSubdomain::addNodalLoad : " << this->getTag() << " " << theLoad->getNodeTag() << endln; */ msgData(0) = ShadowActorSubdomain_addNodalLoadToPattern; msgData(1) = theLoad->getClassTag(); msgData(2) = theLoad->getDbTag(); msgData(3) = loadPattern; this->sendID(msgData); this->sendObject(*theLoad); return true; }
const Vector * ShadowSubdomain::getNodeResponse(int tag, NodeResponseType responseType) { if (theNodes.getLocation(tag) < 0) return NULL; static Vector data(0); msgData(0) = ShadowActorSubdomain_getNodeResponse; msgData(1) = tag; msgData(2) = responseType; this->sendID(msgData); this->recvID(msgData); if (msgData(0) != 0) { int sizeVector = msgData(1); if (data.Size() != sizeVector) data.resize(sizeVector); this->recvVector(data); return &data; } return NULL; }
bool ShadowSubdomain::addElement(Element *theEle) { int tag = theEle->getTag(); #ifdef _G3DEBUG // do all the checking stuff #endif msgData(0) = ShadowActorSubdomain_addElement; msgData(1) = theEle->getClassTag(); msgData(2) = theEle->getDbTag(); this->sendID(msgData); this->sendObject(*theEle); theElements[numElements] = tag; numElements++; // this->Domain::domainChange(); /* msgData(0) = 5; msgData(1) = 6; msgData(2) = 7; msgData(3) = 8; this->sendID(msgData); this->recvID(msgData); opserr << "ShadowSubdomain::addElement() : " << msgData; */ delete theEle; return true; }
int ShadowSubdomain::computeTang(void) { count++; if (count == 1) { msgData(0) = ShadowActorSubdomain_computeTang; msgData(1) = this->getTag(); this->sendID(msgData); for (int i = 0; i < numShadowSubdomains; i++) { ShadowSubdomain *theShadow = theShadowSubdomains[i]; if (theShadow != this) theShadow->computeTang(); } } else if (count <= numShadowSubdomains) { msgData(0) = ShadowActorSubdomain_computeTang; msgData(1) = this->getTag(); this->sendID(msgData); } else if (count == 2*numShadowSubdomains - 1) count = 0; return 0; }
void ShadowSubdomain::setCommitTag(int newTag) { msgData(0) = ShadowActorSubdomain_setCommitTag; msgData(1) = newTag; // this->sendID(msgData); }
void P2PThread::OnMessage(talk_base::Message *msg) { switch (msg->message_id) { case MSG_CONNECT_TO_PEER: { talk_base::TypedMessageData<int> *msgData = static_cast< talk_base::TypedMessageData<int> *>(msg->pdata); int peer_id = msgData->data(); conductor_->ConnectToPeer(peer_id); } break; case MSG_SEND_STRING: { talk_base::TypedMessageData<std::string> *msgData = static_cast< talk_base::TypedMessageData<std::string> *>(msg->pdata); std::string data = msgData->data(); StreamProcess * stream = conductor_->GetStreamProcess(); //stream->WriteData(data.c_str(),data.length()); } break; case MSG_WRITE_BUFFER: { talk_base::scoped_ptr<talk_base::TypedMessageData<talk_base::Buffer> >msgData ( static_cast< talk_base::TypedMessageData<talk_base::Buffer> *>(msg->pdata)); StreamProcess * stream = conductor_->GetStreamProcess(); //stream->WriteBuffer(msgData->data()); } break; case MSG_SEND_TO_PEER: { talk_base::scoped_ptr<talk_base::TypedMessageData<std::string> >msgData ( static_cast< talk_base::TypedMessageData<std::string> *>(msg->pdata)); conductor_->UIThreadCallback(ServerConductor::SEND_MESSAGE_TO_PEER,&msgData->data()); break; } case MSG_SEND_STREAM: { talk_base::TypedMessageData<int> *msgData = static_cast< talk_base::TypedMessageData<int> *>(msg->pdata); int buffer_len = msgData->data(); char * buffer = new char[buffer_len]; for(int i=0;i<buffer_len;i++){ buffer[i] = static_cast<char>(rand()); } talk_base::Buffer sendBuffer(buffer,buffer_len); StreamProcess * stream = conductor_->GetStreamProcess(); // stream->WriteBuffer(sendBuffer); this->PostDelayed(10,this,MSG_SEND_STREAM,msgData); } break; default: break; } }
void ShadowSubdomain::Print(OPS_Stream &s, int flag) { msgData(0) = ShadowActorSubdomain_Print; msgData(1) = flag; this->sendID(msgData); this->recvID(msgData); }
int ShadowSubdomain::addRecorder(Recorder &theRecorder) { msgData(0) = ShadowActorSubdomain_addRecorder; msgData(1) = theRecorder.getClassTag(); this->sendID(msgData); this->sendObject(theRecorder); return 0; }
int ShadowSubdomain::removeRecorder(int tag) { msgData(0) = ShadowActorSubdomain_removeRecorder; msgData(1) = tag; this->sendID(msgData); return 0; }
Parameter * ShadowSubdomain::removeParameter(int tag) { msgData(0) = ShadowActorSubdomain_removeParameter; msgData(1) = tag; this->sendID(msgData); this->recvID(msgData); return 0; }
bool ShadowSubdomain::addParameter(Parameter *param) { msgData(0) = ShadowActorSubdomain_addParameter; msgData(1) = param->getClassTag(); this->sendID(msgData); this->sendObject(*param); return 0; }
void ShadowSubdomain::setDomainDecompAnalysis(DomainDecompositionAnalysis &theDDAnalysis) { msgData(0) = ShadowActorSubdomain_setDomainDecompAnalysis; msgData(1) = theDDAnalysis.getClassTag(); this->sendID(msgData); this->sendObject(theDDAnalysis); this->Subdomain::setDomainDecompAnalysis(theDDAnalysis); }
int ShadowSubdomain::setAnalysisAlgorithm(EquiSolnAlgo &theAlgorithm) { msgData(0) = ShadowActorSubdomain_setAnalysisAlgorithm; msgData(1) = theAlgorithm.getClassTag(); this->sendID(msgData); this->sendObject(theAlgorithm); return 0; }
int ShadowSubdomain::setAnalysisEigenSOE(EigenSOE &theSOE) { msgData(0) = ShadowActorSubdomain_setAnalysisEigenSOE; msgData(1) = theSOE.getClassTag(); this->sendID(msgData); this->sendObject(theSOE); return 0; }
int ShadowSubdomain::setAnalysisConvergenceTest(ConvergenceTest &theTest) { msgData(0) = ShadowActorSubdomain_setAnalysisConvergenceTest; msgData(1) = theTest.getClassTag(); this->sendID(msgData); this->sendObject(theTest); return 0; }
int ShadowSubdomain::calculateNodalReactions(bool incInertia) { msgData(0) = ShadowActorSubdomain_calculateNodalReactions; if (incInertia == true) msgData(1) = 0; else msgData(1) = 1; this->sendID(msgData); return 0; }
int ShadowSubdomain::setAnalysisIntegrator(IncrementalIntegrator &theIntegrator) { msgData(0) = ShadowActorSubdomain_setAnalysisIntegrator; msgData(1) = theIntegrator.getClassTag(); this->sendID(msgData); this->sendObject(theIntegrator); this->recvID(msgData); return 0; }
bool ShadowSubdomain::getDomainChangeFlag(void) { msgData(0) = ShadowActorSubdomain_getDomainChangeFlag; this->sendID(msgData); this->recvID(msgData); if (msgData(0) == 0) return true; else return false; }
bool ShadowSubdomain::hasElement(int tag) { msgData(0) = ShadowActorSubdomain_hasElement; msgData(1) = tag; this->sendID(msgData); this->recvID(msgData); if (msgData(0) == 0) return true; else return false; }
int ShadowSubdomain::setMass(const Matrix &mass, int nodeTag) { msgData(0) = ShadowActorSubdomain_setMass; msgData(1) = nodeTag; msgData(2) = mass.noRows(); msgData(3) = mass.noCols(); this->sendID(msgData); this->sendMatrix(mass); this->recvID(msgData); return msgData(0); }
int ShadowSubdomain::removeSP_Constraint(int theNode, int theDOF, int loadPatternTag) { msgData(0) = ShadowActorSubdomain_removeSP_ConstraintNoTag; msgData(1) = theNode; msgData(2) = theDOF; msgData(3) = loadPatternTag; this->sendID(msgData); this->recvID(msgData); return msgData(0); }
int ShadowSubdomain::updateParameter(int tag, int value) { msgData(0) = ShadowActorSubdomain_updateParameterINT; msgData(1) = tag; msgData(2) = value; //msgData(0) = 0; this->sendID(msgData); this->recvID(msgData); return msgData(0); }
LoadPattern * ShadowSubdomain::removeLoadPattern(int loadTag) { TaggedObject *mc = theShadowLPs->removeComponent(loadTag); if (mc == 0) return 0; msgData(0) = ShadowActorSubdomain_removeLoadPattern; msgData(1) = loadTag; this->sendID(msgData); LoadPattern *result = (LoadPattern *)mc; return result; }
void ShadowSubdomain::setLoadConstant(void) { msgData(0) = ShadowActorSubdomain_setLoadConstant; this->sendID(msgData); }
int ShadowSubdomain::removeRecorders(void) { msgData(0) = ShadowActorSubdomain_removeRecorders; this->sendID(msgData); return 0; }
SP_Constraint * ShadowSubdomain::removeSP_Constraint(int tag) { TaggedObject *mc = theShadowSPs->removeComponent(tag); if (mc == 0) return 0; msgData(0) = ShadowActorSubdomain_removeSP_Constraint; msgData(1) = tag; this->sendID(msgData); numSPs--; SP_Constraint *result = (SP_Constraint *)mc; return result; }