Skip to content

Move ESMF_Interfaces.F90 to superstructure/interfaces/ (new MAPL.ESMF_Interfaces)#5176

Open
pchakraborty wants to merge 1 commit into
developfrom
feature/pchakrab/relocate-esmf-interfaces
Open

Move ESMF_Interfaces.F90 to superstructure/interfaces/ (new MAPL.ESMF_Interfaces)#5176
pchakraborty wants to merge 1 commit into
developfrom
feature/pchakrab/relocate-esmf-interfaces

Conversation

@pchakraborty

Copy link
Copy Markdown
Contributor

Summary

ESMF_Interfaces.F90 was living in infrastructure/esmf/ only because it could not be placed in superstructure/generic/ — doing so would create a circular CMake dependency: MAPL.generic depends on MAPL.state, which in turn already depends on MAPL.esmf, and MAPL.esmf would have needed to depend on MAPL.generic to consume the interfaces. Breaking that cycle requires a dedicated library that sits below both MAPL.state and MAPL.generic in the dependency graph, with no upward dependencies of its own.

The new MAPL.ESMF_Interfaces library (superstructure/interfaces/) fills exactly that role: it depends only on ESMF::ESMF, so both MAPL.state and MAPL.generic can safely list it as a dependency without introducing a cycle.

Changes

  • infrastructure/esmf/CMakeLists.txt: remove ESMF_Interfaces.F90 from MAPL.esmf sources
  • superstructure/interfaces/: new directory with ESMF_Interfaces.F90, API.F90, and CMakeLists.txt defining the MAPL.ESMF_Interfaces library
  • superstructure/CMakeLists.txt: add add_subdirectory(interfaces) and MAPL.ESMF_Interfaces dependency
  • superstructure/state/CMakeLists.txt: add MAPL.ESMF_Interfaces dependency
  • superstructure/generic/CMakeLists.txt: add MAPL.ESMF_Interfaces dependency
  • superstructure/generic/API.F90: remove now-stale commented-out aliases for UserCompGetInternalState / UserCompSetInternalState
  • superstructure/API.F90: re-export mapl_esmf_interfaces_api
  • superstructure/generic/{InnerMetaComponent,MAPL_Generic,OpenMP_Support,OuterMetaComponent/*,transforms/CouplerMetaComponent}: no module-level changes needed; mapl_ESMF_Interfaces_mod is still the same module name

…_Interfaces)

ESMF_Interfaces.F90 was living in infrastructure/esmf/ only because it
could not be placed in superstructure/generic/ -- doing so would create a
circular CMake dependency: MAPL.generic depends on MAPL.state, which in
turn already depends on MAPL.esmf, and MAPL.esmf would have needed to
depend on MAPL.generic to consume the interfaces. Breaking that cycle
requires a dedicated library that sits below both MAPL.state and
MAPL.generic in the dependency graph, with no upward dependencies of its
own.

The new MAPL.ESMF_Interfaces library (superstructure/interfaces/) fills
exactly that role: it depends only on ESMF::ESMF, so both MAPL.state and
MAPL.generic can safely list it as a dependency without introducing a
cycle.

Changes:
- infrastructure/esmf/CMakeLists.txt: remove ESMF_Interfaces.F90 from
  MAPL.esmf sources
- superstructure/interfaces/: new directory with ESMF_Interfaces.F90,
  API.F90, and CMakeLists.txt defining the MAPL.ESMF_Interfaces library
- superstructure/CMakeLists.txt: add add_subdirectory(interfaces) and
  MAPL.ESMF_Interfaces dependency
- superstructure/state/CMakeLists.txt: add MAPL.ESMF_Interfaces dependency
- superstructure/generic/CMakeLists.txt: add MAPL.ESMF_Interfaces dependency
- superstructure/generic/API.F90: remove now-stale commented-out aliases
  for UserCompGetInternalState / UserCompSetInternalState
- superstructure/API.F90: re-export mapl_esmf_interfaces_api
- superstructure/generic/{InnerMetaComponent,MAPL_Generic,OpenMP_Support,
  OuterMetaComponent/*,transforms/CouplerMetaComponent}: no module-level
  changes needed; mapl_ESMF_Interfaces_mod is still the same module name
@pchakraborty pchakraborty requested a review from a team as a code owner June 15, 2026 12:31
@pchakraborty pchakraborty added 0 Diff The changes in this pull request have verified to be zero-diff with the target branch. 🛠️ Refactor This is code refactoring 📈 MAPL3 MAPL 3 Related Changelog Skip Skips the Changelog Enforcer labels Jun 15, 2026
@pchakraborty pchakraborty self-assigned this Jun 15, 2026
set (srcs
# From esmf_utils/
ESMF_Interfaces.F90 # cannot move to MAPL.generic, causes circular dependency
# ESMF_Interfaces.F90 moved to superstructure/interfaces/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this line just be deleted - do we really care where it once was?

@@ -0,0 +1,13 @@
! Export umbrella for the MAPL.ESMF_Interfaces library.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we really need an entire library for not-even-exceutable code?

@tclune tclune left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd like to have just a brief discussion to see if there is a way to avoid the heavy hammer of an entire library for a file that does not even contain executable code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0 Diff The changes in this pull request have verified to be zero-diff with the target branch. Changelog Skip Skips the Changelog Enforcer 📈 MAPL3 MAPL 3 Related 🛠️ Refactor This is code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants