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

Method DOF_Graph

SRC/graph/graph/DOF_Graph.cpp:51–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49// assumes eqn numbers are numbered continuously from START_EQN_NUM
50
51DOF_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

Callers

nothing calls this directly

Calls 6

getIDMethod · 0.80
getNumEqnMethod · 0.45
SizeMethod · 0.45
getVertexPtrMethod · 0.45
addVertexMethod · 0.45
addEdgeMethod · 0.45

Tested by

no test coverage detected