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

Method SetMergeGhostGrid

Filters/ParallelGeometry/vtkPDistributedDataFilter.cxx:4172–4257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4170// Delete all grids except the new merged grid.
4171
4172vtkUnstructuredGrid* vtkPDistributedDataFilter::SetMergeGhostGrid(
4173 vtkUnstructuredGrid* ghostCellGrid, vtkUnstructuredGrid* incomingGhostCells, int ghostLevel,
4174 vtkPDistributedDataFilterSTLCloak* idMap)
4175
4176{
4177 TimeLog timer("SetMergeGhostGrid", this->Timing);
4178 (void)timer;
4179
4180 int i;
4181
4182 if (incomingGhostCells->GetNumberOfCells() < 1)
4183 {
4184 if (incomingGhostCells != nullptr)
4185 {
4186 incomingGhostCells->Delete();
4187 }
4188 return ghostCellGrid;
4189 }
4190
4191 // Set the ghost level of all new cells, and set the ghost level of all
4192 // the points. We know some points in the new grids actually have ghost
4193 // level one lower, because they were on the boundary of the previous
4194 // grid. This is OK if ghostLevel is > 1. When we merge, vtkMergeCells
4195 // will skip these points because they are already in the previous grid.
4196 // But if ghostLevel is 1, those boundary points were in our original
4197 // grid, and we need to use the global ID map to determine if the
4198 // point ghost levels should be set to 0.
4199
4200 vtkUnsignedCharArray* cellGL = incomingGhostCells->GetCellGhostArray();
4201 vtkUnsignedCharArray* ptGL = incomingGhostCells->GetPointGhostArray();
4202
4203 unsigned char* ia = cellGL->GetPointer(0);
4204
4205 for (i = 0; i < incomingGhostCells->GetNumberOfCells(); i++)
4206 {
4207 ia[i] = (unsigned char)ghostLevel;
4208 }
4209
4210 ia = ptGL->GetPointer(0);
4211
4212 for (i = 0; i < incomingGhostCells->GetNumberOfPoints(); i++)
4213 {
4214 ia[i] = (unsigned char)ghostLevel;
4215 }
4216
4217 // now merge
4218
4219 vtkUnstructuredGrid* mergedGrid = incomingGhostCells;
4220
4221 if (ghostCellGrid && (ghostCellGrid->GetNumberOfCells() > 0))
4222 {
4223 vtkDataSet* sets[2];
4224
4225 sets[0] = ghostCellGrid; // both sets will be deleted by MergeGrids
4226 sets[1] = incomingGhostCells;
4227
4228 int useGlobalNodeIds = (this->GetGlobalNodeIds(ghostCellGrid) ? 1 : 0);
4229 mergedGrid =

Calls 10

GetGlobalNodeIdsMethod · 0.95
GetCellGhostArrayMethod · 0.80
GetPointGhostArrayMethod · 0.80
DeleteMethod · 0.65
GetNumberOfCellsMethod · 0.45
GetPointerMethod · 0.45
GetNumberOfPointsMethod · 0.45
findMethod · 0.45
endMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected