Skip to content

Conversation

@gijswl
Copy link
Contributor

@gijswl gijswl commented May 7, 2025

As far as I can see, OrientationInfo has the same functionality as PathOrientationInfo and SurfaceOrientationInfo, so it makes more sense to use only the former. This is preparation work for #1195.

@codecov
Copy link

codecov bot commented May 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.03%. Comparing base (c718c73) to head (a47ad6a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1196   +/-   ##
=======================================
  Coverage   94.03%   94.03%           
=======================================
  Files          39       39           
  Lines        6555     6559    +4     
=======================================
+ Hits         6164     6168    +4     
  Misses        391      391           

☔ 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.

@termi-official
Copy link
Member

termi-official commented May 7, 2025

@AbdAlazezAhmed do you remember what exactly was the reason to not use path and surface orientation info, but introduce a new OrientationInfo struct?

I personally prefer a design where we keep orientation information for each dimension separate tho, because this should help developers in understanding what exactly is going on here and what exactly the involved assumptions/invariants for each dimension are.

@termi-official
Copy link
Member

So the plan from my side was to add different data types per dimension to control internal dispatches, which will be helpful to implement support for problems higher dimensions than 3 later on, as we just need to fill in the places with the dispatches.

@gijswl
Copy link
Contributor Author

gijswl commented May 7, 2025

So the plan from my side was to add different data types per dimension to control internal dispatches

I actually like that better as well. I have no problem implementing that, but would be good to have confirmation about why the separate OrientationInfo exists.

@AbdAlazezAhmed
Copy link
Collaborator

Seems like the plan was to replace them was OrientationInfo
https://github.com/AbdAlazezAhmed/Ferrite.jl/blob/9c60a0b6d8b27457da99c56e6cc4819ca74e7f19/src/Grid/grid.jl#L1453-L1458

Then it became InterfaceOrientationInfo storing relative orientation
https://github.com/AbdAlazezAhmed/Ferrite.jl/blob/5153fde45dedc5db9a3f63b72b11a69ecb18b950/src/Grid/grid.jl#L895-L899

Then back to OrientationInfo with a docs typo.
I think using a single OrientationInfo would be nice if we can fix a set of rules on how to define an orientation for n-dim facet
But yeah I think you can use OrientationInfo and (Path/Surface)OrientationInfo exchangeably

@termi-official
Copy link
Member

I think using a single OrientationInfo would be nice if we can fix a set of rules on how to define an orientation for n-dim facet

Not sure how helpful that is for keeping the code complexity manageable. For generic dimensions (=n) the best you can probably do is encoding the orientation directly as an m-dimensional bitvector.

@gijswl gijswl changed the title Use OrientationInfo instead of {Path,Surface}OrientationInfo everywhere Update usage of {Path,Surface}OrientationInfo May 7, 2025
@gijswl
Copy link
Contributor Author

gijswl commented May 7, 2025

Are the names deliberately chosen, or should they be updated to match the rest of the terminology:

  • PathOrientationInfo -> EdgeOrientationInfo
  • SurfaceOrientationInfo -> FaceOrientationInfo

@termi-official
Copy link
Member

I have chosen the names deliberately, as they precede the consistent rename to edge/face and facet/ridge. I have no strong feeling on renaming the orientation info structs.

@KnutAM
Copy link
Member

KnutAM commented May 7, 2025

I have no strong feeling on renaming the orientation info structs

I have a strong feeling they should be renamed 😄

"""
struct PathOrientationInfo
regular::Bool # Indicator whether the orientation is regular or inverted.
flipped::Bool # Indicator whether the orientation is regular or inverted.
Copy link
Member

Choose a reason for hiding this comment

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

IMO it is less straight forward to store if the edge is flipped, than if it is regular. Personally, I would prefer positive, or perhaps we even can save simply as

direction::Int8 # \pm 1

and return Int8 from get_face_direction and get_edge_direction. Probably, we won't see any significant performance difference by using Int8 vs Int, don't recall the profiles of the dof distribution now if this logic takes some significant portion of the time...

Copy link
Member

Choose a reason for hiding this comment

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

Reagardng the dof distribution time, it is mostly spend in the hash table lookups, as we do not materialize the mesh entities explicitly. But I think just a boolean is clearer here. Also, I would expect that flipped = true would mean 2--->1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A "flip" is indeed the terminology used in the Scroggs paper to indicate that the nodes are swapped compared to the "normal" orientation. So,

  • 1 --> 2 is flipped = false
  • 2 --> 1 is flipped = true

This is the same way OrientationInfo already worked and in line with the paper. The previous definition of regular::Bool was opposite, of course. Can you check whether the tests make sense following this definition?

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 see now that the docstring was not updated yet.
Refer to the latest commit for the corrected definition.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants