| 383 | |
| 384 | |
| 385 | int |
| 386 | Graph::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 | } |
nothing calls this directly
no test coverage detected