Skip to content

Simplify custom tagging of meshes#755

Merged
RemDelaporteMathurin merged 18 commits into
festim-dev:fenicsxfrom
RemDelaporteMathurin:custom-tagging
Jun 17, 2024
Merged

Simplify custom tagging of meshes#755
RemDelaporteMathurin merged 18 commits into
festim-dev:fenicsxfrom
RemDelaporteMathurin:custom-tagging

Conversation

@RemDelaporteMathurin
Copy link
Copy Markdown
Collaborator

@RemDelaporteMathurin RemDelaporteMathurin commented Apr 17, 2024

Proposed changes

This PR brings some simplification in subdomains:

  • moved the meshtags creation from Mesh1D to Mesh to make it more generic
  • moved locate entities methods to base classes
  • added default behaviour of tagging all surfaces with 1 and all cells with 1 to SurfaceSubdomain and VolumeSubdomain respectively.

An example of how this simplifies a lot of things is the refactoring of the system tests!

@jhdark an additional simplification would be to enable users to provide a geometrical locator function when defining a subdomain (instead of creating a custom class). What do you think?

Types of changes

What types of changes does your code introduce to FESTIM?

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactoring
  • Documentation Update (if none of the other choices apply)
  • New tests

Checklist

  • Black formatted
  • Unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.90%. Comparing base (8d3ab7b) to head (072578b).
Report is 72 commits behind head on fenicsx.

Additional details and impacted files
@@             Coverage Diff             @@
##           fenicsx     #755      +/-   ##
===========================================
+ Coverage    98.39%   98.90%   +0.51%     
===========================================
  Files           28       28              
  Lines         1554     1550       -4     
===========================================
+ Hits          1529     1533       +4     
+ Misses          25       17       -8     

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

Copy link
Copy Markdown
Collaborator

@jhdark jhdark left a comment

Choose a reason for hiding this comment

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

Looks great, simplifying H transport problem too, just needs some additional coverage

Comment on lines -151 to -163


def test_surface_setter_raises_TypeError():
"""Test that a TypeError is raised when the surface is not a
F.SurfaceSubdomain1D"""

with pytest.raises(
TypeError, match="surface should be an int or F.SurfaceSubdomain1D"
):
F.SurfaceQuantity(
field=F.Species("H"),
surface="1",
)
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.

This test just needs changing rather than deleting to improve the coverage

@RemDelaporteMathurin
Copy link
Copy Markdown
Collaborator Author

@jhdark is this ok to be merged? I would like to merge it before #735 as it may bring some conflicts

@RemDelaporteMathurin RemDelaporteMathurin merged commit 2f9f966 into festim-dev:fenicsx Jun 17, 2024
@RemDelaporteMathurin RemDelaporteMathurin deleted the custom-tagging branch June 17, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request fenicsx Issue that is related to the fenicsx support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants