Skip to content

Fix Halo constructor for DGVectorHolder#1065

Merged
TomMelt merged 1 commit into
developfrom
fix-halo-constructor-dgvh
Mar 23, 2026
Merged

Fix Halo constructor for DGVectorHolder#1065
TomMelt merged 1 commit into
developfrom
fix-halo-constructor-dgvh

Conversation

@TomMelt
Copy link
Copy Markdown
Contributor

@TomMelt TomMelt commented Mar 16, 2026

Fix Halo constructor for DGVectorHolder

Fixes #1064

Task List

  • Linked an issue above that captures the requirements of this PR
  • Defined the tests that specify a complete and functioning change
  • Implemented the source code change that satisfies the tests
  • Commented all code so that it can be understood without additional context
  • No new warnings are generated or they are mentioned below
  • The documentation has been updated (or an issue has been created to do so)
  • Relevant labels (e.g., enhancement, bug) have been applied to this PR
  • This change conforms to the conventions described in the README

Change Description

After simplifying #1005 I accidentally introduced a bug by making the DGVectorHolder constructor directly call the DGVector one i.e.,

template <int N> Halo(DGVectorHolder<N>& dgvh) { Halo(static_cast<DGVector<N>&>(dgvh)); }

This is incorrect and leads to a segmentation fault.

I have now modified the constructor to use the Member Initializer List, which will ensure the object is stored correctly

template <int N>
Halo(DGVectorHolder<N>& dgvh)
: Halo(static_cast<DGVector<N>&>(dgvh))
{
}

I added a test to check it works correctly, and I have fixed a small typo in the naming of initializeHaloMetadata (which was intializeHaloMetadata before)


Test Description

I added MPI_TEST_CASE("DGVectorHolder", 3) to HaloExchangeCB_test.cpp to check that halo exchange works correctly for DGVectorHolder

@TomMelt TomMelt self-assigned this Mar 16, 2026
@TomMelt TomMelt added the ICCS Tasks or reviews for the ICCS team label Mar 16, 2026
Copy link
Copy Markdown
Contributor

@joewallwork joewallwork left a comment

Choose a reason for hiding this comment

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

Ah yes, easy mistakes to make. Thanks for the fixes @TomMelt.

@TomMelt TomMelt merged commit f53d8c6 into develop Mar 23, 2026
9 checks passed
@TomMelt TomMelt deleted the fix-halo-constructor-dgvh branch March 23, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ICCS Tasks or reviews for the ICCS team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segmentation fault when trying to exchange DGVectorHolders

2 participants