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

Method CreateGhostedMaskArrays

Filters/Geometry/vtkStructuredGridConnectivity.cxx:1052–1160  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1050
1051//------------------------------------------------------------------------------
1052void vtkStructuredGridConnectivity::CreateGhostedMaskArrays(int gridID)
1053{
1054 // Sanity check
1055 assert("pre: gridID is out-of-bounds!" && (gridID >= 0) &&
1056 (gridID < static_cast<int>(this->NumberOfGrids)));
1057 assert("pre: GhostedPointGhostArray has not been allocated" &&
1058 (this->NumberOfGrids == this->GhostedPointGhostArray.size()));
1059 assert("pre: GhostedCellGhostArray has not been allocated" &&
1060 (this->NumberOfGrids == this->GhostedCellGhostArray.size()));
1061
1062 // STEP 0: Initialize the ghosted node and cell arrays
1063 if (this->GhostedPointGhostArray[gridID] == nullptr)
1064 {
1065 this->GhostedPointGhostArray[gridID] = vtkUnsignedCharArray::New();
1066 }
1067 else
1068 {
1069 this->GhostedPointGhostArray[gridID]->Reset();
1070 }
1071
1072 if (this->GhostedCellGhostArray[gridID] == nullptr)
1073 {
1074 this->GhostedCellGhostArray[gridID] = vtkUnsignedCharArray::New();
1075 }
1076 else
1077 {
1078 this->GhostedCellGhostArray[gridID]->Reset();
1079 }
1080
1081 // STEP 1: Get the ghosted extent
1082 int ghostedExtent[6];
1083 this->GetGhostedGridExtent(gridID, ghostedExtent);
1084
1085 // STEP 2: Get the grid extent
1086 int gridExtent[6];
1087 this->GetGridExtent(gridID, gridExtent);
1088
1089 int numNodes = vtkStructuredData::GetNumberOfPoints(ghostedExtent, this->DataDescription);
1090
1091 int numCells = vtkStructuredData::GetNumberOfCells(ghostedExtent, this->DataDescription);
1092
1093 // STEP 3: Allocated the ghosted node and cell arrays and initialize them
1094 this->GhostedPointGhostArray[gridID]->Allocate(numNodes);
1095 this->GhostedCellGhostArray[gridID]->Allocate(numCells);
1096
1097 // Initialize the arrays
1098 unsigned char* pnodes = this->GhostedPointGhostArray[gridID]->WritePointer(0, numNodes);
1099 memset(pnodes, 0, numNodes);
1100 unsigned char* pcells = this->GhostedCellGhostArray[gridID]->WritePointer(0, numCells);
1101 memset(pcells, 0, numCells);
1102
1103 // STEP 4: Loop through the ghosted extent and mark the nodes in the ghosted
1104 // extent accordingly. If the node exists in the grown extent
1105 int ijk[3];
1106 unsigned char p = 0;
1107 for (int i = ghostedExtent[0]; i <= ghostedExtent[1]; ++i)
1108 {
1109 for (int j = ghostedExtent[2]; j <= ghostedExtent[3]; ++j)

Callers 2

CreateGhostLayersMethod · 0.95
CreateGhostLayersMethod · 0.45

Calls 15

GetGhostedGridExtentMethod · 0.95
GetGridExtentMethod · 0.95
IsNodeOnBoundaryMethod · 0.95
FillCellsGhostArrayMethod · 0.95
GetDataDimensionFunction · 0.85
IsNodeWithinExtentMethod · 0.80
assertFunction · 0.50
NewFunction · 0.50
GetNumberOfPointsFunction · 0.50
GetNumberOfCellsFunction · 0.50
sizeMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected