Skip to content

Remove neighbour duplication#87

Open
TomMelt wants to merge 2 commits into
mainfrom
remove-neighbour-duplication
Open

Remove neighbour duplication#87
TomMelt wants to merge 2 commits into
mainfrom
remove-neighbour-duplication

Conversation

@TomMelt

@TomMelt TomMelt commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Unify periodic and non-periodic neighbour info

Closes #84

Summary

Merged periodic neighbour tracking into the same data structures used for non-periodic neighbours. Since a neighbour cannot be both periodic and non-periodic at the same time, separate _p suffixed maps were redundant.

Changes

  • Partitioner.cpp — removed getNeighbourInfoPeriodic() and merged all periodic neighbour data (halo sizes, send/recv buffer positions, corner neighbours) into the existing _neighbours, _sendPos, _recvPos, _cornerNeighbours, and _cornerSendPos maps.
  • Partitioner.hpp — removed _neighbours_p, _sendPos_p, _recvPos_p, _cornerNeighbours_p, _cornerSendPos_p member variables and the periodic overload of getNeighbourInfoPeriodic().
  • saveMetadata() — removed periodic dimension declarations and periodic variable writes from the NetCDF output.
  • Refactor saveMetadata — replace duplicated edge/corner loops with a templated compute_dims() function; introduce DimInfo struct to group neighbour dimension data; use lambda helpers (def_dim, write_array, write_scalar) to reduce repetitive nc_* calls

Tests

Updated all reference CDL files to match the unified neighbour output (periodic neighbour IDs now appear in the standard (non-periodic) fields)

TODO

  • check halo exchange tests in nextsim still work after changing decomp

@TomMelt TomMelt self-assigned this Jun 19, 2026
@TomMelt TomMelt added the ICCS label Jun 19, 2026
@TomMelt TomMelt marked this pull request as draft June 19, 2026 13:27
Previously, neighbours across periodic boundaries were tracked in
separate data structures (_neighbours_p, _sendPos_p, _recvPos_p,
_cornerNeighbours_p, _cornerSendPos_p) with a dedicated
getNeighbourInfoPeriodic() method and separate NetCDF output paths.

This change merges periodic neighbour info into the same maps used
for non-periodic neighbours, removing redundant code and data structures:

- Removed getNeighbourInfoPeriodic() entirely
- Removed periodic dimension/variable definitions from saveMetadata()
- Removed periodic data writes from saveMetadata()
- Consolidated periodic and regular neighbours into _neighbours,
  _sendPos, _recvPos, _cornerNeighbours, _cornerSendPos
@TomMelt TomMelt force-pushed the remove-neighbour-duplication branch from d7ac15e to 8a28401 Compare June 22, 2026 15:19
…bdas

- Replace duplicated edge/corner loop logic with templated compute_dims()
- Introduce DimInfo struct to group neighbour dimension data
- Add lambda helpers (def_dim, write_array, write_scalar) to reduce
  repetitive nc_* calls
@TomMelt TomMelt force-pushed the remove-neighbour-duplication branch from 8a28401 to b154a94 Compare June 22, 2026 15:31
@TomMelt TomMelt moved this to Review required in neXtSIM_DG overview Jun 23, 2026
@TomMelt TomMelt marked this pull request as ready for review June 23, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Review required

Development

Successfully merging this pull request may close these issues.

reduce duplication for periodic neighbours in domain_decomp

1 participant