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

Method recvSelf

DEVELOPER/core/Graph.cpp:402–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400
401
402int
403Graph::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
404{
405 // check not from a datastore
406 if (theChannel.isDatastore() != 0) {
407 opserr << "Graph::recvSelf() - at present does not receive from a database\n";
408 return -1;
409 }
410
411 // check blank
412 if (this->getNumVertex() != 0) {
413 opserr << "Graph::recvSelf() - can only receive to an empty graph at present\n";
414
415 numEdge = 0;
416 myVertices->clearAll();
417 }
418
419 // recv numEdge & numVertices
420 static ID idData(2);
421 if (theChannel.recvID(0, commitTag, idData) < 0) {
422 opserr << "Graph::recvSelf() - failed to receive the id\n";
423 return -3;
424 }
425
426 numEdge = idData(0);
427 int numVertex = idData(1);
428
429 if (numVertex != 0) {
430
431 int *vertexData = new int[5 * numVertex + 2 * numEdge];
432 if (vertexData != 0) {
433 ID verticesData(vertexData, 5*numVertex + 2 * numEdge, true);
434 if (theChannel.recvID(0, commitTag, verticesData) < 0) {
435 opserr << "Graph::recvSelf() - failed to receive the id\n";
436 return -3;
437 }
438 Vector vertexWeights(numVertex);
439 if (theChannel.recvVector(0, commitTag, vertexWeights) < 0) {
440 opserr << "Graph::recvSelf() - failed to receive the weights\n";
441 return -3;
442 }
443
444 int adjacencyLocation = 5 * numVertex;
445 int vertexLocation = 0;
446 for (int i=0; i<numVertex; i++) {
447 int tag = vertexData[vertexLocation++];
448 int ref = vertexData[vertexLocation++];
449 int color = vertexData[vertexLocation++];
450 int tmp = vertexData[vertexLocation++];
451 int adjSize = vertexData[vertexLocation++];
452 Vertex *theVertex = new Vertex(tag, ref);
453 if (theVertex == 0) {
454 opserr << "Graph::recvSelf() - out of memory\n";
455 return -4;
456 }
457 theVertex->setColor(color);
458 theVertex->setTmp(tmp);
459 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