Skip to content
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

[Core] [Properties] Remove MeshIndex from GetProperties #9774

Merged
merged 8 commits into from
Sep 1, 2022

Conversation

miguelmaso
Copy link
Contributor

@miguelmaso miguelmaso commented Mar 16, 2022

📝 Description
closes #9538

Avoids a possible confusion in the python interface of ModelPart.GetProperties:

- GetProperties(prop_id, mesh_id) -> Properties instance
- GetProperties(mesh_id) -> Properties container
+ GetProperties(prop_id) -> Properties instance

🆕 Changelog

  • Remove the MeshIndex from GetProperties, it will return a Properties instance with the given Id
  • Cleanup add_model_part_to_python.cpp
  • Update python scripts from apps and core
  • Add a test

@miguelmaso miguelmaso changed the title [Core] [Properties] Cleanup [Core] [Properties] Remove MeshIndex from GetProperties Mar 22, 2022
@miguelmaso
Copy link
Contributor Author

tip: use this to find the behavior changes:

mmaso@PCCB197:~/Kratos/kratos$ grep -r "GetProperties([[:alnum:]_, ]\+)" --include "*.py"
tests/test_array_1d_interface.py:        prop = model_part.GetProperties(1,0)
tests/test_array_1d_interface.py:        prop = model_part.GetProperties(1,0)
tests/test_model_part.py:        self.assertEqual(model_part.GetProperties(0)[1].Id, 1)
python_scripts/read_materials_process.py:        model_part.GetProperties(prop_id).SetValue(CONSTITUTIVE_LAW, constitutive_law)
python_scripts/read_materials_process.py:        prop = model_part.GetProperties(property_id, mesh_id)
mmaso@PCCB197:~/Kratos/kratos$ 

@miguelmaso miguelmaso marked this pull request as ready for review March 23, 2022 15:51
@miguelmaso miguelmaso requested review from a team as code owners March 23, 2022 15:51
Copy link
Member

@loumalouomega loumalouomega left a comment

Choose a reason for hiding this comment

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

Okay from my side, but we did it that way because legacy reasons

@miguelmaso miguelmaso added this to In progress in Implementation subcommittee via automation Apr 12, 2022
@AlejandroCornejo
Copy link
Member

On behalf of the @KratosMultiphysics/implementation-committee, We all agree with the implementation proposed, What do you guys think? @KratosMultiphysics/technical-committee ?

@ddiezrod
Copy link
Contributor

ping @KratosMultiphysics/technical-committee

@pooyan-dadvand
Copy link
Member

This is pure legacy and I fully agree with this change.

Nevertheless, I would put a visible message stating the change of behavior before changing it. Please consider that it may be used in the old context in some forks and changing the behavior would broke their code without any prompt.

@ddiezrod
Copy link
Contributor

ddiezrod commented Aug 1, 2022

any advance on this?

@rubenzorrilla
Copy link
Member

any advance on this?

I've just approved #9994 to start informing about this change.

In any case, I think we can safely merge this PR right away since it removes a legacy feature from the times with no submodelparts. Note that when we migrated to GitHub submodelparts were already there. Having said so, we can IMO assume that all (or the very vast majority) of our current forks are "submodelpart-based".

@loumalouomega
Copy link
Member

any advance on this?

I've just approved #9994 to start informing about this change.

In any case, I think we can safely merge this PR right away since it removes a legacy feature from the times with no submodelparts. Note that when we migrated to GitHub submodelparts were already there. Having said so, we can IMO assume that all (or the very vast majority) of our current forks are "submodelpart-based".

Meanwhile some forks:
image

@loumalouomega
Copy link
Member

any advance on this?

I've just approved #9994 to start informing about this change.

In any case, I think we can safely merge this PR right away since it removes a legacy feature from the times with no submodelparts. Note that when we migrated to GitHub submodelparts were already there. Having said so, we can IMO assume that all (or the very vast majority) of our current forks are "submodelpart-based".

Yes, and once the index is removed we can store the mesh directly and save some precious microseconds each time we do something in the mesh

@miguelmaso
Copy link
Contributor Author

We can merge this on 1 September so that people can see the deprecation warning

@rubenzorrilla
Copy link
Member

We can merge this on 1 September so that people can see the deprecation warning

Makes sense for me. 👍

@miguelmaso
Copy link
Contributor Author

#10209 has reminded me that it's time to merge it

@miguelmaso miguelmaso merged commit 2f7844e into master Sep 1, 2022
Implementation subcommittee automation moved this from In progress to Done Sep 1, 2022
@miguelmaso miguelmaso deleted the core/properties-cleanup branch September 1, 2022 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Inconsistent ModelPart.GetProperties
6 participants