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

Method getVertexPtr

SRC/graph/graph/ArrayGraph.cpp:174–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172// returned.\\
173
174Vertex *
175ArrayGraph::getVertexPtr(int vertexTag)
176{
177 // check first to see if it's in a nice position
178 if ((vertexTag >= 0) && (vertexTag < sizeVertices) &&
179 (theVertices[vertexTag] != 0) &&
180 (theVertices[vertexTag]->getTag() == vertexTag)) {
181
182 return theVertices[vertexTag];
183 }
184 // it's not nicely positioned, we have to search
185 // through theVertices until we find it
186
187 else
188 for (int i=0; i<sizeVertices; i++)
189 if ((theVertices[i] != 0) &&
190 (theVertices[i]->getTag() == vertexTag)){
191
192 return theVertices[i];
193 }
194
195 // else the vertex is not there
196
197 return 0;
198}
199
200// int addEdge(int vertexTag, int otherVertexTag);
201// Causes the Graph to add an edge {\em (vertexTag,otherVertexTag)} to

Callers 2

addVertexMethod · 0.95
addEdgeMethod · 0.95

Calls 1

getTagMethod · 0.45

Tested by

no test coverage detected