-
Notifications
You must be signed in to change notification settings - Fork 25
Add rescope example #961
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
base: master
Are you sure you want to change the base?
Add rescope example #961
Conversation
Codecov Report
@@ Coverage Diff @@
## master #961 +/- ##
==========================================
+ Coverage 87.24% 87.30% +0.05%
==========================================
Files 81 81
Lines 9223 9223
==========================================
+ Hits 8047 8052 +5
+ Misses 1176 1171 -5 |
# One can indeed see that the node IDs are not in ascending, descending or any particular order. | ||
|
||
# We can compare it to the order the mesh's nodes are in: | ||
nodes_scoping = model.metadata.meshed_region.nodes.scoping |
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.
@PProfizi From reading the example, it could be inferred that the mesh scopings are always ordered, which is not true. I mean, let's say that a user wants to have the data ordered by node Id. This example should address that. The solution offered in the example is to use the mesh scoping, but it can be the case that the mesh scoping is not ordered.
I would remark that the ascending order of the mesh scopings is not mandatory. If a user wants a 100% ordered field, then the approach that works 100% of the times is:
reordered_fields = dpf.operators.scoping.rescope_fc(
fields_container=fields,
mesh_scoping= np.sort(fields[0].scoping.ids),
).outputs.fields_container()
With this approach we also make sure that we don't need to tackle the default_value
pin of the rescope
operator, as you are rescoping with exactly the same Ids you started with (not more, not less)
Co-authored-by: JennaPaikowsky <[email protected]>
Solves #960