-
Notifications
You must be signed in to change notification settings - Fork 35
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
Diagonal tree balance #295
Conversation
Codecov Report
@@ Coverage Diff @@
## main #295 +/- ##
==========================================
+ Coverage 84.36% 84.41% +0.04%
==========================================
Files 36 36
Lines 11001 11014 +13
==========================================
+ Hits 9281 9297 +16
+ Misses 1720 1717 -3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
It is currently implemented as a property that can only be toggled during tree mesh creation, to keep the whole mesh either one way or the other. The other option (which can be switched pretty quickly here) is to allow it to be toggled at each call to the refine functions. i.e. But with not much work it could also be toggled more fine-grained on the calls to the individual refine functions: Both ways work, just the question is which is more intuitive. I could also enable an option to control balancing along the cardinal directions as well... |
Hmm not sure, but sort of more intuitive to me to be at the top level and enforced for all refinements. Feels like it should be defaulted to True for sure. The non-balanced version is cheaper but less well-behaved. |
I feel like defaulting to Essentially it would mean that every older mesh that might be read in would be automatically diagonally balanced. (i.e. you read in an older TreeMesh, with which you want to load in the corresponding model with it.) The way the read-ins work, is that it essentially inserts every cell of the old mesh, into the new mesh using the Maybe the answer is to be very upfront about changing it in the future, keep the default as |
… calls to each of the refine functions, but default to the value set when the TreeMesh is first created.
… use it as a seperate recursive function This was mostly being used this way already, but this makes it slightly more apparent what is happening to someone reading the code.
@domfournier I just pushed a small change in the last commit here that should allow us to support older (non-diagonally balanced) mesh read in when we do change the default behavoir in the future. Essentially the answer is to never enforce diagonal balancing when we are explicitly setting the state of the mesh. The logic goes:
I think in the next release I'll add a warning message to the user saying that the default behavior will be changing. |
Sounds great. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't really comment on the C code, but looks good. Ready for testing.
This adds support to build tree meshes that are balanced along diagonals in addition to along axis directions.
This is equivalent to the types of meshes that the UBC-GIF codes create.
Without diagonal balancing:
With diagonal balancing: