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

Method FillCellsGhostArray

Filters/Geometry/vtkStructuredAMRGridConnectivity.cxx:1162–1244  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1160
1161//------------------------------------------------------------------------------
1162void vtkStructuredAMRGridConnectivity::FillCellsGhostArray(
1163 int gridId, vtkUnsignedCharArray* cellsArray)
1164{
1165 assert("pre: grid index is out-of-bounds" && (gridId >= 0) &&
1166 (gridId < static_cast<int>(this->NumberOfGrids)));
1167
1168 if (cellsArray == nullptr)
1169 {
1170 return;
1171 }
1172
1173 // STEP 0: Get the node extent & grid data description
1174 int ext[6];
1175 this->GetGridExtent(gridId, ext);
1176 int dataDescription = vtkStructuredData::GetDataDescription(ext);
1177 int numCells = vtkStructuredData::GetNumberOfCells(ext, dataDescription);
1178 if (numCells != cellsArray->GetNumberOfTuples())
1179 {
1180 vtkErrorMacro("CellsArray may not be allocated properly!");
1181 return;
1182 }
1183
1184 // STEP 1: Get the cell extent
1185 int cellext[6];
1186 vtkStructuredData::GetCellExtentFromPointExtent(ext, cellext, dataDescription);
1187
1188 // STEP 2: Mark all cells as internal
1189 unsigned char* ghostArrayPtr = cellsArray->GetPointer(0);
1190 assert("pre: ghost array ptr is nullptr" && (ghostArrayPtr != nullptr));
1191
1192 int ijk[3];
1193 for (int i = IMIN(cellext); i <= IMAX(cellext); ++i)
1194 {
1195 for (int j = JMIN(cellext); j <= JMAX(cellext); ++j)
1196 {
1197 for (int k = KMIN(cellext); k <= KMAX(cellext); ++k)
1198 {
1199 ijk[0] = i;
1200 ijk[1] = j;
1201 ijk[2] = k;
1202
1203 vtkIdType idx = vtkStructuredData::ComputePointIdForExtent(cellext, ijk, dataDescription);
1204 assert("pre: cell index is out-of-bounds!" && (idx < numCells));
1205 ghostArrayPtr[idx] = 0;
1206 } // END for all k
1207 } // END for all j
1208 } // END for all i
1209
1210 // STEP 3: Loop through the neighbors of this grid, and mark all cells that
1211 // are covered by hi-res cells.
1212 int numNeis = static_cast<int>(this->Neighbors[gridId].size());
1213 for (int nei = 0; nei < numNeis; ++nei)
1214 {
1215 int rel = this->Neighbors[gridId][nei].RelationShip;
1216 if ((rel == vtkStructuredAMRNeighbor::CHILD) ||
1217 (rel == vtkStructuredAMRNeighbor::PARTIALLY_OVERLAPPING_CHILD))
1218 {
1219

Callers 1

FillGhostArraysMethod · 0.95

Calls 6

GetGridExtentMethod · 0.95
assertFunction · 0.50
GetNumberOfCellsFunction · 0.50
GetNumberOfTuplesMethod · 0.45
GetPointerMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected