| 49 | // assumes eqn numbers are numbered continuously from START_EQN_NUM |
| 50 | |
| 51 | DOF_Graph::DOF_Graph(AnalysisModel &theModel) |
| 52 | :Graph(theModel.getNumEqn()), |
| 53 | myModel(theModel) |
| 54 | { |
| 55 | |
| 56 | /********************** old way to create vertices with dof Tags ******** |
| 57 | int numVertex = myModel.getNumEqn(); |
| 58 | |
| 59 | if (numVertex <= 0) { |
| 60 | opserr << "WARNING DOF_Graph::DOF_Graph"; |
| 61 | opserr << " - 0 equations?\n"; |
| 62 | return; |
| 63 | } |
| 64 | |
| 65 | // now create the vertices with a reference equal to the eqn number. |
| 66 | // and a tag which ranges from START_VERTEX_NUM through |
| 67 | |
| 68 | for (int i =0; i<numVertex; i++) { |
| 69 | Vertex *vertexPtr = new Vertex(i, i); |
| 70 | |
| 71 | if (vertexPtr == 0) { |
| 72 | opserr << "WARNING DOF_Graph::DOF_Graph"; |
| 73 | opserr << " - Not Enough Memory to create " << i+1 << "th Vertex\n"; |
| 74 | return; |
| 75 | } |
| 76 | this->addVertex(vertexPtr,false); |
| 77 | } |
| 78 | *****************************************************************************/ |
| 79 | |
| 80 | // |
| 81 | // create a vertex for each dof |
| 82 | // |
| 83 | |
| 84 | DOF_Group *dofPtr =0; |
| 85 | DOF_GrpIter &theDOFs = myModel.getDOFs(); |
| 86 | while ((dofPtr = theDOFs()) != 0) { |
| 87 | const ID &id = dofPtr->getID(); |
| 88 | int size = id.Size(); |
| 89 | for (int i=0; i<size; i++) { |
| 90 | int dofTag = id(i); |
| 91 | if (dofTag >= START_EQN_NUM) { |
| 92 | Vertex *vertexPtr = this->getVertexPtr(dofTag); |
| 93 | if (vertexPtr == 0) { |
| 94 | Vertex *vertexPtr = new Vertex(dofTag, dofTag); |
| 95 | if (vertexPtr == 0) { |
| 96 | opserr << "WARNING DOF_Graph::DOF_Graph"; |
| 97 | opserr << " - Not Enough Memory to create " << i+1 << "th Vertex\n"; |
| 98 | return; |
| 99 | } |
| 100 | if (this->addVertex(vertexPtr, false) == false) { |
| 101 | opserr << "WARNING DOF_Graph::DOF_Graph - error adding vertex\n"; |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | // now add the edges, by looping over the FE_elements, getting their |