Skip to content
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

Merge two workarounds for ccpp-prebuild for handling optional arguments #617

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/ccpp_prebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,12 @@ def compare_metadata(metadata_define, metadata_request):
if not metadata_define[var_name][0].active == 'T':
for var in metadata_request[var_name]:
if var.optional == 'F':
logging.error("Conditionally allocated host-model variable {0} is not optional in {1}".format(
# DH 20241022 - change logging.error to logging.warn, because it is known
# that this strict check is not correct and will be reverted soon
#logging.error(
logging.warn("Conditionally allocated host-model variable {0} is not optional in {1}".format(
var_name, var.container))
success = False
#success = False
# TEMPORARY CHECK - IF THE VARIABLE IS ALWAYS ALLOCATED, THE SCHEME VARIABLE SHOULDN'T BE OPTIONAL
else:
for var in metadata_request[var_name]:
Expand Down
16 changes: 10 additions & 6 deletions scripts/mkcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,16 @@ def print_def_local(self, metadata):
str = "type({s.type}), pointer :: p => null()"
return str.format(s=self)
else:
# If the host variable is potentially unallocated, the active attribute is
# also set accordingly for the local variable; add target to variable declaration
if self.optional == 'T':
target = ', target'
else:
target = ''
# DH* 20241022 WORKAROUND TO ACCOUNT FOR MISSING UPDATES TO CCPP PHYSICS
# W.R.T. DECLARING OPTIONAL VARIABLES IN METADATA AND CODE. ALWAYS USE TARGET
## If the host variable is potentially unallocated, the active attribute is
## also set accordingly for the local variable; add target to variable declaration
#if self.optional == 'T':
# target = ', target'
#else:
# target = ''
target = ', target'
# *DH
if self.type in STANDARD_VARIABLE_TYPES:
if self.kind:
if self.rank:
Expand Down
Loading