------------------------------------------------------------------------------
| 204 | |
| 205 | //------------------------------------------------------------------------------ |
| 206 | int vtkChacoReader::BuildOutputGrid(vtkUnstructuredGrid* output) |
| 207 | { |
| 208 | int i = 0; |
| 209 | if (this->OpenCurrentFile() != 1) |
| 210 | { |
| 211 | vtkWarningMacro(<< "Can't open file"); |
| 212 | return 0; |
| 213 | } |
| 214 | |
| 215 | int ncells = this->DataCache->GetNumberOfCells(); |
| 216 | int haveVertexWeightArrays = 0; |
| 217 | int haveEdgeWeightArrays = 0; |
| 218 | |
| 219 | if (ncells && (this->NumberOfVertexWeights > 0)) |
| 220 | { |
| 221 | vtkDoubleArray* da = vtkArrayDownCast<vtkDoubleArray>( |
| 222 | this->DataCache->GetPointData()->GetArray(this->VarrayName[0].c_str())); |
| 223 | |
| 224 | haveVertexWeightArrays = (da != nullptr); |
| 225 | } |
| 226 | |
| 227 | if (ncells && (this->NumberOfEdgeWeights > 0)) |
| 228 | { |
| 229 | vtkDoubleArray* da = vtkArrayDownCast<vtkDoubleArray>( |
| 230 | this->DataCache->GetCellData()->GetArray(this->EarrayName[0].c_str())); |
| 231 | |
| 232 | haveEdgeWeightArrays = (da != nullptr); |
| 233 | } |
| 234 | |
| 235 | if (!this->RemakeDataCacheFlag && |
| 236 | ((!haveVertexWeightArrays && this->GenerateVertexWeightArrays) || |
| 237 | (!haveEdgeWeightArrays && this->GenerateEdgeWeightArrays))) |
| 238 | { |
| 239 | this->RemakeDataCacheFlag = 1; |
| 240 | } |
| 241 | |
| 242 | if (this->RemakeDataCacheFlag) |
| 243 | { |
| 244 | output->Initialize(); |
| 245 | int rc = this->ReadFile(output); |
| 246 | |
| 247 | if (rc == 0) |
| 248 | { |
| 249 | this->CloseCurrentFile(); |
| 250 | return 0; |
| 251 | } |
| 252 | |
| 253 | if (this->GenerateGlobalElementIdArray) |
| 254 | { |
| 255 | this->AddElementIds(output); |
| 256 | } |
| 257 | |
| 258 | if (this->GenerateGlobalNodeIdArray) |
| 259 | { |
| 260 | this->AddNodeIds(output); |
| 261 | } |
| 262 | |
| 263 | // Save the output. Next time we execute, it may be simply |
no test coverage detected