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

Method sendSelf

DEVELOPER/core/Graph.cpp:326–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324
325
326int
327Graph::sendSelf(int commitTag, Channel &theChannel)
328{
329 // check not a datastore ..
330 if (theChannel.isDatastore() != 0) {
331 opserr << "Graph::sendSelf() - does not at present send to a database\n";
332 return -1;
333 }
334
335 int numVertex = this->getNumVertex();
336
337 // send numEdge & the number of vertices
338 static ID idData(2);
339 idData(0) = numEdge;
340 idData(1) = numVertex;
341
342 if (theChannel.sendID(0, commitTag, idData) < 0) {
343 opserr << "Graph::sendSelf() - failed to send the id\n";
344 return -3;
345 }
346
347 if (numVertex != 0) {
348 int *vertexData = new int[5 * numVertex + 2 * numEdge];
349 Vector vertexWeights(numVertex);
350 if (vertexData != 0) {
351 VertexIter &theVertices = this->getVertices();
352 Vertex *vertexPtr;
353 int adjacencyLocation = 5 * numVertex;
354 int vertexLocation = 0;
355 int weightLoc = 0;
356 while ((vertexPtr = theVertices()) != 0) {
357 int tag = vertexPtr->getTag();
358 int color = vertexPtr->getColor();
359 int ref = vertexPtr->getRef();
360 int tmp = vertexPtr->getTmp();
361 const ID &adjacency = vertexPtr->getAdjacency();
362 int adjSize = adjacency.Size();
363 vertexData[vertexLocation++] = tag;
364 vertexData[vertexLocation++] = ref;
365 vertexData[vertexLocation++] = color;
366 vertexData[vertexLocation++] = tmp;
367 vertexData[vertexLocation++] = adjSize;
368 for (int i=0; i<adjSize; i++)
369 vertexData[adjacencyLocation++] = adjacency(i);
370 vertexWeights[weightLoc++] = vertexPtr->getWeight();
371
372 }
373
374 ID verticesData(vertexData, 5*numVertex + 2*numEdge, true);
375 if (theChannel.sendID(0, commitTag, verticesData) < 0) {
376 opserr << "Graph::sendSelf() - failed to send the id\n";
377 return -3;
378 }
379
380 if (theChannel.sendVector(0, commitTag, vertexWeights) < 0) {
381 opserr << "Graph::sendSelf() - failed to send the id\n";
382 return -3;
383 }

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