------------------------------------------------------------------------------
| 962 | |
| 963 | //------------------------------------------------------------------------------ |
| 964 | void vtkStructuredAMRGridConnectivity::CreateGhostedMaskArrays(int gridID) |
| 965 | { |
| 966 | assert("pre: gridID is out-of-bounds!" && (gridID >= 0) && |
| 967 | (gridID < static_cast<int>(this->NumberOfGrids))); |
| 968 | assert("pre: GhostedPointGhostArray has not been allocated" && |
| 969 | (this->NumberOfGrids == this->GhostedPointGhostArray.size())); |
| 970 | assert("pre: GhostedCellGhostArray has not been allocated" && |
| 971 | (this->NumberOfGrids == this->GhostedCellGhostArray.size())); |
| 972 | |
| 973 | // STEP 0: Initialize ghosted node and cell arrays |
| 974 | if (this->GhostedPointGhostArray[gridID] == nullptr) |
| 975 | { |
| 976 | this->GhostedPointGhostArray[gridID] = vtkUnsignedCharArray::New(); |
| 977 | } |
| 978 | else |
| 979 | { |
| 980 | this->GhostedPointGhostArray[gridID]->Reset(); |
| 981 | } |
| 982 | |
| 983 | if (this->GhostedCellGhostArray[gridID] == nullptr) |
| 984 | { |
| 985 | this->GhostedCellGhostArray[gridID] = vtkUnsignedCharArray::New(); |
| 986 | } |
| 987 | else |
| 988 | { |
| 989 | this->GhostedCellGhostArray[gridID]->Reset(); |
| 990 | } |
| 991 | |
| 992 | // STEP 1: Get the ghosted extent |
| 993 | int ghostExtent[6]; |
| 994 | this->GetGhostedExtent(gridID, ghostExtent); |
| 995 | |
| 996 | // STEP 2: Compute numNodes/numCells on the ghosted grid |
| 997 | int numNodes = vtkStructuredData::GetNumberOfPoints(ghostExtent, this->DataDescription); |
| 998 | int numCells = vtkStructuredData::GetNumberOfCells(ghostExtent, this->DataDescription); |
| 999 | |
| 1000 | // STEP 3: Allocate the ghosted node and cell arrays |
| 1001 | this->GhostedPointGhostArray[gridID]->Allocate(numNodes); |
| 1002 | this->GhostedCellGhostArray[gridID]->Allocate(numCells); |
| 1003 | |
| 1004 | // STEP 4: Get the registered extent of the grid |
| 1005 | int registeredGridExtent[6]; |
| 1006 | this->GetGridExtent(gridID, registeredGridExtent); |
| 1007 | |
| 1008 | // STEP 5: Get normalized whole extent w.r.t. the level of this grid |
| 1009 | int normalizedWholeExt[6]; |
| 1010 | this->GetWholeExtentAtLevel(this->GetGridLevel(gridID), normalizedWholeExt); |
| 1011 | |
| 1012 | // STEP 6: Fill ghosted points ghost array |
| 1013 | int ijk[3]; |
| 1014 | for (int i = IMIN(ghostExtent); i <= IMAX(ghostExtent); ++i) |
| 1015 | { |
| 1016 | for (int j = JMIN(ghostExtent); j <= JMAX(ghostExtent); ++j) |
| 1017 | { |
| 1018 | for (int k = KMIN(ghostExtent); k <= KMAX(ghostExtent); ++k) |
| 1019 | { |
| 1020 | ijk[0] = i; |
| 1021 | ijk[1] = j; |
no test coverage detected