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

Method InitializeGhostData

Filters/Geometry/vtkStructuredGridConnectivity.cxx:1207–1248  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1205
1206//------------------------------------------------------------------------------
1207void vtkStructuredGridConnectivity::InitializeGhostData(int gridID)
1208{
1209 // Sanity check
1210 assert("pre: gridID is out-of-bounds!" && (gridID >= 0) &&
1211 (gridID < static_cast<int>(this->NumberOfGrids)));
1212 assert("pre: GhostedPointData vector has not been properly allocated!" &&
1213 (this->NumberOfGrids == this->GhostedGridPointData.size()));
1214 assert("pre: GhostedCellData vector has not been properly allocated!" &&
1215 (this->NumberOfGrids == this->GhostedGridCellData.size()));
1216 assert("pre: Grid has no registered point data!" && (this->GridPointData[gridID] != nullptr));
1217 assert("pre: Grid has no registered cell data!" && (this->GridCellData[gridID] != nullptr));
1218
1219 // STEP 0: Get the ghosted grid extent
1220 int GhostedGridExtent[6];
1221 this->GetGhostedGridExtent(gridID, GhostedGridExtent);
1222
1223 // STEP 1: Get the number of nodes/cells in the ghosted extent
1224 int numNodes = vtkStructuredData::GetNumberOfPoints(GhostedGridExtent, this->DataDescription);
1225 int numCells = vtkStructuredData::GetNumberOfCells(GhostedGridExtent, this->DataDescription);
1226
1227 // STEP 2: Allocate coordinates if the grid
1228 if (this->GridPoints[gridID] != nullptr)
1229 {
1230
1231 if (this->GhostedGridPoints[gridID] != nullptr)
1232 {
1233 this->GhostedGridPoints[gridID]->Delete();
1234 }
1235
1236 this->GhostedGridPoints[gridID] = vtkPoints::New();
1237 this->GhostedGridPoints[gridID]->SetDataTypeToDouble();
1238 this->GhostedGridPoints[gridID]->SetNumberOfPoints(numNodes);
1239 }
1240
1241 // STEP 3: Allocate point & cell data
1242 this->GhostedGridPointData[gridID] = vtkPointData::New();
1243 this->GhostedGridCellData[gridID] = vtkCellData::New();
1244
1245 this->AllocatePointData(
1246 this->GridPointData[gridID], numNodes, this->GhostedGridPointData[gridID]);
1247 this->AllocateCellData(this->GridCellData[gridID], numCells, this->GhostedGridCellData[gridID]);
1248}
1249
1250//------------------------------------------------------------------------------
1251void vtkStructuredGridConnectivity::CopyCoordinates(

Callers 2

CreateGhostLayersMethod · 0.95
CreateGhostLayersMethod · 0.45

Calls 10

GetGhostedGridExtentMethod · 0.95
AllocatePointDataMethod · 0.95
AllocateCellDataMethod · 0.95
DeleteMethod · 0.65
assertFunction · 0.50
GetNumberOfPointsFunction · 0.50
GetNumberOfCellsFunction · 0.50
NewFunction · 0.50
sizeMethod · 0.45
SetNumberOfPointsMethod · 0.45

Tested by

no test coverage detected