-
Notifications
You must be signed in to change notification settings - Fork 9
Utilize FourCIPP in MeshPy #354
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: main
Are you sure you want to change the base?
Utilize FourCIPP in MeshPy #354
Conversation
- The 4C input file now directly inherits from the FourCIPP input file - The dict and list comparison now also utilizes utilities from FourCIPP
(Only the second commit is crucial - the first commit is from #348) |
fabe8b3
to
e7afc73
Compare
Sorry for the chaos - got it working locally - I am missing something somewhere |
e7afc73
to
1b8dcc7
Compare
This was one really dumb typo on the fourcipp side ... Now everything works as expected. No more type casting needed for any numpy type and our functions can also be automatically converted everywhere. |
e9d49b9
to
de33f08
Compare
de33f08
to
b4cb809
Compare
@isteinbrecher now this would also be ready from a FourCIPP converter perspective. Now nothing should change anymore - therefore, now it's completely ready for review:) |
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.
Thanks a lot for the changes @davidrudlstorfer ! This was actually very easy to review considering the complexity.
I really like how using the FourCIPP data structures simplifies a lot of the implementation in MeshPy BeamMe.
Some of my raised points can also be tackles in follow up PRs. We can shortly discuss this in the threads and open issues if we think this is the better way to go.
I am getting very used to the new interface!
return len(dictionary[section_name]) | ||
else: | ||
return 0 | ||
return len(self.sections.get("NODE COORDS", [])) |
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.
Related to my previous comment, one general point (for this whole PR, especially this file):
If I understand this directly, FourCIPP will merge the normal sections with the legacy sections when interacting with self.section
. Can we somehow just access the existing data without having to copy around everything? Maybe via self._sections
or self._legacy_sections
?
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.
@gilrrei could you quickly help out here - thanks!
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.
@isteinbrecher @davidrudlstorfer, yes, for now, unfortunately, stuff needs to be copied. As mentioned, correctly pointed out by @isteinbrecher, you can access the _sections
and _legacy_sections
directly. Once this is changed in 4C, this can be improved. If a get
function is method is desired in fourcipp (which can return a default value), feel free to implement it, it might have other use cases.
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.
Thanks for the explanation @gilrrei , just to be sure, I understand this correctly, we don't copy the entire contents of the dictionaries, basically only the keys and the pointers to the data, correct?
@davidrudlstorfer If that is the case, I think we can simply leave this as is right now, and maybe clean this up either when reworking the MeshPy output functionality or if the behaviour in fourcipp changes at some point.
@isteinbrecher this would be ready for your review again. I left four comments open for discussion and fixed the one thing. The remaining points should probably be tackled in separate PR's as they are already documented in the corresponding issue (testing tolerances, ...) |
With 4C-multiphysics/fourcipp#50 being merged I've switched back FourCIPP to the main repo again:) Therefore, this would be finally ready:) |
I've copied the ToDo's from #348 (comment)
After these things are fixed I would merge this and I noted the following clean-ups after this PR
|
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.
Thanks a lot again @davidrudlstorfer for the changes, and sorry for my overdue review. I aded one more point to your comment #354 (comment).
I think if we only have two minor points left, I am confident that we can merge this soon!
@@ -314,10 +312,27 @@ def _assert_results_equal( | |||
# Dictionary comparison | |||
if isinstance(reference, dict) or isinstance(result, dict): | |||
|
|||
def sanitize(obj): |
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.
I think one of my comments of my original review somehow did not make it.
Can we, instead of defining our own converting function here, use the custom_compare
argument to compare_nested_dicts_or_lists
?
Oh, and when this is finished, should we simply copy the open points from #354 (comment) into a "cleanup issue"? |
set_binning_strategy_section( | ||
input_file, option_overwrite=option_overwrite, **binning_parameters | ||
) | ||
set_binning_strategy_section(input_file, **binning_parameters) |
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.
So is the default behavior now, that the parameter will be overwritten once header function is called?
@isteinbrecher are you happy with that? I just remember that for some testcases we would like to have the possibility not to overwrite some already set section parameters...
Utilize FourCIPP in MeshPy (the input file inherits from it and also the testing uses a ready-to-use function from FourCIPP)