MCPcopy Create free account
hub / github.com/Kitware/VTK / TransferLocalNeighborData

Method TransferLocalNeighborData

Filters/Geometry/vtkStructuredGridConnectivity.cxx:1396–1479  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1394
1395//------------------------------------------------------------------------------
1396void vtkStructuredGridConnectivity::TransferLocalNeighborData(
1397 int gridID, const vtkStructuredNeighbor& Neighbor)
1398{
1399 // Sanity check
1400 assert("pre: gridID is out-of-bounds!" && (gridID >= 0) &&
1401 (gridID < static_cast<int>(this->NumberOfGrids)));
1402 assert("pre: Neighbor gridID is out-of-bounds!" && (Neighbor.NeighborID >= 0) &&
1403 (Neighbor.NeighborID < static_cast<int>(this->NumberOfGrids)));
1404
1405 // STEP 0: Get ghosted grid (node) extent and corresponding cell extent
1406 int GhostedGridExtent[6];
1407 this->GetGhostedGridExtent(gridID, GhostedGridExtent);
1408 int GhostedGridCellExtent[6];
1409 vtkStructuredData::GetCellExtentFromPointExtent(GhostedGridExtent, GhostedGridCellExtent);
1410
1411 // STEP 1: Get the neighbor (node) extent and corresponding cell extent
1412 int NeighborExtent[6];
1413 this->GetGridExtent(Neighbor.NeighborID, NeighborExtent);
1414 int NeighborCellExtent[6];
1415 vtkStructuredData::GetCellExtentFromPointExtent(NeighborExtent, NeighborCellExtent);
1416
1417 int RcvCellExtent[6];
1418 vtkStructuredData::GetCellExtentFromPointExtent(
1419 const_cast<int*>(Neighbor.RcvExtent), RcvCellExtent);
1420
1421 // STEP 3: Transfer the RcvExtent to the grid from the Neighbor
1422 int ijk[3];
1423 for (int i = Neighbor.RcvExtent[0]; i <= Neighbor.RcvExtent[1]; ++i)
1424 {
1425 for (int j = Neighbor.RcvExtent[2]; j <= Neighbor.RcvExtent[3]; ++j)
1426 {
1427 for (int k = Neighbor.RcvExtent[4]; k <= Neighbor.RcvExtent[5]; ++k)
1428 {
1429 // Sanity check!
1430 assert("pre: RcvExtent is outside the GhostExtent!" &&
1431 this->IsNodeWithinExtent(i, j, k, GhostedGridExtent));
1432 assert("pre: RcvExtent is outside the NeighborExtent" &&
1433 this->IsNodeWithinExtent(i, j, k, NeighborExtent));
1434
1435 ijk[0] = i;
1436 ijk[1] = j;
1437 ijk[2] = k;
1438
1439 // Compute the source index to the registered neighbor data
1440 vtkIdType srcIdx =
1441 vtkStructuredData::ComputePointIdForExtent(NeighborExtent, ijk, this->DataDescription);
1442
1443 // Compute the target index into the ghosted data
1444 vtkIdType targetIdx =
1445 vtkStructuredData::ComputePointIdForExtent(GhostedGridExtent, ijk, this->DataDescription);
1446
1447 if (this->GridPoints[Neighbor.NeighborID] != nullptr)
1448 {
1449 this->CopyCoordinates(this->GridPoints[Neighbor.NeighborID], srcIdx,
1450 this->GhostedGridPoints[gridID], targetIdx);
1451 } // END if this
1452
1453 // Transfer node data from the registered grid to the ghosted grid

Calls 6

GetGhostedGridExtentMethod · 0.95
GetGridExtentMethod · 0.95
CopyCoordinatesMethod · 0.95
CopyFieldDataMethod · 0.95
IsNodeWithinExtentMethod · 0.80
assertFunction · 0.50

Tested by

no test coverage detected