Skip to content

Conversation

@dennisYatunin
Copy link
Member

@dennisYatunin dennisYatunin commented Jan 10, 2026

Replaces the RecursiveApply module with a new interface that follows the opposite design pattern: instead of defining functions for Tuples and NamedTuples that need to be called in Fields, Operators, MatrixFields, and sometimes even in ClimaAtmos, we can now use a wrapper for Tuples and NamedTuples that behaves the same way when passed to any standard math function. This should make it easy to decouple iteration over field variables from most of ClimaCore's internals.

The new interface can be extended to any iterator type T by defining the method is_auto_broadcastable(::T) = true, as long as T is compatible with UnrolledUtilities.jl. The @auto_broadcaster_args annotation provides a convenient shorthand for extending the new interface to arbitrary functions of Numbers or AbstractArrays, automatically broadcasting those functions over Tuples, NamedTuples, and AutoBroadcasterss. This annotation can also be used to add methods for any other type T, with the resulting behavior depending on whether is_auto_broadcastable is true for that type.

  • 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.

@dennisYatunin dennisYatunin force-pushed the dy/math_wrapper branch 9 times, most recently from cc7a736 to 0b0cbe1 Compare January 16, 2026 03:34
@dennisYatunin dennisYatunin force-pushed the dy/math_wrapper branch 2 times, most recently from e603f47 to 5430722 Compare January 21, 2026 17:33
@dennisYatunin dennisYatunin changed the title Replace RecursiveApply interface with MathWrapper Replace RecursiveApply interface with MathMapper Jan 21, 2026
@dennisYatunin dennisYatunin force-pushed the dy/math_wrapper branch 14 times, most recently from 30377bd to 92cf627 Compare January 24, 2026 02:30
@dennisYatunin dennisYatunin force-pushed the dy/math_wrapper branch 15 times, most recently from 2116c35 to 1d787da Compare February 5, 2026 18:09
Copy link
Member

@nefrathenrici nefrathenrici left a comment

Choose a reason for hiding this comment

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

This looks good to me. It's nice to get rid of RecursiveApply. I didn't have any significant comments.

@dennisYatunin dennisYatunin force-pushed the dy/math_wrapper branch 2 times, most recently from 6e06ee4 to cada7a8 Compare February 6, 2026 05:45
@dennisYatunin dennisYatunin marked this pull request as ready for review February 6, 2026 05:47
@dennisYatunin dennisYatunin force-pushed the dy/math_wrapper branch 9 times, most recently from 38d49cb to 3c1474b Compare February 12, 2026 03:56
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