------------------------------------------------------------------------------
| 1326 | |
| 1327 | //------------------------------------------------------------------------------ |
| 1328 | void vtkStructuredImplicitConnectivity::UnPackData(unsigned char* buffer, unsigned int size) |
| 1329 | { |
| 1330 | assert("pre: output grid is nullptr!" && (this->OutputGrid != nullptr)); |
| 1331 | |
| 1332 | if (size == 0) |
| 1333 | { |
| 1334 | return; |
| 1335 | } |
| 1336 | |
| 1337 | assert("pre: nullptr buffer encountered!" && (buffer != nullptr)); |
| 1338 | |
| 1339 | vtkMultiProcessStream bytestream; |
| 1340 | bytestream.SetRawData(buffer, size); |
| 1341 | |
| 1342 | int* ext = nullptr; |
| 1343 | unsigned int sz = 0; |
| 1344 | bytestream.Pop(ext, sz); |
| 1345 | assert("post: ext size should be 6" && (sz == 6)); |
| 1346 | assert("post: ext is out-of-bounds the output grid!" && |
| 1347 | vtkStructuredExtent::Smaller(ext, this->OutputGrid->Extent)); |
| 1348 | |
| 1349 | int datatype = -1; |
| 1350 | bytestream >> datatype; |
| 1351 | |
| 1352 | if (datatype == VTK_STRUCTURED_GRID) |
| 1353 | { |
| 1354 | int nnodes = 0; |
| 1355 | bytestream >> nnodes; |
| 1356 | assert("pre: nnodes must be greater than 0!" && (nnodes > 0)); |
| 1357 | assert("post: output grid must have nodes!" && (this->OutputGrid->Nodes != nullptr)); |
| 1358 | |
| 1359 | int ijk[3] = { 0, 0, 0 }; |
| 1360 | double* pnt = new double[3]; |
| 1361 | unsigned int pntsz = 3; |
| 1362 | |
| 1363 | for (I(ijk) = IMIN(ext); I(ijk) <= IMAX(ext); ++I(ijk)) |
| 1364 | { |
| 1365 | for (J(ijk) = JMIN(ext); J(ijk) <= JMAX(ext); ++J(ijk)) |
| 1366 | { |
| 1367 | for (K(ijk) = KMIN(ext); K(ijk) <= KMAX(ext); ++K(ijk)) |
| 1368 | { |
| 1369 | vtkIdType idx = vtkStructuredData::ComputePointIdForExtent( |
| 1370 | this->OutputGrid->Extent, ijk, this->OutputGrid->DataDescription); |
| 1371 | assert("post: idx is out-of-bounds!" && (idx >= 0) && |
| 1372 | (idx < this->OutputGrid->Nodes->GetNumberOfPoints())); |
| 1373 | |
| 1374 | bytestream.Pop(pnt, pntsz); |
| 1375 | assert("post: pntsz!=3" && (pntsz == 3)); |
| 1376 | |
| 1377 | this->OutputGrid->Nodes->SetPoint(idx, pnt); |
| 1378 | } // END for all k |
| 1379 | } // END for all j |
| 1380 | } // END for all i |
| 1381 | |
| 1382 | delete[] pnt; |
| 1383 | } // END if structured |
| 1384 | else if (datatype == VTK_RECTILINEAR_GRID) |
| 1385 | { |
no test coverage detected