Skip to content

Conversation

@arporter
Copy link
Member

No description provided.

@arporter arporter added enhancement LFRic Issue relates to the LFRic domain labels Dec 19, 2025
@arporter arporter self-assigned this Jan 5, 2026
@codecov
Copy link

codecov bot commented Jan 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.91%. Comparing base (97dd02d) to head (32766e2).
⚠️ Report is 32 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3264   +/-   ##
=======================================
  Coverage   99.91%   99.91%           
=======================================
  Files         376      376           
  Lines       53529    53553   +24     
=======================================
+ Hits        53484    53508   +24     
  Misses         45       45           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arporter
Copy link
Member Author

arporter commented Jan 5, 2026

This PR shortens the generated names used for various variables in order to avoid hitting compiler limitations as reported by Tom in #3259. Since we're no longer basing the names on existing variable names (which must be unique) I've had to increase the use of tags to ensure we cope in the face of name collisions.
One for @hiker, @LonelyCat124 or @sergisiso.
I've fired off the integration tests.

Copy link
Collaborator

@sergisiso sergisiso left a comment

Choose a reason for hiding this comment

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

Looks good @arporter. Its good to see more symbols managed by tags. My only suggestion is to see if we can keep short names still readable, but feel free to ignore if it is to much work.

self._boundary_dofs.append(self.BoundaryDofs(op_arg, bc_fs))

def invoke_declarations(self):
def invoke_declarations(self) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this is a stylistic choice, but is the "-> None" needed when there is no return? None of my tooling complains with or without

symbol = self.symtab.find_or_create_tag(
basis,
symbol_type=DataSymbol, datatype=UnsupportedFortranType(
f"real(kind=r_def), allocatable :: {basis}{dims}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

As you did somewhere else, you will need to do:
new_name = self.symtab.next_available_name(basis)
if you embed the name in the datatype (as it may end up being different)

kind = const.QUADRATURE_TYPE_MAP["gh_quadrature_xyoz"]["kind"]
for name in self.qr_weight_vars["xyoz"]:
self.symtab.find_or_create(
self.symtab.find_or_create_tag(
Copy link
Collaborator

Choose a reason for hiding this comment

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

new_name = self.symtab.next_available_name(...)

:returns: a shortened form of the name.
'''
new_parts = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe its a pain to do not that you already changed lots of tests, but some of the generated code is more cryptic now, have you considered doing:

if len(name) < threshold:
   return name

to keep already short names descriptive?


# Split name string to find any_*_space ID and create a short name as
# "<start>" + "spc" + "ID"
# "<start>" + "s" + "ID"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this function still necessary now?, we could do:
self._shorten_arg_name(self.orig_name + "_" + arg.name)}

But if you decide not to remove the short_name do we really need to keep the _short_name and _mangled_name as state, it may be safer to compute them in the property method.

f"space '{self._orig_name}'")

@staticmethod
def _shorten_arg_name(name: str) -> str:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe just "_shorten_name", it doesn't use the fact is an arg.

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

Labels

enhancement LFRic Issue relates to the LFRic domain reviewed with actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants