Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix addition of DerivativeCoefficientRows with different Start values #260

Merged
merged 5 commits into from Apr 5, 2024

Conversation

Dougal-s
Copy link
Contributor

@Dougal-s Dougal-s commented Apr 1, 2024

Adding together two DerivativeCoefficientRow variables with different Start values throws a bounds error.
For example,

import SummationByPartsOperators
row1 = SummationByPartsOperators.DerivativeCoefficientRow{Int, 0, 3}([1,2,3])
row2 = SummationByPartsOperators.DerivativeCoefficientRow{Int, 1, 3}([1,2,3])
row1 + row2

results in

ERROR: BoundsError: attempt to access NTuple{4, Int64} at index [0]
Stacktrace:
 [1] getindex
   @ ./tuple.jl:31 [inlined]
 [2] getindex
   @ ~/.julia/packages/StaticArrays/EHHaF/src/SArray.jl:62 [inlined]
 [3] +(coef_row1::SummationByPartsOperators.DerivativeCoefficientRow{Int64, 0, 3}, coef_row2::SummationByPartsOperators.DerivativeCoefficientRow{Int64, 1, 3})
   @ SummationByPartsOperators ~/.julia/packages/SummationByPartsOperators/DBpfT/src/SBP_operators.jl:149
 [4] top-level scope
   @ REPL[4]:1

After applying the fix, it returns

SummationByPartsOperators.DerivativeCoefficientRow{Int64, 0, 4}([1, 3, 5, 3])

Copy link
Owner

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this. Could you please add some unit tests as well to keep track of this?

@Dougal-s
Copy link
Contributor Author

Dougal-s commented Apr 3, 2024

Sure thing! I wasn't sure where to put the unit tests, so I added them to the end of linear_combinations_of_operators_test.jl. Should I put them into a separate file instead?

Copy link
Owner

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@ranocha
Copy link
Owner

ranocha commented Apr 3, 2024

Sure thing! I wasn't sure where to put the unit tests, so I added them to the end of linear_combinations_of_operators_test.jl. Should I put them into a separate file instead?

A new file would be fine 👍

Copy link

codecov bot commented Apr 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.70%. Comparing base (b98874b) to head (5178458).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #260   +/-   ##
=======================================
  Coverage   90.70%   90.70%           
=======================================
  Files          33       33           
  Lines        5112     5112           
=======================================
  Hits         4637     4637           
  Misses        475      475           
Flag Coverage Δ
unittests 90.70% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coveralls
Copy link

coveralls commented Apr 3, 2024

Coverage Status

coverage: 91.609%. remained the same
when pulling 5178458 on Dougal-s:main
into b98874b on ranocha:main.

@ranocha ranocha enabled auto-merge (squash) April 5, 2024 06:11
@ranocha ranocha disabled auto-merge April 5, 2024 06:16
@ranocha ranocha enabled auto-merge (squash) April 5, 2024 06:16
@ranocha ranocha merged commit 497f972 into ranocha:main Apr 5, 2024
21 checks passed
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.

None yet

3 participants