| 110 | } |
| 111 | |
| 112 | int |
| 113 | SkylineSPD::setSize(Graph &theGraph) |
| 114 | { |
| 115 | int oldSize = size; |
| 116 | int result = 0; |
| 117 | size = theGraph.getNumVertex(); |
| 118 | |
| 119 | // check we have enough space in iDiagLoc and iLastCol |
| 120 | // if not delete old and create new |
| 121 | if (size > Bsize) { |
| 122 | if (iDiagLoc != 0) delete [] iDiagLoc; |
| 123 | if (RowTop != 0) delete [] RowTop; |
| 124 | if (topRowPtr != 0) delete [] topRowPtr; |
| 125 | if (invD != 0) delete [] invD; |
| 126 | // if (topRowPtr != 0) free((void *)topRowPtr); |
| 127 | |
| 128 | iDiagLoc = new int[size]; |
| 129 | RowTop = new int[size]; |
| 130 | invD = new double[size]; |
| 131 | // topRowPtr = new double *[size] ; |
| 132 | topRowPtr = (double **)malloc(size *sizeof(double *)); |
| 133 | |
| 134 | |
| 135 | if (iDiagLoc == 0 || RowTop == 0 || topRowPtr == 0 || invD == 0) { |
| 136 | opserr << "WARNING SkylineSPD::setSize() : "; |
| 137 | opserr << " - ran out of memory for iDiagLoc\n"; |
| 138 | size = 0; Asize = 0; |
| 139 | result = -1; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // zero out iDiagLoc |
| 144 | for (int i=0; i<size; i++) { |
| 145 | iDiagLoc[i] = 0; |
| 146 | } |
| 147 | |
| 148 | // now we go through the vertices to find the height of each col and |
| 149 | // width of each row from the connectivity information. |
| 150 | |
| 151 | Vertex *vertexPtr; |
| 152 | VertexIter &theVertices = theGraph.getVertices(); |
| 153 | |
| 154 | while ((vertexPtr = theVertices()) != 0) { |
| 155 | int vertexNum = vertexPtr->getTag(); |
| 156 | const ID &theAdjacency = vertexPtr->getAdjacency(); |
| 157 | int iiDiagLoc = iDiagLoc[vertexNum]; |
| 158 | int *iiDiagLocPtr = &(iDiagLoc[vertexNum]); |
| 159 | |
| 160 | for (int i=0; i<theAdjacency.Size(); i++) { |
| 161 | int otherNum = theAdjacency(i); |
| 162 | int diff = vertexNum-otherNum; |
| 163 | if (diff > 0) { |
| 164 | if (iiDiagLoc < diff) { |
| 165 | iiDiagLoc = diff; |
| 166 | *iiDiagLocPtr = diff; |
| 167 | } |
| 168 | } |
| 169 | } |
nothing calls this directly
no test coverage detected