constructs the Graph
| 43 | |
| 44 | // constructs the Graph |
| 45 | DOF_GroupGraph::DOF_GroupGraph(AnalysisModel &theModel) |
| 46 | :Graph(theModel.getNumDOF_Groups()+START_VERTEX_NUM), |
| 47 | myModel(theModel) |
| 48 | { |
| 49 | |
| 50 | int numVertex = myModel.getNumDOF_Groups(); |
| 51 | |
| 52 | if (numVertex == 0) { |
| 53 | opserr << "WARNING DOF_GroupGraph::DOF_GroupGraph"; |
| 54 | opserr << " - 0 vertices, has the Domain been populated?\n"; |
| 55 | return; |
| 56 | } |
| 57 | |
| 58 | DOF_Group *dofPtr; |
| 59 | |
| 60 | // now create the vertices with a reference equal to the DOF_Group number. |
| 61 | // and a tag which ranges from 0 through numVertex-1 |
| 62 | |
| 63 | DOF_GrpIter &dofIter2 = theModel.getDOFs(); |
| 64 | int count = START_VERTEX_NUM; |
| 65 | while ((dofPtr = dofIter2()) != 0) { |
| 66 | int DOF_GroupTag = dofPtr->getTag(); |
| 67 | int DOF_GroupNodeTag = dofPtr->getNodeTag(); |
| 68 | int numDOF = dofPtr->getNumFreeDOF(); |
| 69 | Vertex *vertexPtr = new Vertex(DOF_GroupTag, DOF_GroupNodeTag, 0, numDOF); |
| 70 | |
| 71 | if (vertexPtr == 0) { |
| 72 | opserr << "WARNING DOF_GroupGraph::DOF_GroupGraph"; |
| 73 | opserr << " - Not Enough Memory to create "; |
| 74 | opserr << count << "th Vertex\n"; |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | this->addVertex(vertexPtr); |
| 79 | } |
| 80 | |
| 81 | |
| 82 | // now add the edges, by looping over the Elements, getting their |
| 83 | // IDs and adding edges between DOFs for equation numbers >= START_EQN_NUM |
| 84 | |
| 85 | FE_Element *elePtr; |
| 86 | FE_EleIter &eleIter = myModel.getFEs(); |
| 87 | |
| 88 | while((elePtr = eleIter()) != 0) { |
| 89 | const ID &id = elePtr->getDOFtags(); |
| 90 | int size = id.Size(); |
| 91 | for (int i=0; i<size; i++) { |
| 92 | int dof1 = id(i); |
| 93 | for (int j=0; j<size; j++) |
| 94 | if (i != j) { |
| 95 | int dof2 = id(j); |
| 96 | this->addEdge(dof1,dof2); |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | DOF_GroupGraph::~DOF_GroupGraph() |
nothing calls this directly
no test coverage detected