Refactor get_coordinate_field interface to use AspectMap (issue #4481)#4484
Merged
tclune merged 1 commit intointegration/conservative-regriddingfrom Mar 4, 2026
Conversation
This commit addresses issue #4481 by refactoring the get_coordinate_field() interface to accept an AspectMap instead of individual scalar parameters (geom, units, typekind). This makes the interface robust to future changes when new StateItemAspect subclasses are added. Key changes: - Abstract interface now accepts aspects parameter as class(*) to avoid circular module dependencies between vertical_grid/ and generic3g/ - Implementations use select type to convert class(*) to AspectMap - Callee now adds VerticalGridAspect internally to avoid Fortran aliasing issues (VerticalGridAspect contains pointer to 'this') - physical_dimension remains a separate parameter as it's derived information computed from comparing source/destination vertical grids - Call site in VerticalGridAspect::make_transform() updated to build and pass AspectMap containing GEOM, TYPEKIND, UNITS, UNGRIDDED_DIMS, ATTRIBUTES, and CLASS aspects - Tests updated to reflect new interface This eliminates the fragile unpack/repack pattern where callers extracted individual aspects from an AspectMap, passed them as scalars, and then the callee had to repack them back into aspects.
ade81a3 to
35c3f30
Compare
7874e00
into
integration/conservative-regridding
32 of 33 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors the get_coordinate_field() interface to accept an AspectMap instead of individual scalar parameters, making it robust to future additions of new StateItemAspect subclasses.
Changes
Key Design Decisions
Testing
Fixes #4481