| 337 | #endif |
| 338 | |
| 339 | void seissol::initializer::MemoryManager::initializeFaceNeighbors( unsigned cluster, |
| 340 | Layer& layer ) |
| 341 | { |
| 342 | #ifdef USE_MPI |
| 343 | assert(layer.getLayerType() == Copy || layer.getLayerType() == Interior); |
| 344 | #else |
| 345 | assert(layer.getLayerType() == Interior); |
| 346 | #endif |
| 347 | |
| 348 | // iterate over clusters |
| 349 | |
| 350 | real** buffers = m_ltsTree.var(m_lts.buffers); // faceNeighborIds are ltsIds and not layer-local |
| 351 | real** derivatives = m_ltsTree.var(m_lts.derivatives); // faceNeighborIds are ltsIds and not layer-local |
| 352 | real *(*faceNeighbors)[4] = layer.var(m_lts.faceNeighbors); |
| 353 | #ifdef ACL_DEVICE |
| 354 | real** buffersDevice = m_ltsTree.var(m_lts.buffersDevice); // faceNeighborIds are ltsIds and not layer-local |
| 355 | real** derivativesDevice = m_ltsTree.var(m_lts.derivativesDevice); // faceNeighborIds are ltsIds and not layer-local |
| 356 | real *(*faceNeighborsDevice)[4] = layer.var(m_lts.faceNeighborsDevice); |
| 357 | #endif |
| 358 | CellLocalInformation* cellInformation = layer.var(m_lts.cellInformation); |
| 359 | |
| 360 | for (unsigned cell = 0; cell < layer.getNumberOfCells(); ++cell) { |
| 361 | for (unsigned face = 0; face < 4; ++face) { |
| 362 | if (cellInformation[cell].faceTypes[face] == FaceType::Regular || |
| 363 | cellInformation[cell].faceTypes[face] == FaceType::Periodic || |
| 364 | cellInformation[cell].faceTypes[face] == FaceType::DynamicRupture) { |
| 365 | // neighboring cell provides derivatives |
| 366 | if( (cellInformation[cell].ltsSetup >> face) % 2 ) { |
| 367 | faceNeighbors[cell][face] = derivatives[ cellInformation[cell].faceNeighborIds[face] ]; |
| 368 | #ifdef ACL_DEVICE |
| 369 | faceNeighborsDevice[cell][face] = derivativesDevice[ cellInformation[cell].faceNeighborIds[face] ]; |
| 370 | #endif |
| 371 | } |
| 372 | // neighboring cell provides a time buffer |
| 373 | else { |
| 374 | faceNeighbors[cell][face] = buffers[ cellInformation[cell].faceNeighborIds[face] ]; |
| 375 | #ifdef ACL_DEVICE |
| 376 | faceNeighborsDevice[cell][face] = buffersDevice[ cellInformation[cell].faceNeighborIds[face] ]; |
| 377 | #endif |
| 378 | } |
| 379 | assert(faceNeighbors[cell][face] != nullptr); |
| 380 | } |
| 381 | // boundaries using local cells |
| 382 | else if (cellInformation[cell].faceTypes[face] == FaceType::FreeSurface || |
| 383 | cellInformation[cell].faceTypes[face] == FaceType::FreeSurfaceGravity || |
| 384 | cellInformation[cell].faceTypes[face] == FaceType::Dirichlet || |
| 385 | cellInformation[cell].faceTypes[face] == FaceType::Analytical) { |
| 386 | if( (cellInformation[cell].ltsSetup >> face) % 2 == 0 ) { // free surface on buffers |
| 387 | faceNeighbors[cell][face] = layer.var(m_lts.buffers)[cell]; |
| 388 | #ifdef ACL_DEVICE |
| 389 | faceNeighborsDevice[cell][face] = layer.var(m_lts.buffersDevice)[cell]; |
| 390 | #endif |
| 391 | } |
| 392 | else { // free surface on derivatives |
| 393 | faceNeighbors[cell][face] = layer.var(m_lts.derivatives)[cell]; |
| 394 | #ifdef ACL_DEVICE |
| 395 | faceNeighborsDevice[cell][face] = layer.var(m_lts.derivativesDevice)[cell]; |
| 396 | #endif |
nothing calls this directly
no test coverage detected