Skip to content

Refactor FieldMatrix indexing, add scalar_field_matrix #2346

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

Merged
merged 2 commits into from
Jul 15, 2025

Conversation

imreddyTeja
Copy link
Member

@imreddyTeja imreddyTeja commented Jun 11, 2025

This PR refactors the internal indexing of FieldMatrix blocks to use a generic recursive implementation, and it defines the scalar_field_matrix function for obtaining views of scalar block components.

  • Code follows the style guidelines OR N/A.
  • Unit tests are included OR N/A.
  • Code is exercised in an integration test OR N/A.
  • Documentation has been added/updated OR N/A.

@imreddyTeja imreddyTeja force-pushed the tr/refactor-fm-internal-index branch from 39ee021 to 14c7eed Compare June 18, 2025 23:20
@imreddyTeja imreddyTeja force-pushed the tr/refactor-fm-internal-index branch 2 times, most recently from c8572ee to 6de72eb Compare July 9, 2025 00:01
Copy link
Member

@dennisYatunin dennisYatunin left a comment

Choose a reason for hiding this comment

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

Thank you for all the new documentation! And the recursive implementations of get_internal_entry and field_offset_and_type are much clearer now.

Couple of minor suggestions for the docs, but overall this is good to merge in. This will be the last change to ClimaCore required for sparse autodiff, so we can make a new release after it's merged.

@imreddyTeja imreddyTeja force-pushed the tr/refactor-fm-internal-index branch 3 times, most recently from ee915f7 to a1a38fb Compare July 14, 2025 16:20
Add scalar_fieldmatrix

Add a function to convert a FieldMatrix where each matrix entry
has an eltype of some struct into a FieldMatrix where each entry
has an eltype of a scalar.

Add additional tests for scalar_matrixfields

Use @test_all in tests

Make suggested changes to tests and field_name_dict.jl

Revert unrolled_findfirst

Clean up field matrix tests and add support for DiagonalMatrixRows

CamelCase struct name

Clean up tests and get_scalar_keys

wip backup

Minimal working with allocs

WIP1

WIP more allocs fix

Assorted cleanup

Fix dx/dx case

reduce code duplication; fix example

Add gpu test

further cleanup, extend diagonalrow

fix names test and comments

Add  docs

docs bugfix

remvoe bad refs

fix docs formatting

WIP Y fields

pre-switch to type space

should work

fix broken tests

bugfix

fix implicit tensor rep tests

WIPP1

working state

Improve readability at cost of concise code

update docs

further cleanup

propgate full key vs keyerror

propogate name_tree

scalar_fielmatrix to scalar_field_matrix
Also add support for tensor slicing and
improved docs

wip

finish docs

minor formatting fix

another minor docs formatting fix

Make suggested docs changes
@imreddyTeja imreddyTeja force-pushed the tr/refactor-fm-internal-index branch from a1a38fb to 633a291 Compare July 15, 2025 16:50
@imreddyTeja imreddyTeja enabled auto-merge (rebase) July 15, 2025 16:51
@imreddyTeja imreddyTeja merged commit b3fb9f7 into main Jul 15, 2025
34 checks passed
@imreddyTeja imreddyTeja deleted the tr/refactor-fm-internal-index branch July 15, 2025 18:11
@dennisYatunin dennisYatunin changed the title Tr/refactor fm internal index Refactor FieldMatrix indexing, add scalar_field_matrix Jul 15, 2025
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