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

API: Revamp sparse subfunction #2374

Merged
merged 7 commits into from
May 24, 2024
Merged

API: Revamp sparse subfunction #2374

merged 7 commits into from
May 24, 2024

Conversation

mloubout
Copy link
Contributor

No description provided.

@mloubout mloubout added the API api (symbolics, types, ...) label May 23, 2024
@mloubout mloubout requested a review from FabioLuporini May 23, 2024 17:57
@mloubout mloubout changed the title Geom setup ex API: Revamp sparse subfunction May 23, 2024
Copy link

codecov bot commented May 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.30%. Comparing base (7fca4a8) to head (0d9f2af).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2374      +/-   ##
==========================================
- Coverage   86.80%   78.30%   -8.51%     
==========================================
  Files         233      226       -7     
  Lines       43755    43170     -585     
  Branches     8078     8040      -38     
==========================================
- Hits        37983    33804    -4179     
- Misses       5063     8608    +3545     
- Partials      709      758      +49     

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

@mloubout mloubout force-pushed the geom-setup-ex branch 4 times, most recently from 6a5af47 to abdee0b Compare May 24, 2024 00:44
@codecov-commenter
Copy link

codecov-commenter commented May 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.82%. Comparing base (7fca4a8) to head (e05c7e5).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2374      +/-   ##
==========================================
+ Coverage   86.80%   86.82%   +0.01%     
==========================================
  Files         233      233              
  Lines       43755    43770      +15     
  Branches     8078     8077       -1     
==========================================
+ Hits        37983    38003      +20     
+ Misses       5063     5060       -3     
+ Partials      709      707       -2     

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

Copy link
Contributor

@FabioLuporini FabioLuporini left a comment

Choose a reason for hiding this comment

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

this is such an outstanding cleanup... !

I've left one tiny coding comment, other than that we good

devito/types/sparse.py Outdated Show resolved Hide resolved
break
except AttributeError:
continue
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

Wrong indent level for this else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No the else goes there with the for. It's a python construct "if for didn't exit then " that avoids wrapping the for in a try/if

Copy link
Contributor

Choose a reason for hiding this comment

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

Huh, TIL

Copy link
Contributor

Choose a reason for hiding this comment

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

yes and it's quite handy

devito/types/sparse.py Show resolved Hide resolved
devito/types/sparse.py Outdated Show resolved Hide resolved
if isinstance(key, SubFunction):
if d in key.indices:
# Can use as is, dimension already matches
if self.alias:
Copy link
Contributor

Choose a reason for hiding this comment

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

if self.alias:
    return key._rebuild(alias=self.alias, name=name)
return key

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like to keep the else for simple blocks and unindent when it's a decent code chunck that is the "main" part

return key._rebuild(alias=self.alias, name=name)
else:
return key
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

This else can be removed and the contents of the block unindented by a level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same

@@ -486,8 +486,7 @@ def interpolation_coeffs(self):
sf = SubFunction(name="wsinc%s" % r.name, dtype=self.sfunction.dtype,
shape=shape, dimensions=dimensions,
space_order=0, alias=self.sfunction.alias,
distributor=self.sfunction._distributor,
parent=self.sfunction)
parent=None)
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpicking: we can probably save a line here by compacting these four lines into three, but obviously this is for another day

@mloubout mloubout merged commit 779aa09 into master May 24, 2024
31 checks passed
@mloubout mloubout deleted the geom-setup-ex branch May 24, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API api (symbolics, types, ...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants