Skip to content

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add rescope example #961

wants to merge 6 commits into from

Conversation

PProfizi
Copy link
Contributor

Solves #960

@PProfizi PProfizi added the examples Related to PyDPF-Core examples label May 22, 2023
@PProfizi PProfizi self-assigned this May 22, 2023
@PProfizi PProfizi requested review from JennaPaikowsky and rlagha May 22, 2023 14:55
@codecov
Copy link

codecov bot commented May 22, 2023

Codecov Report

Merging #961 (0a58a9a) into master (5ee39a2) will increase coverage by 0.05%.
The diff coverage is n/a.

@@            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
Copy link
Contributor

@rafacanton rafacanton Jun 14, 2023

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)

@PProfizi PProfizi added this to the v0.9.0 milestone Jul 12, 2023
@PProfizi PProfizi modified the milestones: v0.9.0, v0.9.1 Jul 26, 2023
@PProfizi PProfizi modified the milestones: v0.10.0, v0.10.1 Oct 16, 2023
@PProfizi PProfizi modified the milestones: v0.10.1, v0.10.2 Dec 14, 2023
@PProfizi PProfizi modified the milestones: v0.12.1, v0.12.2 May 13, 2024
@PProfizi PProfizi modified the milestones: v0.12.2, v0.12.3 Jun 4, 2024
@PProfizi PProfizi modified the milestones: v0.12.3, v0.12.4 Jun 25, 2024
@PProfizi PProfizi removed this from the v0.13.1 milestone Nov 4, 2024
@PProfizi PProfizi modified the milestones: v0.13.2, 0.13.3 Nov 4, 2024
@PProfizi PProfizi modified the milestones: 0.13.3, 0.13.4 Nov 22, 2024
@PProfizi PProfizi modified the milestones: 0.13.4, 0.13.5 Jan 17, 2025
@PProfizi PProfizi modified the milestones: 0.13.5, 0.13.6, 0.13.7 Mar 6, 2025
@PProfizi PProfizi modified the milestones: 0.13.7, 0.13.8 May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Related to PyDPF-Core examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants