------------------------------------------------------------------------------
| 1255 | |
| 1256 | //------------------------------------------------------------------------------ |
| 1257 | void vtkStructuredImplicitConnectivity::PackData(int ext[6], vtkMultiProcessStream& bytestream) |
| 1258 | { |
| 1259 | // Sanity checks |
| 1260 | assert("pre: input grid is nullptr!" && (this->InputGrid != nullptr)); |
| 1261 | assert("pre: output grid is nullptr!" && (this->OutputGrid != nullptr)); |
| 1262 | assert("pre: extent is out-of-bounds the output grid!" && |
| 1263 | vtkStructuredExtent::Smaller(ext, this->OutputGrid->Extent)); |
| 1264 | |
| 1265 | bytestream.Push(ext, 6); |
| 1266 | |
| 1267 | if (this->OutputGrid->Nodes != nullptr) |
| 1268 | { |
| 1269 | bytestream << VTK_STRUCTURED_GRID; |
| 1270 | vtkIdType nnodes = vtkStructuredData::GetNumberOfPoints(ext); |
| 1271 | bytestream << nnodes; |
| 1272 | |
| 1273 | int ijk[3] = { 0, 0, 0 }; |
| 1274 | for (I(ijk) = IMIN(ext); I(ijk) <= IMAX(ext); ++I(ijk)) |
| 1275 | { |
| 1276 | for (J(ijk) = JMIN(ext); J(ijk) <= JMAX(ext); ++J(ijk)) |
| 1277 | { |
| 1278 | for (K(ijk) = KMIN(ext); K(ijk) <= KMAX(ext); ++K(ijk)) |
| 1279 | { |
| 1280 | vtkIdType idx = vtkStructuredData::ComputePointIdForExtent( |
| 1281 | this->OutputGrid->Extent, ijk, this->OutputGrid->DataDescription); |
| 1282 | bytestream.Push(this->OutputGrid->Nodes->GetPoint(idx), 3); |
| 1283 | } // END for all k |
| 1284 | } // END for all j |
| 1285 | } // END for all i |
| 1286 | } // END if structured grid |
| 1287 | else if (this->OutputGrid->IsRectilinearGrid()) |
| 1288 | { |
| 1289 | bytestream << VTK_RECTILINEAR_GRID; |
| 1290 | vtkDataArray* coords[3]; |
| 1291 | coords[0] = this->OutputGrid->X_Coords; |
| 1292 | coords[1] = this->OutputGrid->Y_Coords; |
| 1293 | coords[2] = this->OutputGrid->Z_Coords; |
| 1294 | for (int dim = 0; dim < 3; ++dim) |
| 1295 | { |
| 1296 | assert("pre: nullptr coordinates" && coords[dim] != nullptr); |
| 1297 | int flag = -1; |
| 1298 | if (ext[dim * 2] == ext[dim * 2 + 1]) |
| 1299 | { |
| 1300 | flag = 1; |
| 1301 | bytestream << flag; |
| 1302 | bytestream << coords[dim]->GetTuple1(0); |
| 1303 | } |
| 1304 | else |
| 1305 | { |
| 1306 | bytestream << flag; |
| 1307 | } |
| 1308 | } // END for all dimensions |
| 1309 | } // END if rectilinear grid |
| 1310 | else |
| 1311 | { |
| 1312 | bytestream << VTK_UNIFORM_GRID; |
| 1313 | } |
| 1314 |
no test coverage detected