Closed dustinswales closed 8 months ago
@gold2718 @peverwhee @nusbaume I think that this does almost all that we want it to do. Feel free to take a gander. There's one piece that I'm not sure about? What needs to be done to add support to pass chunks of contiguous arrays? @climbfuji
@gold2718 @peverwhee @nusbaume I think that this does almost all that we want it to do. Feel free to take a gander. There's one piece that I'm not sure about? What needs to be done to add support to pass chunks of contiguous arrays? @climbfuji
In the caps, we need to declare a pointer for each variable with an active attribute that either points to a valid chunk of the contiguous array if the variable is active (based on the active condition), or is passed as a null pointer if the active-attribute condition is evaluated as .false.
@gold2718 @DomHeinzeller I'm close to having this working, just one smallish hold up.
Do either of you two know how to change the local_name of a dummy argument in a call_list? I need to go from, call sub(var=var_local) => call sub(var=var_local_ptr)
@DomHeinzeller @gold2718 @peverwhee @nusbaume This one is ready for review I still need to chase down a failing unit test, but the system tests are working (I probably changed a function call and broke an interface in the unit tests)
Snippets of auto-generated caps:
@gold2718 Would you like to review the PR or should we go ahead and merge? Thanks!
We need to merge this so that I can bring feature/capgen
down to main
. That's needed, because ccpp_prebuild
uses the capgen
metadata parser and I need the updates for the mandatory optional
attribute for schemes if the host model has an active
attribute with a value other than the default .true.
. Once I've got that update, I can make the optional
var changes in prebuild
similar to this PR for capgen
, which will unblock the transition to contiguous arrays instead of blocked DDTs for the UFS.
We need to merge this so that I can bring
feature/capgen
down tomain
. That's needed, becauseccpp_prebuild
uses thecapgen
metadata parser and I need the updates for the mandatoryoptional
attribute for schemes if the host model has anactive
attribute with a value other than the default.true.
. Once I've got that update, I can make theoptional
var changes inprebuild
similar to this PR forcapgen
, which will unblock the transition to contiguous arrays instead of blocked DDTs for the UFS.
Is there time to submit at least comments from partial reviews in progress?
We need to merge this so that I can bring
feature/capgen
down tomain
. That's needed, becauseccpp_prebuild
uses thecapgen
metadata parser and I need the updates for the mandatoryoptional
attribute for schemes if the host model has anactive
attribute with a value other than the default.true.
. Once I've got that update, I can make theoptional
var changes inprebuild
similar to this PR forcapgen
, which will unblock the transition to contiguous arrays instead of blocked DDTs for the UFS.Is there time to submit at least comments from partial reviews in progress?
Oh yes, for sure. Just wanted everyone to know why we need to get his in soon. Thanks for reviewing.
I also created https://github.com/NCAR/ccpp-framework/issues/545 so that I can go ahead and merge this.
Description
This PR adds support to use the fortran optional attribute at the scheme level in Capgen. This functionality does not replace the active attribute, but rather builds on it.
Previously, conditionally allocated fields needed by a scheme were required to be accompanied with the allocation logic defined by the host (e.g the "active" condition). With this change, the scheme can internally query the "presence" instead of carrying the host model logic "down into the scheme".
The following modifications were made:
Fixes:
Addresses #527 (new test for optional variable) and partially #526 (support for optional attribute in Capgen)
Testing: test removed: unit tests: system tests: The var_compatibility_test was expanded, built on top of #525, to test this feature. manual testing: