Skip to content

Tr/minor fixes - #2347

Merged
imreddyTeja merged 1 commit into
mainfrom
tr/minor-fixes
Jun 27, 2025
Merged

Tr/minor fixes#2347
imreddyTeja merged 1 commit into
mainfrom
tr/minor-fixes

Conversation

@imreddyTeja

@imreddyTeja imreddyTeja commented Jun 13, 2025

Copy link
Copy Markdown
Member

This PR addresses three issues:

  1. An incorrect error message is shown when field2array is called with incompatible elements.
  2. For face fields, the level function does not throw BoundsErrors
  3. The indexing behavior for AxisTensors is inconsistent. With any 1d axis tensor vs 2d and 3d.

For the first issue, the message itself is corrected.
For the second issue, tests are added for level(::Field).
The fix for the second issue requires removing an @inbounds, so there may be a performance penalty.

This PR also bumps the UnrolledUtilities compat to v0.1.8. v0.1.7 adds a lot of useful unrolled_functions, including unrolled_findfirst, but the downgrade will throw JET errors unless using v0.1.8

Closes #2337
Closes #2320
Closes #2348

Comment thread src/Spaces/finitedifference.jl Outdated
Comment thread src/Fields/Fields.jl

@dennisYatunin dennisYatunin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd recommend bumping the UnrolledUtilities version to 0.1.9, since that will slightly improve latency compared to 0.1.8. The corrections and new tests in this PR look good to me!

@akshaysridhar

Copy link
Copy Markdown
Member

Thanks @imreddyTeja ! Please squash the commits, then this is ready to be merged.

Bump UnrolledUtilities compat

Fix inconsistent tensor indexing behavior

Fix field2array error message

Add tests for level function on Fields

Also add `issubspace` for `FiniteDifferenceSpaces`

The test currently fails because an error
is not thrown for face spaces when out of
bounds indexing.

remove issubspace

Remove `@inbounds` from `level` function

`level` on a field on cell faces does not throw
errors when attempting to access a level
outside the space. This fixes that, but there
may be a performance penalty.

Simplify AxisTensor idxin function

The previous idxin method for a 1d axis tensor
behaved different that non singlular dimension axistensors.

This commit unifies all the different methods by
using unrolled_findfirst

Bump UnrolledUtilities compat

Simplify level bounds tests

Bump UnrolledUtilities again
@imreddyTeja
imreddyTeja enabled auto-merge (rebase) June 27, 2025 16:55
@imreddyTeja
imreddyTeja disabled auto-merge June 27, 2025 17:46
@imreddyTeja
imreddyTeja merged commit 476c5a9 into main Jun 27, 2025
33 of 35 checks passed
@imreddyTeja
imreddyTeja deleted the tr/minor-fixes branch June 27, 2025 22:02
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.

Inconsistent AxisVector indexing Spaces.nlevels doesn't error for invalid level input arg field2array error statement is inaccurate

4 participants