MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / recvSelf

Method recvSelf

SRC/graph/graph/Graph.cpp:461–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459
460
461int
462Graph::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
463{
464 // check not from a datastore
465 if (theChannel.isDatastore() != 0) {
466 opserr << "Graph::recvSelf() - at present does not receive from a database\n";
467 return -1;
468 }
469
470 // check blank
471 if (this->getNumVertex() != 0) {
472 opserr << "Graph::recvSelf() - can only receive to an empty graph at present\n";
473
474 numEdge = 0;
475 myVertices->clearAll();
476 }
477
478 // recv numEdge & numVertices
479 static ID idData(2);
480 if (theChannel.recvID(0, commitTag, idData) < 0) {
481 opserr << "Graph::recvSelf() - failed to receive the id\n";
482 return -3;
483 }
484
485 numEdge = idData(0);
486 int numVertex = idData(1);
487
488 if (numVertex != 0) {
489
490 int *vertexData = new int[5 * numVertex + 2 * numEdge];
491 if (vertexData != 0) {
492 ID verticesData(vertexData, 5*numVertex + 2 * numEdge, true);
493 if (theChannel.recvID(0, commitTag, verticesData) < 0) {
494 opserr << "Graph::recvSelf() - failed to receive the id\n";
495 return -3;
496 }
497 Vector vertexWeights(numVertex);
498 if (theChannel.recvVector(0, commitTag, vertexWeights) < 0) {
499 opserr << "Graph::recvSelf() - failed to receive the weights\n";
500 return -3;
501 }
502
503 int adjacencyLocation = 5 * numVertex;
504 int vertexLocation = 0;
505 for (int i=0; i<numVertex; i++) {
506 int tag = vertexData[vertexLocation++];
507 int ref = vertexData[vertexLocation++];
508 int color = vertexData[vertexLocation++];
509 int tmp = vertexData[vertexLocation++];
510 int adjSize = vertexData[vertexLocation++];
511 Vertex *theVertex = new Vertex(tag, ref);
512 if (theVertex == 0) {
513 opserr << "Graph::recvSelf() - out of memory\n";
514 return -4;
515 }
516 theVertex->setColor(color);
517 theVertex->setTmp(tmp);
518 theVertex->setWeight(vertexWeights(i));

Callers

nothing calls this directly

Calls 10

getNumVertexMethod · 0.95
addVertexMethod · 0.95
isDatastoreMethod · 0.45
clearAllMethod · 0.45
recvIDMethod · 0.45
recvVectorMethod · 0.45
setColorMethod · 0.45
setTmpMethod · 0.45
setWeightMethod · 0.45
addEdgeMethod · 0.45

Tested by

no test coverage detected