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

Method sendSelf

SRC/graph/graph/Graph.cpp:385–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383
384
385int
386Graph::sendSelf(int commitTag, Channel &theChannel)
387{
388 // check not a datastore ..
389 if (theChannel.isDatastore() != 0) {
390 opserr << "Graph::sendSelf() - does not at present send to a database\n";
391 return -1;
392 }
393
394 int numVertex = this->getNumVertex();
395
396 // send numEdge & the number of vertices
397 static ID idData(2);
398 idData(0) = numEdge;
399 idData(1) = numVertex;
400
401 if (theChannel.sendID(0, commitTag, idData) < 0) {
402 opserr << "Graph::sendSelf() - failed to send the id\n";
403 return -3;
404 }
405
406 if (numVertex != 0) {
407 int *vertexData = new int[5 * numVertex + 2 * numEdge];
408 Vector vertexWeights(numVertex);
409 if (vertexData != 0) {
410 VertexIter &theVertices = this->getVertices();
411 Vertex *vertexPtr;
412 int adjacencyLocation = 5 * numVertex;
413 int vertexLocation = 0;
414 int weightLoc = 0;
415 while ((vertexPtr = theVertices()) != 0) {
416 int tag = vertexPtr->getTag();
417 int color = vertexPtr->getColor();
418 int ref = vertexPtr->getRef();
419 int tmp = vertexPtr->getTmp();
420 const ID &adjacency = vertexPtr->getAdjacency();
421 int adjSize = adjacency.Size();
422 vertexData[vertexLocation++] = tag;
423 vertexData[vertexLocation++] = ref;
424 vertexData[vertexLocation++] = color;
425 vertexData[vertexLocation++] = tmp;
426 vertexData[vertexLocation++] = adjSize;
427 for (int i=0; i<adjSize; i++)
428 vertexData[adjacencyLocation++] = adjacency(i);
429 vertexWeights[weightLoc++] = vertexPtr->getWeight();
430
431 }
432
433 ID verticesData(vertexData, 5*numVertex + 2*numEdge, true);
434 if (theChannel.sendID(0, commitTag, verticesData) < 0) {
435 opserr << "Graph::sendSelf() - failed to send the id\n";
436 return -3;
437 }
438
439 if (theChannel.sendVector(0, commitTag, vertexWeights) < 0) {
440 opserr << "Graph::sendSelf() - failed to send the id\n";
441 return -3;
442 }

Callers

nothing calls this directly

Calls 10

getNumVertexMethod · 0.95
isDatastoreMethod · 0.45
sendIDMethod · 0.45
getTagMethod · 0.45
getColorMethod · 0.45
getRefMethod · 0.45
getTmpMethod · 0.45
SizeMethod · 0.45
getWeightMethod · 0.45
sendVectorMethod · 0.45

Tested by

no test coverage detected