------------------------------------------------------------------------------
| 194 | |
| 195 | //------------------------------------------------------------------------------ |
| 196 | void vtkHyperTreeGridGeometry3DImpl::GenerateCellSurface( |
| 197 | vtkHyperTreeGridNonOrientedVonNeumannSuperCursor* cursor, |
| 198 | unsigned char vtkNotUsed(coarseCellFacesToBeTreated), vtkIdType cellId) |
| 199 | { |
| 200 | // Determine if the current cell contains an interface and |
| 201 | // fill the related member variables accordingly |
| 202 | this->ProbeForCellInterface(cellId); |
| 203 | |
| 204 | // Retrieve info about the current cell |
| 205 | unsigned level = cursor->GetLevel(); |
| 206 | bool masked = cursor->IsMasked(); |
| 207 | const double* cellOrigin = cursor->GetOrigin(); |
| 208 | const double* cellSize = cursor->GetSize(); |
| 209 | |
| 210 | std::vector<HTG3DPoint> cellPoints; |
| 211 | cellPoints.resize(NUMBER_OF_POINTS); |
| 212 | std::vector<std::pair<HTG3DPoint, HTG3DPoint>> edgePoints; |
| 213 | edgePoints.resize(NUMBER_OF_EDGES + MAX_NUMBER_OF_INTERFACE_EDGES); |
| 214 | |
| 215 | std::map<unsigned int, std::pair<HTG3DPoint*, unsigned int>> internalFaceA; |
| 216 | std::map<unsigned int, std::pair<HTG3DPoint*, unsigned int>> internalFaceB; |
| 217 | |
| 218 | // Iterate over all neighboring cells using the Von Neumann neighborhood |
| 219 | for (unsigned int faceId = 0; faceId < 6; ++faceId) |
| 220 | { |
| 221 | const unsigned int& neighborId = ::VON_NEUMANN_NEIGH_ID[faceId]; |
| 222 | const unsigned int& faceOrientation = ::FACE_ORIENTATION[faceId]; |
| 223 | const unsigned int& faceOffset = ::FACE_OFFSET[faceId]; |
| 224 | |
| 225 | // Retrieve cursor to neighbor across face |
| 226 | // Retrieve tree, leaf flag, and mask of neighbor cursor |
| 227 | bool leafN = false; |
| 228 | vtkIdType neighborCellId = 0; |
| 229 | unsigned int levelN = 0; |
| 230 | vtkHyperTree* treeN = cursor->GetInformation(neighborId, levelN, leafN, neighborCellId); |
| 231 | int maskedN = cursor->IsMasked(neighborId); |
| 232 | bool hasInterfaceCellN = this->GetHasInterface(cursor->GetGlobalNodeIndex(neighborId)); |
| 233 | |
| 234 | // We generate a face if one of the following conditions are fulfilled: |
| 235 | // - The current cell is unmasked, and the neighboring cell is masked |
| 236 | // - The current cell is unmasked, and has no neighbouring cell |
| 237 | // - The current cell is unmasked, and has an interface |
| 238 | // - The current cell is unmasked, and has the neighboring cell has an interface |
| 239 | // - The current cell is masked, and has a neighbor that is a non-masked leaf of lower level |
| 240 | // This ensures that faces between unmasked and masked cells will be generated once and only |
| 241 | // once. |
| 242 | if ((!masked && (!treeN || maskedN || this->HasInterfaceOnThisCell || hasInterfaceCellN)) || |
| 243 | (masked && treeN && leafN && levelN < level && !maskedN)) |
| 244 | { |
| 245 | // Generate face with corresponding normal and offset |
| 246 | // Here we differentiate the case where the current cell is masked. |
| 247 | // In that case, we must copy the data from the neighboring cell to the created face, |
| 248 | // and not from the current cell. |
| 249 | this->GenerateOneCellFace(cellPoints, edgePoints, faceId, (masked ? neighborCellId : cellId), |
| 250 | cellOrigin, cellSize, faceOffset, faceOrientation, internalFaceA, internalFaceB); |
| 251 | } |
| 252 | } |
| 253 |
no test coverage detected