Skip to content

MAINT: Refactor of domain boundary sides#766

Merged
jhabriel merged 2 commits intodevelopfrom
refactor_domain_boundary_sides
Nov 11, 2022
Merged

MAINT: Refactor of domain boundary sides#766
jhabriel merged 2 commits intodevelopfrom
refactor_domain_boundary_sides

Conversation

@jhabriel
Copy link
Contributor

Proposed changes

This PR proposes a refactor of domain_boundary_sides() without changing its functionality. First, the output type was converted from a regular tuple to a namedtuple. This facilitates accessing the boundary sides as attributes (without having to check/remember its position in the returned tuple). The second change is related to the way the boundary sides are picked. Now, the distance between the face-centers and the box sides are computed such that it matches a given tolerance.

P.D.: A cool feature of named tuples is that they also behave as regular tuples. Another cool feature is that they can be transformed into dictionaries.

Types of changes

What types of changes does this PR introduce to PorePy?
Put an x in the boxes that apply

  • Minor change (e.g., dependency bumps, broken links, etc).
  • 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).
  • Testing (contribution related to testing of existing or new functionality).
  • Documentation (contribution related to adding, improving, or fixing documentation).
  • Maintenance (e.g., improve logic and performance, remove obsolete code, etc).
  • Other:

Checklist

Put an x in the boxes that apply or explain briefly why the box is not relevant.

  • The documentation is up-to-date.
  • Static typing is included in the update.
  • This PR does not duplicated existing functionality.
  • The update is covered by the test suite (including tests added in the PR).

@jhabriel jhabriel added enhancement New feature or request. review - short Short size review effort of a PR ~ minutes. labels Nov 11, 2022
@jhabriel jhabriel self-assigned this Nov 11, 2022
Copy link
Contributor

@IvarStefansson IvarStefansson left a comment

Choose a reason for hiding this comment

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

Nice! Wouldn't a named tuple be a much better solution for bounding boxes as well?

@jhabriel
Copy link
Contributor Author

Yes. That was my immediate thought as well. Should I create an issue for that?

@IvarStefansson
Copy link
Contributor

IvarStefansson commented Nov 11, 2022

Yes. That was my immediate thought as well. Should I create an issue for that?

Yes, please. Or, if you have the time, have a look and just implement it if it's relatively easy (if overhead of creating issue is substantial relative to overall effort).

@IvarStefansson IvarStefansson self-requested a review November 11, 2022 12:41
@jhabriel jhabriel merged commit 89ba86c into develop Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request. review - short Short size review effort of a PR ~ minutes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants