-
Notifications
You must be signed in to change notification settings - Fork 32
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
WIP: Store pmb->gid in VariableState #1010
base: develop
Are you sure you want to change the base?
Conversation
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.
This is a nice solution... Better than putting it directly into the pack. 👍
Credit to @lroberts36 |
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.
See my comment below.
pmb_gid_ = wpmb.lock().get()->gid; | ||
|
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.
It is possible that after a re-mesh when amr is turned on a block can have its gid
changed. I don't think there is any mechanism to propagate this through to the variables, so I think that the VariableState
could end up with a stale gid
in this case.
The two possible solutions I think of. First, maybe adding a method to MeshBlock
called UpdateGid(int gid)
which updates the block gid
and the VariableState
of all variables (but I guess this depends on iterating through all of the containers). This method would need to be called in amr_loadbalance.cpp instead of just setting the block gid
s by hand. The other possibility is to just make sure that the values are updated during sparse packing, which is a little less clean I think but probably easier to implement.
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.
Just double checking: are our gids always guaranteed to be contiguous (starting from 0)?
We have some code paths that implicitly assume that there's always a block with gid 0.
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.
Yes, gid
s are defined to always start at zero and be contiguous (i.e. they are just the indices of all the blocks in a std::vector that has been sorted by the Morton number of the blocks' logical locations). The issue is that after remeshing, the Morton number of a block that hasn't been refined or derefined doesn't change but it's gid
can change since blocks with lower Morton numbers may have been added/removed from the grid.
PR Summary
In addition to
sparse_id
, it would be also nice to be able to access the current blockgid
in aSparsePack
viapack(b, var()).gid
This utility is added in this MR, by adding
gid
toVariableState
.PR Checklist