------------------------------------------------------------------------------
| 139 | |
| 140 | //------------------------------------------------------------------------------ |
| 141 | int vtkEdgeTable::InitEdgeInsertion(vtkIdType numPoints, int storeAttributes) |
| 142 | { |
| 143 | vtkIdType i; |
| 144 | |
| 145 | numPoints = (numPoints < 1 ? 1 : numPoints); |
| 146 | |
| 147 | // Discard old memory if not enough has been previously allocated |
| 148 | this->StoreAttributes = storeAttributes; |
| 149 | this->TableMaxId = -1; |
| 150 | |
| 151 | if (numPoints > this->TableSize) |
| 152 | { |
| 153 | this->Initialize(); |
| 154 | this->Table = new vtkIdList*[numPoints]; |
| 155 | for (i = 0; i < numPoints; i++) |
| 156 | { |
| 157 | this->Table[i] = nullptr; |
| 158 | } |
| 159 | |
| 160 | if (this->StoreAttributes == 1) |
| 161 | { |
| 162 | this->Attributes = new vtkIdList*[numPoints]; |
| 163 | for (i = 0; i < numPoints; i++) |
| 164 | { |
| 165 | this->Attributes[i] = nullptr; |
| 166 | } |
| 167 | } |
| 168 | else if (this->StoreAttributes == 2) |
| 169 | { |
| 170 | this->PointerAttributes = new vtkVoidArray*[numPoints]; |
| 171 | for (i = 0; i < numPoints; i++) |
| 172 | { |
| 173 | this->PointerAttributes[i] = nullptr; |
| 174 | } |
| 175 | } |
| 176 | this->TableSize = numPoints; |
| 177 | } |
| 178 | |
| 179 | // Otherwise, reuse the old memory |
| 180 | else |
| 181 | { |
| 182 | this->Reset(); |
| 183 | } |
| 184 | |
| 185 | this->Position[0] = 0; |
| 186 | this->Position[1] = -1; |
| 187 | |
| 188 | this->NumberOfEdges = 0; |
| 189 | |
| 190 | return 1; |
| 191 | } |
| 192 | |
| 193 | //------------------------------------------------------------------------------ |
| 194 | // Return non-negative if edge (p1,p2) is an edge; otherwise -1. |
no test coverage detected