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

Method buildEleGraph

DEVELOPER/core/Domain.cpp:2414–2571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2412
2413
2414int
2415Domain::buildEleGraph(Graph *theEleGraph)
2416{
2417 // see if quick return
2418 int numVertex = this->getNumElements();
2419 if (numVertex == 0)
2420 return 0;
2421
2422 //
2423 // iterate over the lements of the domain
2424 // create a vertex with a unique tag for each element
2425 // also create a map to hold element tag - vertex tag mapping
2426 //
2427
2428 MAP_INT theEleToVertexMap;
2429 MAP_INT_ITERATOR theEleToVertexMapEle;
2430
2431 Element *theEle;
2432 ElementIter &theElements = this->getElements();
2433 int count = START_VERTEX_NUM;
2434 while ((theEle = theElements()) != 0) {
2435 int eleTag = theEle->getTag();
2436 Vertex *vertexPtr = new Vertex(count, eleTag);
2437
2438 if (vertexPtr == 0) {
2439 opserr << "WARNING Domain::buildEleGraph - Not Enough Memory to create the " << count << " vertex\n";
2440 return -1;
2441 }
2442
2443 theEleGraph->addVertex(vertexPtr);
2444 theEleToVertexMapEle = theEleToVertexMap.find(eleTag);
2445 if (theEleToVertexMapEle == theEleToVertexMap.end()) {
2446 theEleToVertexMap.insert(MAP_INT_TYPE(eleTag, count));
2447
2448 // check if sucessfully added
2449 theEleToVertexMapEle = theEleToVertexMap.find(eleTag);
2450 if (theEleToVertexMapEle == theEleToVertexMap.end()) {
2451 opserr << "Domain::buildEleGraph - map STL failed to add object with tag : " << eleTag << endln;
2452 return false;
2453 }
2454
2455 count++;
2456 }
2457 }
2458
2459 //
2460 // We now need to determine which elements are asssociated with each node.
2461 // As this info is not in the Node interface we must build it;
2462 //
2463 // again we will use an stl map, index will be nodeTag, object will be Vertex
2464 // do using vertices for each node, when we addVertex at thes nodes we
2465 // will not be adding vertices but element tags.
2466 //
2467
2468 MAP_ID theNodeToVertexMap;
2469 MAP_ID_ITERATOR theNodeEle;
2470
2471 Node *nodPtr;

Callers 1

Domain.cppFile · 0.45

Calls 10

getNumElementsMethod · 0.95
getNodesMethod · 0.80
getElementsMethod · 0.45
getTagMethod · 0.45
addVertexMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
SizeMethod · 0.45
beginMethod · 0.45
addEdgeMethod · 0.45

Tested by

no test coverage detected