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

Method FillCellsGhostArray

Filters/Geometry/vtkStructuredGridConnectivity.cxx:402–450  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

400
401//------------------------------------------------------------------------------
402void vtkStructuredGridConnectivity::FillCellsGhostArray(int dataDescription, int numNodesPerCell,
403 int dims[3], int CellExtent[6], vtkUnsignedCharArray* nodesArray,
404 vtkUnsignedCharArray* cellsArray)
405{
406 assert("pre: nodes array should not be nullptr" && (nodesArray != nullptr));
407
408 if (cellsArray == nullptr)
409 {
410 return;
411 }
412
413 vtkIdList* cellNodeIds = vtkIdList::New();
414 unsigned char* cellNodeGhostFields = new unsigned char[numNodesPerCell];
415
416 int ijk[3];
417 for (int i = CellExtent[0]; i <= CellExtent[1]; ++i)
418 {
419 for (int j = CellExtent[2]; j <= CellExtent[3]; ++j)
420 {
421 for (int k = CellExtent[4]; k <= CellExtent[5]; ++k)
422 {
423 ijk[0] = i;
424 ijk[1] = j;
425 ijk[2] = k;
426
427 // Note: this is really a cell index, since it is computed from the
428 // cell extent
429 vtkIdType idx =
430 vtkStructuredData::ComputePointIdForExtent(CellExtent, ijk, dataDescription);
431
432 cellNodeIds->Reset();
433 vtkStructuredData::GetCellPoints(idx, cellNodeIds, dataDescription, dims);
434 assert(cellNodeIds->GetNumberOfIds() == numNodesPerCell);
435 assert(cellNodeGhostFields != nullptr);
436
437 for (int ii = 0; ii < numNodesPerCell; ++ii)
438 {
439 vtkIdType nodeIdx = cellNodeIds->GetId(ii);
440 cellNodeGhostFields[ii] = *nodesArray->GetPointer(nodeIdx);
441 } // END for all nodes
442
443 this->MarkCellProperty(*cellsArray->GetPointer(idx), cellNodeGhostFields, numNodesPerCell);
444 } // END for all cells along k
445 } // END for all cells along j
446 } // END for all cells along i
447
448 delete[] cellNodeGhostFields;
449 cellNodeIds->Delete();
450}
451
452//------------------------------------------------------------------------------
453void vtkStructuredGridConnectivity::FillGhostArrays(

Callers 2

FillGhostArraysMethod · 0.95

Calls 9

MarkCellPropertyMethod · 0.95
DeleteMethod · 0.65
assertFunction · 0.50
NewFunction · 0.50
GetCellPointsFunction · 0.50
ResetMethod · 0.45
GetNumberOfIdsMethod · 0.45
GetIdMethod · 0.45
GetPointerMethod · 0.45

Tested by

no test coverage detected