Skip to content

Use standard sort via zip instead of custom sort for multiple items#1106

Merged
riclarsson merged 1 commit intoatmtools:mainfrom
riclarsson:use-zip-sort-instead-of-custom
Mar 9, 2026
Merged

Use standard sort via zip instead of custom sort for multiple items#1106
riclarsson merged 1 commit intoatmtools:mainfrom
riclarsson:use-zip-sort-instead-of-custom

Conversation

@riclarsson
Copy link
Contributor

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes several multi-array sorting sites by replacing the removed custom bubble_sort_by helper with std::ranges::sort over std::views::zip, keeping related containers permuted consistently while using standard library algorithms.

Changes:

  • Replaced bubble_sort_by calls with std::ranges::sort(std::views::zip(...), ...) in multiple call sites to sort multiple correlated sequences together.
  • Removed the unused bubble_sort_by implementation and related concepts from src/core/util/sorting.h.
  • Updated includes/formatting where needed to support the new ranges-based sorting.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/workspace_meta_methods.cpp Sorts meta-method generic input vectors together via zipped ranges sort.
src/python_interface/py_disort.cpp Sorts tau_ alongside an index vector using zipped ranges sort.
src/m_lbl.cc Sorts equivalent value/string tensors together via zipped ranges sort.
src/core/util/sorting.h Removes the custom bubble_sort_by utility (no remaining usages found).
src/core/lbl/lbl_lineshape_voigt_nlte.cpp Sorts lines and pos together via zipped ranges sort.
src/core/lbl/lbl_lineshape_voigt_lte_mirrored.cpp Same zipped sort refactor for mirrored LTE implementation (plus include tweak).
src/core/lbl/lbl_lineshape_voigt_lte.cpp Same zipped sort refactor for LTE implementation.
src/core/lbl/lbl_lineshape_voigt_ecs.cpp Replaces multi-vector bubble sort with zipped ranges sort for ECS pre-sorting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@riclarsson riclarsson merged commit 13f8368 into atmtools:main Mar 9, 2026
13 checks passed
@riclarsson riclarsson deleted the use-zip-sort-instead-of-custom branch March 9, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants